File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 67
67
- uses : actions/checkout@v1
68
68
69
69
- name : Mount bazel cache
70
- uses : actions/cache@v1
70
+ uses : actions/cache@v4
71
71
with :
72
72
path : " /home/runner/.cache/bazel"
73
73
key : bazel
Original file line number Diff line number Diff line change @@ -26,17 +26,23 @@ PKG_CONFIG_PATH = ${EMSDK}/upstream/emscripten/cache/sysroot/lib/pkgconfig
26
26
WASM_LIBS = $(shell $(PKG_CONFIG ) $(WASM_DEPS ) $(PROTO_DEPS ) \
27
27
--with-path=$(PKG_CONFIG_PATH ) --libs | sed -e 's/-pthread //g')
28
28
29
+ # See proxy_wasm_cc_binary build rule definition in bazel/defs.bzl for
30
+ # explanation of emscripten link options.
31
+ EMSCRIPTEN_LINK_OPTS := --no-entry \
32
+ --js-library ${PROXY_WASM_CPP_SDK}/proxy_wasm_intrinsics.js \
33
+ -sSTANDALONE_WASM -sEXPORTED_FUNCTIONS=_malloc \
34
+ -sALLOW_MEMORY_GROWTH=1 -sINITIAL_HEAP=64KB
35
+
36
+
29
37
debug-deps :
30
38
# WASM_DEPS : ${WASM_DEPS}
31
39
# WASM_LIBS : ${WASM_LIBS}
32
40
# PROTO_DEPS: ${PROTO_DEPS}
33
41
# PROTO_OPTS: ${PROTO_OPTS}
34
42
35
- # TODO(mpwarres): Add Emscripten stack/heap size params in PR#174.
36
43
% .wasm % .wat : % .cc
37
- em++ --no-entry -sSTANDALONE_WASM -sEXPORTED_FUNCTIONS=_malloc \
38
- --std=c++17 -O3 -flto \
39
- --js-library ${PROXY_WASM_CPP_SDK} /proxy_wasm_intrinsics.js \
44
+ em++ --std=c++17 -O3 -flto \
45
+ ${EMSCRIPTEN_LINK_OPTS} \
40
46
-I${PROXY_WASM_CPP_SDK} \
41
47
${CPP_CONTEXT_LIB} \
42
48
${PROTO_OPTS} \
Original file line number Diff line number Diff line change @@ -90,10 +90,20 @@ def proxy_wasm_cc_binary(
90
90
"@proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_js" ,
91
91
],
92
92
linkopts = linkopts + [
93
+ # Setting to indicate module is a "reactor library" without a main() entry point:
94
+ # https://emscripten.org/docs/tools_reference/settings_reference.html#standalone-wasm
93
95
"--no-entry" ,
96
+ # File listing additional functions that Emscripten should expect to be implemented by the host:
97
+ # https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#implement-c-in-javascript
94
98
"--js-library=$(location @proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_js)" ,
99
+ # Emit Wasm module that can run without JavaScript
95
100
"-sSTANDALONE_WASM" ,
101
+ # Give host code access to Emscripten's _malloc() function
96
102
"-sEXPORTED_FUNCTIONS=_malloc" ,
103
+ # Allow allocating memory past initial heap size
104
+ "-sALLOW_MEMORY_GROWTH=1" ,
105
+ # Initial amount of heap memory. 64KB matches Rust SDK starting heap size.
106
+ "-sINITIAL_HEAP=64KB" ,
97
107
],
98
108
tags = tags + [
99
109
"manual" ,
You can’t perform that action at this time.
0 commit comments