mirror of
https://github.com/open-goal/jak-project
synced 2026-08-19 06:02:15 -04:00
deftype and defmethod syntax major changes (#3094)
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
+8
-14
@@ -3,16 +3,13 @@
|
||||
|
||||
;; definition of type dgo-entry
|
||||
(deftype dgo-entry (structure)
|
||||
((offset uint32 :offset-assert 0)
|
||||
(length uint32 :offset-assert 4)
|
||||
((offset uint32)
|
||||
(length uint32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition for method 3 of type dgo-entry
|
||||
(defmethod inspect dgo-entry ((this dgo-entry))
|
||||
(defmethod inspect ((this dgo-entry))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -26,18 +23,15 @@
|
||||
|
||||
;; definition of type dgo-file
|
||||
(deftype dgo-file (basic)
|
||||
((num-go-files uint32 :offset-assert 4)
|
||||
(total-length uint32 :offset-assert 8)
|
||||
(rsvd uint32 :offset-assert 12)
|
||||
(data uint8 :dynamic :offset-assert 16)
|
||||
((num-go-files uint32)
|
||||
(total-length uint32)
|
||||
(rsvd uint32)
|
||||
(data uint8 :dynamic)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type dgo-file
|
||||
(defmethod inspect dgo-file ((this dgo-file))
|
||||
(defmethod inspect ((this dgo-file))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
|
||||
+26
-38
@@ -106,13 +106,10 @@
|
||||
(z float :offset 64 :size 32)
|
||||
(w float :offset 96 :size 32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type vec4s
|
||||
(defmethod inspect vec4s ((this vec4s))
|
||||
(defmethod inspect ((this vec4s))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -127,28 +124,25 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type vec4s
|
||||
(defmethod print vec4s ((this vec4s))
|
||||
(defmethod print ((this vec4s))
|
||||
(format #t "#<vector ~F ~F ~F ~F @ #x~X>" (-> this x) (-> this y) (-> this z) (-> this w) this)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type vector
|
||||
(deftype vector (structure)
|
||||
((data float 4 :offset-assert 0)
|
||||
(x float :offset 0)
|
||||
(y float :offset 4)
|
||||
(z float :offset 8)
|
||||
(w float :offset 12)
|
||||
(quad uint128 :offset 0)
|
||||
((data float 4)
|
||||
(x float :overlay-at (-> data 0))
|
||||
(y float :overlay-at (-> data 1))
|
||||
(z float :overlay-at (-> data 2))
|
||||
(w float :overlay-at (-> data 3))
|
||||
(quad uint128 :overlay-at (-> data 0))
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type vector
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod inspect vector ((this vector))
|
||||
(defmethod inspect ((this vector))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -166,15 +160,12 @@
|
||||
|
||||
;; definition of type bfloat
|
||||
(deftype bfloat (basic)
|
||||
((data float :offset-assert 4)
|
||||
((data float)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition for method 3 of type bfloat
|
||||
(defmethod inspect bfloat ((this bfloat))
|
||||
(defmethod inspect ((this bfloat))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -186,14 +177,14 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type bfloat
|
||||
(defmethod print bfloat ((this bfloat))
|
||||
(defmethod print ((this bfloat))
|
||||
(format #t "~f" (-> this data))
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 5 of type type
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of type ((this type))
|
||||
(defmethod asize-of ((this type))
|
||||
(the-as int (logand (the-as uint #xfffffff0) (+ (* (-> this allocated-length) 4) 43)))
|
||||
)
|
||||
|
||||
@@ -276,7 +267,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 4 of type pair
|
||||
(defmethod length pair ((this pair))
|
||||
(defmethod length ((this pair))
|
||||
(local-vars (v0-0 int))
|
||||
(cond
|
||||
((null? this)
|
||||
@@ -297,7 +288,7 @@
|
||||
|
||||
;; definition for method 5 of type pair
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of pair ((this pair))
|
||||
(defmethod asize-of ((this pair))
|
||||
(the-as int (-> pair size))
|
||||
)
|
||||
|
||||
@@ -497,20 +488,17 @@
|
||||
|
||||
;; definition of type inline-array-class
|
||||
(deftype inline-array-class (basic)
|
||||
((length int32 :offset-assert 4)
|
||||
(allocated-length int32 :offset-assert 8)
|
||||
(_data uint8 :dynamic :offset 16)
|
||||
((length int32)
|
||||
(allocated-length int32)
|
||||
(_data uint8 :dynamic :offset 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(new (symbol type int) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type inline-array-class
|
||||
(defmethod inspect inline-array-class ((this inline-array-class))
|
||||
(defmethod inspect ((this inline-array-class))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -540,13 +528,13 @@
|
||||
)
|
||||
|
||||
;; definition for method 4 of type inline-array-class
|
||||
(defmethod length inline-array-class ((this inline-array-class))
|
||||
(defmethod length ((this inline-array-class))
|
||||
(-> this length)
|
||||
)
|
||||
|
||||
;; definition for method 5 of type inline-array-class
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of inline-array-class ((this inline-array-class))
|
||||
(defmethod asize-of ((this inline-array-class))
|
||||
(the-as int (+ (-> this type size) (* (-> this allocated-length) (the-as int (-> this type heap-base)))))
|
||||
)
|
||||
|
||||
@@ -574,7 +562,7 @@
|
||||
|
||||
;; definition for method 2 of type array
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod print array ((this array))
|
||||
(defmethod print ((this array))
|
||||
(format #t "#(")
|
||||
(cond
|
||||
((type-type? (-> this content-type) integer)
|
||||
@@ -724,7 +712,7 @@
|
||||
|
||||
;; definition for method 3 of type array
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod inspect array ((this array))
|
||||
(defmethod inspect ((this array))
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~Tlength: ~D~%" (-> this length))
|
||||
@@ -800,13 +788,13 @@
|
||||
)
|
||||
|
||||
;; definition for method 4 of type array
|
||||
(defmethod length array ((this array))
|
||||
(defmethod length ((this array))
|
||||
(-> this length)
|
||||
)
|
||||
|
||||
;; definition for method 5 of type array
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of array ((this array))
|
||||
(defmethod asize-of ((this array))
|
||||
(the-as
|
||||
int
|
||||
(+ (-> this type size) (* (-> this allocated-length) (if (type-type? (-> this content-type) number)
|
||||
|
||||
+122
-167
@@ -3,27 +3,24 @@
|
||||
|
||||
;; definition of type kernel-context
|
||||
(deftype kernel-context (basic)
|
||||
((prevent-from-run process-mask :offset-assert 4)
|
||||
(require-for-run process-mask :offset-assert 8)
|
||||
(allow-to-run process-mask :offset-assert 12)
|
||||
(next-pid int32 :offset-assert 16)
|
||||
(fast-stack-top pointer :offset-assert 20)
|
||||
(current-process process :offset-assert 24)
|
||||
(relocating-process basic :offset-assert 28)
|
||||
(relocating-min int32 :offset-assert 32)
|
||||
(relocating-max int32 :offset-assert 36)
|
||||
(relocating-offset int32 :offset-assert 40)
|
||||
(relocating-level level :offset-assert 44)
|
||||
(low-memory-message symbol :offset-assert 48)
|
||||
(login-object basic :offset-assert 52)
|
||||
((prevent-from-run process-mask)
|
||||
(require-for-run process-mask)
|
||||
(allow-to-run process-mask)
|
||||
(next-pid int32)
|
||||
(fast-stack-top pointer)
|
||||
(current-process process)
|
||||
(relocating-process basic)
|
||||
(relocating-min int32)
|
||||
(relocating-max int32)
|
||||
(relocating-offset int32)
|
||||
(relocating-level level)
|
||||
(low-memory-message symbol)
|
||||
(login-object basic)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x38
|
||||
:flag-assert #x900000038
|
||||
)
|
||||
|
||||
;; definition for method 3 of type kernel-context
|
||||
(defmethod inspect kernel-context ((this kernel-context))
|
||||
(defmethod inspect ((this kernel-context))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -49,43 +46,37 @@
|
||||
;; definition of type time-frame
|
||||
(deftype time-frame (int64)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition of type clock
|
||||
(deftype clock (basic)
|
||||
((index int32 :offset-assert 4)
|
||||
(mask process-mask :offset-assert 8)
|
||||
(clock-ratio float :offset-assert 12)
|
||||
(accum float :offset-assert 16)
|
||||
(integral-accum float :offset-assert 20)
|
||||
(frame-counter time-frame :offset-assert 24)
|
||||
(old-frame-counter time-frame :offset-assert 32)
|
||||
(integral-frame-counter uint64 :offset-assert 40)
|
||||
(old-integral-frame-counter uint64 :offset-assert 48)
|
||||
(sparticle-data vector :inline :offset-assert 64)
|
||||
(seconds-per-frame float :offset-assert 80)
|
||||
(frames-per-second float :offset-assert 84)
|
||||
(time-adjust-ratio float :offset-assert 88)
|
||||
((index int32)
|
||||
(mask process-mask)
|
||||
(clock-ratio float)
|
||||
(accum float)
|
||||
(integral-accum float)
|
||||
(frame-counter time-frame)
|
||||
(old-frame-counter time-frame)
|
||||
(integral-frame-counter uint64)
|
||||
(old-integral-frame-counter uint64)
|
||||
(sparticle-data vector :inline)
|
||||
(seconds-per-frame float)
|
||||
(frames-per-second float)
|
||||
(time-adjust-ratio float)
|
||||
)
|
||||
:method-count-assert 15
|
||||
:size-assert #x5c
|
||||
:flag-assert #xf0000005c
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(update-rates! (_type_ float) float 9)
|
||||
(advance-by! (_type_ float) clock 10)
|
||||
(tick! (_type_) clock 11)
|
||||
(save! (_type_ (pointer uint64)) int 12)
|
||||
(load! (_type_ (pointer uint64)) int 13)
|
||||
(reset! (_type_) none 14)
|
||||
(new (symbol type int) _type_)
|
||||
(update-rates! (_type_ float) float)
|
||||
(advance-by! (_type_ float) clock)
|
||||
(tick! (_type_) clock)
|
||||
(save! (_type_ (pointer uint64)) int)
|
||||
(load! (_type_ (pointer uint64)) int)
|
||||
(reset! (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type clock
|
||||
(defmethod inspect clock ((this clock))
|
||||
(defmethod inspect ((this clock))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -123,28 +114,25 @@
|
||||
|
||||
;; definition of type thread
|
||||
(deftype thread (basic)
|
||||
((name symbol :offset-assert 4)
|
||||
(process process :offset-assert 8)
|
||||
(previous thread :offset-assert 12)
|
||||
(suspend-hook (function cpu-thread none) :offset-assert 16)
|
||||
(resume-hook (function cpu-thread none) :offset-assert 20)
|
||||
(pc pointer :offset-assert 24)
|
||||
(sp pointer :offset-assert 28)
|
||||
(stack-top pointer :offset-assert 32)
|
||||
(stack-size int32 :offset-assert 36)
|
||||
((name symbol)
|
||||
(process process)
|
||||
(previous thread)
|
||||
(suspend-hook (function cpu-thread none))
|
||||
(resume-hook (function cpu-thread none))
|
||||
(pc pointer)
|
||||
(sp pointer)
|
||||
(stack-top pointer)
|
||||
(stack-size int32)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #x28
|
||||
:flag-assert #xc00000028
|
||||
(:methods
|
||||
(stack-size-set! (_type_ int) none 9)
|
||||
(thread-suspend (_type_) none 10)
|
||||
(thread-resume (_type_) none 11)
|
||||
(stack-size-set! (_type_ int) none)
|
||||
(thread-suspend (_type_) none)
|
||||
(thread-resume (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type thread
|
||||
(defmethod inspect thread ((this thread))
|
||||
(defmethod inspect ((this thread))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -165,20 +153,17 @@
|
||||
|
||||
;; definition of type cpu-thread
|
||||
(deftype cpu-thread (thread)
|
||||
((rreg uint64 7 :offset-assert 40)
|
||||
(freg float 8 :offset-assert 96)
|
||||
(stack uint8 :dynamic :offset-assert 128)
|
||||
((rreg uint64 7)
|
||||
(freg float 8)
|
||||
(stack uint8 :dynamic)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #x80
|
||||
:flag-assert #xc00000080
|
||||
(:methods
|
||||
(new (symbol type process symbol int pointer) _type_ 0)
|
||||
(new (symbol type process symbol int pointer) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cpu-thread
|
||||
(defmethod inspect cpu-thread ((this cpu-thread))
|
||||
(defmethod inspect ((this cpu-thread))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -203,18 +188,15 @@
|
||||
;; definition of type dead-pool
|
||||
(deftype dead-pool (process-tree)
|
||||
()
|
||||
:method-count-assert 16
|
||||
:size-assert #x24
|
||||
:flag-assert #x1000000024
|
||||
(:methods
|
||||
(new (symbol type int int string) _type_ 0)
|
||||
(get-process (_type_ type int) process 14)
|
||||
(return-process (_type_ process) none 15)
|
||||
(new (symbol type int int string) _type_)
|
||||
(get-process (_type_ type int) process)
|
||||
(return-process (_type_ process) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type dead-pool
|
||||
(defmethod inspect dead-pool ((this dead-pool))
|
||||
(defmethod inspect ((this dead-pool))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-68)
|
||||
@@ -333,18 +315,15 @@
|
||||
|
||||
;; definition of type dead-pool-heap-rec
|
||||
(deftype dead-pool-heap-rec (structure)
|
||||
((process process :offset-assert 0)
|
||||
(prev dead-pool-heap-rec :offset-assert 4)
|
||||
(next dead-pool-heap-rec :offset-assert 8)
|
||||
((process process)
|
||||
(prev dead-pool-heap-rec)
|
||||
(next dead-pool-heap-rec)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #xc
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
;; definition for method 3 of type dead-pool-heap-rec
|
||||
(defmethod inspect dead-pool-heap-rec ((this dead-pool-heap-rec))
|
||||
(defmethod inspect ((this dead-pool-heap-rec))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -359,42 +338,39 @@
|
||||
|
||||
;; definition of type dead-pool-heap
|
||||
(deftype dead-pool-heap (dead-pool)
|
||||
((allocated-length int32 :offset-assert 36)
|
||||
(compact-time uint32 :offset-assert 40)
|
||||
(compact-count-targ uint32 :offset-assert 44)
|
||||
(compact-count uint32 :offset-assert 48)
|
||||
(fill-percent float :offset-assert 52)
|
||||
(first-gap dead-pool-heap-rec :offset-assert 56)
|
||||
(first-shrink dead-pool-heap-rec :offset-assert 60)
|
||||
(heap kheap :inline :offset-assert 64)
|
||||
(alive-list dead-pool-heap-rec :inline :offset-assert 80)
|
||||
(last dead-pool-heap-rec :offset 84)
|
||||
(dead-list dead-pool-heap-rec :inline :offset-assert 92)
|
||||
(process-list dead-pool-heap-rec :inline :dynamic :offset-assert 104)
|
||||
((allocated-length int32)
|
||||
(compact-time uint32)
|
||||
(compact-count-targ uint32)
|
||||
(compact-count uint32)
|
||||
(fill-percent float)
|
||||
(first-gap dead-pool-heap-rec)
|
||||
(first-shrink dead-pool-heap-rec)
|
||||
(heap kheap :inline)
|
||||
(alive-list dead-pool-heap-rec :inline)
|
||||
(last dead-pool-heap-rec :overlay-at (-> alive-list prev))
|
||||
(dead-list dead-pool-heap-rec :inline)
|
||||
(process-list dead-pool-heap-rec :inline :dynamic)
|
||||
)
|
||||
:method-count-assert 28
|
||||
:size-assert #x68
|
||||
:flag-assert #x1c00000068
|
||||
(:methods
|
||||
(new (symbol type string int int) _type_ 0)
|
||||
(init (_type_ symbol int) none 16)
|
||||
(compact (dead-pool-heap int) none 17)
|
||||
(shrink-heap (dead-pool-heap process) dead-pool-heap 18)
|
||||
(churn (dead-pool-heap int) none 19)
|
||||
(memory-used (_type_) int 20)
|
||||
(memory-total (_type_) int 21)
|
||||
(memory-free (dead-pool-heap) int 22)
|
||||
(compact-time (dead-pool-heap) uint 23)
|
||||
(gap-size (dead-pool-heap dead-pool-heap-rec) int 24)
|
||||
(gap-location (dead-pool-heap dead-pool-heap-rec) pointer 25)
|
||||
(find-gap (dead-pool-heap dead-pool-heap-rec) dead-pool-heap-rec 26)
|
||||
(find-gap-by-size (dead-pool-heap int) dead-pool-heap-rec 27)
|
||||
(new (symbol type string int int) _type_)
|
||||
(init (_type_ symbol int) none)
|
||||
(compact (dead-pool-heap int) none)
|
||||
(shrink-heap (dead-pool-heap process) dead-pool-heap)
|
||||
(churn (dead-pool-heap int) none)
|
||||
(memory-used (_type_) int)
|
||||
(memory-total (_type_) int)
|
||||
(memory-free (dead-pool-heap) int)
|
||||
(compact-time (dead-pool-heap) uint)
|
||||
(gap-size (dead-pool-heap dead-pool-heap-rec) int)
|
||||
(gap-location (dead-pool-heap dead-pool-heap-rec) pointer)
|
||||
(find-gap (dead-pool-heap dead-pool-heap-rec) dead-pool-heap-rec)
|
||||
(find-gap-by-size (dead-pool-heap int) dead-pool-heap-rec)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type dead-pool-heap
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
(defmethod inspect dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod inspect ((this dead-pool-heap))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-68)
|
||||
@@ -525,21 +501,18 @@
|
||||
|
||||
;; definition of type catch-frame
|
||||
(deftype catch-frame (stack-frame)
|
||||
((sp int32 :offset-assert 12)
|
||||
(ra int32 :offset-assert 16)
|
||||
(freg float 10 :offset-assert 20)
|
||||
(rreg uint128 7 :offset-assert 64)
|
||||
((sp int32)
|
||||
(ra int32)
|
||||
(freg float 10)
|
||||
(rreg uint128 7)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #xb0
|
||||
:flag-assert #x9000000b0
|
||||
(:methods
|
||||
(new (symbol type symbol function (pointer uint64)) object 0)
|
||||
(new (symbol type symbol function (pointer uint64)) object)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type catch-frame
|
||||
(defmethod inspect catch-frame ((this catch-frame))
|
||||
(defmethod inspect ((this catch-frame))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -557,18 +530,15 @@
|
||||
|
||||
;; definition of type protect-frame
|
||||
(deftype protect-frame (stack-frame)
|
||||
((exit (function object) :offset-assert 12)
|
||||
((exit (function object))
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
(:methods
|
||||
(new (symbol type (function object)) protect-frame 0)
|
||||
(new (symbol type (function object)) protect-frame)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type protect-frame
|
||||
(defmethod inspect protect-frame ((this protect-frame))
|
||||
(defmethod inspect ((this protect-frame))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -587,13 +557,10 @@
|
||||
(pid int32 :offset 32 :size 32)
|
||||
(u64 uint64 :offset 0 :size 64)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition for method 3 of type handle
|
||||
(defmethod inspect handle ((this handle))
|
||||
(defmethod inspect ((this handle))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -606,7 +573,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type handle
|
||||
(defmethod print handle ((this handle))
|
||||
(defmethod print ((this handle))
|
||||
(if (nonzero? this)
|
||||
(format #t "#<handle :process ~A :pid ~D>" (handle->process this) (-> this pid))
|
||||
(format #t "#<handle :process 0 :pid 0>")
|
||||
@@ -616,22 +583,19 @@
|
||||
|
||||
;; definition of type state
|
||||
(deftype state (protect-frame)
|
||||
((code function :offset-assert 16)
|
||||
(trans (function object) :offset-assert 20)
|
||||
(post function :offset-assert 24)
|
||||
(enter function :offset-assert 28)
|
||||
(event (function process int symbol event-message-block object) :offset-assert 32)
|
||||
((code function)
|
||||
(trans (function object))
|
||||
(post function)
|
||||
(enter function)
|
||||
(event (function process int symbol event-message-block object))
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x24
|
||||
:flag-assert #x900000024
|
||||
(:methods
|
||||
(new (symbol type symbol function (function object) function (function object) (function process int symbol event-message-block object)) _type_ 0)
|
||||
(new (symbol type symbol function (function object) function (function object) (function process int symbol event-message-block object)) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type state
|
||||
(defmethod inspect state ((this state))
|
||||
(defmethod inspect ((this state))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -651,21 +615,18 @@
|
||||
|
||||
;; definition of type event-message-block
|
||||
(deftype event-message-block (structure)
|
||||
((to-handle handle :offset-assert 0)
|
||||
(to (pointer process) :offset 0)
|
||||
(form-handle handle :offset-assert 8)
|
||||
(from (pointer process) :offset 8)
|
||||
(param uint64 6 :offset-assert 16)
|
||||
(message symbol :offset-assert 64)
|
||||
(num-params int32 :offset-assert 68)
|
||||
((to-handle handle)
|
||||
(to (pointer process) :overlay-at to-handle)
|
||||
(form-handle handle)
|
||||
(from (pointer process) :overlay-at form-handle)
|
||||
(param uint64 6)
|
||||
(message symbol)
|
||||
(num-params int32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x48
|
||||
:flag-assert #x900000048
|
||||
)
|
||||
|
||||
;; definition for method 3 of type event-message-block
|
||||
(defmethod inspect event-message-block ((this event-message-block))
|
||||
(defmethod inspect ((this event-message-block))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-8)
|
||||
@@ -684,18 +645,15 @@
|
||||
|
||||
;; definition of type event-message-block-array
|
||||
(deftype event-message-block-array (inline-array-class)
|
||||
((data event-message-block :inline :dynamic :offset-assert 16)
|
||||
((data event-message-block :inline :dynamic)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x10
|
||||
:flag-assert #xa00000010
|
||||
(:methods
|
||||
(send-all! (_type_) none 9)
|
||||
(send-all! (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type event-message-block-array
|
||||
(defmethod inspect event-message-block-array ((this event-message-block-array))
|
||||
(defmethod inspect ((this event-message-block-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -713,16 +671,13 @@
|
||||
|
||||
;; definition of type sql-result
|
||||
(deftype sql-result (basic)
|
||||
((len int32 :offset-assert 4)
|
||||
(allocated-length uint32 :offset-assert 8)
|
||||
(error symbol :offset-assert 12)
|
||||
(data string :dynamic :offset-assert 16)
|
||||
((len int32)
|
||||
(allocated-length uint32)
|
||||
(error symbol)
|
||||
(data string :dynamic)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
(:methods
|
||||
(new (symbol type uint) _type_ 0)
|
||||
(new (symbol type uint) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -736,7 +691,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type sql-result
|
||||
(defmethod print sql-result ((this sql-result))
|
||||
(defmethod print ((this sql-result))
|
||||
(format #t "#(~A" (-> this error))
|
||||
(dotimes (s5-0 (-> this len))
|
||||
(format #t " ~A" (-> this data s5-0))
|
||||
|
||||
+32
-33
@@ -26,7 +26,7 @@
|
||||
(define *last-loado-debug-usage* 0)
|
||||
|
||||
;; definition for method 7 of type object
|
||||
(defmethod relocate object ((this object) (arg0 int))
|
||||
(defmethod relocate ((this object) (arg0 int))
|
||||
this
|
||||
)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
;; definition for method 1 of type thread
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod delete thread ((this thread))
|
||||
(defmethod delete ((this thread))
|
||||
(when (= this (-> this process main-thread))
|
||||
(break!)
|
||||
0
|
||||
@@ -86,7 +86,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type thread
|
||||
(defmethod print thread ((this thread))
|
||||
(defmethod print ((this thread))
|
||||
(format
|
||||
#t
|
||||
"#<~A ~S of ~S pc: #x~X @ #x~X>"
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
;; definition for method 9 of type thread
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod stack-size-set! thread ((this thread) (arg0 int))
|
||||
(defmethod stack-size-set! ((this thread) (arg0 int))
|
||||
(let ((a2-0 (-> this process)))
|
||||
(cond
|
||||
((!= this (-> a2-0 main-thread))
|
||||
@@ -154,7 +154,7 @@
|
||||
|
||||
;; definition for method 5 of type cpu-thread
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of cpu-thread ((this cpu-thread))
|
||||
(defmethod asize-of ((this cpu-thread))
|
||||
(the-as int (+ (-> this type size) (-> this stack-size)))
|
||||
)
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
(define *pause-lock* #f)
|
||||
|
||||
;; definition for method 2 of type process-tree
|
||||
(defmethod print process-tree ((this process-tree))
|
||||
(defmethod print ((this process-tree))
|
||||
(format #t "#<~A ~S @ #x~X>" (-> this type) (-> this name) this)
|
||||
this
|
||||
)
|
||||
@@ -299,7 +299,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type process-tree
|
||||
(defmethod inspect process-tree ((this process-tree))
|
||||
(defmethod inspect ((this process-tree))
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tname: ~S~%" (-> this name))
|
||||
(format #t "~1Tmask: #x~X : (process-mask " (-> this mask))
|
||||
@@ -366,7 +366,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 3 of type process
|
||||
(defmethod inspect process ((this process))
|
||||
(defmethod inspect ((this process))
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tname: ~S~%" (-> this name))
|
||||
(format #t "~1Tmask: #x~X : (process-mask " (-> this mask))
|
||||
@@ -405,13 +405,12 @@
|
||||
|
||||
;; definition for method 5 of type process
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of process ((this process))
|
||||
(defmethod asize-of ((this process))
|
||||
(the-as int (+ (-> process size) (-> this allocated-length)))
|
||||
)
|
||||
|
||||
;; definition for method 2 of type process
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
(defmethod print process ((this process))
|
||||
(defmethod print ((this process))
|
||||
(cond
|
||||
((and (-> this top-thread) (!= (-> this status) 'dead))
|
||||
(format #t "#<~A ~S ~A :state ~S " (-> this type) (-> this name) (-> this status) (if (-> this state)
|
||||
@@ -485,7 +484,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 14 of type dead-pool
|
||||
(defmethod get-process dead-pool ((this dead-pool) (arg0 type) (arg1 int))
|
||||
(defmethod get-process ((this dead-pool) (arg0 type) (arg1 int))
|
||||
(let ((s4-0 (the-as object (-> this child))))
|
||||
(when (and (not (the-as (pointer process-tree) s4-0)) *debug-segment* (!= this *debug-dead-pool*))
|
||||
(set! s4-0 (get-process *debug-dead-pool* arg0 arg1))
|
||||
@@ -520,7 +519,7 @@
|
||||
|
||||
;; definition for method 15 of type dead-pool
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod return-process dead-pool ((this dead-pool) (arg0 process))
|
||||
(defmethod return-process ((this dead-pool) (arg0 process))
|
||||
(change-parent arg0 this)
|
||||
0
|
||||
(none)
|
||||
@@ -544,7 +543,7 @@
|
||||
|
||||
;; definition for method 16 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch dead-pool-heap vs none.
|
||||
(defmethod init dead-pool-heap ((this dead-pool-heap) (arg0 symbol) (arg1 int))
|
||||
(defmethod init ((this dead-pool-heap) (arg0 symbol) (arg1 int))
|
||||
(countdown (v1-0 (-> this allocated-length))
|
||||
(let ((a0-4 (-> this process-list v1-0)))
|
||||
(set! (-> a0-4 process) *null-process*)
|
||||
@@ -579,7 +578,7 @@
|
||||
|
||||
;; definition for method 25 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch object vs pointer.
|
||||
(defmethod gap-location dead-pool-heap ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(defmethod gap-location ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(the-as
|
||||
pointer
|
||||
(if (-> arg0 process)
|
||||
@@ -590,7 +589,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 24 of type dead-pool-heap
|
||||
(defmethod gap-size dead-pool-heap ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(defmethod gap-size ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(cond
|
||||
((-> arg0 process)
|
||||
(let ((v1-3 (&+ (&+ (the-as pointer (-> arg0 process)) (-> process size)) (-> arg0 process allocated-length))))
|
||||
@@ -610,7 +609,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 26 of type dead-pool-heap
|
||||
(defmethod find-gap dead-pool-heap ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(defmethod find-gap ((this dead-pool-heap) (arg0 dead-pool-heap-rec))
|
||||
(while (and (-> arg0 next) (zero? (gap-size this arg0)))
|
||||
(set! arg0 (-> arg0 next))
|
||||
)
|
||||
@@ -619,7 +618,7 @@
|
||||
|
||||
;; definition for method 3 of type dead-pool-heap
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
(defmethod inspect dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod inspect ((this dead-pool-heap))
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tname: ~A~%" (-> this name))
|
||||
(format #t "~1Tmask: #x~X : (process-mask " (-> this mask))
|
||||
@@ -667,12 +666,12 @@
|
||||
|
||||
;; definition for method 5 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod asize-of ((this dead-pool-heap))
|
||||
(the-as int (+ (-> this type size) (* 12 (-> this allocated-length))))
|
||||
)
|
||||
|
||||
;; definition for method 20 of type dead-pool-heap
|
||||
(defmethod memory-used dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod memory-used ((this dead-pool-heap))
|
||||
(if (-> this alive-list prev)
|
||||
(- (memory-total this) (gap-size this (-> this alive-list prev)))
|
||||
0
|
||||
@@ -680,12 +679,12 @@
|
||||
)
|
||||
|
||||
;; definition for method 21 of type dead-pool-heap
|
||||
(defmethod memory-total dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod memory-total ((this dead-pool-heap))
|
||||
(&- (-> this heap top) (the-as uint (-> this heap base)))
|
||||
)
|
||||
|
||||
;; definition for method 22 of type dead-pool-heap
|
||||
(defmethod memory-free dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod memory-free ((this dead-pool-heap))
|
||||
(let ((v1-0 (-> this heap top)))
|
||||
(if (-> this alive-list prev)
|
||||
(gap-size this (-> this alive-list prev))
|
||||
@@ -695,12 +694,12 @@
|
||||
)
|
||||
|
||||
;; definition for method 23 of type dead-pool-heap
|
||||
(defmethod compact-time dead-pool-heap ((this dead-pool-heap))
|
||||
(defmethod compact-time ((this dead-pool-heap))
|
||||
(-> this compact-time)
|
||||
)
|
||||
|
||||
;; definition for method 27 of type dead-pool-heap
|
||||
(defmethod find-gap-by-size dead-pool-heap ((this dead-pool-heap) (arg0 int))
|
||||
(defmethod find-gap-by-size ((this dead-pool-heap) (arg0 int))
|
||||
(let ((gp-0 (-> this first-gap)))
|
||||
(while (and gp-0 (< (gap-size this gp-0) arg0))
|
||||
(set! gp-0 (-> gp-0 next))
|
||||
@@ -710,7 +709,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 14 of type dead-pool-heap
|
||||
(defmethod get-process dead-pool-heap ((this dead-pool-heap) (arg0 type) (arg1 int))
|
||||
(defmethod get-process ((this dead-pool-heap) (arg0 type) (arg1 int))
|
||||
(let ((s4-0 (-> this dead-list next))
|
||||
(s3-0 (the-as process #f))
|
||||
)
|
||||
@@ -770,7 +769,7 @@
|
||||
|
||||
;; definition for method 15 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod return-process dead-pool-heap ((this dead-pool-heap) (arg0 process))
|
||||
(defmethod return-process ((this dead-pool-heap) (arg0 process))
|
||||
(if (!= this (-> arg0 pool))
|
||||
(format 0 "ERROR: process ~A does not belong to dead-pool-heap ~A.~%" arg0 this)
|
||||
)
|
||||
@@ -803,7 +802,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 18 of type dead-pool-heap
|
||||
(defmethod shrink-heap dead-pool-heap ((this dead-pool-heap) (arg0 process))
|
||||
(defmethod shrink-heap ((this dead-pool-heap) (arg0 process))
|
||||
(when arg0
|
||||
(let ((s5-0 (-> arg0 ppointer)))
|
||||
(when (not (or (logtest? (-> arg0 mask) (process-mask heap-shrunk))
|
||||
@@ -828,7 +827,7 @@
|
||||
;; definition for method 17 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
;; WARN: Function (method 17 dead-pool-heap) has a return type of none, but the expression builder found a return statement.
|
||||
(defmethod compact dead-pool-heap ((this dead-pool-heap) (arg0 int))
|
||||
(defmethod compact ((this dead-pool-heap) (arg0 int))
|
||||
(if (zero? (-> this heap base))
|
||||
(return 0)
|
||||
)
|
||||
@@ -889,7 +888,7 @@
|
||||
|
||||
;; definition for method 19 of type dead-pool-heap
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod churn dead-pool-heap ((this dead-pool-heap) (arg0 int))
|
||||
(defmethod churn ((this dead-pool-heap) (arg0 int))
|
||||
(while (nonzero? arg0)
|
||||
(+! arg0 -1)
|
||||
(let ((s4-0 (-> this alive-list next)))
|
||||
@@ -1027,7 +1026,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 12 of type process
|
||||
(defmethod run-logic? process ((this process))
|
||||
(defmethod run-logic? ((this process))
|
||||
#t
|
||||
)
|
||||
|
||||
@@ -1399,7 +1398,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 9 of type process
|
||||
(defmethod activate process ((this process) (arg0 process-tree) (arg1 basic) (arg2 pointer))
|
||||
(defmethod activate ((this process) (arg0 process-tree) (arg1 basic) (arg2 pointer))
|
||||
(set! (-> this mask) (logclear (-> arg0 mask) (process-mask sleep sleep-code process-tree heap-shrunk)))
|
||||
(set! (-> this clock) (-> arg0 clock))
|
||||
(set! (-> this status) 'ready)
|
||||
@@ -1472,7 +1471,7 @@
|
||||
|
||||
;; definition for method 10 of type process-tree
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod deactivate process-tree ((this process-tree))
|
||||
(defmethod deactivate ((this process-tree))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
@@ -1489,7 +1488,7 @@
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
|
||||
(defmethod deactivate process ((this process))
|
||||
(defmethod deactivate ((this process))
|
||||
(local-vars (s7-0 none) (ra-0 int))
|
||||
(with-pp
|
||||
(when (!= (-> this status) 'dead)
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 2 of type state
|
||||
(defmethod print state ((this state))
|
||||
(defmethod print ((this state))
|
||||
(format #t "#<~A ~A @ #x~X>" (-> this type) (-> this name) this)
|
||||
this
|
||||
)
|
||||
@@ -151,7 +151,7 @@
|
||||
|
||||
;; definition for method 9 of type event-message-block-array
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod send-all! event-message-block-array ((this event-message-block-array))
|
||||
(defmethod send-all! ((this event-message-block-array))
|
||||
(dotimes (s5-0 (-> this length))
|
||||
(let* ((a1-0 (-> this data s5-0))
|
||||
(a0-2 (handle->process (-> a1-0 to-handle)))
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
(in-package goal)
|
||||
|
||||
;; definition for method 4 of type string
|
||||
(defmethod length string ((this string))
|
||||
(defmethod length ((this string))
|
||||
(let ((v1-0 (-> this data)))
|
||||
(while (nonzero? (-> v1-0 0))
|
||||
(nop!)
|
||||
@@ -15,7 +15,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 5 of type string
|
||||
(defmethod asize-of string ((this string))
|
||||
(defmethod asize-of ((this string))
|
||||
(+ (-> this allocated-length) 1 (-> string size))
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user