diff options
-rw-r--r-- | src/ir/module-utils.h | 2 | ||||
-rw-r--r-- | test/passes/func-metrics.txt | 20 | ||||
-rw-r--r-- | test/passes/func-metrics.wast | 9 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index b488db765..66d3a1015 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -92,6 +92,8 @@ inline Global* copyGlobal(Global* global, Module& out) { ret->name = global->name; ret->type = global->type; ret->mutable_ = global->mutable_; + ret->module = global->module; + ret->base = global->base; if (global->imported()) { ret->init = nullptr; } else { diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index 2d3b8a12b..2d70c07c9 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -199,3 +199,23 @@ start: func_a (call $waka) ) ) +global + [funcs] : 1 + [imports] : 1 + [total] : 1 + global.get : 1 +func: 0 + [binary-bytes] : 4 + [total] : 1 + global.get : 1 +export: stackSave (0) + [removable-bytes-without-it]: 74 +(module + (type $0 (func (result i32))) + (import "env" "STACKTOP" (global $gimport$0 i32)) + (global $global$0 (mut i32) (global.get $gimport$0)) + (export "stackSave" (func $0)) + (func $0 (; 0 ;) (type $0) (result i32) + (global.get $global$0) + ) +) diff --git a/test/passes/func-metrics.wast b/test/passes/func-metrics.wast index 5b16848ea..e95d819d9 100644 --- a/test/passes/func-metrics.wast +++ b/test/passes/func-metrics.wast @@ -122,4 +122,13 @@ (call $waka) ) ) +(module ;; various globals + (type $0 (func (result i32))) + (import "env" "STACKTOP" (global $gimport$0 i32)) + (global $global$0 (mut i32) (global.get $gimport$0)) + (export "stackSave" (func $0)) + (func $0 (; 0 ;) (type $0) (result i32) + (global.get $global$0) + ) +) |