Skip to content

Commit 6441947

Browse files
authored
Revert "feat: support WasmEdge (#93)"
This reverts commit 140961d.
1 parent 140961d commit 6441947

File tree

12 files changed

+6
-844
lines changed

12 files changed

+6
-844
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ on:
88

99
jobs:
1010
test:
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
vm:
15-
- wasmedge
16-
- wasmtime
1711
runs-on: "ubuntu-20.04"
1812
env:
1913
OPENRESTY_PREFIX: "/usr/local/openresty"
@@ -58,18 +52,16 @@ jobs:
5852
5953
- name: Install
6054
run: |
61-
./install-wasmedge.sh
62-
6355
wget https://raw.githubusercontent.com/api7/apisix-build-tools/master/build-apisix-base.sh
6456
chmod +x build-apisix-base.sh
6557
OR_PREFIX=$OPENRESTY_PREFIX CC="clang -fsanitize=address -fcolor-diagnostics -Qunused-arguments" \
6658
cc_opt="-Werror -fsanitize=undefined" \
67-
ld_opt="-lubsan -Wl,-rpath,$OPENRESTY_PREFIX/wasmedge/lib" \
59+
ld_opt="-lubsan" \
6860
./build-apisix-base.sh latest
6961
7062
- name: Script
7163
run: |
7264
sudo chown -R runner:root ~/.cache
7365
make build.all.testdata
7466
export PATH=$OPENRESTY_PREFIX/nginx/sbin:$PATH
75-
WASM_VM=${{ matrix.vm }} prove -I. -Itest-nginx/lib -r t/
67+
WASM_VM=wasmtime prove -I. -Itest-nginx/lib -r t/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
wasmtime-*-c-api
44
wasmtime-*-c-api.tar.xz
55
wasmtime-c-api
6-
wasmedge/
76
*.wasm
87
*.wasm.map
98
*.wat

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ RUST_DIR = $(wildcard t/testdata/rust/*)
2020
install:
2121
$(INSTALL) -m 664 lib/resty/*.lua $(OPENRESTY_PREFIX)/lualib/resty/
2222
cp -r ./wasmtime-c-api $(OPENRESTY_PREFIX)/
23-
cp -r ./wasmedge $(OPENRESTY_PREFIX)/
2423

2524
.PHONY: build.go.testdata
2625
build.go.testdata:

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,18 @@ export wasmtime_prefix=/path/to/wasm-nginx-module/wasmtime-c-api
3434
--with-ld-opt="-Wl,-rpath,${wasmtime_prefix}/lib" \
3535
```
3636

37-
* Download WasmEdge with the `./install-wasmedge.sh`.
38-
Remember to add the `$HOME/.wasmedge/lib` to the library search path when you build Nginx, for instance,
39-
40-
```
41-
./configure ... \
42-
--with-ld-opt="-Wl,-rpath,${HOME}/.wasmedge/lib" \
43-
```
44-
4537
## Directives
4638

4739
### wasm_vm
4840

49-
**syntax:** *wasm_vm wasmtime|wasmedge*
41+
**syntax:** *wasm_vm wasmtime*
5042

5143
**default:** -
5244

5345
**context:** *http*
5446

55-
Select the WASM VM. Currently, only wasmtime and WasmEdge are supported.
56-
If the directive is not set, the WASM VM won't be enabled.
47+
Select the Wasm VM. Currently, only wasmtime is supported.
48+
If the directive is not set, the Wasm VM won't be enabled.
5749

5850
## Methods
5951

config

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,6 @@ ngx_module_libs=" \
3636
-L$ngx_addon_dir/wasmtime-c-api/lib -lwasmtime \
3737
"
3838

39-
if [ -d $ngx_addon_dir/wasmedge ]; then
40-
# if wasmedge is installed
41-
wasmedge_path=$ngx_addon_dir/wasmedge
42-
ngx_module_srcs=" \
43-
$ngx_module_srcs \
44-
$ngx_addon_dir/src/vm/wasmedge.c \
45-
"
46-
ngx_module_incs=" \
47-
$ngx_module_incs \
48-
$wasmedge_path/include \
49-
"
50-
ngx_module_libs=" \
51-
$ngx_module_libs \
52-
-L$wasmedge_path/lib -lwasmedge_c \
53-
"
54-
55-
echo "Build with WasmEdge enabled"
56-
have=NGX_WASM_HAVE_WASMEDGE . auto/have
57-
fi
58-
5939
. auto/module
6040

6141
ngx_addon_name=$ngx_module_name

gen_wasm_host_api.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,6 @@ def predefined_macro(vm):
103103
wasm_valkind_t param_type[MAX_WASM_API_ARG];
104104
} ngx_wasm_wasmtime_host_api_t;
105105
106-
"""
107-
elif vm == "wasmedge":
108-
vm_def = """
109-
#define DEFINE_WASM_API(NAME, ARG_CHECK) \\
110-
static WasmEdge_Result wasmedge_##NAME( \\
111-
void *Data, \\
112-
WasmEdge_MemoryInstanceContext *MemCxt, \\
113-
const WasmEdge_Value *In, \\
114-
WasmEdge_Value *Out \\
115-
) { \\
116-
ARG_CHECK \\
117-
Out[0] = WasmEdge_ValueGenI32(res); \\
118-
return WasmEdge_Result_Success; \\
119-
}
120-
#define DEFINE_WASM_NAME(NAME, ARG) \\
121-
{ngx_string(#NAME), wasmedge_##NAME, ARG},
122-
123-
124-
typedef struct {
125-
ngx_str_t name;
126-
WasmEdge_HostFunc_t cb;
127-
int8_t param_num;
128-
enum WasmEdge_ValType param_type[MAX_WASM_API_ARG];
129-
} ngx_wasm_wasmedge_host_api_t;
130-
131106
"""
132107

133108
for i in range(max_wasm_api_arg + 1):
@@ -143,8 +118,6 @@ def predefined_macro(vm):
143118
param_s = ""
144119
if vm == "wasmtime":
145120
kind = "WASM_I32"
146-
else:
147-
kind = "WasmEdge_ValType_I32"
148121
for j in range(1, i + 1):
149122
if j % 5 == 1:
150123
param_s += " "
@@ -160,8 +133,6 @@ def predefined_macro(vm):
160133
for j in range(i):
161134
if vm == "wasmtime":
162135
vm_def += " int32_t p%d = args[%d].of.i32; \\\n" % (j, j)
163-
elif vm == "wasmedge":
164-
vm_def += " int32_t p%d = WasmEdge_ValueGetI32(In[%d]); \\\n" % (j, j)
165136
param_s = ", ".join('p' + str(j) for j in range(i))
166137
vm_def += " int32_t res = NAME(%s);\n" % (param_s)
167138
return vm_def
@@ -251,15 +222,3 @@ def get_host_apis(src_dir):
251222
wasm_api_def=wasmtime_def,
252223
max_wasm_api_arg=max_wasm_api_arg,
253224
))
254-
255-
wasmedge_def = predefined_macro("wasmedge")
256-
wasmedge_def += api_def + "\n\nstatic ngx_wasm_wasmedge_host_api_t host_apis[] = {\n"
257-
wasmedge_def += name_def
258-
with open(os.path.join(src_dir, "ngx_http_wasm_api_wasmedge.h"), 'w') as f:
259-
f.write(s.substitute(
260-
header=header,
261-
vm_header="#include <wasmedge/wasmedge.h>",
262-
vm_api_header_name="NGX_HTTP_WASM_API_WASMEDGE_H",
263-
wasm_api_def=wasmedge_def,
264-
max_wasm_api_arg=max_wasm_api_arg,
265-
))

install-wasmedge.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)