mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
[decomp] even more res
(#529)
* [decomp] even more `res` * [decompiler] make `logand` with pointers and constants return pointer * [decomp] more work * update offline tests * fix tests(?) * `*res-static-buf*` * fixes * fix reference * [opengoal] make `logand` work directly with pointers * [decomp] `inspect res-lump` * use the inline methods * don't use a math mode for pointers * [compiler] allow optionally setting disassembly output file * [x86 disasm] Keep casing consistent between instructions and offsets
This commit is contained in:
parent
3d8013633a
commit
784119188c
|
@ -503,6 +503,14 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_kind == Kind::AND) {
|
if (m_kind == Kind::AND) {
|
||||||
|
if (arg0_type.typespec().base_type() == "pointer" && tc(dts, TypeSpec("integer"), arg1_type)) {
|
||||||
|
// pointer logand integer = pointer
|
||||||
|
return TP_Type::make_from_ts(arg0_type.typespec());
|
||||||
|
} else if (arg1_type.typespec().base_type() == "pointer" &&
|
||||||
|
tc(dts, TypeSpec("integer"), arg0_type)) {
|
||||||
|
// integer logand pointer = pointer
|
||||||
|
return TP_Type::make_from_ts(arg1_type.typespec());
|
||||||
|
}
|
||||||
// base case for and. Just get an integer.
|
// base case for and. Just get an integer.
|
||||||
return TP_Type::make_from_ts(TypeSpec("int"));
|
return TP_Type::make_from_ts(TypeSpec("int"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1012,10 +1012,13 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env,
|
||||||
update_from_stack_copy_first_int_2(env, kind, pool, stack, result, allow_side_effects);
|
update_from_stack_copy_first_int_2(env, kind, pool, stack, result, allow_side_effects);
|
||||||
} else {
|
} else {
|
||||||
// and, two forms
|
// and, two forms
|
||||||
|
auto arg1_type = env.get_variable_type(m_expr.get_arg(1).var(), true);
|
||||||
auto arg0_i = is_int_type(env, m_my_idx, m_expr.get_arg(0).var());
|
auto arg0_i = is_int_type(env, m_my_idx, m_expr.get_arg(0).var());
|
||||||
auto arg0_u = is_uint_type(env, m_my_idx, m_expr.get_arg(0).var());
|
auto arg0_u = is_uint_type(env, m_my_idx, m_expr.get_arg(0).var());
|
||||||
auto arg1_i = is_int_type(env, m_my_idx, m_expr.get_arg(1).var());
|
auto arg1_i = is_int_type(env, m_my_idx, m_expr.get_arg(1).var());
|
||||||
auto arg1_u = is_uint_type(env, m_my_idx, m_expr.get_arg(1).var());
|
auto arg1_u = is_uint_type(env, m_my_idx, m_expr.get_arg(1).var());
|
||||||
|
auto arg0_n = arg0_i || arg0_u;
|
||||||
|
auto arg1_n = arg1_i || arg1_u;
|
||||||
|
|
||||||
auto args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack,
|
auto args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack,
|
||||||
allow_side_effects);
|
allow_side_effects);
|
||||||
|
@ -1065,8 +1068,11 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((arg0_i && arg1_i) || (arg0_u && arg1_u)) {
|
if ((arg0_i && arg1_i) || (arg0_u && arg1_u) ||
|
||||||
|
(arg0_n && arg1_type.base_type() == "pointer") ||
|
||||||
|
(arg1_n && arg0_type.base_type() == "pointer")) {
|
||||||
// types already good
|
// types already good
|
||||||
|
// we also allow (logand intvar pointer) and (logand pointer intvar)
|
||||||
auto new_form = pool.alloc_element<GenericElement>(GenericOperator::make_fixed(kind),
|
auto new_form = pool.alloc_element<GenericElement>(GenericOperator::make_fixed(kind),
|
||||||
args.at(0), args.at(1));
|
args.at(0), args.at(1));
|
||||||
result->push_back(new_form);
|
result->push_back(new_form);
|
||||||
|
|
|
@ -8564,18 +8564,18 @@
|
||||||
(:methods
|
(:methods
|
||||||
(new (symbol type int int) _type_ 0)
|
(new (symbol type int int) _type_ 0)
|
||||||
(get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9)
|
(get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9)
|
||||||
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
|
(get-property-struct (_type_ symbol symbol float structure (pointer res-tag) pointer) structure 10)
|
||||||
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
|
(get-property-value (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 11)
|
||||||
(dummy-12 (_type_ symbol symbol float float symbol pointer) float 12)
|
(get-property-value2 (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 12)
|
||||||
(get-tag-index-data (_type_ int) pointer 13)
|
(get-tag-index-data (_type_ int) pointer 13)
|
||||||
(get-tag-data (_type_ res-tag) pointer 14)
|
(get-tag-data (_type_ res-tag) pointer 14)
|
||||||
(dummy-15 (_type_) none 15)
|
(dummy-15 (_type_ res-tag) res-tag 15)
|
||||||
(dummy-16 (_type_ int int int int) none 16)
|
(sort! (_type_) _type_ 16)
|
||||||
(dummy-17 (_type_ int int) res-lump 17)
|
(dummy-17 (_type_ res-tag pointer) res-lump 17)
|
||||||
(dummy-18 (_type_ int int) none 18)
|
(dummy-18 (_type_ res-tag res-tag) res-lump 18)
|
||||||
(lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19)
|
(lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19)
|
||||||
(make-property-data (_type_ float res-tag-pair pointer) pointer 20)
|
(make-property-data (_type_ float res-tag-pair pointer) pointer 20)
|
||||||
(dummy-21 (_type_ int int int int int) none 21)
|
(dummy-21 (_type_ pointer symbol symbol float) symbol 21)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33646,8 +33646,8 @@
|
||||||
(define-extern part-group-pointer? function)
|
(define-extern part-group-pointer? function)
|
||||||
(define-extern nav-mesh type)
|
(define-extern nav-mesh type)
|
||||||
(define-extern collide-mesh type)
|
(define-extern collide-mesh type)
|
||||||
;;(define-extern sinteger object) ;; unknown type
|
(define-extern sinteger type)
|
||||||
;;(define-extern uinteger object) ;; unknown type
|
(define-extern uinteger type)
|
||||||
;;(define-extern id object) ;; unknown type
|
;;(define-extern id object) ;; unknown type
|
||||||
;;(define-extern aid object) ;; unknown type
|
;;(define-extern aid object) ;; unknown type
|
||||||
;;(define-extern interp object) ;; unknown type
|
;;(define-extern interp object) ;; unknown type
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
// these options are used rarely and should usually be left at false
|
// these options are used rarely and should usually be left at false
|
||||||
|
|
||||||
// output a file type_defs.gc which is used the types part of all-types.gc
|
// output a file type_defs.gc which is used for the types part of all-types.gc
|
||||||
"regenerate_all_types": false,
|
"regenerate_all_types": false,
|
||||||
|
|
||||||
// generate the symbol_map.json file.
|
// generate the symbol_map.json file.
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
// the second argument is the name of the first condition in the cond. Use print_cfg to find it out.
|
// the second argument is the name of the first condition in the cond. Use print_cfg to find it out.
|
||||||
// The third argument is the number of cases. If you set it too small it may fail to build the CFG.
|
// The third argument is the number of cases. If you set it too small it may fail to build the CFG.
|
||||||
"cond_with_else_max_lengths":[
|
"cond_with_else_max_lengths":[
|
||||||
["(method 20 res-lump)", "b0", 2]
|
["(method 20 res-lump)", "b0", 2],
|
||||||
|
["(method 11 res-lump)", "b0", 1],
|
||||||
|
["(method 12 res-lump)", "b0", 1]
|
||||||
],
|
],
|
||||||
|
|
||||||
// if a cond with an else case is being used a value in a place where it looks wrong
|
// if a cond with an else case is being used a value in a place where it looks wrong
|
||||||
|
|
|
@ -222,8 +222,6 @@
|
||||||
|
|
||||||
"pat-h": [["L1", "(inline-array pat-mode-info)", true, 4]],
|
"pat-h": [["L1", "(inline-array pat-mode-info)", true, 4]],
|
||||||
|
|
||||||
"fact-h": [["L35", "_auto_", true]],
|
|
||||||
|
|
||||||
"sync-info": [
|
"sync-info": [
|
||||||
["L78", "float", true],
|
["L78", "float", true],
|
||||||
["L84", "float", true],
|
["L84", "float", true],
|
||||||
|
@ -259,6 +257,7 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"fact-h": [
|
"fact-h": [
|
||||||
|
["L35", "_auto_", true],
|
||||||
["L36", "float", true],
|
["L36", "float", true],
|
||||||
["L37", "float", true],
|
["L37", "float", true],
|
||||||
["L38", "float", true],
|
["L38", "float", true],
|
||||||
|
|
|
@ -166,6 +166,9 @@
|
||||||
"draw-sprite2d-xy": [[16, "draw-context"]],
|
"draw-sprite2d-xy": [[16, "draw-context"]],
|
||||||
"screen-gradient": [[16, "draw-context"]],
|
"screen-gradient": [[16, "draw-context"]],
|
||||||
|
|
||||||
|
//"(method 18 res-lump)": [[16, "res-tag"]],
|
||||||
|
//"(method 21 res-lump)": [[16, "res-tag"], [32, "res-tag"]],
|
||||||
|
|
||||||
//"(method 0 fact-info)": [[16, "res-tag"]],
|
//"(method 0 fact-info)": [[16, "res-tag"]],
|
||||||
|
|
||||||
"(method 10 oscillating-vector)": [[16, "vector"]],
|
"(method 10 oscillating-vector)": [[16, "vector"]],
|
||||||
|
|
|
@ -387,6 +387,10 @@
|
||||||
[184, "t5", "(pointer uint64)"],
|
[184, "t5", "(pointer uint64)"],
|
||||||
[64, "t6", "(pointer uint64)"]
|
[64, "t6", "(pointer uint64)"]
|
||||||
],
|
],
|
||||||
|
"(method 16 res-lump)": [
|
||||||
|
[22, "t1", "(pointer uint64)"],
|
||||||
|
[29, "t2", "(pointer uint64)"]
|
||||||
|
],
|
||||||
|
|
||||||
// SHADOW-CPU-H
|
// SHADOW-CPU-H
|
||||||
"(method 10 shadow-control)": [[1, "v1", "int"]],
|
"(method 10 shadow-control)": [[1, "v1", "int"]],
|
||||||
|
|
|
@ -1596,15 +1596,62 @@
|
||||||
"a2-13": "src-hi"
|
"a2-13": "src-hi"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"(method 3 res-lump)": {
|
||||||
|
"vars": { "s5-0": "i" }
|
||||||
|
},
|
||||||
"(method 9 res-lump)": {
|
"(method 9 res-lump)": {
|
||||||
"args": ["obj", "name", "mode", "time", "data-addr", "tag-addr", "buf-addr"],
|
"args": ["obj", "name", "mode", "time", "default", "tag-addr", "buf-addr"],
|
||||||
"vars": { "s3-0": "tag-pair" }
|
"vars": { "s3-0": "tag-pair" }
|
||||||
},
|
},
|
||||||
|
"(method 10 res-lump)": {
|
||||||
|
"args": ["obj", "name", "mode", "time", "default", "tag-addr", "buf-addr"],
|
||||||
|
"vars": { "s3-0": "tag-pair", "v1-4": "tag" }
|
||||||
|
},
|
||||||
|
"(method 11 res-lump)": {
|
||||||
|
"args": ["obj", "name", "mode", "time", "default", "tag-addr", "buf-addr"],
|
||||||
|
"vars": {
|
||||||
|
"a2-1": "tag-pair",
|
||||||
|
"s1-0": "tag",
|
||||||
|
"s0-0": "tag-type",
|
||||||
|
"gp-1": "data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"(method 12 res-lump)": {
|
||||||
|
"args": ["obj", "name", "mode", "time", "default", "tag-addr", "buf-addr"],
|
||||||
|
"vars": {
|
||||||
|
"a2-1": "tag-pair",
|
||||||
|
"s1-0": "tag",
|
||||||
|
"s0-0": "tag-type",
|
||||||
|
"gp-1": "data"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"(method 16 res-lump)": {
|
||||||
|
"vars": {
|
||||||
|
"v1-0": "tags-sorted",
|
||||||
|
"a1-0": "i",
|
||||||
|
"a2-1": "tag-stop",
|
||||||
|
"a3-2": "tag1",
|
||||||
|
"t0-3": "tag2",
|
||||||
|
"t1-6": "tag-name1",
|
||||||
|
"t2-6": "tag-name2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"(method 15 res-lump)": {
|
||||||
|
"vars": {
|
||||||
|
"s5-0": ["tag-pair", "res-tag-pair"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// FACT-H
|
// FACT-H
|
||||||
"(method 0 fact-info-target)": {
|
"(method 0 fact-info-target)": {
|
||||||
"vars": { "gp-0": "obj" }
|
"vars": { "gp-0": "obj" }
|
||||||
},
|
},
|
||||||
|
"(method 0 fact-info-enemy)": {
|
||||||
|
"vars": {
|
||||||
|
"gp-0": "obj",
|
||||||
|
"s5-0": "entity"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"(method 0 align-control)": {
|
"(method 0 align-control)": {
|
||||||
"vars": { "v0-0": ["obj", "align-control"] }
|
"vars": { "v0-0": ["obj", "align-control"] }
|
||||||
|
|
|
@ -41,19 +41,20 @@
|
||||||
(:methods
|
(:methods
|
||||||
(new (symbol type int int) _type_ 0)
|
(new (symbol type int int) _type_ 0)
|
||||||
(get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9)
|
(get-property-data (_type_ symbol symbol float pointer (pointer res-tag) pointer) pointer 9)
|
||||||
(dummy-10 (_type_ symbol symbol int symbol symbol pointer) int 10)
|
(get-property-struct (_type_ symbol symbol float structure (pointer res-tag) pointer) structure 10)
|
||||||
(dummy-11 (_type_ symbol symbol int int symbol pointer) int 11)
|
(get-property-value (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 11)
|
||||||
(dummy-12 (_type_ symbol symbol float float symbol pointer) float 12)
|
(get-property-value2 (_type_ symbol symbol float uint128 (pointer res-tag) pointer) uint128 12)
|
||||||
(get-tag-index-data (_type_ int) pointer 13)
|
(get-tag-index-data (_type_ int) pointer 13)
|
||||||
(get-tag-data (_type_ res-tag) pointer 14)
|
(get-tag-data (_type_ res-tag) pointer 14)
|
||||||
(dummy-15 (_type_) none 15)
|
(dummy-15 (_type_ res-tag) res-tag 15)
|
||||||
(dummy-16 (_type_ int int int int) none 16)
|
(sort! (_type_) _type_ 16)
|
||||||
(dummy-17 (_type_ int int) res-lump 17)
|
(dummy-17 (_type_ res-tag pointer) res-lump 17)
|
||||||
(dummy-18 (_type_ int int) none 18)
|
(dummy-18 (_type_ res-tag res-tag) res-lump 18)
|
||||||
(lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19)
|
(lookup-tag-idx (_type_ symbol symbol float) res-tag-pair 19)
|
||||||
(make-property-data (_type_ float res-tag-pair pointer) pointer 20)
|
(make-property-data (_type_ float res-tag-pair pointer) pointer 20)
|
||||||
(dummy-21 (_type_ int int int int int) none 21)
|
(dummy-21 (_type_ pointer symbol symbol float) symbol 21)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(define *res-key-string* (new 'global 'string 64 (the-as string #f))) ;; why 64?
|
(define *res-key-string* (new 'global 'string 64 (the-as string #f))) ;; why 64?
|
||||||
|
(define-extern *res-static-buf* pointer)
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
(defmethod get-tag-index-data res-lump ((obj res-lump) (n int))
|
(defmethod get-tag-index-data res-lump ((obj res-lump) (n int))
|
||||||
"get the data address of the n'th tag."
|
"get the data address of the n'th tag."
|
||||||
|
(declare (inline))
|
||||||
|
|
||||||
(&+ (-> obj data-base)
|
(&+ (-> obj data-base)
|
||||||
(-> obj tag n data-offset))
|
(-> obj tag n data-offset))
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
|
|
||||||
(defmethod get-tag-data res-lump ((obj res-lump) (tag res-tag))
|
(defmethod get-tag-data res-lump ((obj res-lump) (tag res-tag))
|
||||||
"get the data address of the specified tag."
|
"get the data address of the specified tag."
|
||||||
|
(declare (inline))
|
||||||
|
|
||||||
(&+ (-> obj data-base)
|
(&+ (-> obj data-base)
|
||||||
(-> tag data-offset))
|
(-> tag data-offset))
|
||||||
|
@ -114,6 +116,31 @@
|
||||||
(-> obj data-size)))
|
(-> obj data-size)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defmethod inspect res-lump ((obj res-lump))
|
||||||
|
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||||
|
(format #t "~Textra: ~A~%" (-> obj extra))
|
||||||
|
(format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
|
||||||
|
(format #t "~Tlength: ~D~%" (-> obj length))
|
||||||
|
(format #t "~Tdata-base: #x~X~%" (-> obj data-base))
|
||||||
|
(format #t "~Tdata-top: #x~X~%" (-> obj data-top))
|
||||||
|
(format #t "~Tdata-size: #x~X~%" (-> obj data-size))
|
||||||
|
(format #t "~Ttag[~D]: @ #x~X~%" (-> obj allocated-length) (-> obj tag))
|
||||||
|
(dotimes (i (-> obj length))
|
||||||
|
(format #t "~T [~D] " i)
|
||||||
|
(print (-> (-> obj tag) i))
|
||||||
|
(format #t " @ #x~X" (get-tag-index-data obj i))
|
||||||
|
(cond
|
||||||
|
((res-ref? (-> obj tag i))
|
||||||
|
(format #t " = ~A~%" (deref basic (get-tag-index-data obj i)))
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(format #t "~%")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
obj
|
||||||
|
)
|
||||||
|
|
||||||
(defmethod lookup-tag-idx res-lump ((obj res-lump) (name-sym symbol) (mode symbol) (time float))
|
(defmethod lookup-tag-idx res-lump ((obj res-lump) (name-sym symbol) (mode symbol) (time float))
|
||||||
"Look up the index of the tag containing with the given name and timestamp.
|
"Look up the index of the tag containing with the given name and timestamp.
|
||||||
Correct lookups return a res-tag-pair, which contains one tag index in the lower 32 bits and one in the upper 32 bits.
|
Correct lookups return a res-tag-pair, which contains one tag index in the lower 32 bits and one in the upper 32 bits.
|
||||||
|
@ -309,26 +336,26 @@
|
||||||
If tag-pair does not represent an exact point in the timeline, then the data is interpolated based on time
|
If tag-pair does not represent an exact point in the timeline, then the data is interpolated based on time
|
||||||
with the result written into buf. buf must have enough space to copy all of the data.
|
with the result written into buf. buf must have enough space to copy all of the data.
|
||||||
Otherwise, simply returns an address to the resource binary."
|
Otherwise, simply returns an address to the resource binary."
|
||||||
|
|
||||||
(let* ((tag-lo (-> obj tag (-> tag-pair lo)))
|
(let* ((tag-lo (-> obj tag (-> tag-pair lo)))
|
||||||
(tag-hi (-> obj tag (-> tag-pair hi)))
|
(tag-hi (-> obj tag (-> tag-pair hi)))
|
||||||
(elt-count (-> tag-lo elt-count))
|
(elt-count (-> tag-lo elt-count))
|
||||||
)
|
)
|
||||||
(cond
|
(cond
|
||||||
((res-ref? tag-lo)
|
((res-ref? tag-lo)
|
||||||
(&+ (-> obj data-base) (-> tag-lo data-offset))
|
(get-tag-data obj tag-lo)
|
||||||
)
|
)
|
||||||
((or (not buf)
|
((or (not buf)
|
||||||
(= (-> tag-pair lo) (-> tag-pair hi))
|
(= (-> tag-pair lo) (-> tag-pair hi))
|
||||||
(!= elt-count (-> tag-hi elt-count))
|
(!= elt-count (-> tag-hi elt-count))
|
||||||
(!= (-> tag-lo elt-type) (-> tag-hi elt-type)))
|
(!= (-> tag-lo elt-type) (-> tag-hi elt-type)))
|
||||||
(&+ (-> obj data-base) (-> tag-lo data-offset))
|
(get-tag-data obj tag-lo)
|
||||||
)
|
)
|
||||||
(else
|
(else
|
||||||
(let ((interp (/ (- time (-> tag-lo key-frame))
|
(let ((interp (/ (- time (-> tag-lo key-frame))
|
||||||
(- (-> tag-hi key-frame) (-> tag-lo key-frame)))) ;; DBZ
|
(- (-> tag-hi key-frame) (-> tag-lo key-frame)))) ;; DBZ
|
||||||
(src-lo (&+ (-> obj data-base) (-> tag-lo data-offset)))
|
(src-lo (get-tag-data obj tag-lo))
|
||||||
(src-hi (&+ (-> obj data-base) (-> tag-hi data-offset)))
|
(src-hi (get-tag-data obj tag-hi))
|
||||||
)
|
)
|
||||||
(case (-> tag-lo elt-type symbol)
|
(case (-> tag-lo elt-type symbol)
|
||||||
(('float)
|
(('float)
|
||||||
|
@ -380,7 +407,7 @@
|
||||||
buf
|
buf
|
||||||
)
|
)
|
||||||
(else
|
(else
|
||||||
(&+ (-> obj data-base) (-> tag-lo data-offset))
|
(get-tag-data obj tag-lo)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -389,10 +416,10 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defmethod get-property-data res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (data-addr pointer) (tag-addr (pointer res-tag)) (buf-addr pointer))
|
(defmethod get-property-data res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default pointer) (tag-addr (pointer res-tag)) (buf-addr pointer))
|
||||||
"Returns an address to a given property's data at a specific time stamp.
|
"Returns an address to a given property's data at a specific time stamp, or default on error.
|
||||||
name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp.
|
name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp.
|
||||||
data-addr is an address to the new data, or simply the old data if lookup failed.
|
default is the default result returned in the case of an error.
|
||||||
tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f
|
tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f
|
||||||
buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode."
|
buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode."
|
||||||
|
|
||||||
|
@ -402,13 +429,184 @@
|
||||||
(empty)
|
(empty)
|
||||||
)
|
)
|
||||||
(else
|
(else
|
||||||
(set! data-addr (make-property-data obj time tag-pair buf-addr))
|
(set! default (make-property-data obj time tag-pair buf-addr))
|
||||||
(if tag-addr
|
(if tag-addr
|
||||||
(set! (-> tag-addr) (-> obj tag (-> tag-pair lo)))
|
(set! (-> tag-addr) (-> obj tag (-> tag-pair lo)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
default
|
||||||
data-addr
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defmethod get-property-struct res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default structure) (tag-addr (pointer res-tag)) (buf-addr pointer))
|
||||||
|
"Returns a given struct property's value at a specific time stamp, or default on error.
|
||||||
|
name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp.
|
||||||
|
default is the default result returned in the case of an error.
|
||||||
|
tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f
|
||||||
|
buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode."
|
||||||
|
|
||||||
|
(let ((tag-pair (lookup-tag-idx obj name mode time)))
|
||||||
|
(cond
|
||||||
|
((< (the-as int tag-pair) 0)
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(set! default (the-as structure (make-property-data obj time tag-pair buf-addr)))
|
||||||
|
(let ((tag (-> obj tag (-> tag-pair lo))))
|
||||||
|
(if tag-addr
|
||||||
|
(set! (-> tag-addr 0) tag)
|
||||||
|
)
|
||||||
|
(if (res-ref? tag)
|
||||||
|
(set! default (deref structure default))
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
default
|
||||||
|
)
|
||||||
|
|
||||||
|
(defmethod get-property-value res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default uint128) (tag-addr (pointer res-tag)) (buf-addr pointer))
|
||||||
|
"Returns a given value property's value at a specific time stamp, or default on error.
|
||||||
|
name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp.
|
||||||
|
default is the default result returned in the case of an error.
|
||||||
|
tag-addr is an address to a res-tag. The current base tag is written to this. Ignored if tag-addr is #f
|
||||||
|
buf-addr is an address to the data buffer used to write interpolated data to. It must have enough space! Only necessary for 'interp mode."
|
||||||
|
|
||||||
|
(let ((tag-pair (lookup-tag-idx obj name mode time)))
|
||||||
|
(cond
|
||||||
|
((< (the-as int tag-pair) 0)
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(let* ((tag (-> obj tag (-> tag-pair lo)))
|
||||||
|
(tag-type (-> tag elt-type))
|
||||||
|
(data (make-property-data obj time tag-pair buf-addr))
|
||||||
|
)
|
||||||
|
(if tag-addr
|
||||||
|
(set! (-> tag-addr 0) tag)
|
||||||
|
)
|
||||||
|
(cond
|
||||||
|
((type-type? tag-type uinteger)
|
||||||
|
(case (-> tag elt-type size)
|
||||||
|
((1) (set! default (the-as uint128 (deref uint8 data))))
|
||||||
|
((2) (set! default (the-as uint128 (deref uint16 data))))
|
||||||
|
((4) (set! default (the-as uint128 (deref uint32 data))))
|
||||||
|
((16) (set! default (the-as uint128 (deref uint128 data))))
|
||||||
|
(else (set! default (the-as uint128 (deref uint64 data))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
((type-type? tag-type integer)
|
||||||
|
(case (-> tag elt-type size)
|
||||||
|
((1) (set! default (the-as uint128 (deref int8 data))))
|
||||||
|
((2) (set! default (the-as uint128 (deref int16 data))))
|
||||||
|
((4) (set! default (the-as uint128 (deref int32 data))))
|
||||||
|
((16) (set! default (the-as uint128 (deref uint128 data))))
|
||||||
|
(else (set! default (the-as uint128 (deref uint64 data))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
((type-type? tag-type float)
|
||||||
|
(set! default (the-as uint128 (deref float data)))
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
default
|
||||||
|
)
|
||||||
|
|
||||||
|
(defmethod get-property-value2 res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default uint128) (tag-addr (pointer res-tag)) (buf-addr pointer))
|
||||||
|
"same as get-property-value but float type is checked first?"
|
||||||
|
|
||||||
|
(let ((tag-pair (lookup-tag-idx obj name mode time)))
|
||||||
|
(cond
|
||||||
|
((< (the-as int tag-pair) 0)
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(let* ((tag (-> obj tag (-> tag-pair lo)))
|
||||||
|
(tag-type (-> tag elt-type))
|
||||||
|
(data (make-property-data obj time tag-pair buf-addr))
|
||||||
|
)
|
||||||
|
(if tag-addr
|
||||||
|
(set! (-> tag-addr 0) tag)
|
||||||
|
)
|
||||||
|
(cond
|
||||||
|
((type-type? tag-type float)
|
||||||
|
(set! default (the-as uint128 (deref float data)))
|
||||||
|
)
|
||||||
|
((type-type? tag-type uinteger)
|
||||||
|
(case (-> tag elt-type size)
|
||||||
|
((1) (set! default (the-as uint128 (deref uint8 data))))
|
||||||
|
((2) (set! default (the-as uint128 (deref uint16 data))))
|
||||||
|
((4) (set! default (the-as uint128 (deref uint32 data))))
|
||||||
|
((16) (set! default (the-as uint128 (deref uint128 data))))
|
||||||
|
(else (set! default (the-as uint128 (deref uint64 data))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
((type-type? tag-type integer)
|
||||||
|
(case (-> tag elt-type size)
|
||||||
|
((1) (set! default (the-as uint128 (deref int8 data))))
|
||||||
|
((2) (set! default (the-as uint128 (deref int16 data))))
|
||||||
|
((4) (set! default (the-as uint128 (deref int32 data))))
|
||||||
|
((16) (set! default (the-as uint128 (deref uint128 data))))
|
||||||
|
(else (set! default (the-as uint128 (deref uint64 data))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(else
|
||||||
|
(empty)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
default
|
||||||
|
)
|
||||||
|
|
||||||
|
(defmethod sort! res-lump ((obj res-lump))
|
||||||
|
"Sort all tags based on name, then key-frame."
|
||||||
|
|
||||||
|
(let ((tags-sorted -1))
|
||||||
|
(while (nonzero? tags-sorted)
|
||||||
|
(set! tags-sorted 0)
|
||||||
|
(let ((i 0)
|
||||||
|
(tag-stop (+ (-> obj length) -2))
|
||||||
|
)
|
||||||
|
(while (>= tag-stop i)
|
||||||
|
(let* ((tag1 (-> obj tag i))
|
||||||
|
(tag2 (-> obj tag (1+ i)))
|
||||||
|
(tag-name1 (deref uint64 (-> (symbol->string (-> tag1 name)) data)))
|
||||||
|
(tag-name2 (deref uint64 (-> (symbol->string (-> tag2 name)) data)))
|
||||||
|
)
|
||||||
|
(when (or (< tag-name2 tag-name1)
|
||||||
|
(and (= tag-name1 tag-name2)
|
||||||
|
(< (-> tag2 key-frame) (-> tag1 key-frame))))
|
||||||
|
(1+! tags-sorted)
|
||||||
|
(set! (-> obj tag i) tag2)
|
||||||
|
(set! (-> obj tag (1+ i)) tag1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(1+! i)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
obj
|
||||||
|
)
|
||||||
|
|
||||||
|
;; method 15 res-lump
|
||||||
|
;; method 17 res-lump
|
||||||
|
;; method 18 res-lump
|
||||||
|
;; method 21 res-lump
|
||||||
|
;; mem-usage res-lump
|
||||||
|
|
||||||
|
|
||||||
|
(define *res-static-buf* (malloc 'global 128))
|
||||||
|
|
||||||
|
|
|
@ -142,3 +142,5 @@
|
||||||
(defmethod dummy-11 fact-info ((obj fact-info))
|
(defmethod dummy-11 fact-info ((obj fact-info))
|
||||||
0.0
|
0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
`(asm-file ,file :color :write)
|
`(asm-file ,file :color :write)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defmacro md (file)
|
(defmacro md (file &rest path)
|
||||||
"Make Debug: make + print disassembly for a file"
|
"Make Debug: make + print disassembly for a file"
|
||||||
`(asm-file ,file :color :write :disassemble)
|
`(asm-file ,file :color :write :disassemble ,@path)
|
||||||
)
|
)
|
||||||
|
|
||||||
(defmacro ml (file)
|
(defmacro ml (file)
|
||||||
|
@ -364,21 +364,21 @@
|
||||||
(cond ,@(apply
|
(cond ,@(apply
|
||||||
(lambda (x) `(
|
(lambda (x) `(
|
||||||
;; each case is of format ((cond cond cond...) body)
|
;; each case is of format ((cond cond cond...) body)
|
||||||
,@(let ((cond-list (first x)) ;; list of conds, OR just else
|
,@(let ((conditions (first x)) ;; list of conditions, OR just else
|
||||||
(body (rest x))) ;; the body
|
(body (rest x))) ;; the body
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
;; if the cond is just 'else'
|
;; if the condition is just 'else'
|
||||||
( (eq? cond-list 'else)
|
( (eq? conditions 'else)
|
||||||
`(else ,@body)
|
`(else ,@body)
|
||||||
)
|
)
|
||||||
;; if the list is made up of a single cond
|
;; if the list is made up of a single condition
|
||||||
( (= (length cond-list) 1)
|
( (= (length conditions) 1)
|
||||||
`((= sw ,(first cond-list)) ,@body)
|
`((= sw ,(first conditions)) ,@body)
|
||||||
)
|
)
|
||||||
;; otherwise it is made up of multiple conds, or them together!
|
;; otherwise it is made up of multiple conditions, or them together!
|
||||||
(#t
|
(#t
|
||||||
`((or ,@(apply (lambda (c) `(= sw ,c)) cond-list)) ,@body)
|
`((or ,@(apply (lambda (c) `(= sw ,c)) conditions)) ,@body)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ Val* Compiler::compile_asm_file(const goos::Object& form, const goos::Object& re
|
||||||
(void)env;
|
(void)env;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
|
std::string disasm_filename = "";
|
||||||
bool load = false;
|
bool load = false;
|
||||||
bool color = false;
|
bool color = false;
|
||||||
bool write = false;
|
bool write = false;
|
||||||
|
@ -91,7 +92,16 @@ Val* Compiler::compile_asm_file(const goos::Object& form, const goos::Object& re
|
||||||
Timer total_timer;
|
Timer total_timer;
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
|
bool last_was_disasm = false;
|
||||||
for_each_in_list(rest, [&](const goos::Object& o) {
|
for_each_in_list(rest, [&](const goos::Object& o) {
|
||||||
|
if (last_was_disasm) {
|
||||||
|
last_was_disasm = false;
|
||||||
|
if (o.type == goos::ObjectType::STRING) {
|
||||||
|
disasm_filename = as_string(o);
|
||||||
|
i++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
filename = as_string(o);
|
filename = as_string(o);
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,6 +116,7 @@ Val* Compiler::compile_asm_file(const goos::Object& form, const goos::Object& re
|
||||||
no_code = true;
|
no_code = true;
|
||||||
} else if (setting == ":disassemble") {
|
} else if (setting == ":disassemble") {
|
||||||
disassemble = true;
|
disassemble = true;
|
||||||
|
last_was_disasm = true;
|
||||||
} else {
|
} else {
|
||||||
throw_compiler_error(form, "The option {} was not recognized for asm-file.", setting);
|
throw_compiler_error(form, "The option {} was not recognized for asm-file.", setting);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +157,11 @@ Val* Compiler::compile_asm_file(const goos::Object& form, const goos::Object& re
|
||||||
std::string disasm;
|
std::string disasm;
|
||||||
if (disassemble) {
|
if (disassemble) {
|
||||||
codegen_and_disassemble_object_file(obj_file, &data, &disasm);
|
codegen_and_disassemble_object_file(obj_file, &data, &disasm);
|
||||||
printf("%s\n", disasm.c_str());
|
if (disasm_filename == "") {
|
||||||
|
printf("%s\n", disasm.c_str());
|
||||||
|
} else {
|
||||||
|
file_util::write_text_file(disasm_filename, disasm);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
data = codegen_object_file(obj_file);
|
data = codegen_object_file(obj_file);
|
||||||
}
|
}
|
||||||
|
@ -541,4 +556,4 @@ Val* Compiler::compile_add_macro_to_autocomplete(const goos::Object& form,
|
||||||
va_check(form, args, {goos::ObjectType::SYMBOL}, {});
|
va_check(form, args, {goos::ObjectType::SYMBOL}, {});
|
||||||
m_symbol_info.add_macro(args.unnamed.at(0).as_symbol()->name, form);
|
m_symbol_info.add_macro(args.unnamed.at(0).as_symbol()->name, form);
|
||||||
return get_none();
|
return get_none();
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,13 +572,18 @@ Val* Compiler::compile_logand(const goos::Object& form, const goos::Object& rest
|
||||||
va_check(form, args, {{}, {}}, {});
|
va_check(form, args, {{}, {}}, {});
|
||||||
auto first = compile_error_guard(args.unnamed.at(0), env)->to_gpr(env);
|
auto first = compile_error_guard(args.unnamed.at(0), env)->to_gpr(env);
|
||||||
auto second = compile_error_guard(args.unnamed.at(1), env)->to_gpr(env);
|
auto second = compile_error_guard(args.unnamed.at(1), env)->to_gpr(env);
|
||||||
if (get_math_mode(first->type()) != MathMode::MATH_INT ||
|
auto math_1 = get_math_mode(first->type());
|
||||||
get_math_mode(second->type()) != MathMode::MATH_INT) {
|
auto math_2 = get_math_mode(second->type());
|
||||||
|
if (!((math_1 == MathMode::MATH_INT && math_2 == MathMode::MATH_INT) ||
|
||||||
|
(math_1 == MathMode::MATH_INT && m_ts.tc(TypeSpec("pointer"), second->type())) ||
|
||||||
|
(m_ts.tc(TypeSpec("pointer"), first->type()) && math_2 == MathMode::MATH_INT))) {
|
||||||
throw_compiler_error(form, "Cannot logand a {} by a {}.", first->type().print(),
|
throw_compiler_error(form, "Cannot logand a {} by a {}.", first->type().print(),
|
||||||
second->type().print());
|
second->type().print());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = env->make_gpr(first->type());
|
// kind of a hack, but make (logand int pointer) return pointer.
|
||||||
|
auto result =
|
||||||
|
env->make_gpr(m_ts.tc(TypeSpec("pointer"), second->type()) ? second->type() : first->type());
|
||||||
env->emit(std::make_unique<IR_RegSet>(result, first));
|
env->emit(std::make_unique<IR_RegSet>(result, first));
|
||||||
env->emit(std::make_unique<IR_IntegerMath>(IntegerMathKind::AND_64, result, second));
|
env->emit(std::make_unique<IR_IntegerMath>(IntegerMathKind::AND_64, result, second));
|
||||||
return result;
|
return result;
|
||||||
|
@ -630,4 +635,4 @@ Val* Compiler::compile_lognot(const goos::Object& form, const goos::Object& rest
|
||||||
env->emit(std::make_unique<IR_RegSet>(result, first));
|
env->emit(std::make_unique<IR_RegSet>(result, first));
|
||||||
env->emit(std::make_unique<IR_IntegerMath>(IntegerMathKind::NOT_64, result, nullptr));
|
env->emit(std::make_unique<IR_IntegerMath>(IntegerMathKind::NOT_64, result, nullptr));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ std::string disassemble_x86_function(u8* data,
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
line += fmt::format("{:c} [0x{:x}] ", prefix, base_addr);
|
line += fmt::format("{:c} [0x{:X}] ", prefix, base_addr);
|
||||||
ZydisFormatterFormatInstruction(&formatter, &instr, print_buff, print_buff_size, base_addr);
|
ZydisFormatterFormatInstruction(&formatter, &instr, print_buff, print_buff_size, base_addr);
|
||||||
line += print_buff;
|
line += print_buff;
|
||||||
|
|
||||||
|
@ -147,4 +147,4 @@ std::string disassemble_x86_function(u8* data,
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,77 +320,43 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
;; definition for function find-temp-buffer
|
;; definition for function find-temp-buffer
|
||||||
;; INFO: Return type mismatch int vs pointer.
|
|
||||||
(defun find-temp-buffer ((size int))
|
(defun find-temp-buffer ((size int))
|
||||||
(let ((qwc (+ (/ size 16) 2)))
|
(let ((qwc (+ (/ size 16) 2)))
|
||||||
(the-as pointer (cond
|
(cond
|
||||||
((<
|
((<
|
||||||
(the-as uint qwc)
|
(the-as uint qwc)
|
||||||
(the-as
|
(the-as
|
||||||
uint
|
uint
|
||||||
(dma-buffer-free
|
(dma-buffer-free
|
||||||
(->
|
(-> *display* frames (-> *display* on-screen) frame global-buf)
|
||||||
*display*
|
)
|
||||||
frames
|
)
|
||||||
(-> *display* on-screen)
|
)
|
||||||
frame
|
(logand
|
||||||
global-buf
|
-16
|
||||||
)
|
(&+
|
||||||
)
|
(-> *display* frames (-> *display* on-screen) frame global-buf base)
|
||||||
)
|
15
|
||||||
)
|
)
|
||||||
(logand
|
)
|
||||||
-16
|
)
|
||||||
(the-as
|
((<
|
||||||
int
|
(the-as uint qwc)
|
||||||
(&+
|
(the-as
|
||||||
(->
|
uint
|
||||||
*display*
|
(dma-buffer-free
|
||||||
frames
|
(-> *display* frames (-> *display* on-screen) frame global-buf)
|
||||||
(-> *display* on-screen)
|
)
|
||||||
frame
|
)
|
||||||
global-buf
|
)
|
||||||
base
|
(logand
|
||||||
)
|
-16
|
||||||
15
|
(&+
|
||||||
)
|
(-> *display* frames (-> *display* on-screen) frame global-buf base)
|
||||||
)
|
15
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
((<
|
)
|
||||||
(the-as uint qwc)
|
|
||||||
(the-as
|
|
||||||
uint
|
|
||||||
(dma-buffer-free
|
|
||||||
(->
|
|
||||||
*display*
|
|
||||||
frames
|
|
||||||
(-> *display* on-screen)
|
|
||||||
frame
|
|
||||||
global-buf
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(logand
|
|
||||||
-16
|
|
||||||
(the-as
|
|
||||||
int
|
|
||||||
(&+
|
|
||||||
(->
|
|
||||||
*display*
|
|
||||||
frames
|
|
||||||
(-> *display* on-screen)
|
|
||||||
frame
|
|
||||||
global-buf
|
|
||||||
base
|
|
||||||
)
|
|
||||||
15
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,10 +48,7 @@
|
||||||
(set! (-> v0-0 elt-count) arg1)
|
(set! (-> v0-0 elt-count) arg1)
|
||||||
(set! (-> v0-0 elt-used) (the-as uint 0))
|
(set! (-> v0-0 elt-used) (the-as uint 0))
|
||||||
(set! (-> v0-0 busy) #f)
|
(set! (-> v0-0 busy) #f)
|
||||||
(set!
|
(set! (-> v0-0 base) (logand -64 (&-> (-> v0-0 data) 63)))
|
||||||
(-> v0-0 base)
|
|
||||||
(the-as pointer (logand -64 (the-as int (&-> (-> v0-0 data) 63))))
|
|
||||||
)
|
|
||||||
v0-0
|
v0-0
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
;; definition for method 0 of type cpu-thread
|
;; definition for method 0 of type cpu-thread
|
||||||
;; INFO: Return type mismatch object vs cpu-thread.
|
;; INFO: Return type mismatch pointer vs cpu-thread.
|
||||||
(defmethod
|
(defmethod
|
||||||
new
|
new
|
||||||
cpu-thread
|
cpu-thread
|
||||||
|
@ -164,26 +164,14 @@
|
||||||
(else
|
(else
|
||||||
(let
|
(let
|
||||||
((v1-2
|
((v1-2
|
||||||
(logand
|
(logand -16 (&+ (-> arg0 heap-cur) 15))
|
||||||
-16
|
|
||||||
(the-as int (&+ (-> arg0 heap-cur) 15))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set!
|
(set!
|
||||||
(-> arg0 heap-cur)
|
(-> arg0 heap-cur)
|
||||||
(the-as
|
(&+ (&+ v1-2 (-> type-to-make size)) arg2)
|
||||||
pointer
|
|
||||||
(+
|
|
||||||
(+
|
|
||||||
v1-2
|
|
||||||
(the-as int (-> type-to-make size))
|
|
||||||
)
|
|
||||||
arg2
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
(the-as cpu-thread (+ v1-2 4))
|
(the-as cpu-thread (&+ v1-2 4))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -200,7 +188,7 @@
|
||||||
(set! (-> obj suspend-hook) (method-of-object obj thread-suspend))
|
(set! (-> obj suspend-hook) (method-of-object obj thread-suspend))
|
||||||
(set! (-> obj resume-hook) (method-of-object obj thread-resume))
|
(set! (-> obj resume-hook) (method-of-object obj thread-resume))
|
||||||
(set! (-> obj stack-size) arg2)
|
(set! (-> obj stack-size) arg2)
|
||||||
(the-as cpu-thread (the-as object obj))
|
(the-as cpu-thread (the-as pointer obj))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -341,21 +341,12 @@ TEST_F(FormRegressionTest, ExprMethod0Thread) {
|
||||||
" )\n"
|
" )\n"
|
||||||
" (else\n"
|
" (else\n"
|
||||||
" (let\n"
|
" (let\n"
|
||||||
" ((v1-2\n"
|
" ((v1-2 (logand -16 (&+ (-> arg2 heap-cur) 15))))\n"
|
||||||
" (logand\n"
|
|
||||||
" -16\n"
|
|
||||||
" (the-as int (&+ (-> arg2 heap-cur) 15))\n"
|
|
||||||
" )\n"
|
|
||||||
" )\n"
|
|
||||||
" )\n"
|
|
||||||
" (set!\n"
|
" (set!\n"
|
||||||
" (-> arg2 heap-cur)\n"
|
" (-> arg2 heap-cur)\n"
|
||||||
" (the-as\n"
|
" (&+ (&+ v1-2 (-> arg1 size)) arg4)\n"
|
||||||
" pointer\n"
|
|
||||||
" (+ (+ v1-2 (the-as int (-> arg1 size))) arg4)\n"
|
|
||||||
" )\n"
|
|
||||||
" )\n"
|
" )\n"
|
||||||
" (the-as cpu-thread (+ v1-2 4))\n"
|
" (the-as cpu-thread (&+ v1-2 4))\n"
|
||||||
" )\n"
|
" )\n"
|
||||||
" )\n"
|
" )\n"
|
||||||
" )\n"
|
" )\n"
|
||||||
|
@ -372,7 +363,7 @@ TEST_F(FormRegressionTest, ExprMethod0Thread) {
|
||||||
" (set! (-> obj suspend-hook) (method-of-object obj thread-suspend))\n"
|
" (set! (-> obj suspend-hook) (method-of-object obj thread-suspend))\n"
|
||||||
" (set! (-> obj resume-hook) (method-of-object obj thread-resume))\n"
|
" (set! (-> obj resume-hook) (method-of-object obj thread-resume))\n"
|
||||||
" (set! (-> obj stack-size) arg4)\n"
|
" (set! (-> obj stack-size) arg4)\n"
|
||||||
" (the-as cpu-thread (the-as object obj))\n"
|
" (the-as cpu-thread (the-as pointer obj))\n"
|
||||||
" )";
|
" )";
|
||||||
test_with_expr(func, type, expected, false, "cpu-thread", {},
|
test_with_expr(func, type, expected, false, "cpu-thread", {},
|
||||||
"[[[13, 28], \"v0\", \"cpu-thread\"]]",
|
"[[[13, 28], \"v0\", \"cpu-thread\"]]",
|
||||||
|
@ -2834,4 +2825,4 @@ TEST_F(FormRegressionTest, ExprMethod18DeadPoolHeap) {
|
||||||
" (none)\n"
|
" (none)\n"
|
||||||
" )";
|
" )";
|
||||||
test_with_expr(func, type, expected);
|
test_with_expr(func, type, expected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue