diff options
author | Alon Zakai <azakai@google.com> | 2020-09-03 08:06:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 08:06:34 -0700 |
commit | 132c72bb5e93591de34a9bfc267e4a2007908626 (patch) | |
tree | f049f98d371fdbd2ea4b3fb37db2aedc8ff6f98d | |
parent | 560baeea1810e7e4a0da6155be6e3dc9716a6758 (diff) | |
download | binaryen-132c72bb5e93591de34a9bfc267e4a2007908626.tar.gz binaryen-132c72bb5e93591de34a9bfc267e4a2007908626.tar.bz2 binaryen-132c72bb5e93591de34a9bfc267e4a2007908626.zip |
Remove old stack function from StackCheck (#3100)
-rw-r--r-- | src/passes/StackCheck.cpp | 13 | ||||
-rw-r--r-- | test/lld/basic_safe_stack.wat.out | 9 | ||||
-rw-r--r-- | test/lld/recursive_safe_stack.wat.out | 8 | ||||
-rw-r--r-- | test/lld/safe_stack_standalone-wasm.wat.out | 8 | ||||
-rw-r--r-- | test/passes/stack-check_enable-mutable-globals.txt | 7 |
5 files changed, 2 insertions, 43 deletions
diff --git a/src/passes/StackCheck.cpp b/src/passes/StackCheck.cpp index 183420fba..4388705e6 100644 --- a/src/passes/StackCheck.cpp +++ b/src/passes/StackCheck.cpp @@ -36,10 +36,7 @@ namespace wasm { static Name STACK_BASE("__stack_base"); // The limit is the farthest it can grow to, which is the lowest valid address. static Name STACK_LIMIT("__stack_limit"); -// Old version, which sets the limit. -// TODO: remove this -static Name SET_STACK_LIMIT("__set_stack_limit"); -// New version, which sets the base and the limit. +// Exported function to set the base and the limit. static Name SET_STACK_LIMITS("__set_stack_limits"); static void importStackOverflowHandler(Module& module, Name name) { @@ -65,14 +62,6 @@ static void addExportedFunction(Module& module, Function* function) { static void generateSetStackLimitFunctions(Module& module) { Builder builder(module); - // One-parameter version - Function* limitFunc = - builder.makeFunction(SET_STACK_LIMIT, Signature(Type::i32, Type::none), {}); - LocalGet* getArg = builder.makeLocalGet(0, Type::i32); - Expression* store = builder.makeGlobalSet(STACK_LIMIT, getArg); - limitFunc->body = store; - addExportedFunction(module, limitFunc); - // Two-parameter version Function* limitsFunc = builder.makeFunction( SET_STACK_LIMITS, Signature({Type::i32, Type::i32}, Type::none), {}); LocalGet* getBase = builder.makeLocalGet(0, Type::i32); diff --git a/test/lld/basic_safe_stack.wat.out b/test/lld/basic_safe_stack.wat.out index 9e6a916da..74a2355dd 100644 --- a/test/lld/basic_safe_stack.wat.out +++ b/test/lld/basic_safe_stack.wat.out @@ -1,7 +1,7 @@ (module (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (import "env" "__handle_stack_overflow" (func $__handle_stack_overflow)) (memory $0 2) @@ -16,7 +16,6 @@ (export "stackAlloc" (func $stackAlloc)) (export "main" (func $main)) (export "__data_end" (global $global$1)) - (export "__set_stack_limit" (func $__set_stack_limit)) (export "__set_stack_limits" (func $__set_stack_limits)) (export "__growWasmMemory" (func $__growWasmMemory)) (func $__wasm_call_ctors @@ -80,11 +79,6 @@ (func $main (nop) ) - (func $__set_stack_limit (param $0 i32) - (global.set $__stack_limit - (local.get $0) - ) - ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base (local.get $0) @@ -117,7 +111,6 @@ "stackRestore", "stackAlloc", "main", - "__set_stack_limit", "__set_stack_limits", "__growWasmMemory" ], diff --git a/test/lld/recursive_safe_stack.wat.out b/test/lld/recursive_safe_stack.wat.out index cceca00ab..d70611220 100644 --- a/test/lld/recursive_safe_stack.wat.out +++ b/test/lld/recursive_safe_stack.wat.out @@ -1,7 +1,6 @@ (module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) @@ -20,7 +19,6 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (export "main" (func $main)) - (export "__set_stack_limit" (func $__set_stack_limit)) (export "__set_stack_limits" (func $__set_stack_limits)) (export "__growWasmMemory" (func $__growWasmMemory)) (func $__wasm_call_ctors @@ -167,11 +165,6 @@ (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main) ) - (func $__set_stack_limit (param $0 i32) - (global.set $__stack_limit - (local.get $0) - ) - ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base (local.get $0) @@ -203,7 +196,6 @@ "exports": [ "__wasm_call_ctors", "main", - "__set_stack_limit", "__set_stack_limits", "__growWasmMemory" ], diff --git a/test/lld/safe_stack_standalone-wasm.wat.out b/test/lld/safe_stack_standalone-wasm.wat.out index 51b88661b..3f1cdeb3c 100644 --- a/test/lld/safe_stack_standalone-wasm.wat.out +++ b/test/lld/safe_stack_standalone-wasm.wat.out @@ -1,7 +1,6 @@ (module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) @@ -19,7 +18,6 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (export "main" (func $main)) - (export "__set_stack_limit" (func $__set_stack_limit)) (export "__set_stack_limits" (func $__set_stack_limits)) (export "__growWasmMemory" (func $__growWasmMemory)) (func $__wasm_call_ctors @@ -166,11 +164,6 @@ (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main) ) - (func $__set_stack_limit (param $0 i32) - (global.set $__stack_limit - (local.get $0) - ) - ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base (local.get $0) @@ -201,7 +194,6 @@ "exports": [ "__wasm_call_ctors", "main", - "__set_stack_limit", "__set_stack_limits", "__growWasmMemory" ], diff --git a/test/passes/stack-check_enable-mutable-globals.txt b/test/passes/stack-check_enable-mutable-globals.txt index 52ee091ef..c89f112a8 100644 --- a/test/passes/stack-check_enable-mutable-globals.txt +++ b/test/passes/stack-check_enable-mutable-globals.txt @@ -1,12 +1,10 @@ (module - (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $none_=>_i32 (func (result i32))) (import "env" "__stack_pointer" (global $sp (mut i32))) (global $__stack_base (mut i32) (i32.const 0)) (global $__stack_limit (mut i32) (i32.const 0)) (export "use_stack" (func $0)) - (export "__set_stack_limit" (func $__set_stack_limit)) (export "__set_stack_limits" (func $__set_stack_limits)) (func $0 (result i32) (local $0 i32) @@ -32,11 +30,6 @@ ) (global.get $sp) ) - (func $__set_stack_limit (param $0 i32) - (global.set $__stack_limit - (local.get $0) - ) - ) (func $__set_stack_limits (param $0 i32) (param $1 i32) (global.set $__stack_base (local.get $0) |