Make heap and linear memory contiguous to refine compilation time and footprint (#233)

Use FastISel for JIT mode
Use united aot version in aot file and aot runtime
Disable check signature failed warning for wamrc
Fix fast interpreter x86_32 float issue
Remove unused empty lvgl folder
This commit is contained in:
wenyongh
2020-04-13 10:49:40 +08:00
committed by GitHub
parent ffd975d2d6
commit b40e79c160
27 changed files with 983 additions and 755 deletions

View File

@ -46,26 +46,54 @@ typedef struct iovec_app {
} iovec_app_t;
typedef struct WASIContext {
void *curfds;
void *prestats;
void *argv_environ;
int32 curfds_offset;
int32 prestats_offset;
int32 argv_environ_offset;
} *wasi_ctx_t;
wasi_ctx_t
wasm_runtime_get_wasi_ctx(wasm_module_inst_t module_inst);
static struct fd_table *
wasi_ctx_get_curfds(wasm_module_inst_t module_inst,
wasi_ctx_t wasi_ctx)
{
return (struct fd_table *)
wasm_runtime_addr_app_to_native(module_inst,
wasi_ctx->curfds_offset);
}
static struct argv_environ_values *
wasi_ctx_get_argv_environ(wasm_module_inst_t module_inst,
wasi_ctx_t wasi_ctx)
{
return (struct argv_environ_values *)
wasm_runtime_addr_app_to_native(module_inst,
wasi_ctx->argv_environ_offset);
}
static struct fd_prestats *
wasi_ctx_get_prestats(wasm_module_inst_t module_inst,
wasi_ctx_t wasi_ctx)
{
return (struct fd_prestats *)
wasm_runtime_addr_app_to_native(module_inst,
wasi_ctx->prestats_offset);
}
static wasi_errno_t
wasi_args_get(wasm_exec_env_t exec_env, int32 *argv_offsets, char *argv_buf)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct argv_environ_values *argv_environ =
wasi_ctx_get_argv_environ(module_inst, wasi_ctx);
size_t argc, argv_buf_size, i;
char **argv;
uint64 total_size;
wasi_errno_t err;
err = wasmtime_ssp_args_sizes_get(wasi_ctx->argv_environ,
&argc, &argv_buf_size);
err = wasmtime_ssp_args_sizes_get(argv_environ, &argc, &argv_buf_size);
if (err)
return err;
@ -81,7 +109,7 @@ wasi_args_get(wasm_exec_env_t exec_env, int32 *argv_offsets, char *argv_buf)
|| !(argv = wasm_runtime_malloc((uint32)total_size)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_args_get(wasi_ctx->argv_environ, argv, argv_buf);
err = wasmtime_ssp_args_get(argv_environ, argv, argv_buf);
if (err) {
wasm_runtime_free(argv);
return err;
@ -101,6 +129,7 @@ wasi_args_sizes_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct argv_environ_values *argv_environ;
size_t argc, argv_buf_size;
wasi_errno_t err;
@ -108,7 +137,11 @@ wasi_args_sizes_get(wasm_exec_env_t exec_env,
|| !validate_native_addr(argv_buf_size_app, sizeof(uint32)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_args_sizes_get(wasi_ctx->argv_environ,
argv_environ = (struct argv_environ_values *)
wasm_runtime_addr_app_to_native(module_inst,
wasi_ctx->argv_environ_offset);
err = wasmtime_ssp_args_sizes_get(argv_environ,
&argc, &argv_buf_size);
if (err)
return err;
@ -151,12 +184,14 @@ wasi_environ_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct argv_environ_values *argv_environ =
wasi_ctx_get_argv_environ(module_inst, wasi_ctx);
size_t environ_count, environ_buf_size, i;
uint64 total_size;
char **environs;
wasi_errno_t err;
err = wasmtime_ssp_environ_sizes_get(wasi_ctx->argv_environ,
err = wasmtime_ssp_environ_sizes_get(argv_environ,
&environ_count, &environ_buf_size);
if (err)
return err;
@ -174,7 +209,7 @@ wasi_environ_get(wasm_exec_env_t exec_env,
|| !(environs = wasm_runtime_malloc((uint32)total_size)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_environ_get(wasi_ctx->argv_environ, environs, environ_buf);
err = wasmtime_ssp_environ_get(argv_environ, environs, environ_buf);
if (err) {
wasm_runtime_free(environs);
return err;
@ -194,6 +229,8 @@ wasi_environ_sizes_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct argv_environ_values *argv_environ =
wasi_ctx_get_argv_environ(module_inst, wasi_ctx);
size_t environ_count, environ_buf_size;
wasi_errno_t err;
@ -201,7 +238,7 @@ wasi_environ_sizes_get(wasm_exec_env_t exec_env,
|| !validate_native_addr(environ_buf_size_app, sizeof(uint32)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_environ_sizes_get(wasi_ctx->argv_environ,
err = wasmtime_ssp_environ_sizes_get(argv_environ,
&environ_count, &environ_buf_size);
if (err)
return err;
@ -218,13 +255,14 @@ wasi_fd_prestat_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
wasi_prestat_t prestat;
wasi_errno_t err;
if (!validate_native_addr(prestat_app, sizeof(wasi_prestat_app_t)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_fd_prestat_get(wasi_ctx->prestats, fd, &prestat);
err = wasmtime_ssp_fd_prestat_get(prestats, fd, &prestat);
if (err)
return err;
@ -239,8 +277,9 @@ wasi_fd_prestat_dir_name(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
return wasmtime_ssp_fd_prestat_dir_name(wasi_ctx->prestats,
return wasmtime_ssp_fd_prestat_dir_name(prestats,
fd, path, path_len);
}
@ -249,8 +288,10 @@ wasi_fd_close(wasm_exec_env_t exec_env, wasi_fd_t fd)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
return wasmtime_ssp_fd_close(wasi_ctx->curfds, wasi_ctx->prestats, fd);
return wasmtime_ssp_fd_close(curfds, prestats, fd);
}
static wasi_errno_t
@ -258,8 +299,9 @@ wasi_fd_datasync(wasm_exec_env_t exec_env, wasi_fd_t fd)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_datasync(wasi_ctx->curfds, fd);
return wasmtime_ssp_fd_datasync(curfds, fd);
}
static wasi_errno_t
@ -269,6 +311,7 @@ wasi_fd_pread(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_iovec_t *iovec, *iovec_begin;
uint64 total_size;
size_t nread;
@ -298,7 +341,7 @@ wasi_fd_pread(wasm_exec_env_t exec_env,
iovec->buf_len = iovec_app->buf_len;
}
err = wasmtime_ssp_fd_pread(wasi_ctx->curfds, fd, iovec_begin,
err = wasmtime_ssp_fd_pread(curfds, fd, iovec_begin,
iovs_len, offset, &nread);
if (err)
goto fail;
@ -320,6 +363,7 @@ wasi_fd_pwrite(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_ciovec_t *ciovec, *ciovec_begin;
uint64 total_size;
size_t nwritten;
@ -349,7 +393,7 @@ wasi_fd_pwrite(wasm_exec_env_t exec_env,
ciovec->buf_len = iovec_app->buf_len;
}
err = wasmtime_ssp_fd_pwrite(wasi_ctx->curfds, fd, ciovec_begin,
err = wasmtime_ssp_fd_pwrite(curfds, fd, ciovec_begin,
iovs_len, offset, &nwritten);
if (err)
goto fail;
@ -371,6 +415,7 @@ wasi_fd_read(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_iovec_t *iovec, *iovec_begin;
uint64 total_size;
size_t nread;
@ -400,7 +445,7 @@ wasi_fd_read(wasm_exec_env_t exec_env,
iovec->buf_len = iovec_app->buf_len;
}
err = wasmtime_ssp_fd_read(wasi_ctx->curfds, fd,
err = wasmtime_ssp_fd_read(curfds, fd,
iovec_begin, iovs_len, &nread);
if (err)
goto fail;
@ -420,9 +465,10 @@ wasi_fd_renumber(wasm_exec_env_t exec_env, wasi_fd_t from, wasi_fd_t to)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
return wasmtime_ssp_fd_renumber(wasi_ctx->curfds,
wasi_ctx->prestats, from, to);
return wasmtime_ssp_fd_renumber(curfds, prestats, from, to);
}
static wasi_errno_t
@ -432,12 +478,12 @@ wasi_fd_seek(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t)))
return (wasi_errno_t)-1;
return wasmtime_ssp_fd_seek(wasi_ctx->curfds, fd,
offset, whence, newoffset);
return wasmtime_ssp_fd_seek(curfds, fd, offset, whence, newoffset);
}
static wasi_errno_t
@ -446,11 +492,12 @@ wasi_fd_tell(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
if (!validate_native_addr(newoffset, sizeof(wasi_filesize_t)))
return (wasi_errno_t)-1;
return wasmtime_ssp_fd_tell(wasi_ctx->curfds, fd, newoffset);
return wasmtime_ssp_fd_tell(curfds, fd, newoffset);
}
static wasi_errno_t
@ -459,13 +506,14 @@ wasi_fd_fdstat_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_fdstat_t fdstat;
wasi_errno_t err;
if (!validate_native_addr(fdstat_app, sizeof(wasi_fdstat_t)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_fd_fdstat_get(wasi_ctx->curfds, fd, &fdstat);
err = wasmtime_ssp_fd_fdstat_get(curfds, fd, &fdstat);
if (err)
return err;
@ -479,8 +527,9 @@ wasi_fd_fdstat_set_flags(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_fdstat_set_flags(wasi_ctx->curfds, fd, flags);
return wasmtime_ssp_fd_fdstat_set_flags(curfds, fd, flags);
}
static wasi_errno_t
@ -491,8 +540,9 @@ wasi_fd_fdstat_set_rights(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_fdstat_set_rights(wasi_ctx->curfds, fd,
return wasmtime_ssp_fd_fdstat_set_rights(curfds, fd,
fs_rights_base, fs_rights_inheriting);
}
@ -501,8 +551,9 @@ wasi_fd_sync(wasm_exec_env_t exec_env, wasi_fd_t fd)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_sync(wasi_ctx->curfds, fd);
return wasmtime_ssp_fd_sync(curfds, fd);
}
static wasi_errno_t
@ -512,6 +563,7 @@ wasi_fd_write(wasm_exec_env_t exec_env, wasi_fd_t fd,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_ciovec_t *ciovec, *ciovec_begin;
uint64 total_size;
size_t nwritten;
@ -541,7 +593,7 @@ wasi_fd_write(wasm_exec_env_t exec_env, wasi_fd_t fd,
ciovec->buf_len = iovec_app->buf_len;
}
err = wasmtime_ssp_fd_write(wasi_ctx->curfds, fd,
err = wasmtime_ssp_fd_write(curfds, fd,
ciovec_begin, iovs_len, &nwritten);
if (err)
goto fail;
@ -565,8 +617,9 @@ wasi_fd_advise(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_advise(wasi_ctx->curfds, fd, offset, len, advice);
return wasmtime_ssp_fd_advise(curfds, fd, offset, len, advice);
}
static wasi_errno_t
@ -577,8 +630,9 @@ wasi_fd_allocate(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_allocate(wasi_ctx->curfds, fd, offset, len);
return wasmtime_ssp_fd_allocate(curfds, fd, offset, len);
}
static wasi_errno_t
@ -587,8 +641,9 @@ wasi_path_create_directory(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_path_create_directory(wasi_ctx->curfds, fd,
return wasmtime_ssp_path_create_directory(curfds, fd,
path, path_len);
}
@ -602,8 +657,10 @@ wasi_path_link(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
return wasmtime_ssp_path_link(wasi_ctx->curfds, wasi_ctx->prestats,
return wasmtime_ssp_path_link(curfds, prestats,
old_fd, old_flags, old_path, old_path_len,
new_fd, new_path, new_path_len);
}
@ -621,20 +678,21 @@ wasi_path_open(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_fd_t fd = -1; /* set fd_app -1 if path open failed */
wasi_errno_t err;
if (!validate_native_addr(fd_app, sizeof(wasi_fd_t)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_path_open(wasi_ctx->curfds,
dirfd, dirflags,
path, path_len,
oflags,
fs_rights_base,
fs_rights_inheriting,
fs_flags,
&fd);
err = wasmtime_ssp_path_open(curfds,
dirfd, dirflags,
path, path_len,
oflags,
fs_rights_base,
fs_rights_inheriting,
fs_flags,
&fd);
*fd_app = fd;
return err;
@ -649,13 +707,14 @@ wasi_fd_readdir(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
size_t bufused;
wasi_errno_t err;
if (!validate_native_addr(bufused_app, sizeof(uint32)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_fd_readdir(wasi_ctx->curfds, fd,
err = wasmtime_ssp_fd_readdir(curfds, fd,
buf, buf_len, cookie, &bufused);
if (err)
return err;
@ -673,13 +732,14 @@ wasi_path_readlink(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
size_t bufused;
wasi_errno_t err;
if (!validate_native_addr(bufused_app, sizeof(uint32)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_path_readlink(wasi_ctx->curfds, fd,
err = wasmtime_ssp_path_readlink(curfds, fd,
path, path_len,
buf, buf_len, &bufused);
if (err)
@ -696,8 +756,9 @@ wasi_path_rename(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_path_rename(wasi_ctx->curfds,
return wasmtime_ssp_path_rename(curfds,
old_fd, old_path, old_path_len,
new_fd, new_path, new_path_len);
}
@ -708,11 +769,12 @@ wasi_fd_filestat_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
if (!validate_native_addr(filestat, sizeof(wasi_filestat_t)))
return (wasi_errno_t)-1;
return wasmtime_ssp_fd_filestat_get(wasi_ctx->curfds, fd, filestat);
return wasmtime_ssp_fd_filestat_get(curfds, fd, filestat);
}
static wasi_errno_t
@ -724,8 +786,9 @@ wasi_fd_filestat_set_times(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_filestat_set_times(wasi_ctx->curfds, fd,
return wasmtime_ssp_fd_filestat_set_times(curfds, fd,
st_atim, st_mtim, fstflags);
}
@ -736,8 +799,9 @@ wasi_fd_filestat_set_size(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_fd_filestat_set_size(wasi_ctx->curfds, fd, st_size);
return wasmtime_ssp_fd_filestat_set_size(curfds, fd, st_size);
}
static wasi_errno_t
@ -749,11 +813,12 @@ wasi_path_filestat_get(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
if (!validate_native_addr(filestat, sizeof(wasi_filestat_t)))
return (wasi_errno_t)-1;
return wasmtime_ssp_path_filestat_get(wasi_ctx->curfds, fd,
return wasmtime_ssp_path_filestat_get(curfds, fd,
flags, path, path_len, filestat);
}
@ -768,8 +833,9 @@ wasi_path_filestat_set_times(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_path_filestat_set_times(wasi_ctx->curfds, fd,
return wasmtime_ssp_path_filestat_set_times(curfds, fd,
flags, path, path_len,
st_atim, st_mtim, fstflags);
}
@ -781,8 +847,10 @@ wasi_path_symlink(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
struct fd_prestats *prestats = wasi_ctx_get_prestats(module_inst, wasi_ctx);
return wasmtime_ssp_path_symlink(wasi_ctx->curfds, wasi_ctx->prestats,
return wasmtime_ssp_path_symlink(curfds, prestats,
old_path, old_path_len, fd,
new_path, new_path_len);
}
@ -793,8 +861,9 @@ wasi_path_unlink_file(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_path_unlink_file(wasi_ctx->curfds, fd, path, path_len);
return wasmtime_ssp_path_unlink_file(curfds, fd, path, path_len);
}
static wasi_errno_t
@ -803,8 +872,9 @@ wasi_path_remove_directory(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_path_remove_directory(wasi_ctx->curfds, fd, path, path_len);
return wasmtime_ssp_path_remove_directory(curfds, fd, path, path_len);
}
static wasi_errno_t
@ -814,6 +884,7 @@ wasi_poll_oneoff(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
size_t nevents;
wasi_errno_t err;
@ -822,7 +893,7 @@ wasi_poll_oneoff(wasm_exec_env_t exec_env,
|| !validate_native_addr(nevents_app, sizeof(uint32)))
return (wasi_errno_t)-1;
err = wasmtime_ssp_poll_oneoff(wasi_ctx->curfds, in, out,
err = wasmtime_ssp_poll_oneoff(curfds, in, out,
nsubscriptions, &nevents);
if (err)
return err;
@ -864,6 +935,7 @@ wasi_sock_recv(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_iovec_t *iovec, *iovec_begin;
uint64 total_size;
size_t ro_datalen;
@ -894,7 +966,7 @@ wasi_sock_recv(wasm_exec_env_t exec_env,
iovec->buf_len = ri_data->buf_len;
}
err = wasmtime_ssp_sock_recv(wasi_ctx->curfds, sock,
err = wasmtime_ssp_sock_recv(curfds, sock,
iovec_begin, ri_data_len,
ri_flags, &ro_datalen,
ro_flags);
@ -920,6 +992,7 @@ wasi_sock_send(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
wasi_ciovec_t *ciovec, *ciovec_begin;
uint64 total_size;
size_t so_datalen;
@ -949,7 +1022,7 @@ wasi_sock_send(wasm_exec_env_t exec_env,
ciovec->buf_len = si_data->buf_len;
}
err = wasmtime_ssp_sock_send(wasi_ctx->curfds, sock,
err = wasmtime_ssp_sock_send(curfds, sock,
ciovec_begin, si_data_len,
si_flags, &so_datalen);
if (err)
@ -971,8 +1044,9 @@ wasi_sock_shutdown(wasm_exec_env_t exec_env,
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasi_ctx_t wasi_ctx = get_wasi_ctx(module_inst);
struct fd_table *curfds = wasi_ctx_get_curfds(module_inst, wasi_ctx);
return wasmtime_ssp_sock_shutdown(wasi_ctx->curfds, sock, how);
return wasmtime_ssp_sock_shutdown(curfds, sock, how);
}
static wasi_errno_t