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
5 changes: 3 additions & 2 deletions src/parser/context-decls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ ParseDeclsCtx::addGlobalDecl(Index pos, Name name, ImportNames* importNames) {
}
g->setExplicitName(name);
} else {
name = (importNames ? "gimport$" : "") + std::to_string(globalCounter++);
name =
(importNames ? "gimport$" : "global$") + std::to_string(globalCounter++);
name = Names::getValidGlobalName(wasm, name);
g->name = name;
}
Expand Down Expand Up @@ -276,7 +277,7 @@ ParseDeclsCtx::addTagDecl(Index pos, Name name, ImportNames* importNames) {
}
t->setExplicitName(name);
} else {
name = (importNames ? "timport$" : "") + std::to_string(tagCounter++);
name = (importNames ? "eimport$" : "tag$") + std::to_string(tagCounter++);
name = Names::getValidTagName(wasm, name);
t->name = name;
}
Expand Down
4 changes: 2 additions & 2 deletions test/lit/basic/tags.wast
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

;; CHECK-TEXT: (import "env" "im0" (tag $e-import (param i32)))

;; CHECK-TEXT: (import "env" "im1" (tag $timport$0 (param i32 f32)))
;; CHECK-TEXT: (import "env" "im1" (tag $eimport$0 (param i32 f32)))

;; CHECK-TEXT: (tag $1 (param i32))
;; CHECK-TEXT: (tag $tag$1 (param i32))

;; CHECK-TEXT: (tag $e (param i32 f32))
;; CHECK-BIN: (type $0 (func (param i32 f32)))
Expand Down
2 changes: 1 addition & 1 deletion test/lit/validation/extended-const.wast
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;; NO-EXTENDED: unexpected false: table segment offset must be constant

;; EXTENDED: (import "env" "global" (global $gimport$0 i32))
;; EXTENDED: (global $1 i32 (i32.add
;; EXTENDED: (global $global$1 i32 (i32.add
;; EXTENDED: (global.get $gimport$0)
;; EXTENDED: (i32.const 42)
;; EXTENDED: ))
Expand Down
14 changes: 7 additions & 7 deletions test/lit/wat-kitchen-sink.wast
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@

;; CHECK: (import "mod" "t0" (tag $imported (param i32 i64)))

;; CHECK: (import "mod" "t1" (tag $timport$0))
;; CHECK: (import "mod" "t1" (tag $eimport$0))

;; CHECK: (import "mod" "imported-tag" (tag $timport$1))
;; CHECK: (import "mod" "imported-tag" (tag $eimport$1))

;; CHECK: (global $2 (mut i32) (i32.const 0))
;; CHECK: (global $global$2 (mut i32) (i32.const 0))

;; CHECK: (global $i32 i32 (i32.const 42))
(global $i32 i32 i32.const 42)
Expand Down Expand Up @@ -413,7 +413,7 @@
;; tags
(tag)

;; CHECK: (tag $2)
;; CHECK: (tag $tag$2)

;; CHECK: (tag $empty)
(tag $empty)
Expand Down Expand Up @@ -1919,7 +1919,7 @@
;; CHECK-NEXT: (catch $empty
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch $timport$0
;; CHECK-NEXT: (catch $eimport$0
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch_all
Expand Down Expand Up @@ -2228,7 +2228,7 @@
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch $timport$0
;; CHECK-NEXT: (catch $eimport$0
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
Expand Down Expand Up @@ -3710,7 +3710,7 @@
)

;; CHECK: (func $throw (type $0)
;; CHECK-NEXT: (throw $timport$1)
;; CHECK-NEXT: (throw $eimport$1)
;; CHECK-NEXT: (throw $tag-i32
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
Expand Down
4 changes: 2 additions & 2 deletions test/lld/em_asm_main_thread.wat
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
(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)))
(memory $0 2)
(data (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
(global (export "__start_em_asm") i32 (i32.const 568))
(global (export "__stop_em_asm") i32 (i32.const 652))
(table $0 1 1 funcref)
(global $global$0 (mut i32) (i32.const 66192))
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
(global $global$3 (export "__start_em_asm") i32 (i32.const 568))
(global $global$4 (export "__stop_em_asm") i32 (i32.const 652))
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
Expand Down
8 changes: 4 additions & 4 deletions test/lld/em_asm_main_thread.wat.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
(type $5 (func (param i32) (result i32)))
(type $6 (func (param 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)))
(global $0 i32 (i32.const 568))
(global $1 i32 (i32.const 652))
(global $global$0 (mut i32) (i32.const 66192))
(global $global$1 i32 (i32.const 66192))
(global $global$2 i32 (i32.const 652))
(global $global$3 i32 (i32.const 568))
(global $global$4 i32 (i32.const 652))
(memory $0 2)
(data $0 (i32.const 568) "{ Module.print(\"Hello world\"); }\00{ return $0 + $1; }\00{ Module.print(\"Got \" + $0); }\00")
(table $0 1 1 funcref)
(export "__start_em_asm" (global $0))
(export "__stop_em_asm" (global $1))
(export "__start_em_asm" (global $global$3))
(export "__stop_em_asm" (global $global$4))
(export "memory" (memory $0))
(export "__wasm_call_ctors" (func $__wasm_call_ctors))
(export "__heap_base" (global $global$1))
Expand Down