Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/shared-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

namespace wasm {

extern Name GROW_WASM_MEMORY;
extern Name WASM_CALL_CTORS;
extern Name MEMORY_BASE;
extern Name TABLE_BASE;
Expand Down
1 change: 0 additions & 1 deletion src/tools/wasm-emscripten-finalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ int main(int argc, const char* argv[]) {
} else {
BYN_TRACE("finalizing as regular module\n");
generator.internalizeStackPointerGlobal();
generator.generateMemoryGrowthFunction();
// For side modules these gets called via __post_instantiate
if (Function* F = wasm.getFunctionOrNull(ASSIGN_GOT_ENTRIES)) {
auto* ex = new Export();
Expand Down
1 change: 0 additions & 1 deletion src/wasm-emscripten.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class EmscriptenGlueGenerator {
: wasm(wasm), builder(wasm), stackPointerOffset(stackPointerOffset),
useStackPointerGlobal(stackPointerOffset == 0) {}

Function* generateMemoryGrowthFunction();
Function* generateAssignGOTEntriesFunction();
void generatePostInstantiateFunction();

Expand Down
13 changes: 0 additions & 13 deletions src/wasm/wasm-emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,6 @@ void EmscriptenGlueGenerator::generatePostInstantiateFunction() {
wasm.addExport(ex);
}

Function* EmscriptenGlueGenerator::generateMemoryGrowthFunction() {
Name name(GROW_WASM_MEMORY);
std::vector<NameType> params{{NEW_SIZE, Type::i32}};
Function* growFunction =
builder.makeFunction(name, std::move(params), Type::i32, {});
growFunction->body =
builder.makeMemoryGrow(builder.makeLocalGet(0, Type::i32));

addExportedFunction(wasm, growFunction);

return growFunction;
}

inline void exportFunction(Module& wasm, Name name, bool must_export) {
if (!wasm.getFunctionOrNull(name)) {
assert(!must_export);
Expand Down
1 change: 0 additions & 1 deletion src/wasm/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const char* Memory64Feature = "memory64";
} // namespace UserSections
} // namespace BinaryConsts

Name GROW_WASM_MEMORY("__growWasmMemory");
Name WASM_CALL_CTORS("__wasm_call_ctors");
Name MEMORY_BASE("__memory_base");
Name TABLE_BASE("__table_base");
Expand Down
11 changes: 2 additions & 9 deletions test/lld/basic_safe_stack.wat.out
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(module
(type $none_=>_none (func))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_=>_none (func (param i32)))
(type $i32_i32_=>_none (func (param i32 i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(import "env" "__handle_stack_overflow" (func $__handle_stack_overflow))
(memory $0 2)
(table $0 1 1 funcref)
Expand All @@ -17,7 +17,6 @@
(export "main" (func $main))
(export "__data_end" (global $global$1))
(export "__set_stack_limits" (func $__set_stack_limits))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $__wasm_call_ctors
(nop)
)
Expand Down Expand Up @@ -87,11 +86,6 @@
(local.get $1)
)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -111,8 +105,7 @@
"stackRestore",
"stackAlloc",
"main",
"__set_stack_limits",
"__growWasmMemory"
"__set_stack_limits"
],
"namedGlobals": {
"__data_end" : "568"
Expand Down
10 changes: 1 addition & 9 deletions test/lld/bigint.wat.out
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
(module
(type $i64_=>_i64 (func (param i64) (result i64)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i64_=>_i64 (func (param i32 i64) (result i64)))
(table $0 1 1 funcref)
(elem (i32.const 1) $foo)
(global $global$0 (mut i32) (i32.const 66208))
(global $global$1 i32 (i32.const 658))
(export "__data_end" (global $global$1))
(export "dynCall_jj" (func $dynCall_jj))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $foo (param $0 i64) (result i64)
(unreachable)
)
Expand All @@ -18,11 +16,6 @@
(local.get $fptr)
)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -34,8 +27,7 @@
"externs": [
],
"exports": [
"dynCall_jj",
"__growWasmMemory"
"dynCall_jj"
],
"namedGlobals": {
"__data_end" : "658"
Expand Down
11 changes: 2 additions & 9 deletions test/lld/duplicate_imports.wat.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(module
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $none_=>_none (func))
(type $none_=>_i32 (func (result i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $i64_=>_i32 (func (param i64) (result i32)))
(type $i32_f32_f64_=>_f32 (func (param i32 f32 f64) (result f32)))
Expand All @@ -21,7 +21,6 @@
(export "main" (func $main))
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $main (result i32)
(drop
(call $puts1
Expand All @@ -46,11 +45,6 @@
)
)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -67,8 +61,7 @@
],
"exports": [
"__wasm_call_ctors",
"main",
"__growWasmMemory"
"main"
],
"namedGlobals": {
"__heap_base" : "66128",
Expand Down
10 changes: 1 addition & 9 deletions test/lld/em_asm.wat.mem.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(module
(type $none_=>_none (func))
(type $none_=>_i32 (func (result i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
Expand All @@ -13,7 +12,6 @@
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__data_end" (global $global$1))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $__wasm_call_ctors
(nop)
)
Expand Down Expand Up @@ -67,11 +65,6 @@
(func $main (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -93,8 +86,7 @@
],
"exports": [
"__wasm_call_ctors",
"main",
"__growWasmMemory"
"main"
],
"namedGlobals": {
"__data_end" : "658"
Expand Down
10 changes: 1 addition & 9 deletions test/lld/em_asm.wat.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(module
(type $none_=>_none (func))
(type $none_=>_i32 (func (result i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
Expand All @@ -14,7 +13,6 @@
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__data_end" (global $global$1))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $__wasm_call_ctors
(nop)
)
Expand Down Expand Up @@ -68,11 +66,6 @@
(func $main (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -94,8 +87,7 @@
],
"exports": [
"__wasm_call_ctors",
"main",
"__growWasmMemory"
"main"
],
"namedGlobals": {
"__data_end" : "658"
Expand Down
10 changes: 1 addition & 9 deletions test/lld/em_asm_O0.wat.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(module
(type $none_=>_none (func))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
(import "env" "emscripten_asm_const_int" (func $emscripten_asm_const_int (param i32 i32 i32) (result i32)))
Expand All @@ -13,7 +12,6 @@
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "main" (func $main))
(export "__data_end" (global $global$1))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $__wasm_call_ctors
(nop)
)
Expand Down Expand Up @@ -93,11 +91,6 @@
)
(local.get $3)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -119,8 +112,7 @@
],
"exports": [
"__wasm_call_ctors",
"main",
"__growWasmMemory"
"main"
],
"namedGlobals": {
"__data_end" : "652"
Expand Down
11 changes: 2 additions & 9 deletions test/lld/em_asm_main_thread.wat.out
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(module
(type $none_=>_i32 (func (result i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $none_=>_none (func))
(type $i32_i32_=>_none (func (param i32 i32)))
(type $i32_i32_i32_=>_none (func (param i32 i32 i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
(import "env" "emscripten_asm_const_int_sync_on_main_thread" (func $emscripten_asm_const_int_sync_on_main_thread (param i32 i32 i32) (result i32)))
Expand All @@ -18,7 +18,6 @@
(export "__heap_base" (global $global$1))
(export "__data_end" (global $global$2))
(export "main" (func $main))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $__wasm_call_ctors
(nop)
)
Expand Down Expand Up @@ -190,11 +189,6 @@
(func $main (param $0 i32) (param $1 i32) (result i32)
(call $__original_main)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -216,8 +210,7 @@
],
"exports": [
"__wasm_call_ctors",
"main",
"__growWasmMemory"
"main"
],
"namedGlobals": {
"__heap_base" : "66192",
Expand Down
10 changes: 1 addition & 9 deletions test/lld/em_asm_table.wat.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(type $i32_i32_=>_none (func (param i32 i32)))
(type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32)))
(type $i32_i32_i32_=>_none (func (param i32 i32 i32)))
(type $i32_=>_i32 (func (param i32) (result i32)))
(type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32)))
(import "env" "memory" (memory $2 8192))
(import "env" "emscripten_log" (func $fimport$0 (param i32 i32)))
Expand All @@ -14,7 +13,6 @@
(export "__data_end" (global $global$1))
(export "dynCall_vii" (func $dynCall_vii))
(export "dynCall_iiii" (func $dynCall_iiii))
(export "__growWasmMemory" (func $__growWasmMemory))
(func $dynCall_vii (param $fptr i32) (param $0 i32) (param $1 i32)
(call_indirect (type $i32_i32_=>_none)
(local.get $0)
Expand All @@ -30,11 +28,6 @@
(local.get $fptr)
)
)
(func $__growWasmMemory (param $newSize i32) (result i32)
(memory.grow
(local.get $newSize)
)
)
)
(;
--BEGIN METADATA --
Expand All @@ -49,8 +42,7 @@
],
"exports": [
"dynCall_vii",
"dynCall_iiii",
"__growWasmMemory"
"dynCall_iiii"
],
"namedGlobals": {
"__data_end" : "1048"
Expand Down
Loading