diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-26 16:20:40 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-26 16:20:40 -0500 |
commit | b258f03455399fcadc6a4ba7426fa447fe6dff66 (patch) | |
tree | ce325377fe85edfa7fceea651fc8b958fcbfba3f | |
parent | fc2d299ffe1877a635277acff15574d987da9a53 (diff) | |
download | binaryen-b258f03455399fcadc6a4ba7426fa447fe6dff66.tar.gz binaryen-b258f03455399fcadc6a4ba7426fa447fe6dff66.tar.bz2 binaryen-b258f03455399fcadc6a4ba7426fa447fe6dff66.zip |
implement a temporary hack for __stack_pointer
-rwxr-xr-x | auto_update_tests.py | 2 | ||||
-rwxr-xr-x | check.py | 2 | ||||
-rw-r--r-- | src/s2wasm.h | 15 | ||||
-rw-r--r-- | test/dot_s/legalize.wast | 384 |
4 files changed, 204 insertions, 199 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py index 566967640..12cc253ec 100755 --- a/auto_update_tests.py +++ b/auto_update_tests.py @@ -29,7 +29,7 @@ for t in sorted(os.listdir('test')): for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))): if not s.endswith('.s'): continue - if s in ['inline-asm.s', 'userstack.s', 'offset-folding.s', 'legalize.s']: continue + if s in ['inline-asm.s', 'offset-folding.s']: continue print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) @@ -236,7 +236,7 @@ print '\n[ checking .s testcases... ]\n' for s in sorted(os.listdir(os.path.join('test', 'dot_s'))) + sorted(os.listdir(os.path.join('test', 'experimental', 'prototype-wasmate', 'test'))): if not s.endswith('.s'): continue - if s in ['inline-asm.s', 'userstack.s', 'offset-folding.s', 'legalize.s']: continue + if s in ['inline-asm.s', 'offset-folding.s',]: continue print '..', s wasm = s.replace('.s', '.wast') full = os.path.join('test', 'dot_s', s) diff --git a/src/s2wasm.h b/src/s2wasm.h index dd4437ed9..af5fccf82 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -42,11 +42,12 @@ class S2WasmBuilder { public: S2WasmBuilder(AllocatingModule& wasm, const char* input, bool debug, size_t globalBase) : wasm(wasm), allocator(wasm.allocator), debug(debug), globalBase(globalBase), nextStatic(globalBase) { - s = input; - scan(); - s = input; - process(); - fix(); + s = input; + scan(); + s = input; + prepare(); + process(); + fix(); } private: @@ -302,6 +303,10 @@ private: } } + void prepare() { + staticAddresses["__stack_pointer"] = 0; // XXX HACK for now + } + void process() { while (*s) { skipWhitespace(); diff --git a/test/dot_s/legalize.wast b/test/dot_s/legalize.wast index 72230965a..e7cb8ffb0 100644 --- a/test/dot_s/legalize.wast +++ b/test/dot_s/legalize.wast @@ -402,13 +402,13 @@ ) ) (call_import $__lshrti3 + (get_local $$184) + (get_local $$1) + (get_local $$2) (i64.sub (i64.const 896) (get_local $$17) ) - (get_local $$2) - (get_local $$1) - (get_local $$184) ) (set_local $$33 (i64.add @@ -426,10 +426,10 @@ ) ) (call_import $__ashlti3 - (get_local $$33) - (get_local $$4) - (get_local $$3) (get_local $$185) + (get_local $$3) + (get_local $$4) + (get_local $$33) ) (set_local $$186 (i32.const 496) @@ -441,13 +441,13 @@ ) ) (call_import $__ashlti3 + (get_local $$186) + (get_local $$1) + (get_local $$2) (i64.add (get_local $$17) (i64.const -896) ) - (get_local $$2) - (get_local $$1) - (get_local $$186) ) (set_local $$34 (i64.sub @@ -465,10 +465,10 @@ ) ) (call_import $__lshrti3 - (get_local $$34) - (get_local $$6) - (get_local $$5) (get_local $$187) + (get_local $$5) + (get_local $$6) + (get_local $$34) ) (set_local $$35 (i64.add @@ -486,10 +486,10 @@ ) ) (call_import $__ashlti3 - (get_local $$35) - (get_local $$8) - (get_local $$7) (get_local $$188) + (get_local $$7) + (get_local $$8) + (get_local $$35) ) (set_local $$36 (i64.add @@ -507,10 +507,10 @@ ) ) (call_import $__ashlti3 - (get_local $$36) - (get_local $$6) - (get_local $$5) (get_local $$189) + (get_local $$5) + (get_local $$6) + (get_local $$36) ) (set_local $$37 (i64.sub @@ -528,10 +528,10 @@ ) ) (call_import $__lshrti3 - (get_local $$37) - (get_local $$4) - (get_local $$3) (get_local $$190) + (get_local $$3) + (get_local $$4) + (get_local $$37) ) (set_local $$38 (i64.const 384) @@ -552,10 +552,10 @@ ) ) (call_import $__lshrti3 - (get_local $$39) - (get_local $$10) - (get_local $$9) (get_local $$191) + (get_local $$9) + (get_local $$10) + (get_local $$39) ) (set_local $$40 (i64.add @@ -573,10 +573,10 @@ ) ) (call_import $__ashlti3 - (get_local $$40) - (get_local $$12) - (get_local $$11) (get_local $$192) + (get_local $$11) + (get_local $$12) + (get_local $$40) ) (set_local $$41 (i64.add @@ -594,10 +594,10 @@ ) ) (call_import $__ashlti3 - (get_local $$41) - (get_local $$10) - (get_local $$9) (get_local $$193) + (get_local $$9) + (get_local $$10) + (get_local $$41) ) (set_local $$194 (i32.const 1008) @@ -609,10 +609,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$16) - (get_local $$15) (get_local $$194) + (get_local $$15) + (get_local $$16) + (get_local $$17) ) (set_local $$42 (i64.const 128) @@ -633,10 +633,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$14) - (get_local $$13) (get_local $$195) + (get_local $$13) + (get_local $$14) + (get_local $$51) ) (set_local $$43 (i64.add @@ -654,10 +654,10 @@ ) ) (call_import $__ashlti3 - (get_local $$43) - (get_local $$14) - (get_local $$13) (get_local $$196) + (get_local $$13) + (get_local $$14) + (get_local $$43) ) (set_local $$44 (i64.const 256) @@ -678,10 +678,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$12) - (get_local $$11) (get_local $$197) + (get_local $$11) + (get_local $$12) + (get_local $$45) ) (set_local $$46 (i64.const 512) @@ -702,10 +702,10 @@ ) ) (call_import $__lshrti3 - (get_local $$47) - (get_local $$8) - (get_local $$7) (get_local $$198) + (get_local $$7) + (get_local $$8) + (get_local $$47) ) (set_local $$199 (i32.const 912) @@ -717,10 +717,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$12) - (get_local $$11) (get_local $$199) + (get_local $$11) + (get_local $$12) + (get_local $$17) ) (set_local $$200 (i32.const 928) @@ -732,10 +732,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$10) - (get_local $$9) (get_local $$200) + (get_local $$9) + (get_local $$10) + (get_local $$51) ) (set_local $$201 (i32.const 944) @@ -747,10 +747,10 @@ ) ) (call_import $__ashlti3 - (get_local $$43) - (get_local $$10) - (get_local $$9) (get_local $$201) + (get_local $$9) + (get_local $$10) + (get_local $$43) ) (set_local $$48 (i64.sub @@ -768,10 +768,10 @@ ) ) (call_import $__ashlti3 - (get_local $$48) - (get_local $$8) - (get_local $$7) (get_local $$202) + (get_local $$7) + (get_local $$8) + (get_local $$48) ) (set_local $$203 (i32.const 96) @@ -783,13 +783,13 @@ ) ) (call_import $__lshrti3 + (get_local $$203) + (get_local $$5) + (get_local $$6) (i64.sub (get_local $$42) (get_local $$48) ) - (get_local $$6) - (get_local $$5) - (get_local $$203) ) (set_local $$49 (i64.sub @@ -807,10 +807,10 @@ ) ) (call_import $__ashlti3 - (get_local $$49) - (get_local $$6) - (get_local $$5) (get_local $$204) + (get_local $$5) + (get_local $$6) + (get_local $$49) ) (set_local $$205 (i32.const 48) @@ -822,10 +822,10 @@ ) ) (call_import $__lshrti3 - (get_local $$47) - (get_local $$4) - (get_local $$3) (get_local $$205) + (get_local $$3) + (get_local $$4) + (get_local $$47) ) (set_local $$206 (i32.const 176) @@ -837,10 +837,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$8) - (get_local $$7) (get_local $$206) + (get_local $$7) + (get_local $$8) + (get_local $$45) ) (set_local $$207 (i32.const 288) @@ -852,10 +852,10 @@ ) ) (call_import $__lshrti3 - (get_local $$34) - (get_local $$2) - (get_local $$1) (get_local $$207) + (get_local $$1) + (get_local $$2) + (get_local $$34) ) (set_local $$208 (i32.const 272) @@ -867,10 +867,10 @@ ) ) (call_import $__ashlti3 - (get_local $$35) - (get_local $$4) - (get_local $$3) (get_local $$208) + (get_local $$3) + (get_local $$4) + (get_local $$35) ) (set_local $$209 (i32.const 304) @@ -882,10 +882,10 @@ ) ) (call_import $__ashlti3 - (get_local $$36) - (get_local $$2) - (get_local $$1) (get_local $$209) + (get_local $$1) + (get_local $$2) + (get_local $$36) ) (set_local $$210 (i32.const 128) @@ -897,10 +897,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$6) - (get_local $$5) (get_local $$210) + (get_local $$5) + (get_local $$6) + (get_local $$45) ) (set_local $$211 (i32.const 144) @@ -912,13 +912,13 @@ ) ) (call_import $__ashlti3 + (get_local $$211) + (get_local $$7) + (get_local $$8) (i64.sub (get_local $$38) (get_local $$47) ) - (get_local $$8) - (get_local $$7) - (get_local $$211) ) (set_local $$212 (i32.const 160) @@ -930,10 +930,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$8) - (get_local $$7) (get_local $$212) + (get_local $$7) + (get_local $$8) + (get_local $$51) ) (set_local $$213 (i32.const 0) @@ -945,10 +945,10 @@ ) ) (call_import $__lshrti3 - (get_local $$47) - (get_local $$2) - (get_local $$1) (get_local $$213) + (get_local $$1) + (get_local $$2) + (get_local $$47) ) (set_local $$214 (i32.const 16) @@ -960,10 +960,10 @@ ) ) (call_import $__ashlti3 - (get_local $$49) - (get_local $$4) - (get_local $$3) (get_local $$214) + (get_local $$3) + (get_local $$4) + (get_local $$49) ) (set_local $$215 (i32.const 32) @@ -975,10 +975,10 @@ ) ) (call_import $__lshrti3 - (get_local $$39) - (get_local $$4) - (get_local $$3) (get_local $$215) + (get_local $$3) + (get_local $$4) + (get_local $$39) ) (set_local $$216 (i32.const 64) @@ -990,10 +990,10 @@ ) ) (call_import $__ashlti3 - (get_local $$48) - (get_local $$6) - (get_local $$5) (get_local $$216) + (get_local $$5) + (get_local $$6) + (get_local $$48) ) (set_local $$217 (i32.const 896) @@ -1005,10 +1005,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$10) - (get_local $$9) (get_local $$217) + (get_local $$9) + (get_local $$10) + (get_local $$17) ) (set_local $$218 (i32.const 256) @@ -1020,10 +1020,10 @@ ) ) (call_import $__ashlti3 - (get_local $$35) - (get_local $$2) - (get_local $$1) (get_local $$218) + (get_local $$1) + (get_local $$2) + (get_local $$35) ) (set_local $$219 (i32.const 192) @@ -1035,10 +1035,10 @@ ) ) (call_import $__lshrti3 - (get_local $$47) - (get_local $$6) - (get_local $$5) (get_local $$219) + (get_local $$5) + (get_local $$6) + (get_local $$47) ) (set_local $$220 (i32.const 208) @@ -1050,10 +1050,10 @@ ) ) (call_import $__ashlti3 - (get_local $$49) - (get_local $$8) - (get_local $$7) (get_local $$220) + (get_local $$7) + (get_local $$8) + (get_local $$49) ) (set_local $$221 (i32.const 224) @@ -1065,10 +1065,10 @@ ) ) (call_import $__lshrti3 - (get_local $$39) - (get_local $$8) - (get_local $$7) (get_local $$221) + (get_local $$7) + (get_local $$8) + (get_local $$39) ) (set_local $$222 (i32.const 768) @@ -1080,10 +1080,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$10) - (get_local $$9) (get_local $$222) + (get_local $$9) + (get_local $$10) + (get_local $$45) ) (set_local $$49 (i64.sub @@ -1101,10 +1101,10 @@ ) ) (call_import $__ashlti3 - (get_local $$49) - (get_local $$12) - (get_local $$11) (get_local $$223) + (get_local $$11) + (get_local $$12) + (get_local $$49) ) (set_local $$224 (i32.const 800) @@ -1116,10 +1116,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$12) - (get_local $$11) (get_local $$224) + (get_local $$11) + (get_local $$12) + (get_local $$51) ) (set_local $$225 (i32.const 992) @@ -1131,10 +1131,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$14) - (get_local $$13) (get_local $$225) + (get_local $$13) + (get_local $$14) + (get_local $$17) ) (set_local $$226 (i32.const 832) @@ -1146,10 +1146,10 @@ ) ) (call_import $__ashlti3 - (get_local $$40) - (get_local $$10) - (get_local $$9) (get_local $$226) + (get_local $$9) + (get_local $$10) + (get_local $$40) ) (set_local $$227 (i32.const 384) @@ -1161,10 +1161,10 @@ ) ) (call_import $__lshrti3 - (get_local $$37) - (get_local $$2) - (get_local $$1) (get_local $$227) + (get_local $$1) + (get_local $$2) + (get_local $$37) ) (set_local $$228 (i32.const 400) @@ -1176,13 +1176,13 @@ ) ) (call_import $__ashlti3 + (get_local $$228) + (get_local $$3) + (get_local $$4) (i64.sub (get_local $$42) (get_local $$37) ) - (get_local $$4) - (get_local $$3) - (get_local $$228) ) (set_local $$229 (i32.const 416) @@ -1194,10 +1194,10 @@ ) ) (call_import $__lshrti3 - (get_local $$34) - (get_local $$4) - (get_local $$3) (get_local $$229) + (get_local $$3) + (get_local $$4) + (get_local $$34) ) (set_local $$230 (i32.const 320) @@ -1209,10 +1209,10 @@ ) ) (call_import $__ashlti3 - (get_local $$35) - (get_local $$6) - (get_local $$5) (get_local $$230) + (get_local $$5) + (get_local $$6) + (get_local $$35) ) (set_local $$231 (i32.const 448) @@ -1224,10 +1224,10 @@ ) ) (call_import $__ashlti3 - (get_local $$33) - (get_local $$2) - (get_local $$1) (get_local $$231) + (get_local $$1) + (get_local $$2) + (get_local $$33) ) (set_local $$232 (i32.const 736) @@ -1239,10 +1239,10 @@ ) ) (call_import $__lshrti3 - (get_local $$39) - (get_local $$2) - (get_local $$1) (get_local $$232) + (get_local $$1) + (get_local $$2) + (get_local $$39) ) (set_local $$233 (i32.const 720) @@ -1254,10 +1254,10 @@ ) ) (call_import $__ashlti3 - (get_local $$40) - (get_local $$4) - (get_local $$3) (get_local $$233) + (get_local $$3) + (get_local $$4) + (get_local $$40) ) (set_local $$234 (i32.const 752) @@ -1269,10 +1269,10 @@ ) ) (call_import $__ashlti3 - (get_local $$41) - (get_local $$2) - (get_local $$1) (get_local $$234) + (get_local $$1) + (get_local $$2) + (get_local $$41) ) (set_local $$235 (i32.const 592) @@ -1284,10 +1284,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$8) - (get_local $$7) (get_local $$235) + (get_local $$7) + (get_local $$8) + (get_local $$17) ) (set_local $$236 (i32.const 608) @@ -1299,10 +1299,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$6) - (get_local $$5) (get_local $$236) + (get_local $$5) + (get_local $$6) + (get_local $$51) ) (set_local $$237 (i32.const 624) @@ -1314,10 +1314,10 @@ ) ) (call_import $__ashlti3 - (get_local $$43) - (get_local $$6) - (get_local $$5) (get_local $$237) + (get_local $$5) + (get_local $$6) + (get_local $$43) ) (set_local $$238 (i32.const 688) @@ -1329,10 +1329,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$4) - (get_local $$3) (get_local $$238) + (get_local $$3) + (get_local $$4) + (get_local $$45) ) (set_local $$239 (i32.const 640) @@ -1344,10 +1344,10 @@ ) ) (call_import $__lshrti3 - (get_local $$45) - (get_local $$2) - (get_local $$1) (get_local $$239) + (get_local $$1) + (get_local $$2) + (get_local $$45) ) (set_local $$240 (i32.const 656) @@ -1359,10 +1359,10 @@ ) ) (call_import $__ashlti3 - (get_local $$49) - (get_local $$4) - (get_local $$3) (get_local $$240) + (get_local $$3) + (get_local $$4) + (get_local $$49) ) (set_local $$241 (i32.const 672) @@ -1374,10 +1374,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$4) - (get_local $$3) (get_local $$241) + (get_local $$3) + (get_local $$4) + (get_local $$51) ) (set_local $$242 (i32.const 576) @@ -1389,10 +1389,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$6) - (get_local $$5) (get_local $$242) + (get_local $$5) + (get_local $$6) + (get_local $$17) ) (set_local $$243 (i32.const 704) @@ -1404,10 +1404,10 @@ ) ) (call_import $__ashlti3 - (get_local $$40) - (get_local $$2) - (get_local $$1) (get_local $$243) + (get_local $$1) + (get_local $$2) + (get_local $$40) ) (set_local $$244 (i32.const 528) @@ -1419,10 +1419,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$4) - (get_local $$3) (get_local $$244) + (get_local $$3) + (get_local $$4) + (get_local $$17) ) (set_local $$245 (i32.const 544) @@ -1434,10 +1434,10 @@ ) ) (call_import $__lshrti3 - (get_local $$51) - (get_local $$2) - (get_local $$1) (get_local $$245) + (get_local $$1) + (get_local $$2) + (get_local $$51) ) (set_local $$246 (i32.const 560) @@ -1449,10 +1449,10 @@ ) ) (call_import $__ashlti3 - (get_local $$43) - (get_local $$2) - (get_local $$1) (get_local $$246) + (get_local $$1) + (get_local $$2) + (get_local $$43) ) (set_local $$247 (i32.const 512) @@ -1464,10 +1464,10 @@ ) ) (call_import $__ashlti3 - (get_local $$17) - (get_local $$2) - (get_local $$1) (get_local $$247) + (get_local $$1) + (get_local $$2) + (get_local $$17) ) (set_local $$39 (i64.load align=8 offset=480 |