support non-virtual gos in decompiler (#707)

This commit is contained in:
water111
2021-07-17 18:07:21 -04:00
committed by GitHub
parent 0ed587cba9
commit b70fcb2f7a
48 changed files with 824 additions and 733 deletions
+26 -23
View File
@@ -452,7 +452,7 @@ TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) {
" (set! (-> v0-0 brother) (the-as (pointer process-tree) #f))\n"
" (set! (-> v0-0 child) (the-as (pointer process-tree) #f))\n"
" (set! (-> v0-0 self) v0-0)\n"
" (set! (-> v0-0 ppointer) (&-> v0-0 self))\n"
" (set! (-> v0-0 ppointer) (the-as (pointer process) (&-> v0-0 self)))\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, false, "process-tree");
@@ -637,35 +637,35 @@ TEST_F(FormRegressionTest, ExprMethod0Process) {
" daddiu sp, sp, 48";
std::string type = "(function symbol type basic int process)";
std::string expected =
"(let\n"
" ((v0-0\n"
" (if\n"
" (= (-> arg0 type) symbol)\n"
" (object-new\n"
" arg0\n"
" arg1\n"
" (the-as int (+ (-> process size) (the-as uint arg3)))\n"
"(let ((v0-0 (if (= (-> arg0 type) symbol)\n"
" (object-new\n"
" arg0\n"
" arg1\n"
" (the-as int (+ (-> process size) (the-as uint arg3)))\n"
" )\n"
" (+ (the-as int arg0) 4)\n"
" )\n"
" )\n"
" (+ (the-as int arg0) 4)\n"
" )\n"
" )\n"
" )\n"
" (set! (-> (the-as process v0-0) name) arg2)\n"
" (set! (-> (the-as process v0-0) status) (quote dead))\n"
" (set! (-> (the-as process v0-0) status) 'dead)\n"
" (set! (-> (the-as process v0-0) pid) 0)\n"
" (set! (-> (the-as process v0-0) pool) #f)\n"
" (set! (-> (the-as process v0-0) allocated-length) arg3)\n"
" (set! (-> (the-as process v0-0) top-thread) #f)\n"
" (set! (-> (the-as process v0-0) main-thread) #f)\n"
" (let\n"
" ((v1-5 (-> (the-as process v0-0) stack)))\n"
" (let ((v1-5 (-> (the-as process v0-0) stack)))\n"
" (set! (-> (the-as process v0-0) heap-cur) v1-5)\n"
" (set! (-> (the-as process v0-0) heap-base) v1-5)\n"
" )\n"
" (set! (-> (the-as process v0-0) heap-top) (&-> (the-as process v0-0) stack (-> (the-as "
"process v0-0) allocated-length)))\n"
" (set! (-> (the-as process v0-0) stack-frame-top) (the-as stack-frame (-> (the-as process "
"v0-0) heap-top)))\n"
" (set!\n"
" (-> (the-as process v0-0) heap-top)\n"
" (&-> (the-as process v0-0) stack (-> (the-as process v0-0) allocated-length))\n"
" )\n"
" (set!\n"
" (-> (the-as process v0-0) stack-frame-top)\n"
" (the-as stack-frame (-> (the-as process v0-0) heap-top))\n"
" )\n"
" (set! (-> (the-as process v0-0) stack-frame-top) #f)\n"
" (set! (-> (the-as process v0-0) state) #f)\n"
" (set! (-> (the-as process v0-0) next-state) #f)\n"
@@ -677,7 +677,10 @@ TEST_F(FormRegressionTest, ExprMethod0Process) {
" (set! (-> (the-as process v0-0) brother) (the-as (pointer process-tree) #f))\n"
" (set! (-> (the-as process v0-0) child) (the-as (pointer process-tree) #f))\n"
" (set! (-> (the-as process v0-0) self) (the-as process v0-0))\n"
" (set! (-> (the-as process v0-0) ppointer) (&-> (the-as process v0-0) self))\n"
" (set!\n"
" (-> (the-as process v0-0) ppointer)\n"
" (the-as (pointer process) (&-> (the-as process v0-0) self))\n"
" )\n"
" (the-as process v0-0)\n"
" )";
test_with_expr(func, type, expected, false, "process", {},
@@ -948,7 +951,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPool) {
" (set! (-> s3-0 brother) (the-as (pointer process-tree) #f))\n"
" (set! (-> s3-0 child) (the-as (pointer process-tree) #f))\n"
" (set! (-> s3-0 self) s3-0)\n"
" (set! (-> s3-0 ppointer) (&-> s3-0 self))\n"
" (set! (-> s3-0 ppointer) (the-as (pointer process) (&-> s3-0 self)))\n"
" (dotimes\n"
" (s2-1 arg2)\n"
" (let\n"
@@ -1264,7 +1267,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) {
" (set! (-> obj brother) (the-as (pointer process-tree) #f))\n"
" (set! (-> obj child) (the-as (pointer process-tree) #f))\n"
" (set! (-> obj self) obj)\n"
" (set! (-> obj ppointer) (&-> obj self))\n"
" (set! (-> obj ppointer) (the-as (pointer process) (&-> obj self)))\n"
" (countdown (v1-4 arg3)\n"
" (let ((a0-4 (-> obj process-list v1-4)))\n"
" (set! (-> a0-4 process) *null-process*)\n"
@@ -2240,7 +2243,7 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPoolHeap) {
" (set! (-> s5-1 2 mask) (the-as process-mask (-> s5-1 1)))\n"
" (set! (-> arg0 alive-list prev) (the-as dead-pool-heap-rec (-> s5-1 1)))\n"
" )\n"
" (set! (-> s5-1 2) (the-as process-tree (-> arg0 dead-list next)))\n"
" (set! (-> s5-1 2) (the-as process (-> arg0 dead-list next)))\n"
" (set! (-> arg0 dead-list next) (the-as dead-pool-heap-rec s5-1))\n"
" (set! (-> s5-1 0) *null-process*)\n"
" )\n"