[Decompiler] Clean up the output (#245)

* fix parent issue

* fix compiler issue

* update

* add error messages

* fix error

* fix array access, temporary

* more clean

* fix

* rename arg variables better

* fix method name

* fix no return value in decompiler

* many small fixes

* cheat types so it works

* name map

* fix old test'
This commit is contained in:
water111
2021-02-09 20:59:14 -05:00
committed by GitHub
parent fa061ef7eb
commit 6e0ff4c9d0
55 changed files with 2042 additions and 595 deletions
+346 -122
View File
@@ -538,20 +538,19 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
std::string expected =
"(begin\n"
" (set! gp-0 a0-0)\n"
" (format (quote #t) L342)\n"
" (format (quote #t) \"#(\")\n"
" (cond\n"
" ((type-type? (-> gp-0 content-type) integer)\n"
" (set! v1-1 (-> gp-0 content-type symbol))\n"
" ((type-type? (-> arg0 content-type) integer)\n"
" (set! v1-1 (-> arg0 content-type symbol))\n"
" (cond\n"
" ((= v1-1 (quote int32))\n"
" (set! s5-0 0)\n"
" (while\n"
" (< s5-0 (-> gp-0 length))\n"
" (< s5-0 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-0) L341 L340)\n"
" (-> (the-as (array int32) gp-0) s5-0)\n"
" (if (zero? s5-0) \"~D\" \" ~D\")\n"
" (-> (the-as (array int32) arg0) s5-0)\n"
" )\n"
" (set! s5-0 (+ s5-0 1))\n"
" )\n"
@@ -561,11 +560,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote uint32))\n"
" (set! s5-1 0)\n"
" (while\n"
" (< s5-1 (-> gp-0 length))\n"
" (< s5-1 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-1) L341 L340)\n"
" (-> (the-as (array uint32) gp-0) s5-1)\n"
" (if (zero? s5-1) \"~D\" \" ~D\")\n"
" (-> (the-as (array uint32) arg0) s5-1)\n"
" )\n"
" (set! s5-1 (+ s5-1 1))\n"
" )\n"
@@ -575,11 +574,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote int64))\n"
" (set! s5-2 0)\n"
" (while\n"
" (< s5-2 (-> gp-0 length))\n"
" (< s5-2 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-2) L341 L340)\n"
" (-> (the-as (array int64) gp-0) s5-2)\n"
" (if (zero? s5-2) \"~D\" \" ~D\")\n"
" (-> (the-as (array int64) arg0) s5-2)\n"
" )\n"
" (set! s5-2 (+ s5-2 1))\n"
" )\n"
@@ -589,11 +588,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote uint64))\n"
" (set! s5-3 0)\n"
" (while\n"
" (< s5-3 (-> gp-0 length))\n"
" (< s5-3 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-3) L339 L338)\n"
" (-> (the-as (array uint64) gp-0) s5-3)\n"
" (if (zero? s5-3) \"#x~X\" \" #x~X\")\n"
" (-> (the-as (array uint64) arg0) s5-3)\n"
" )\n"
" (set! s5-3 (+ s5-3 1))\n"
" )\n"
@@ -603,11 +602,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote int8))\n"
" (set! s5-4 0)\n"
" (while\n"
" (< s5-4 (-> gp-0 length))\n"
" (< s5-4 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-4) L341 L340)\n"
" (-> (the-as (array int8) gp-0) s5-4)\n"
" (if (zero? s5-4) \"~D\" \" ~D\")\n"
" (-> (the-as (array int8) arg0) s5-4)\n"
" )\n"
" (set! s5-4 (+ s5-4 1))\n"
" )\n"
@@ -617,11 +616,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote uint8))\n"
" (set! s5-5 0)\n"
" (while\n"
" (< s5-5 (-> gp-0 length))\n"
" (< s5-5 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-5) L341 L340)\n"
" (-> (the-as (array uint8) gp-0) s5-5)\n"
" (if (zero? s5-5) \"~D\" \" ~D\")\n"
" (-> (the-as (array uint8) arg0) s5-5)\n"
" )\n"
" (set! s5-5 (+ s5-5 1))\n"
" )\n"
@@ -631,11 +630,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote int16))\n"
" (set! s5-6 0)\n"
" (while\n"
" (< s5-6 (-> gp-0 length))\n"
" (< s5-6 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-6) L341 L340)\n"
" (-> (the-as (array int16) gp-0) s5-6)\n"
" (if (zero? s5-6) \"~D\" \" ~D\")\n"
" (-> (the-as (array int16) arg0) s5-6)\n"
" )\n"
" (set! s5-6 (+ s5-6 1))\n"
" )\n"
@@ -645,11 +644,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" ((= v1-1 (quote uint16))\n"
" (set! s5-7 0)\n"
" (while\n"
" (< s5-7 (-> gp-0 length))\n"
" (< s5-7 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-7) L341 L340)\n"
" (-> (the-as (array uint16) gp-0) s5-7)\n"
" (if (zero? s5-7) \"~D\" \" ~D\")\n"
" (-> (the-as (array uint16) arg0) s5-7)\n"
" )\n"
" (set! s5-7 (+ s5-7 1))\n"
" )\n"
@@ -662,16 +661,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" (v1-40\n"
" (set! s5-8 0)\n"
" (while\n"
" (< s5-8 (-> gp-0 length))\n"
" (< s5-8 (-> arg0 length))\n"
" (set! t9-10 format)\n"
" (set! a0-21 (quote #t))\n"
" (set! a1-11 (if (zero? s5-8) L339 L338))\n"
" (set! a1-11 (if (zero? s5-8) \"#x~X\" \" #x~X\"))\n"
" (set!\n"
" v1-42\n"
" (+\n"
" (shl s5-8 4)\n"
" (the-as int (the-as (array uint128) gp-0))\n"
" )\n"
" (+ (shl s5-8 4) (the-as int (the-as (array uint128) arg0)))\n"
" )\n"
" (.lq a2-8 12 v1-42)\n"
" (t9-10 a0-21 a1-11 a2-8)\n"
@@ -683,11 +679,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" (else\n"
" (set! s5-9 0)\n"
" (while\n"
" (< s5-9 (-> gp-0 length))\n"
" (< s5-9 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" (if (zero? s5-9) L341 L340)\n"
" (-> (the-as (array int32) gp-0) s5-9)\n"
" (if (zero? s5-9) \"~D\" \" ~D\")\n"
" (-> (the-as (array int32) arg0) s5-9)\n"
" )\n"
" (set! s5-9 (+ s5-9 1))\n"
" )\n"
@@ -701,14 +697,14 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" )\n"
" (else\n"
" (cond\n"
" ((= (-> gp-0 content-type) float)\n"
" ((= (-> arg0 content-type) float)\n"
" (set! s5-10 0)\n"
" (while\n"
" (< s5-10 (-> gp-0 length))\n"
" (< s5-10 (-> arg0 length))\n"
" (if\n"
" (zero? s5-10)\n"
" (format (quote #t) L343 (-> (the-as (array float) gp-0) s5-10))\n"
" (format (quote #t) L337 (-> (the-as (array float) gp-0) s5-10))\n"
" (format (quote #t) \"~f\" (-> (the-as (array float) arg0) s5-10))\n"
" (format (quote #t) \" ~f\" (-> (the-as (array float) arg0) s5-10))\n"
" )\n"
" (set! s5-10 (+ s5-10 1))\n"
" )\n"
@@ -718,11 +714,11 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" (else\n"
" (set! s5-11 0)\n"
" (while\n"
" (< s5-11 (-> gp-0 length))\n"
" (< s5-11 (-> arg0 length))\n"
" (if\n"
" (zero? s5-11)\n"
" (format (quote #t) L336 (-> (the-as (array basic) gp-0) s5-11))\n"
" (format (quote #t) L335 (-> (the-as (array basic) gp-0) s5-11))\n"
" (format (quote #t) \"~A\" (-> (the-as (array basic) arg0) s5-11))\n"
" (format (quote #t) \" ~A\" (-> (the-as (array basic) arg0) s5-11))\n"
" )\n"
" (set! s5-11 (+ s5-11 1))\n"
" )\n"
@@ -732,8 +728,8 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" )\n"
" )\n"
" )\n"
" (format (quote #t) L334)\n"
" gp-0\n"
" (format (quote #t) \")\")\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, true, "array",
{{"L343", "~f"},
@@ -1218,21 +1214,30 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
std::string expected =
"(begin\n"
" (set! gp-0 a0-0)\n"
" (format (quote #t) L333 gp-0 (-> gp-0 type))\n"
" (format (quote #t) L332 (-> gp-0 allocated-length))\n"
" (format (quote #t) L331 (-> gp-0 length))\n"
" (format (quote #t) L330 (-> gp-0 content-type))\n"
" (format (quote #t) L329 (-> gp-0 allocated-length) (-> gp-0 data))\n"
" (format (quote #t) \"[~8x] ~A~%\" arg0 (-> arg0 type))\n"
" (format (quote #t) \"~Tallocated-length: ~D~%\" (-> arg0 allocated-length))\n"
" (format (quote #t) \"~Tlength: ~D~%\" (-> arg0 length))\n"
" (format (quote #t) \" ~Tcontent-type: ~A~%\" (-> arg0 content-type))\n"
" (format\n"
" (quote #t)\n"
" \"~Tdata[~D]: @ #x~X~%\"\n"
" (-> arg0 allocated-length)\n"
" (-> arg0 data)\n"
" )\n"
" (cond\n"
" ((type-type? (-> gp-0 content-type) integer)\n"
" (set! v1-1 (-> gp-0 content-type symbol))\n"
" ((type-type? (-> arg0 content-type) integer)\n"
" (set! v1-1 (-> arg0 content-type symbol))\n"
" (cond\n"
" ((= v1-1 (quote int32))\n"
" (set! s5-0 0)\n"
" (while\n"
" (< s5-0 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-0 (-> (the-as (array int32) gp-0) s5-0))\n"
" (< s5-0 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-0\n"
" (-> (the-as (array int32) arg0) s5-0)\n"
" )\n"
" (set! s5-0 (+ s5-0 1))\n"
" )\n"
" (set! v1-5 (quote #f))\n"
@@ -1241,8 +1246,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote uint32))\n"
" (set! s5-1 0)\n"
" (while\n"
" (< s5-1 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-1 (-> (the-as (array uint32) gp-0) s5-1))\n"
" (< s5-1 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-1\n"
" (-> (the-as (array uint32) arg0) s5-1)\n"
" )\n"
" (set! s5-1 (+ s5-1 1))\n"
" )\n"
" (set! v1-10 (quote #f))\n"
@@ -1251,8 +1261,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote int64))\n"
" (set! s5-2 0)\n"
" (while\n"
" (< s5-2 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-2 (-> (the-as (array int64) gp-0) s5-2))\n"
" (< s5-2 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-2\n"
" (-> (the-as (array int64) arg0) s5-2)\n"
" )\n"
" (set! s5-2 (+ s5-2 1))\n"
" )\n"
" (set! v1-15 (quote #f))\n"
@@ -1261,8 +1276,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote uint64))\n"
" (set! s5-3 0)\n"
" (while\n"
" (< s5-3 (-> gp-0 length))\n"
" (format (quote #t) L327 s5-3 (-> (the-as (array uint64) gp-0) s5-3))\n"
" (< s5-3 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] #x~X~%\"\n"
" s5-3\n"
" (-> (the-as (array uint64) arg0) s5-3)\n"
" )\n"
" (set! s5-3 (+ s5-3 1))\n"
" )\n"
" (set! v1-20 (quote #f))\n"
@@ -1271,8 +1291,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote int8))\n"
" (set! s5-4 0)\n"
" (while\n"
" (< s5-4 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-4 (-> (the-as (array int8) gp-0) s5-4))\n"
" (< s5-4 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-4\n"
" (-> (the-as (array int8) arg0) s5-4)\n"
" )\n"
" (set! s5-4 (+ s5-4 1))\n"
" )\n"
" (set! v1-24 (quote #f))\n"
@@ -1281,8 +1306,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote uint8))\n"
" (set! s5-5 0)\n"
" (while\n"
" (< s5-5 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-5 (-> (the-as (array int8) gp-0) s5-5))\n"
" (< s5-5 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-5\n"
" (-> (the-as (array int8) arg0) s5-5)\n"
" )\n"
" (set! s5-5 (+ s5-5 1))\n"
" )\n"
" (set! v1-28 (quote #f))\n"
@@ -1291,8 +1321,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote int16))\n"
" (set! s5-6 0)\n"
" (while\n"
" (< s5-6 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-6 (-> (the-as (array int16) gp-0) s5-6))\n"
" (< s5-6 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-6\n"
" (-> (the-as (array int16) arg0) s5-6)\n"
" )\n"
" (set! s5-6 (+ s5-6 1))\n"
" )\n"
" (set! v1-33 (quote #f))\n"
@@ -1301,8 +1336,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" ((= v1-1 (quote uint16))\n"
" (set! s5-7 0)\n"
" (while\n"
" (< s5-7 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-7 (-> (the-as (array uint16) gp-0) s5-7))\n"
" (< s5-7 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~D~%\"\n"
" s5-7\n"
" (-> (the-as (array uint16) arg0) s5-7)\n"
" )\n"
" (set! s5-7 (+ s5-7 1))\n"
" )\n"
" (set! v1-38 (quote #f))\n"
@@ -1314,17 +1354,14 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" (v1-40\n"
" (set! s5-8 0)\n"
" (while\n"
" (< s5-8 (-> gp-0 length))\n"
" (< s5-8 (-> arg0 length))\n"
" (set! t9-14 format)\n"
" (set! a0-25 (quote #t))\n"
" (set! a1-15 L327)\n"
" (set! a1-15 \"~T [~D] #x~X~%\")\n"
" (set! a2-13 s5-8)\n"
" (set!\n"
" v1-42\n"
" (+\n"
" (shl s5-8 4)\n"
" (the-as int (the-as (array uint128) gp-0))\n"
" )\n"
" (+ (shl s5-8 4) (the-as int (the-as (array uint128) arg0)))\n"
" )\n"
" (.lq a3-10 12 v1-42)\n"
" (t9-14 a0-25 a1-15 a2-13 a3-10)\n"
@@ -1336,8 +1373,8 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" (else\n"
" (set! s5-9 0)\n"
" (while\n"
" (< s5-9 (-> gp-0 length))\n"
" (format (quote #t) L328 s5-9 (-> gp-0 s5-9))\n"
" (< s5-9 (-> arg0 length))\n"
" (format (quote #t) \"~T [~D] ~D~%\" s5-9 (-> arg0 s5-9))\n"
" (set! s5-9 (+ s5-9 1))\n"
" )\n"
" (set! v1-49 (quote #f))\n"
@@ -1350,11 +1387,16 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" )\n"
" (else\n"
" (cond\n"
" ((= (-> gp-0 content-type) float)\n"
" ((= (-> arg0 content-type) float)\n"
" (set! s5-10 0)\n"
" (while\n"
" (< s5-10 (-> gp-0 length))\n"
" (format (quote #t) L326 s5-10 (-> (the-as (array float) gp-0) s5-10))\n"
" (< s5-10 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~f~%\"\n"
" s5-10\n"
" (-> (the-as (array float) arg0) s5-10)\n"
" )\n"
" (set! s5-10 (+ s5-10 1))\n"
" )\n"
" (set! v1-55 (quote #f))\n"
@@ -1363,8 +1405,13 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" (else\n"
" (set! s5-11 0)\n"
" (while\n"
" (< s5-11 (-> gp-0 length))\n"
" (format (quote #t) L325 s5-11 (-> (the-as (array basic) gp-0) s5-11))\n"
" (< s5-11 (-> arg0 length))\n"
" (format\n"
" (quote #t)\n"
" \"~T [~D] ~A~%\"\n"
" s5-11\n"
" (-> (the-as (array basic) arg0) s5-11)\n"
" )\n"
" (set! s5-11 (+ s5-11 1))\n"
" )\n"
" (set! v1-60 (quote #f))\n"
@@ -1373,7 +1420,7 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" )\n"
" )\n"
" )\n"
" gp-0\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, true, "array",
{{"L333", "[~8x] ~A~%"},
@@ -1928,34 +1975,71 @@ TEST_F(FormRegressionTest, ExprValid) {
" (set!\n"
" v1-1\n"
" (begin\n"
" (set! gp-0 a0-0)\n"
" (set! s3-0 a1-0)\n"
" (set! s4-0 a2-0)\n"
" (set! s5-0 t0-0)\n"
" (set! arg0 arg0)\n"
" (set! arg1 arg1)\n"
" (set! arg2 arg2)\n"
" (set! arg4 arg4)\n"
" (and\n"
" (>= (the-as uint gp-0) (the-as uint __START-OF-TABLE__))\n"
" (< (the-as uint gp-0) (the-as uint 134217728))\n"
" (>= (the-as uint arg0) (the-as uint __START-OF-TABLE__))\n"
" (< (the-as uint arg0) (the-as uint 134217728))\n"
" )\n"
" )\n"
" )\n"
" (cond\n"
" ((not s3-0)\n"
" ((not arg1)\n"
" (cond\n"
" ((nonzero? (logand (the-as int gp-0) 3))\n"
" (if s4-0 (set! v1-4 (format s5-0 L321 gp-0 s4-0)))\n"
" ((nonzero? (logand (the-as int arg0) 3))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-4\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object (misaligned)~%\"\n"
" arg0\n"
" arg2\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((not v1-1)\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-6\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object (bad address)~%\"\n"
" arg0\n"
" arg2\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((not v1-1) (if s4-0 (set! v1-6 (format s5-0 L320 gp-0 s4-0))) (quote #f))\n"
" (else (quote #t))\n"
" )\n"
" )\n"
" ((and a3-0 (not gp-0)) (quote #t))\n"
" ((and arg3 (not arg0)) (quote #t))\n"
" (else\n"
" (cond\n"
" ((= s3-0 structure)\n"
" ((= arg1 structure)\n"
" (cond\n"
" ((nonzero? (logand (the-as int gp-0) 15))\n"
" (if s4-0 (set! v1-8 (format s5-0 L319 gp-0 s4-0 s3-0)))\n"
" ((nonzero? (logand (the-as int arg0) 15))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-8\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((or\n"
@@ -1963,72 +2047,199 @@ TEST_F(FormRegressionTest, ExprValid) {
" (begin\n"
" (set! v1-10 32768)\n"
" (.daddu v1-11 v1-10 s7-0)\n"
" (< (the-as uint gp-0) (the-as uint v1-11))\n"
" (< (the-as uint arg0) (the-as uint v1-11))\n"
" )\n"
" )\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-13\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (if s4-0 (set! v1-13 (format s5-0 L318 gp-0 s4-0 s3-0)))\n"
" (quote #f)\n"
" )\n"
" (else (quote #t))\n"
" )\n"
" )\n"
" ((= s3-0 pair)\n"
" ((= arg1 pair)\n"
" (cond\n"
" ((!= (logand (the-as int gp-0) 7) 2)\n"
" (if s4-0 (set! v1-15 (format s5-0 L319 gp-0 s4-0 s3-0)))\n"
" ((!= (logand (the-as int arg0) 7) 2)\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-15\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((not v1-1)\n"
" (if s4-0 (set! v1-17 (format s5-0 L318 gp-0 s4-0 s3-0)))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-17\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" (else (quote #t))\n"
" )\n"
" )\n"
" ((= s3-0 binteger)\n"
" ((= arg1 binteger)\n"
" (cond\n"
" ((zero? (logand (the-as int gp-0) 7)) (quote #t))\n"
" ((zero? (logand (the-as int arg0) 7)) (quote #t))\n"
" (else\n"
" (if s4-0 (set! v1-20 (format s5-0 L319 gp-0 s4-0 s3-0)))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-20\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" )\n"
" )\n"
" ((!= (logand (the-as int gp-0) 7) 4)\n"
" (if s4-0 (set! v1-22 (format s5-0 L319 gp-0 s4-0 s3-0)))\n"
" ((!= (logand (the-as int arg0) 7) 4)\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-22\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((not v1-1)\n"
" (if s4-0 (set! v1-24 (format s5-0 L318 gp-0 s4-0 s3-0)))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-24\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((and (= s3-0 type) (!= (rtype-of gp-0) type))\n"
" (if s4-0 (set! v1-31 (format s5-0 L317 gp-0 s4-0 s3-0 (rtype-of gp-0))))\n"
" ((and (= arg1 type) (!= (rtype-of arg0) type))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-31\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (invalid type "
"#x~X)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" (rtype-of arg0)\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" (else\n"
" (set!\n"
" v1-33\n"
" (and\n"
" (!= s3-0 type)\n"
" (not (valid? (rtype-of gp-0) type (quote #f) (quote #t) 0))\n"
" (!= arg1 type)\n"
" (not (valid? (rtype-of arg0) type (quote #f) (quote #t) 0))\n"
" )\n"
" )\n"
" (cond\n"
" (v1-33\n"
" (if s4-0 (set! v1-37 (format s5-0 L317 gp-0 s4-0 s3-0 (rtype-of gp-0))))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-37\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (invalid type "
"#x~X)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" (rtype-of arg0)\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((not (type-type? (rtype-of gp-0) s3-0))\n"
" (if s4-0 (set! v1-41 (format s5-0 L316 gp-0 s4-0 s3-0 (rtype-of gp-0))))\n"
" ((not (type-type? (rtype-of arg0) arg1))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-41\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (is type '~A' "
"instead)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" (rtype-of arg0)\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" ((= s3-0 symbol)\n"
" ((= arg1 symbol)\n"
" (set! v1-43 32768)\n"
" (.daddu v1-44 v1-43 s7-0)\n"
" (cond\n"
" ((>= (the-as uint gp-0) (the-as uint v1-44))\n"
" (if s4-0 (set! v1-46 (format s5-0 L315 gp-0 s4-0 s3-0)))\n"
" ((>= (the-as uint arg0) (the-as uint v1-44))\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-46\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (not in symbol "
"table)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (quote #f)\n"
" )\n"
" (else (quote #t))\n"
@@ -2037,9 +2248,22 @@ TEST_F(FormRegressionTest, ExprValid) {
" ((begin\n"
" (set! v1-47 32768)\n"
" (.daddu v1-48 v1-47 s7-0)\n"
" (< (the-as uint gp-0) (the-as uint v1-48))\n"
" (< (the-as uint arg0) (the-as uint v1-48))\n"
" )\n"
" (if\n"
" arg2\n"
" (set!\n"
" v1-50\n"
" (format\n"
" arg4\n"
" \"ERROR: object #x~X ~S is not a valid object of type '~A' (inside symbol "
"table)~%\"\n"
" arg0\n"
" arg2\n"
" arg1\n"
" )\n"
" )\n"
" )\n"
" (if s4-0 (set! v1-50 (format s5-0 L314 gp-0 s4-0 s3-0)))\n"
" (quote #f)\n"
" )\n"
" (else (quote #t))\n"