-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler, runtime: enable go:wasmexport for wasip2 (#4499)
* compiler: prefer go:wasmexport over go:export * runtime, targets/wasip2: enable -buildmode=c-shared for wasip2 * runtime: rename import from wasi_run to wasiclirun (PR feedback)
- Loading branch information
Showing
4 changed files
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,19 @@ import ( | |
"unsafe" | ||
|
||
"internal/wasi/cli/v0.2.0/environment" | ||
wasiclirun "internal/wasi/cli/v0.2.0/run" | ||
monotonicclock "internal/wasi/clocks/v0.2.0/monotonic-clock" | ||
|
||
"internal/cm" | ||
) | ||
|
||
type timeUnit int64 | ||
|
||
//export wasi:cli/[email protected]#run | ||
func __wasi_cli_run_run() uint32 { | ||
// These need to be initialized early so that the heap can be initialized. | ||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol)) | ||
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize) | ||
run() | ||
return 0 | ||
func init() { | ||
wasiclirun.Exports.Run = func() cm.BoolResult { | ||
callMain() | ||
return false | ||
} | ||
} | ||
|
||
var args []string | ||
|
@@ -51,3 +52,6 @@ func sleepTicks(d timeUnit) { | |
func ticks() timeUnit { | ||
return timeUnit(monotonicclock.Now()) | ||
} | ||
|
||
func beforeExit() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build tinygo.wasm && !wasip2 && !js | ||
//go:build tinygo.wasm && !js | ||
|
||
package runtime | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters