Coverage Report

Created: 2025-07-04 09:33

/src/node/src/node_wasi.cc
Line
Count
Source (jump to first uncovered line)
1
#include "env-inl.h"
2
#include "base_object-inl.h"
3
#include "debug_utils-inl.h"
4
#include "memory_tracker-inl.h"
5
#include "node_mem-inl.h"
6
#include "util-inl.h"
7
#include "node.h"
8
#include "node_errors.h"
9
#include "uv.h"
10
#include "uvwasi.h"
11
#include "node_wasi.h"
12
13
namespace node {
14
namespace wasi {
15
16
template <typename... Args>
17
0
inline void Debug(const WASI& wasi, Args&&... args) {
18
0
  Debug(wasi.env(), DebugCategory::WASI, std::forward<Args>(args)...);
19
0
}
Unexecuted instantiation: void node::wasi::Debug<char const (&) [18], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [18], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [24], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [24], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [23], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [23], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [28], unsigned int&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [28], unsigned int&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [21], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [21], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [27], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [27], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [27], unsigned int&, unsigned long&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [27], unsigned int&, unsigned long&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [25], unsigned int&, unsigned long&, unsigned long&>(node::wasi::WASI const&, char const (&) [25], unsigned int&, unsigned long&, unsigned long&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [14], unsigned int&>(node::wasi::WASI const&, char const (&) [14], unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [17], unsigned int&>(node::wasi::WASI const&, char const (&) [17], unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [29], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [29], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [34], unsigned int&, unsigned long&, unsigned long&>(node::wasi::WASI const&, char const (&) [34], unsigned int&, unsigned long&, unsigned long&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [25], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [25], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [30], unsigned int&, unsigned long&>(node::wasi::WASI const&, char const (&) [30], unsigned int&, unsigned long&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [39], unsigned int&, unsigned long&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [39], unsigned int&, unsigned long&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [37], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [37], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [33], unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [33], unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [38], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [38], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [25], unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [25], unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [25], unsigned int&, long&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [25], unsigned int&, long&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [13], unsigned int&>(node::wasi::WASI const&, char const (&) [13], unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [17], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [17], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [26], unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [26], unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [35], unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [35], unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [31], unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [31], unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [53], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned long&, unsigned int&>(node::wasi::WASI const&, char const (&) [53], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned long&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [47], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned long&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [47], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned long&, unsigned long&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [39], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [37], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [37], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [34], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [34], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [30], unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [30], unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [29], unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [29], unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [15], unsigned int&>(node::wasi::WASI const&, char const (&) [15], unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [16], unsigned int&>(node::wasi::WASI const&, char const (&) [16], unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [20], unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [20], unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [15]>(node::wasi::WASI const&, char const (&) [15])
Unexecuted instantiation: void node::wasi::Debug<char const (&) [25], unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [25], unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [35], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [35], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
Unexecuted instantiation: void node::wasi::Debug<char const (&) [31], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&>(node::wasi::WASI const&, char const (&) [31], unsigned int&, unsigned int&, unsigned int&, unsigned int&, unsigned int&)
20
21
#define CHECK_BOUNDS_OR_RETURN(mem_size, offset, buf_size)                     \
22
0
  do {                                                                         \
23
0
    if (!uvwasi_serdes_check_bounds((offset), (mem_size), (buf_size))) {       \
24
0
      return UVWASI_EOVERFLOW;                                                 \
25
0
    }                                                                          \
26
0
  } while (0)
27
28
using v8::Array;
29
using v8::ArrayBuffer;
30
using v8::BigInt;
31
using v8::CFunction;
32
using v8::Context;
33
using v8::Exception;
34
using v8::FastApiCallbackOptions;
35
using v8::FunctionCallbackInfo;
36
using v8::FunctionTemplate;
37
using v8::Integer;
38
using v8::Isolate;
39
using v8::Local;
40
using v8::MaybeLocal;
41
using v8::Object;
42
using v8::Signature;
43
using v8::String;
44
using v8::Uint32;
45
using v8::Value;
46
using v8::WasmMemoryObject;
47
48
static MaybeLocal<Value> WASIException(Local<Context> context,
49
                                       int errorno,
50
0
                                       const char* syscall) {
51
0
  Isolate* isolate = context->GetIsolate();
52
0
  Environment* env = Environment::GetCurrent(context);
53
0
  CHECK_NOT_NULL(env);
54
0
  const char* err_name = uvwasi_embedder_err_code_to_string(errorno);
55
0
  Local<String> js_code = OneByteString(isolate, err_name);
56
0
  Local<String> js_syscall = OneByteString(isolate, syscall);
57
0
  Local<String> js_msg = js_code;
58
0
  js_msg =
59
0
      String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ", "));
60
0
  js_msg = String::Concat(isolate, js_msg, js_syscall);
61
0
  Local<Object> e;
62
0
  if (!Exception::Error(js_msg)->ToObject(context).ToLocal(&e))
63
0
    return MaybeLocal<Value>();
64
65
0
  if (e->Set(context,
66
0
             env->errno_string(),
67
0
             Integer::New(isolate, errorno)).IsNothing() ||
68
0
      e->Set(context, env->code_string(), js_code).IsNothing() ||
69
0
      e->Set(context, env->syscall_string(), js_syscall).IsNothing()) {
70
0
    return MaybeLocal<Value>();
71
0
  }
72
73
0
  return e;
74
0
}
75
76
77
WASI::WASI(Environment* env,
78
           Local<Object> object,
79
0
           uvwasi_options_t* options) : BaseObject(env, object) {
80
0
  MakeWeak();
81
0
  alloc_info_ = MakeAllocator();
82
0
  options->allocator = &alloc_info_;
83
0
  int err = uvwasi_init(&uvw_, options);
84
0
  if (err != UVWASI_ESUCCESS) {
85
0
    Local<Value> exception;
86
0
    CHECK(
87
0
        WASIException(env->context(), err, "uvwasi_init").ToLocal(&exception));
88
89
0
    env->isolate()->ThrowException(exception);
90
0
  }
91
0
}
92
93
94
0
WASI::~WASI() {
95
0
  uvwasi_destroy(&uvw_);
96
0
  CHECK_EQ(current_uvwasi_memory_, 0);
97
0
}
98
99
0
void WASI::MemoryInfo(MemoryTracker* tracker) const {
100
0
  tracker->TrackField("memory", memory_);
101
0
  tracker->TrackFieldWithSize("uvwasi_memory", current_uvwasi_memory_);
102
0
}
103
104
0
void WASI::CheckAllocatedSize(size_t previous_size) const {
105
0
  CHECK_GE(current_uvwasi_memory_, previous_size);
106
0
}
107
108
0
void WASI::IncreaseAllocatedSize(size_t size) {
109
0
  current_uvwasi_memory_ += size;
110
0
}
111
112
0
void WASI::DecreaseAllocatedSize(size_t size) {
113
0
  current_uvwasi_memory_ -= size;
114
0
}
115
116
0
void WASI::New(const FunctionCallbackInfo<Value>& args) {
117
0
  CHECK(args.IsConstructCall());
118
0
  CHECK_EQ(args.Length(), 4);
119
0
  CHECK(args[0]->IsArray());
120
0
  CHECK(args[1]->IsArray());
121
0
  CHECK(args[2]->IsArray());
122
0
  CHECK(args[3]->IsArray());
123
124
0
  Environment* env = Environment::GetCurrent(args);
125
0
  Local<Context> context = env->context();
126
0
  Local<Array> argv = args[0].As<Array>();
127
0
  const uint32_t argc = argv->Length();
128
0
  uvwasi_options_t options;
129
130
0
  uvwasi_options_init(&options);
131
132
0
  Local<Array> stdio = args[3].As<Array>();
133
0
  CHECK_EQ(stdio->Length(), 3);
134
0
  options.in = stdio->Get(context, 0).ToLocalChecked()->
135
0
    Int32Value(context).FromJust();
136
0
  options.out = stdio->Get(context, 1).ToLocalChecked()->
137
0
    Int32Value(context).FromJust();
138
0
  options.err = stdio->Get(context, 2).ToLocalChecked()->
139
0
    Int32Value(context).FromJust();
140
141
0
  options.fd_table_size = 3;
142
0
  options.argc = argc;
143
0
  options.argv =
144
0
    const_cast<const char**>(argc == 0 ? nullptr : new char*[argc]);
145
146
0
  for (uint32_t i = 0; i < argc; i++) {
147
0
    auto arg = argv->Get(context, i).ToLocalChecked();
148
0
    CHECK(arg->IsString());
149
0
    node::Utf8Value str(env->isolate(), arg);
150
0
    options.argv[i] = strdup(*str);
151
0
    CHECK_NOT_NULL(options.argv[i]);
152
0
  }
153
154
0
  Local<Array> env_pairs = args[1].As<Array>();
155
0
  const uint32_t envc = env_pairs->Length();
156
0
  options.envp = const_cast<const char**>(new char*[envc + 1]);
157
0
  for (uint32_t i = 0; i < envc; i++) {
158
0
    auto pair = env_pairs->Get(context, i).ToLocalChecked();
159
0
    CHECK(pair->IsString());
160
0
    node::Utf8Value str(env->isolate(), pair);
161
0
    options.envp[i] = strdup(*str);
162
0
    CHECK_NOT_NULL(options.envp[i]);
163
0
  }
164
0
  options.envp[envc] = nullptr;
165
166
0
  Local<Array> preopens = args[2].As<Array>();
167
0
  CHECK_EQ(preopens->Length() % 2, 0);
168
0
  options.preopenc = preopens->Length() / 2;
169
0
  options.preopens = Calloc<uvwasi_preopen_t>(options.preopenc);
170
0
  int index = 0;
171
0
  for (uint32_t i = 0; i < preopens->Length(); i += 2) {
172
0
    auto mapped = preopens->Get(context, i).ToLocalChecked();
173
0
    auto real = preopens->Get(context, i + 1).ToLocalChecked();
174
0
    CHECK(mapped->IsString());
175
0
    CHECK(real->IsString());
176
0
    node::Utf8Value mapped_path(env->isolate(), mapped);
177
0
    node::Utf8Value real_path(env->isolate(), real);
178
0
    options.preopens[index].mapped_path = strdup(*mapped_path);
179
0
    CHECK_NOT_NULL(options.preopens[index].mapped_path);
180
0
    options.preopens[index].real_path = strdup(*real_path);
181
0
    CHECK_NOT_NULL(options.preopens[index].real_path);
182
0
    index++;
183
0
  }
184
185
0
  new WASI(env, args.This(), &options);
186
187
0
  if (options.argv != nullptr) {
188
0
    for (uint32_t i = 0; i < argc; i++)
189
0
      free(const_cast<char*>(options.argv[i]));
190
0
    delete[] options.argv;
191
0
  }
192
193
0
  for (uint32_t i = 0; options.envp[i]; i++)
194
0
    free(const_cast<char*>(options.envp[i]));
195
0
  delete[] options.envp;
196
197
0
  if (options.preopens != nullptr) {
198
0
    for (uint32_t i = 0; i < options.preopenc; i++) {
199
0
      free(const_cast<char*>(options.preopens[i].mapped_path));
200
0
      free(const_cast<char*>(options.preopens[i].real_path));
201
0
    }
202
203
0
    free(options.preopens);
204
0
  }
205
0
}
206
207
template <typename FT, FT F, typename R, typename... Args>
208
void WASI::WasiFunction<FT, F, R, Args...>::SetFunction(
209
0
    Environment* env, const char* name, Local<FunctionTemplate> tmpl) {
210
0
  auto c_function = CFunction::Make(FastCallback);
211
0
  Local<FunctionTemplate> t =
212
0
      FunctionTemplate::New(env->isolate(),
213
0
                            SlowCallback,
214
0
                            Local<Value>(),
215
0
                            Local<Signature>(),
216
0
                            sizeof...(Args),
217
0
                            v8::ConstructorBehavior::kThrow,
218
0
                            v8::SideEffectType::kHasSideEffect,
219
0
                            &c_function);
220
0
  const v8::NewStringType type = v8::NewStringType::kInternalized;
221
0
  Local<String> name_string =
222
0
      String::NewFromUtf8(env->isolate(), name, type).ToLocalChecked();
223
0
  tmpl->PrototypeTemplate()->Set(name_string, t);
224
0
  t->SetClassName(name_string);
225
0
}
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsSizesGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ClockResGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::ClockTimeGet, unsigned int, unsigned int, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironSizesGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdAdvise, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdAllocate, unsigned int, unsigned int, unsigned long, unsigned long>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdClose, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdDatasync, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatSetFlags, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdFdstatSetRights, unsigned int, unsigned int, unsigned long, unsigned long>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFilestatGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long), &node::wasi::WASI::FdFilestatSetSize, unsigned int, unsigned int, unsigned long>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdFilestatSetTimes, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPread, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatDirName, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPwrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdRead, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdReaddir, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdRenumber, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, long, unsigned int, unsigned int), &node::wasi::WASI::FdSeek, unsigned int, unsigned int, long, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdSync, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdTell, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdWrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathCreateDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathFilestatGet, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::PathFilestatSetTimes, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathLink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int), &node::wasi::WASI::PathOpen, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathReadlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRemoveDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRename, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathSymlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathUnlinkFile, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PollOneoff, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<void (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcExit, void, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcRaise, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::RandomGet, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory), &node::wasi::WASI::SchedYield, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockAccept, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockRecv, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockSend, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::SockShutdown, unsigned int, unsigned int, unsigned int>::SetFunction(node::Environment*, char const*, v8::Local<v8::FunctionTemplate>)
226
227
namespace {
228
template <typename R>
229
inline R EinvalError();
230
231
template <>
232
0
inline uint32_t EinvalError() {
233
0
  return UVWASI_EINVAL;
234
0
}
235
236
template <>
237
0
inline void EinvalError() {}
238
}  // namespace
239
240
template <typename FT, FT F, typename R, typename... Args>
241
R WASI::WasiFunction<FT, F, R, Args...>::FastCallback(
242
    Local<Object> receiver,
243
    Args... args,
244
    // NOLINTNEXTLINE(runtime/references) This is V8 api.
245
0
    FastApiCallbackOptions& options) {
246
0
  WASI* wasi = reinterpret_cast<WASI*>(BaseObject::FromJSObject(receiver));
247
0
  if (UNLIKELY(wasi == nullptr)) return EinvalError<R>();
248
249
0
  if (UNLIKELY(options.wasm_memory == nullptr || wasi->memory_.IsEmpty())) {
250
    // fallback to slow path which to throw an error about missing memory.
251
0
    options.fallback = true;
252
0
    return EinvalError<R>();
253
0
  }
254
0
  uint8_t* memory = nullptr;
255
0
  CHECK(LIKELY(options.wasm_memory->getStorageIfAligned(&memory)));
256
257
0
  return F(*wasi,
258
0
           {reinterpret_cast<char*>(memory), options.wasm_memory->length()},
259
0
           args...);
260
0
}
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsSizesGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ClockResGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::ClockTimeGet, unsigned int, unsigned int, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironSizesGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdAdvise, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdAllocate, unsigned int, unsigned int, unsigned long, unsigned long>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, unsigned long, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdClose, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdDatasync, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatSetFlags, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdFdstatSetRights, unsigned int, unsigned int, unsigned long, unsigned long>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, unsigned long, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFilestatGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long), &node::wasi::WASI::FdFilestatSetSize, unsigned int, unsigned int, unsigned long>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdFilestatSetTimes, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned long, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPread, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatDirName, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPwrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdRead, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdReaddir, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdRenumber, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, long, unsigned int, unsigned int), &node::wasi::WASI::FdSeek, unsigned int, unsigned int, long, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, long, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdSync, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdTell, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdWrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathCreateDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathFilestatGet, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::PathFilestatSetTimes, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathLink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int), &node::wasi::WASI::PathOpen, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathReadlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRemoveDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRename, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathSymlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathUnlinkFile, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PollOneoff, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<void (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcExit, void, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcRaise, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::RandomGet, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory), &node::wasi::WASI::SchedYield, unsigned int>::FastCallback(v8::Local<v8::Object>, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockAccept, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockRecv, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockSend, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::SockShutdown, unsigned int, unsigned int, unsigned int>::FastCallback(v8::Local<v8::Object>, unsigned int, unsigned int, v8::FastApiCallbackOptions&)
261
262
namespace {
263
template <typename VT>
264
static bool CheckType(Local<Value> v);
265
266
template <typename VT>
267
static VT ConvertType(Local<Value> V);
268
269
template <>
270
0
bool CheckType<uint32_t>(Local<Value> value) {
271
0
  return value->IsUint32();
272
0
}
273
274
template <>
275
0
uint32_t ConvertType(Local<Value> value) {
276
0
  return value.As<Uint32>()->Value();
277
0
}
278
279
template <>
280
0
bool CheckType<uint64_t>(Local<Value> value) {
281
0
  return value->IsBigInt();
282
0
}
283
284
template <>
285
0
uint64_t ConvertType(Local<Value> value) {
286
0
  Local<BigInt> js_value = value.As<BigInt>();
287
0
  bool lossless;
288
0
  return js_value->Uint64Value(&lossless);
289
0
}
290
291
template <>
292
0
bool CheckType<int64_t>(Local<Value> value) {
293
0
  return value->IsBigInt();
294
0
}
295
296
template <>
297
0
int64_t ConvertType(Local<Value> value) {
298
0
  Local<BigInt> js_value = value.As<BigInt>();
299
0
  bool lossless;
300
0
  return js_value->Int64Value(&lossless);
301
0
}
302
303
template <typename T>
304
0
bool CheckTypes(const FunctionCallbackInfo<Value>& info, int i, T) {
305
0
  return CheckType<T>(info[i]);
306
0
}
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<long>(v8::FunctionCallbackInfo<v8::Value> const&, int, long)
307
308
template <typename T, typename... Ts>
309
bool CheckTypes(const FunctionCallbackInfo<Value>& info,
310
                int i,
311
                T arg,
312
0
                Ts... args) {
313
0
  if (!CheckTypes<T>(info, i, arg)) return false;
314
0
  return CheckTypes<Ts...>(info, i + 1, args...);
315
0
}
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned long, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned long, unsigned long)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long, unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long, unsigned long)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned long)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long, unsigned long, unsigned int, unsigned int)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&, int, unsigned long, unsigned int, unsigned int)
316
317
template <typename... Args>
318
0
bool CheckTypes(const FunctionCallbackInfo<Value>& info) {
319
0
  return CheckTypes<Args...>(info, 0, Args()...);
320
0
}
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long, unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned long>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node_wasi.cc:bool node::wasi::(anonymous namespace)::CheckTypes<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>(v8::FunctionCallbackInfo<v8::Value> const&)
321
322
template <>
323
0
bool CheckTypes(const FunctionCallbackInfo<Value>& info) {
324
0
  return true;
325
0
}
326
327
template <typename FT,
328
          FT F,
329
          typename R,
330
          typename... Args,
331
          std::size_t... Indices,
332
          typename std::enable_if_t<!std::is_void<R>::value, bool> = true>
333
inline void CallAndSetReturn(std::index_sequence<Indices...>,
334
                             const FunctionCallbackInfo<Value>& args,
335
                             WASI* wasi,
336
0
                             WasmMemory memory) {
337
0
  args.GetReturnValue().Set(
338
0
      F(*wasi, memory, ConvertType<Args>(args[Indices])...));
339
0
}
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_7ArgsGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_12ArgsSizesGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_11ClockResGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmjETnT_XadL_ZNS3_12ClockTimeGetES4_S5_jmjEEjJjmjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_10EnvironGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_15EnvironSizesGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmmjETnT_XadL_ZNS3_8FdAdviseES4_S5_jmmjEEjJjmmjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmmETnT_XadL_ZNS3_10FdAllocateES4_S5_jmmEEjJjmmEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS3_7FdCloseES4_S5_jEEjJjEJLm0EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS3_10FdDatasyncES4_S5_jEEjJjEJLm0EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_11FdFdstatGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_16FdFdstatSetFlagsES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmmETnT_XadL_ZNS3_17FdFdstatSetRightsES4_S5_jmmEEjJjmmEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_13FdFilestatGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmETnT_XadL_ZNS3_17FdFilestatSetSizeES4_S5_jmEEjJjmEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjmmjETnT_XadL_ZNS3_18FdFilestatSetTimesES4_S5_jmmjEEjJjmmjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS3_7FdPreadES4_S5_jjjmjEEjJjjjmjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_12FdPrestatGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS3_16FdPrestatDirNameES4_S5_jjjEEjJjjjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS3_8FdPwriteES4_S5_jjjmjEEjJjjjmjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS3_6FdReadES4_S5_jjjjEEjJjjjjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS3_9FdReaddirES4_S5_jjjmjEEjJjjjmjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_10FdRenumberES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjljjETnT_XadL_ZNS3_6FdSeekES4_S5_jljjEEjJjljjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS3_6FdSyncES4_S5_jEEjJjEJLm0EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_6FdTellES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS3_7FdWriteES4_S5_jjjjEEjJjjjjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS3_19PathCreateDirectoryES4_S5_jjjEEjJjjjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS3_15PathFilestatGetES4_S5_jjjjjEEjJjjjjjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjmmjETnT_XadL_ZNS3_20PathFilestatSetTimesES4_S5_jjjjmmjEEjJjjjjmmjEJLm0ELm1ELm2ELm3ELm4ELm5ELm6EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjjETnT_XadL_ZNS3_8PathLinkES4_S5_jjjjjjjEEjJjjjjjjjEJLm0ELm1ELm2ELm3ELm4ELm5ELm6EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjmmjjETnT_XadL_ZNS3_8PathOpenES4_S5_jjjjjmmjjEEjJjjjjjmmjjEJLm0ELm1ELm2ELm3ELm4ELm5ELm6ELm7ELm8EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS3_12PathReadlinkES4_S5_jjjjjjEEjJjjjjjjEJLm0ELm1ELm2ELm3ELm4ELm5EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS3_19PathRemoveDirectoryES4_S5_jjjEEjJjjjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS3_10PathRenameES4_S5_jjjjjjEEjJjjjjjjEJLm0ELm1ELm2ELm3ELm4ELm5EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS3_11PathSymlinkES4_S5_jjjjjEEjJjjjjjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS3_14PathUnlinkFileES4_S5_jjjEEjJjjjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS3_10PollOneoffES4_S5_jjjjEEjJjjjjEJLm0ELm1ELm2ELm3EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS3_9ProcRaiseES4_S5_jEEjJjEJLm0EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_9RandomGetES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEETnT_XadL_ZNS3_10SchedYieldES4_S5_EEjJETpTnmJETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS3_10SockAcceptES4_S5_jjjEEjJjjjEJLm0ELm1ELm2EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS3_8SockRecvES4_S5_jjjjjjEEjJjjjjjjEJLm0ELm1ELm2ELm3ELm4ELm5EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS3_8SockSendES4_S5_jjjjjEEjJjjjjjEJLm0ELm1ELm2ELm3ELm4EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasi12_GLOBAL__N_116CallAndSetReturnIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS3_12SockShutdownES4_S5_jjEEjJjjEJLm0ELm1EETnNSt3__19enable_ifIXntsr3std7is_voidIT1_EE5valueEbE4typeELb1EEEvNS9_16integer_sequenceImJXspT3_EEEERKN2v820FunctionCallbackInfoINSG_5ValueEEEPS3_S5_
340
341
template <typename FT,
342
          FT F,
343
          typename R,
344
          typename... Args,
345
          std::size_t... Indices,
346
          typename std::enable_if_t<std::is_void<R>::value, bool> = true>
347
inline void CallAndSetReturn(std::index_sequence<Indices...>,
348
                             const FunctionCallbackInfo<Value>& args,
349
                             WASI* wasi,
350
0
                             WasmMemory memory) {
351
0
  F(*wasi, memory, ConvertType<Args>(args[Indices])...);
352
0
}
353
354
}  // namespace
355
356
template <typename FT, FT F, typename R, typename... Args>
357
void WASI::WasiFunction<FT, F, R, Args...>::SlowCallback(
358
0
    const FunctionCallbackInfo<Value>& args) {
359
0
  if (args.Length() != sizeof...(Args)) {
360
0
    args.GetReturnValue().Set(UVWASI_EINVAL);
361
0
    return;
362
0
  }
363
0
  if (!CheckTypes<Args...>(args)) {
364
0
    args.GetReturnValue().Set(UVWASI_EINVAL);
365
0
    return;
366
0
  }
367
368
0
  WASI* wasi;
369
0
  ASSIGN_OR_RETURN_UNWRAP(&wasi, args.This());
370
0
  if (wasi->memory_.IsEmpty()) {
371
0
    THROW_ERR_WASI_NOT_STARTED(Environment::GetCurrent(args));
372
0
    return;
373
0
  }
374
375
0
  Local<WasmMemoryObject> memory = PersistentToLocal::Strong(wasi->memory_);
376
0
  Local<ArrayBuffer> ab = memory->Buffer();
377
0
  size_t mem_size = ab->ByteLength();
378
0
  char* mem_data = static_cast<char*>(ab->Data());
379
0
  CHECK_NOT_NULL(mem_data);
380
381
0
  CallAndSetReturn<FT, F, R, Args...>(
382
0
      std::make_index_sequence<sizeof...(Args)>{},
383
0
      args,
384
0
      wasi,
385
0
      {mem_data, mem_size});
386
0
}
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ArgsSizesGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::ClockResGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::ClockTimeGet, unsigned int, unsigned int, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::EnvironSizesGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdAdvise, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdAllocate, unsigned int, unsigned int, unsigned long, unsigned long>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdClose, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdDatasync, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFdstatSetFlags, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long), &node::wasi::WASI::FdFdstatSetRights, unsigned int, unsigned int, unsigned long, unsigned long>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdFilestatGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long), &node::wasi::WASI::FdFilestatSetSize, unsigned int, unsigned int, unsigned long>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::FdFilestatSetTimes, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPread, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdPrestatDirName, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdPwrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdRead, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int), &node::wasi::WASI::FdReaddir, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdRenumber, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, long, unsigned int, unsigned int), &node::wasi::WASI::FdSeek, unsigned int, unsigned int, long, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::FdSync, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::FdTell, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::FdWrite, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathCreateDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathFilestatGet, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int), &node::wasi::WASI::PathFilestatSetTimes, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathLink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int), &node::wasi::WASI::PathOpen, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathReadlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRemoveDirectory, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathRename, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathSymlink, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PathUnlinkFile, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::PollOneoff, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<void (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcExit, void, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int), &node::wasi::WASI::ProcRaise, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::RandomGet, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory), &node::wasi::WASI::SchedYield, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockAccept, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockRecv, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int), &node::wasi::WASI::SockSend, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
Unexecuted instantiation: node::wasi::WASI::WasiFunction<unsigned int (*)(node::wasi::WASI&, node::wasi::WasmMemory, unsigned int, unsigned int), &node::wasi::WASI::SockShutdown, unsigned int, unsigned int, unsigned int>::SlowCallback(v8::FunctionCallbackInfo<v8::Value> const&)
387
388
template <typename FT, FT F, typename R, typename... Args>
389
static void SetFunction(R (*f)(WASI&, WasmMemory, Args...),
390
                        Environment* env,
391
                        const char* name,
392
0
                        Local<FunctionTemplate> tmpl) {
393
0
  WASI::WasiFunction<FT, F, R, Args...>::SetFunction(env, name, tmpl);
394
0
}
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_7ArgsGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_12ArgsSizesGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_11ClockResGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmjETnT_XadL_ZNS2_12ClockTimeGetES3_S4_jmjEEjJjmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_10EnvironGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_15EnvironSizesGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmmjETnT_XadL_ZNS2_8FdAdviseES3_S4_jmmjEEjJjmmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmmETnT_XadL_ZNS2_10FdAllocateES3_S4_jmmEEjJjmmEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS2_7FdCloseES3_S4_jEEjJjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS2_10FdDatasyncES3_S4_jEEjJjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_11FdFdstatGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_16FdFdstatSetFlagsES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmmETnT_XadL_ZNS2_17FdFdstatSetRightsES3_S4_jmmEEjJjmmEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_13FdFilestatGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmETnT_XadL_ZNS2_17FdFilestatSetSizeES3_S4_jmEEjJjmEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjmmjETnT_XadL_ZNS2_18FdFilestatSetTimesES3_S4_jmmjEEjJjmmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS2_7FdPreadES3_S4_jjjmjEEjJjjjmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_12FdPrestatGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS2_16FdPrestatDirNameES3_S4_jjjEEjJjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS2_8FdPwriteES3_S4_jjjmjEEjJjjjmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS2_6FdReadES3_S4_jjjjEEjJjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjmjETnT_XadL_ZNS2_9FdReaddirES3_S4_jjjmjEEjJjjjmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_10FdRenumberES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjljjETnT_XadL_ZNS2_6FdSeekES3_S4_jljjEEjJjljjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS2_6FdSyncES3_S4_jEEjJjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_6FdTellES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS2_7FdWriteES3_S4_jjjjEEjJjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS2_19PathCreateDirectoryES3_S4_jjjEEjJjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS2_15PathFilestatGetES3_S4_jjjjjEEjJjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjmmjETnT_XadL_ZNS2_20PathFilestatSetTimesES3_S4_jjjjmmjEEjJjjjjmmjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjjETnT_XadL_ZNS2_8PathLinkES3_S4_jjjjjjjEEjJjjjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjmmjjETnT_XadL_ZNS2_8PathOpenES3_S4_jjjjjmmjjEEjJjjjjjmmjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS2_12PathReadlinkES3_S4_jjjjjjEEjJjjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS2_19PathRemoveDirectoryES3_S4_jjjEEjJjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS2_10PathRenameES3_S4_jjjjjjEEjJjjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS2_11PathSymlinkES3_S4_jjjjjEEjJjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS2_14PathUnlinkFileES3_S4_jjjEEjJjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjETnT_XadL_ZNS2_10PollOneoffES3_S4_jjjjEEjJjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFvRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS2_8ProcExitES3_S4_jEEvJjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjETnT_XadL_ZNS2_9ProcRaiseES3_S4_jEEjJjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_9RandomGetES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEETnT_XadL_ZNS2_10SchedYieldES3_S4_EEjJEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjETnT_XadL_ZNS2_10SockAcceptES3_S4_jjjEEjJjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjjETnT_XadL_ZNS2_8SockRecvES3_S4_jjjjjjEEjJjjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjjjjETnT_XadL_ZNS2_8SockSendES3_S4_jjjjjEEjJjjjjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
Unexecuted instantiation: node_wasi.cc:_ZN4node4wasiL11SetFunctionIPFjRNS0_4WASIENS0_10WasmMemoryEjjETnT_XadL_ZNS2_12SockShutdownES3_S4_jjEEjJjjEEEvPFT1_S3_S4_DpT2_EPNS_11EnvironmentEPKcN2v85LocalINSH_16FunctionTemplateEEE
395
396
uint32_t WASI::ArgsGet(WASI& wasi,
397
                       WasmMemory memory,
398
                       uint32_t argv_offset,
399
0
                       uint32_t argv_buf_offset) {
400
0
  Debug(wasi, "args_get(%d, %d)\n", argv_offset, argv_buf_offset);
401
402
0
  CHECK_BOUNDS_OR_RETURN(memory.size, argv_buf_offset, wasi.uvw_.argv_buf_size);
403
0
  CHECK_BOUNDS_OR_RETURN(
404
0
      memory.size, argv_offset, wasi.uvw_.argc * UVWASI_SERDES_SIZE_uint32_t);
405
0
  std::vector<char*> argv(wasi.uvw_.argc);
406
0
  char* argv_buf = &memory.data[argv_buf_offset];
407
0
  uvwasi_errno_t err = uvwasi_args_get(&wasi.uvw_, argv.data(), argv_buf);
408
409
0
  if (err == UVWASI_ESUCCESS) {
410
0
    for (size_t i = 0; i < wasi.uvw_.argc; i++) {
411
0
      uint32_t offset =
412
0
          static_cast<uint32_t>(argv_buf_offset + (argv[i] - argv[0]));
413
0
      uvwasi_serdes_write_uint32_t(
414
0
          memory.data, argv_offset + (i * UVWASI_SERDES_SIZE_uint32_t), offset);
415
0
    }
416
0
  }
417
418
0
  return err;
419
0
}
420
421
uint32_t WASI::ArgsSizesGet(WASI& wasi,
422
                            WasmMemory memory,
423
                            uint32_t argc_offset,
424
0
                            uint32_t argv_buf_offset) {
425
0
  Debug(wasi, "args_sizes_get(%d, %d)\n", argc_offset, argv_buf_offset);
426
0
  CHECK_BOUNDS_OR_RETURN(memory.size, argc_offset, UVWASI_SERDES_SIZE_size_t);
427
0
  CHECK_BOUNDS_OR_RETURN(
428
0
      memory.size, argv_buf_offset, UVWASI_SERDES_SIZE_size_t);
429
0
  uvwasi_size_t argc;
430
0
  uvwasi_size_t argv_buf_size;
431
0
  uvwasi_errno_t err = uvwasi_args_sizes_get(&wasi.uvw_, &argc, &argv_buf_size);
432
0
  if (err == UVWASI_ESUCCESS) {
433
0
    uvwasi_serdes_write_size_t(memory.data, argc_offset, argc);
434
0
    uvwasi_serdes_write_size_t(memory.data, argv_buf_offset, argv_buf_size);
435
0
  }
436
437
0
  return err;
438
0
}
439
440
uint32_t WASI::ClockResGet(WASI& wasi,
441
                           WasmMemory memory,
442
                           uint32_t clock_id,
443
0
                           uint32_t resolution_ptr) {
444
0
  Debug(wasi, "clock_res_get(%d, %d)\n", clock_id, resolution_ptr);
445
0
  CHECK_BOUNDS_OR_RETURN(
446
0
      memory.size, resolution_ptr, UVWASI_SERDES_SIZE_timestamp_t);
447
0
  uvwasi_timestamp_t resolution;
448
0
  uvwasi_errno_t err = uvwasi_clock_res_get(&wasi.uvw_, clock_id, &resolution);
449
0
  if (err == UVWASI_ESUCCESS)
450
0
    uvwasi_serdes_write_timestamp_t(memory.data, resolution_ptr, resolution);
451
452
0
  return err;
453
0
}
454
455
uint32_t WASI::ClockTimeGet(WASI& wasi,
456
                            WasmMemory memory,
457
                            uint32_t clock_id,
458
                            uint64_t precision,
459
0
                            uint32_t time_ptr) {
460
0
  Debug(wasi, "clock_time_get(%d, %d, %d)\n", clock_id, precision, time_ptr);
461
0
  CHECK_BOUNDS_OR_RETURN(memory.size, time_ptr, UVWASI_SERDES_SIZE_timestamp_t);
462
0
  uvwasi_timestamp_t time;
463
0
  uvwasi_errno_t err =
464
0
      uvwasi_clock_time_get(&wasi.uvw_, clock_id, precision, &time);
465
0
  if (err == UVWASI_ESUCCESS)
466
0
    uvwasi_serdes_write_timestamp_t(memory.data, time_ptr, time);
467
468
0
  return err;
469
0
}
470
471
uint32_t WASI::EnvironGet(WASI& wasi,
472
                          WasmMemory memory,
473
                          uint32_t environ_offset,
474
0
                          uint32_t environ_buf_offset) {
475
0
  Debug(wasi, "environ_get(%d, %d)\n", environ_offset, environ_buf_offset);
476
0
  CHECK_BOUNDS_OR_RETURN(
477
0
      memory.size, environ_buf_offset, wasi.uvw_.env_buf_size);
478
0
  CHECK_BOUNDS_OR_RETURN(memory.size,
479
0
                         environ_offset,
480
0
                         wasi.uvw_.envc * UVWASI_SERDES_SIZE_uint32_t);
481
0
  std::vector<char*> environment(wasi.uvw_.envc);
482
0
  char* environ_buf = &memory.data[environ_buf_offset];
483
0
  uvwasi_errno_t err =
484
0
      uvwasi_environ_get(&wasi.uvw_, environment.data(), environ_buf);
485
486
0
  if (err == UVWASI_ESUCCESS) {
487
0
    for (size_t i = 0; i < wasi.uvw_.envc; i++) {
488
0
      uint32_t offset = static_cast<uint32_t>(
489
0
          environ_buf_offset + (environment[i] - environment[0]));
490
491
0
      uvwasi_serdes_write_uint32_t(
492
0
          memory.data,
493
0
          environ_offset + (i * UVWASI_SERDES_SIZE_uint32_t),
494
0
          offset);
495
0
    }
496
0
  }
497
498
0
  return err;
499
0
}
500
501
uint32_t WASI::EnvironSizesGet(WASI& wasi,
502
                               WasmMemory memory,
503
                               uint32_t envc_offset,
504
0
                               uint32_t env_buf_offset) {
505
0
  Debug(wasi, "environ_sizes_get(%d, %d)\n", envc_offset, env_buf_offset);
506
0
  CHECK_BOUNDS_OR_RETURN(memory.size, envc_offset, UVWASI_SERDES_SIZE_size_t);
507
0
  CHECK_BOUNDS_OR_RETURN(
508
0
      memory.size, env_buf_offset, UVWASI_SERDES_SIZE_size_t);
509
0
  uvwasi_size_t envc;
510
0
  uvwasi_size_t env_buf_size;
511
0
  uvwasi_errno_t err =
512
0
      uvwasi_environ_sizes_get(&wasi.uvw_, &envc, &env_buf_size);
513
0
  if (err == UVWASI_ESUCCESS) {
514
0
    uvwasi_serdes_write_size_t(memory.data, envc_offset, envc);
515
0
    uvwasi_serdes_write_size_t(memory.data, env_buf_offset, env_buf_size);
516
0
  }
517
518
0
  return err;
519
0
}
520
521
uint32_t WASI::FdAdvise(WASI& wasi,
522
                        WasmMemory,
523
                        uint32_t fd,
524
                        uint64_t offset,
525
                        uint64_t len,
526
0
                        uint32_t advice) {
527
0
  Debug(wasi, "fd_advise(%d, %d, %d, %d)\n", fd, offset, len, advice);
528
0
  return uvwasi_fd_advise(&wasi.uvw_, fd, offset, len, advice);
529
0
}
530
531
uint32_t WASI::FdAllocate(
532
0
    WASI& wasi, WasmMemory, uint32_t fd, uint64_t offset, uint64_t len) {
533
0
  Debug(wasi, "fd_allocate(%d, %d, %d)\n", fd, offset, len);
534
0
  return uvwasi_fd_allocate(&wasi.uvw_, fd, offset, len);
535
0
}
536
537
0
uint32_t WASI::FdClose(WASI& wasi, WasmMemory, uint32_t fd) {
538
0
  Debug(wasi, "fd_close(%d)\n", fd);
539
0
  return uvwasi_fd_close(&wasi.uvw_, fd);
540
0
}
541
542
0
uint32_t WASI::FdDatasync(WASI& wasi, WasmMemory, uint32_t fd) {
543
0
  Debug(wasi, "fd_datasync(%d)\n", fd);
544
0
  return uvwasi_fd_datasync(&wasi.uvw_, fd);
545
0
}
546
547
uint32_t WASI::FdFdstatGet(WASI& wasi,
548
                           WasmMemory memory,
549
                           uint32_t fd,
550
0
                           uint32_t buf) {
551
0
  Debug(wasi, "fd_fdstat_get(%d, %d)\n", fd, buf);
552
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf, UVWASI_SERDES_SIZE_fdstat_t);
553
0
  uvwasi_fdstat_t stats;
554
0
  uvwasi_errno_t err = uvwasi_fd_fdstat_get(&wasi.uvw_, fd, &stats);
555
556
0
  if (err == UVWASI_ESUCCESS)
557
0
    uvwasi_serdes_write_fdstat_t(memory.data, buf, &stats);
558
559
0
  return err;
560
0
}
561
562
uint32_t WASI::FdFdstatSetFlags(WASI& wasi,
563
                                WasmMemory,
564
                                uint32_t fd,
565
0
                                uint32_t flags) {
566
0
  Debug(wasi, "fd_fdstat_set_flags(%d, %d)\n", fd, flags);
567
0
  return uvwasi_fd_fdstat_set_flags(&wasi.uvw_, fd, flags);
568
0
}
569
570
uint32_t WASI::FdFdstatSetRights(WASI& wasi,
571
                                 WasmMemory,
572
                                 uint32_t fd,
573
                                 uint64_t fs_rights_base,
574
0
                                 uint64_t fs_rights_inheriting) {
575
0
  Debug(wasi,
576
0
        "fd_fdstat_set_rights(%d, %d, %d)\n",
577
0
        fd,
578
0
        fs_rights_base,
579
0
        fs_rights_inheriting);
580
0
  return uvwasi_fd_fdstat_set_rights(
581
0
      &wasi.uvw_, fd, fs_rights_base, fs_rights_inheriting);
582
0
}
583
584
uint32_t WASI::FdFilestatGet(WASI& wasi,
585
                             WasmMemory memory,
586
                             uint32_t fd,
587
0
                             uint32_t buf) {
588
0
  Debug(wasi, "fd_filestat_get(%d, %d)\n", fd, buf);
589
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf, UVWASI_SERDES_SIZE_filestat_t);
590
0
  uvwasi_filestat_t stats;
591
0
  uvwasi_errno_t err = uvwasi_fd_filestat_get(&wasi.uvw_, fd, &stats);
592
593
0
  if (err == UVWASI_ESUCCESS)
594
0
    uvwasi_serdes_write_filestat_t(memory.data, buf, &stats);
595
596
0
  return err;
597
0
}
598
599
uint32_t WASI::FdFilestatSetSize(WASI& wasi,
600
                                 WasmMemory,
601
                                 uint32_t fd,
602
0
                                 uint64_t st_size) {
603
0
  Debug(wasi, "fd_filestat_set_size(%d, %d)\n", fd, st_size);
604
0
  return uvwasi_fd_filestat_set_size(&wasi.uvw_, fd, st_size);
605
0
}
606
607
uint32_t WASI::FdFilestatSetTimes(WASI& wasi,
608
                                  WasmMemory,
609
                                  uint32_t fd,
610
                                  uint64_t st_atim,
611
                                  uint64_t st_mtim,
612
0
                                  uint32_t fst_flags) {
613
0
  Debug(wasi,
614
0
        "fd_filestat_set_times(%d, %d, %d, %d)\n",
615
0
        fd,
616
0
        st_atim,
617
0
        st_mtim,
618
0
        fst_flags);
619
0
  return uvwasi_fd_filestat_set_times(
620
0
      &wasi.uvw_, fd, st_atim, st_mtim, fst_flags);
621
0
}
622
623
uint32_t WASI::FdPread(WASI& wasi,
624
                       WasmMemory memory,
625
                       uint32_t fd,
626
                       uint32_t iovs_ptr,
627
                       uint32_t iovs_len,
628
                       uint64_t offset,
629
0
                       uint32_t nread_ptr) {
630
0
  Debug(wasi,
631
0
        "uvwasi_fd_pread(%d, %d, %d, %d, %d)\n",
632
0
        fd,
633
0
        iovs_ptr,
634
0
        iovs_len,
635
0
        offset,
636
0
        nread_ptr);
637
0
  CHECK_BOUNDS_OR_RETURN(
638
0
      memory.size, iovs_ptr, iovs_len * UVWASI_SERDES_SIZE_iovec_t);
639
0
  CHECK_BOUNDS_OR_RETURN(memory.size, nread_ptr, UVWASI_SERDES_SIZE_size_t);
640
0
  std::vector<uvwasi_iovec_t> iovs(iovs_len);
641
0
  uvwasi_errno_t err;
642
643
0
  err = uvwasi_serdes_readv_iovec_t(
644
0
      memory.data, memory.size, iovs_ptr, iovs.data(), iovs_len);
645
0
  if (err != UVWASI_ESUCCESS) {
646
0
    return err;
647
0
  }
648
649
0
  uvwasi_size_t nread;
650
0
  err = uvwasi_fd_pread(&wasi.uvw_, fd, iovs.data(), iovs_len, offset, &nread);
651
0
  if (err == UVWASI_ESUCCESS)
652
0
    uvwasi_serdes_write_size_t(memory.data, nread_ptr, nread);
653
654
0
  return err;
655
0
}
656
657
uint32_t WASI::FdPrestatGet(WASI& wasi,
658
                            WasmMemory memory,
659
                            uint32_t fd,
660
0
                            uint32_t buf) {
661
0
  Debug(wasi, "fd_prestat_get(%d, %d)\n", fd, buf);
662
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf, UVWASI_SERDES_SIZE_prestat_t);
663
0
  uvwasi_prestat_t prestat;
664
0
  uvwasi_errno_t err = uvwasi_fd_prestat_get(&wasi.uvw_, fd, &prestat);
665
666
0
  if (err == UVWASI_ESUCCESS)
667
0
    uvwasi_serdes_write_prestat_t(memory.data, buf, &prestat);
668
669
0
  return err;
670
0
}
671
672
uint32_t WASI::FdPrestatDirName(WASI& wasi,
673
                                WasmMemory memory,
674
                                uint32_t fd,
675
                                uint32_t path_ptr,
676
0
                                uint32_t path_len) {
677
0
  Debug(wasi, "fd_prestat_dir_name(%d, %d, %d)\n", fd, path_ptr, path_len);
678
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
679
0
  return uvwasi_fd_prestat_dir_name(
680
0
      &wasi.uvw_, fd, &memory.data[path_ptr], path_len);
681
0
}
682
683
uint32_t WASI::FdPwrite(WASI& wasi,
684
                        WasmMemory memory,
685
                        uint32_t fd,
686
                        uint32_t iovs_ptr,
687
                        uint32_t iovs_len,
688
                        uint64_t offset,
689
0
                        uint32_t nwritten_ptr) {
690
0
  Debug(wasi,
691
0
        "uvwasi_fd_pwrite(%d, %d, %d, %d, %d)\n",
692
0
        fd,
693
0
        iovs_ptr,
694
0
        iovs_len,
695
0
        offset,
696
0
        nwritten_ptr);
697
0
  CHECK_BOUNDS_OR_RETURN(
698
0
      memory.size, iovs_ptr, iovs_len * UVWASI_SERDES_SIZE_ciovec_t);
699
0
  CHECK_BOUNDS_OR_RETURN(memory.size, nwritten_ptr, UVWASI_SERDES_SIZE_size_t);
700
0
  std::vector<uvwasi_ciovec_t> iovs(iovs_len);
701
0
  uvwasi_errno_t err;
702
703
0
  err = uvwasi_serdes_readv_ciovec_t(
704
0
      memory.data, memory.size, iovs_ptr, iovs.data(), iovs_len);
705
0
  if (err != UVWASI_ESUCCESS) {
706
0
    return err;
707
0
  }
708
709
0
  uvwasi_size_t nwritten;
710
0
  err = uvwasi_fd_pwrite(
711
0
      &wasi.uvw_, fd, iovs.data(), iovs_len, offset, &nwritten);
712
0
  if (err == UVWASI_ESUCCESS)
713
0
    uvwasi_serdes_write_size_t(memory.data, nwritten_ptr, nwritten);
714
715
0
  return err;
716
0
}
717
718
uint32_t WASI::FdRead(WASI& wasi,
719
                      WasmMemory memory,
720
                      uint32_t fd,
721
                      uint32_t iovs_ptr,
722
                      uint32_t iovs_len,
723
0
                      uint32_t nread_ptr) {
724
0
  Debug(wasi, "fd_read(%d, %d, %d, %d)\n", fd, iovs_ptr, iovs_len, nread_ptr);
725
0
  CHECK_BOUNDS_OR_RETURN(
726
0
      memory.size, iovs_ptr, iovs_len * UVWASI_SERDES_SIZE_iovec_t);
727
0
  CHECK_BOUNDS_OR_RETURN(memory.size, nread_ptr, UVWASI_SERDES_SIZE_size_t);
728
0
  std::vector<uvwasi_iovec_t> iovs(iovs_len);
729
0
  uvwasi_errno_t err;
730
731
0
  err = uvwasi_serdes_readv_iovec_t(
732
0
      memory.data, memory.size, iovs_ptr, iovs.data(), iovs_len);
733
0
  if (err != UVWASI_ESUCCESS) {
734
0
    return err;
735
0
  }
736
737
0
  uvwasi_size_t nread;
738
0
  err = uvwasi_fd_read(&wasi.uvw_, fd, iovs.data(), iovs_len, &nread);
739
0
  if (err == UVWASI_ESUCCESS)
740
0
    uvwasi_serdes_write_size_t(memory.data, nread_ptr, nread);
741
742
0
  return err;
743
0
}
744
745
uint32_t WASI::FdReaddir(WASI& wasi,
746
                         WasmMemory memory,
747
                         uint32_t fd,
748
                         uint32_t buf_ptr,
749
                         uint32_t buf_len,
750
                         uint64_t cookie,
751
0
                         uint32_t bufused_ptr) {
752
0
  Debug(wasi,
753
0
        "uvwasi_fd_readdir(%d, %d, %d, %d, %d)\n",
754
0
        fd,
755
0
        buf_ptr,
756
0
        buf_len,
757
0
        cookie,
758
0
        bufused_ptr);
759
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf_ptr, buf_len);
760
0
  CHECK_BOUNDS_OR_RETURN(memory.size, bufused_ptr, UVWASI_SERDES_SIZE_size_t);
761
0
  uvwasi_size_t bufused;
762
0
  uvwasi_errno_t err = uvwasi_fd_readdir(
763
0
      &wasi.uvw_, fd, &memory.data[buf_ptr], buf_len, cookie, &bufused);
764
0
  if (err == UVWASI_ESUCCESS)
765
0
    uvwasi_serdes_write_size_t(memory.data, bufused_ptr, bufused);
766
767
0
  return err;
768
0
}
769
770
0
uint32_t WASI::FdRenumber(WASI& wasi, WasmMemory, uint32_t from, uint32_t to) {
771
0
  Debug(wasi, "fd_renumber(%d, %d)\n", from, to);
772
0
  return uvwasi_fd_renumber(&wasi.uvw_, from, to);
773
0
}
774
775
uint32_t WASI::FdSeek(WASI& wasi,
776
                      WasmMemory memory,
777
                      uint32_t fd,
778
                      int64_t offset,
779
                      uint32_t whence,
780
0
                      uint32_t newoffset_ptr) {
781
0
  Debug(wasi, "fd_seek(%d, %d, %d, %d)\n", fd, offset, whence, newoffset_ptr);
782
0
  CHECK_BOUNDS_OR_RETURN(
783
0
      memory.size, newoffset_ptr, UVWASI_SERDES_SIZE_filesize_t);
784
0
  uvwasi_filesize_t newoffset;
785
0
  uvwasi_errno_t err =
786
0
      uvwasi_fd_seek(&wasi.uvw_, fd, offset, whence, &newoffset);
787
0
  if (err == UVWASI_ESUCCESS)
788
0
    uvwasi_serdes_write_filesize_t(memory.data, newoffset_ptr, newoffset);
789
790
0
  return err;
791
0
}
792
793
0
uint32_t WASI::FdSync(WASI& wasi, WasmMemory, uint32_t fd) {
794
0
  Debug(wasi, "fd_sync(%d)\n", fd);
795
0
  return uvwasi_fd_sync(&wasi.uvw_, fd);
796
0
}
797
798
uint32_t WASI::FdTell(WASI& wasi,
799
                      WasmMemory memory,
800
                      uint32_t fd,
801
0
                      uint32_t offset_ptr) {
802
0
  Debug(wasi, "fd_tell(%d, %d)\n", fd, offset_ptr);
803
0
  CHECK_BOUNDS_OR_RETURN(
804
0
      memory.size, offset_ptr, UVWASI_SERDES_SIZE_filesize_t);
805
0
  uvwasi_filesize_t offset;
806
0
  uvwasi_errno_t err = uvwasi_fd_tell(&wasi.uvw_, fd, &offset);
807
808
0
  if (err == UVWASI_ESUCCESS)
809
0
    uvwasi_serdes_write_filesize_t(memory.data, offset_ptr, offset);
810
811
0
  return err;
812
0
}
813
814
uint32_t WASI::FdWrite(WASI& wasi,
815
                       WasmMemory memory,
816
                       uint32_t fd,
817
                       uint32_t iovs_ptr,
818
                       uint32_t iovs_len,
819
0
                       uint32_t nwritten_ptr) {
820
0
  Debug(wasi,
821
0
        "fd_write(%d, %d, %d, %d)\n",
822
0
        fd,
823
0
        iovs_ptr,
824
0
        iovs_len,
825
0
        nwritten_ptr);
826
0
  CHECK_BOUNDS_OR_RETURN(
827
0
      memory.size, iovs_ptr, iovs_len * UVWASI_SERDES_SIZE_ciovec_t);
828
0
  CHECK_BOUNDS_OR_RETURN(memory.size, nwritten_ptr, UVWASI_SERDES_SIZE_size_t);
829
0
  std::vector<uvwasi_ciovec_t> iovs(iovs_len);
830
0
  uvwasi_errno_t err;
831
832
0
  err = uvwasi_serdes_readv_ciovec_t(
833
0
      memory.data, memory.size, iovs_ptr, iovs.data(), iovs_len);
834
0
  if (err != UVWASI_ESUCCESS) {
835
0
    return err;
836
0
  }
837
838
0
  uvwasi_size_t nwritten;
839
0
  err = uvwasi_fd_write(&wasi.uvw_, fd, iovs.data(), iovs_len, &nwritten);
840
0
  if (err == UVWASI_ESUCCESS)
841
0
    uvwasi_serdes_write_size_t(memory.data, nwritten_ptr, nwritten);
842
843
0
  return err;
844
0
}
845
846
uint32_t WASI::PathCreateDirectory(WASI& wasi,
847
                                   WasmMemory memory,
848
                                   uint32_t fd,
849
                                   uint32_t path_ptr,
850
0
                                   uint32_t path_len) {
851
0
  Debug(wasi, "path_create_directory(%d, %d, %d)\n", fd, path_ptr, path_len);
852
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
853
0
  uvwasi_errno_t err = uvwasi_path_create_directory(
854
0
      &wasi.uvw_, fd, &memory.data[path_ptr], path_len);
855
0
  return err;
856
0
}
857
858
uint32_t WASI::PathFilestatGet(WASI& wasi,
859
                               WasmMemory memory,
860
                               uint32_t fd,
861
                               uint32_t flags,
862
                               uint32_t path_ptr,
863
                               uint32_t path_len,
864
0
                               uint32_t buf_ptr) {
865
0
  Debug(wasi,
866
0
        "path_filestat_get(%d, %d, %d)\n",
867
0
        fd,
868
0
        path_ptr,
869
0
        path_len);
870
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
871
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf_ptr, UVWASI_SERDES_SIZE_filestat_t);
872
0
  uvwasi_filestat_t stats;
873
0
  uvwasi_errno_t err = uvwasi_path_filestat_get(
874
0
      &wasi.uvw_, fd, flags, &memory.data[path_ptr], path_len, &stats);
875
0
  if (err == UVWASI_ESUCCESS)
876
0
    uvwasi_serdes_write_filestat_t(memory.data, buf_ptr, &stats);
877
878
0
  return err;
879
0
}
880
881
uint32_t WASI::PathFilestatSetTimes(WASI& wasi,
882
                                    WasmMemory memory,
883
                                    uint32_t fd,
884
                                    uint32_t flags,
885
                                    uint32_t path_ptr,
886
                                    uint32_t path_len,
887
                                    uint64_t st_atim,
888
                                    uint64_t st_mtim,
889
0
                                    uint32_t fst_flags) {
890
0
  Debug(wasi,
891
0
        "path_filestat_set_times(%d, %d, %d, %d, %d, %d, %d)\n",
892
0
        fd,
893
0
        flags,
894
0
        path_ptr,
895
0
        path_len,
896
0
        st_atim,
897
0
        st_mtim,
898
0
        fst_flags);
899
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
900
0
  return uvwasi_path_filestat_set_times(&wasi.uvw_,
901
0
                                        fd,
902
0
                                        flags,
903
0
                                        &memory.data[path_ptr],
904
0
                                        path_len,
905
0
                                        st_atim,
906
0
                                        st_mtim,
907
0
                                        fst_flags);
908
0
}
909
910
uint32_t WASI::PathLink(WASI& wasi,
911
                        WasmMemory memory,
912
                        uint32_t old_fd,
913
                        uint32_t old_flags,
914
                        uint32_t old_path_ptr,
915
                        uint32_t old_path_len,
916
                        uint32_t new_fd,
917
                        uint32_t new_path_ptr,
918
0
                        uint32_t new_path_len) {
919
0
  Debug(wasi,
920
0
        "path_link(%d, %d, %d, %d, %d, %d, %d)\n",
921
0
        old_fd,
922
0
        old_flags,
923
0
        old_path_ptr,
924
0
        old_path_len,
925
0
        new_fd,
926
0
        new_path_ptr,
927
0
        new_path_len);
928
0
  CHECK_BOUNDS_OR_RETURN(memory.size, old_path_ptr, old_path_len);
929
0
  CHECK_BOUNDS_OR_RETURN(memory.size, new_path_ptr, new_path_len);
930
0
  return uvwasi_path_link(&wasi.uvw_,
931
0
                          old_fd,
932
0
                          old_flags,
933
0
                          &memory.data[old_path_ptr],
934
0
                          old_path_len,
935
0
                          new_fd,
936
0
                          &memory.data[new_path_ptr],
937
0
                          new_path_len);
938
0
}
939
940
uint32_t WASI::PathOpen(WASI& wasi,
941
                        WasmMemory memory,
942
                        uint32_t dirfd,
943
                        uint32_t dirflags,
944
                        uint32_t path_ptr,
945
                        uint32_t path_len,
946
                        uint32_t o_flags,
947
                        uint64_t fs_rights_base,
948
                        uint64_t fs_rights_inheriting,
949
                        uint32_t fs_flags,
950
0
                        uint32_t fd_ptr) {
951
0
  Debug(wasi,
952
0
        "path_open(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n",
953
0
        dirfd,
954
0
        dirflags,
955
0
        path_ptr,
956
0
        path_len,
957
0
        o_flags,
958
0
        fs_rights_base,
959
0
        fs_rights_inheriting,
960
0
        fs_flags,
961
0
        fd_ptr);
962
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
963
0
  CHECK_BOUNDS_OR_RETURN(memory.size, fd_ptr, UVWASI_SERDES_SIZE_fd_t);
964
0
  uvwasi_fd_t fd;
965
0
  uvwasi_errno_t err = uvwasi_path_open(&wasi.uvw_,
966
0
                                        dirfd,
967
0
                                        dirflags,
968
0
                                        &memory.data[path_ptr],
969
0
                                        path_len,
970
0
                                        static_cast<uvwasi_oflags_t>(o_flags),
971
0
                                        fs_rights_base,
972
0
                                        fs_rights_inheriting,
973
0
                                        static_cast<uvwasi_fdflags_t>(fs_flags),
974
0
                                        &fd);
975
0
  if (err == UVWASI_ESUCCESS)
976
0
    uvwasi_serdes_write_size_t(memory.data, fd_ptr, fd);
977
978
0
  return err;
979
0
}
980
981
uint32_t WASI::PathReadlink(WASI& wasi,
982
                            WasmMemory memory,
983
                            uint32_t fd,
984
                            uint32_t path_ptr,
985
                            uint32_t path_len,
986
                            uint32_t buf_ptr,
987
                            uint32_t buf_len,
988
0
                            uint32_t bufused_ptr) {
989
0
  Debug(wasi,
990
0
        "path_readlink(%d, %d, %d, %d, %d, %d)\n",
991
0
        fd,
992
0
        path_ptr,
993
0
        path_len,
994
0
        buf_ptr,
995
0
        buf_len,
996
0
        bufused_ptr);
997
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
998
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf_ptr, buf_len);
999
0
  CHECK_BOUNDS_OR_RETURN(memory.size, bufused_ptr, UVWASI_SERDES_SIZE_size_t);
1000
0
  uvwasi_size_t bufused;
1001
0
  uvwasi_errno_t err = uvwasi_path_readlink(&wasi.uvw_,
1002
0
                                            fd,
1003
0
                                            &memory.data[path_ptr],
1004
0
                                            path_len,
1005
0
                                            &memory.data[buf_ptr],
1006
0
                                            buf_len,
1007
0
                                            &bufused);
1008
0
  if (err == UVWASI_ESUCCESS)
1009
0
    uvwasi_serdes_write_size_t(memory.data, bufused_ptr, bufused);
1010
1011
0
  return err;
1012
0
}
1013
1014
uint32_t WASI::PathRemoveDirectory(WASI& wasi,
1015
                                   WasmMemory memory,
1016
                                   uint32_t fd,
1017
                                   uint32_t path_ptr,
1018
0
                                   uint32_t path_len) {
1019
0
  Debug(wasi, "path_remove_directory(%d, %d, %d)\n", fd, path_ptr, path_len);
1020
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
1021
0
  return uvwasi_path_remove_directory(
1022
0
      &wasi.uvw_, fd, &memory.data[path_ptr], path_len);
1023
0
}
1024
1025
uint32_t WASI::PathRename(WASI& wasi,
1026
                          WasmMemory memory,
1027
                          uint32_t old_fd,
1028
                          uint32_t old_path_ptr,
1029
                          uint32_t old_path_len,
1030
                          uint32_t new_fd,
1031
                          uint32_t new_path_ptr,
1032
0
                          uint32_t new_path_len) {
1033
0
  Debug(wasi,
1034
0
        "path_rename(%d, %d, %d, %d, %d, %d)\n",
1035
0
        old_fd,
1036
0
        old_path_ptr,
1037
0
        old_path_len,
1038
0
        new_fd,
1039
0
        new_path_ptr,
1040
0
        new_path_len);
1041
0
  CHECK_BOUNDS_OR_RETURN(memory.size, old_path_ptr, old_path_len);
1042
0
  CHECK_BOUNDS_OR_RETURN(memory.size, new_path_ptr, new_path_len);
1043
0
  return uvwasi_path_rename(&wasi.uvw_,
1044
0
                            old_fd,
1045
0
                            &memory.data[old_path_ptr],
1046
0
                            old_path_len,
1047
0
                            new_fd,
1048
0
                            &memory.data[new_path_ptr],
1049
0
                            new_path_len);
1050
0
}
1051
1052
uint32_t WASI::PathSymlink(WASI& wasi,
1053
                           WasmMemory memory,
1054
                           uint32_t old_path_ptr,
1055
                           uint32_t old_path_len,
1056
                           uint32_t fd,
1057
                           uint32_t new_path_ptr,
1058
0
                           uint32_t new_path_len) {
1059
0
  Debug(wasi,
1060
0
        "path_symlink(%d, %d, %d, %d, %d)\n",
1061
0
        old_path_ptr,
1062
0
        old_path_len,
1063
0
        fd,
1064
0
        new_path_ptr,
1065
0
        new_path_len);
1066
0
  CHECK_BOUNDS_OR_RETURN(memory.size, old_path_ptr, old_path_len);
1067
0
  CHECK_BOUNDS_OR_RETURN(memory.size, new_path_ptr, new_path_len);
1068
0
  return uvwasi_path_symlink(&wasi.uvw_,
1069
0
                             &memory.data[old_path_ptr],
1070
0
                             old_path_len,
1071
0
                             fd,
1072
0
                             &memory.data[new_path_ptr],
1073
0
                             new_path_len);
1074
0
}
1075
1076
uint32_t WASI::PathUnlinkFile(WASI& wasi,
1077
                              WasmMemory memory,
1078
                              uint32_t fd,
1079
                              uint32_t path_ptr,
1080
0
                              uint32_t path_len) {
1081
0
  Debug(wasi, "path_unlink_file(%d, %d, %d)\n", fd, path_ptr, path_len);
1082
0
  CHECK_BOUNDS_OR_RETURN(memory.size, path_ptr, path_len);
1083
0
  return uvwasi_path_unlink_file(
1084
0
      &wasi.uvw_, fd, &memory.data[path_ptr], path_len);
1085
0
}
1086
1087
uint32_t WASI::PollOneoff(WASI& wasi,
1088
                          WasmMemory memory,
1089
                          uint32_t in_ptr,
1090
                          uint32_t out_ptr,
1091
                          uint32_t nsubscriptions,
1092
0
                          uint32_t nevents_ptr) {
1093
0
  Debug(wasi,
1094
0
        "poll_oneoff(%d, %d, %d, %d)\n",
1095
0
        in_ptr,
1096
0
        out_ptr,
1097
0
        nsubscriptions,
1098
0
        nevents_ptr);
1099
0
  CHECK_BOUNDS_OR_RETURN(
1100
0
      memory.size, in_ptr, nsubscriptions * UVWASI_SERDES_SIZE_subscription_t);
1101
0
  CHECK_BOUNDS_OR_RETURN(
1102
0
      memory.size, out_ptr, nsubscriptions * UVWASI_SERDES_SIZE_event_t);
1103
0
  CHECK_BOUNDS_OR_RETURN(memory.size, nevents_ptr, UVWASI_SERDES_SIZE_size_t);
1104
0
  std::vector<uvwasi_subscription_t> in(nsubscriptions);
1105
0
  std::vector<uvwasi_event_t> out(nsubscriptions);
1106
1107
0
  for (uint32_t i = 0; i < nsubscriptions; ++i) {
1108
0
    uvwasi_serdes_read_subscription_t(memory.data, in_ptr, &in[i]);
1109
0
    in_ptr += UVWASI_SERDES_SIZE_subscription_t;
1110
0
  }
1111
1112
0
  uvwasi_size_t nevents;
1113
0
  uvwasi_errno_t err = uvwasi_poll_oneoff(
1114
0
      &wasi.uvw_, in.data(), out.data(), nsubscriptions, &nevents);
1115
0
  if (err == UVWASI_ESUCCESS) {
1116
0
    uvwasi_serdes_write_size_t(memory.data, nevents_ptr, nevents);
1117
1118
0
    for (uint32_t i = 0; i < nsubscriptions; ++i) {
1119
0
      uvwasi_serdes_write_event_t(memory.data, out_ptr, &out[i]);
1120
0
      out_ptr += UVWASI_SERDES_SIZE_event_t;
1121
0
    }
1122
0
  }
1123
1124
0
  return err;
1125
0
}
1126
1127
0
void WASI::ProcExit(WASI& wasi, WasmMemory, uint32_t code) {
1128
0
  Debug(wasi, "proc_exit(%d)\n", code);
1129
0
  uvwasi_proc_exit(&wasi.uvw_, code);
1130
0
}
1131
1132
0
uint32_t WASI::ProcRaise(WASI& wasi, WasmMemory, uint32_t sig) {
1133
0
  Debug(wasi, "proc_raise(%d)\n", sig);
1134
0
  return uvwasi_proc_raise(&wasi.uvw_, sig);
1135
0
}
1136
1137
uint32_t WASI::RandomGet(WASI& wasi,
1138
                         WasmMemory memory,
1139
                         uint32_t buf_ptr,
1140
0
                         uint32_t buf_len) {
1141
0
  Debug(wasi, "random_get(%d, %d)\n", buf_ptr, buf_len);
1142
0
  CHECK_BOUNDS_OR_RETURN(memory.size, buf_ptr, buf_len);
1143
0
  return uvwasi_random_get(&wasi.uvw_, &memory.data[buf_ptr], buf_len);
1144
0
}
1145
1146
0
uint32_t WASI::SchedYield(WASI& wasi, WasmMemory) {
1147
0
  Debug(wasi, "sched_yield()\n");
1148
0
  return uvwasi_sched_yield(&wasi.uvw_);
1149
0
}
1150
1151
uint32_t WASI::SockAccept(WASI& wasi,
1152
                          WasmMemory memory,
1153
                          uint32_t sock,
1154
                          uint32_t flags,
1155
0
                          uint32_t fd_ptr) {
1156
0
  Debug(wasi, "sock_accept(%d, %d, %d)\n", sock, flags, fd_ptr);
1157
0
  uvwasi_fd_t fd;
1158
0
  uvwasi_errno_t err = uvwasi_sock_accept(&wasi.uvw_, sock, flags, &fd);
1159
1160
0
  if (err == UVWASI_ESUCCESS)
1161
0
    uvwasi_serdes_write_size_t(memory.data, fd_ptr, fd);
1162
1163
0
  return err;
1164
0
}
1165
1166
uint32_t WASI::SockRecv(WASI& wasi,
1167
                        WasmMemory memory,
1168
                        uint32_t sock,
1169
                        uint32_t ri_data_ptr,
1170
                        uint32_t ri_data_len,
1171
                        uint32_t ri_flags,
1172
                        uint32_t ro_datalen_ptr,
1173
0
                        uint32_t ro_flags_ptr) {
1174
0
  Debug(wasi,
1175
0
        "sock_recv(%d, %d, %d, %d, %d, %d)\n",
1176
0
        sock,
1177
0
        ri_data_ptr,
1178
0
        ri_data_len,
1179
0
        ri_flags,
1180
0
        ro_datalen_ptr,
1181
0
        ro_flags_ptr);
1182
0
  CHECK_BOUNDS_OR_RETURN(
1183
0
      memory.size, ri_data_ptr, ri_data_len * UVWASI_SERDES_SIZE_iovec_t);
1184
0
  CHECK_BOUNDS_OR_RETURN(memory.size, ro_datalen_ptr, 4);
1185
0
  CHECK_BOUNDS_OR_RETURN(memory.size, ro_flags_ptr, 4);
1186
0
  std::vector<uvwasi_iovec_t> ri_data(ri_data_len);
1187
0
  uvwasi_errno_t err = uvwasi_serdes_readv_iovec_t(
1188
0
      memory.data, memory.size, ri_data_ptr, ri_data.data(), ri_data_len);
1189
0
  if (err != UVWASI_ESUCCESS) {
1190
0
    return err;
1191
0
  }
1192
1193
0
  uvwasi_size_t ro_datalen;
1194
0
  uvwasi_roflags_t ro_flags;
1195
0
  err = uvwasi_sock_recv(&wasi.uvw_,
1196
0
                         sock,
1197
0
                         ri_data.data(),
1198
0
                         ri_data_len,
1199
0
                         ri_flags,
1200
0
                         &ro_datalen,
1201
0
                         &ro_flags);
1202
0
  if (err == UVWASI_ESUCCESS) {
1203
0
    uvwasi_serdes_write_size_t(memory.data, ro_datalen_ptr, ro_datalen);
1204
0
    uvwasi_serdes_write_roflags_t(memory.data, ro_flags_ptr, ro_flags);
1205
0
  }
1206
1207
0
  return err;
1208
0
}
1209
1210
uint32_t WASI::SockSend(WASI& wasi,
1211
                        WasmMemory memory,
1212
                        uint32_t sock,
1213
                        uint32_t si_data_ptr,
1214
                        uint32_t si_data_len,
1215
                        uint32_t si_flags,
1216
0
                        uint32_t so_datalen_ptr) {
1217
0
  Debug(wasi,
1218
0
        "sock_send(%d, %d, %d, %d, %d)\n",
1219
0
        sock,
1220
0
        si_data_ptr,
1221
0
        si_data_len,
1222
0
        si_flags,
1223
0
        so_datalen_ptr);
1224
0
  CHECK_BOUNDS_OR_RETURN(
1225
0
      memory.size, si_data_ptr, si_data_len * UVWASI_SERDES_SIZE_ciovec_t);
1226
0
  CHECK_BOUNDS_OR_RETURN(
1227
0
      memory.size, so_datalen_ptr, UVWASI_SERDES_SIZE_size_t);
1228
0
  std::vector<uvwasi_ciovec_t> si_data(si_data_len);
1229
0
  uvwasi_errno_t err = uvwasi_serdes_readv_ciovec_t(
1230
0
      memory.data, memory.size, si_data_ptr, si_data.data(), si_data_len);
1231
0
  if (err != UVWASI_ESUCCESS) {
1232
0
    return err;
1233
0
  }
1234
1235
0
  uvwasi_size_t so_datalen;
1236
0
  err = uvwasi_sock_send(
1237
0
      &wasi.uvw_, sock, si_data.data(), si_data_len, si_flags, &so_datalen);
1238
0
  if (err == UVWASI_ESUCCESS)
1239
0
    uvwasi_serdes_write_size_t(memory.data, so_datalen_ptr, so_datalen);
1240
1241
0
  return err;
1242
0
}
1243
1244
uint32_t WASI::SockShutdown(WASI& wasi,
1245
                            WasmMemory,
1246
                            uint32_t sock,
1247
0
                            uint32_t how) {
1248
0
  Debug(wasi, "sock_shutdown(%d, %d)\n", sock, how);
1249
0
  return uvwasi_sock_shutdown(&wasi.uvw_, sock, how);
1250
0
}
1251
1252
0
void WASI::_SetMemory(const FunctionCallbackInfo<Value>& args) {
1253
0
  WASI* wasi;
1254
0
  ASSIGN_OR_RETURN_UNWRAP(&wasi, args.This());
1255
0
  CHECK_EQ(args.Length(), 1);
1256
0
  if (!args[0]->IsWasmMemoryObject()) {
1257
0
    return node::THROW_ERR_INVALID_ARG_TYPE(
1258
0
        wasi->env(),
1259
0
        "\"instance.exports.memory\" property must be a WebAssembly.Memory "
1260
0
        "object");
1261
0
  }
1262
0
  wasi->memory_.Reset(wasi->env()->isolate(), args[0].As<WasmMemoryObject>());
1263
0
}
1264
1265
static void InitializePreview1(Local<Object> target,
1266
                               Local<Value> unused,
1267
                               Local<Context> context,
1268
0
                               void* priv) {
1269
0
  Environment* env = Environment::GetCurrent(context);
1270
0
  Isolate* isolate = env->isolate();
1271
1272
0
  Local<FunctionTemplate> tmpl = NewFunctionTemplate(isolate, WASI::New);
1273
0
  tmpl->InstanceTemplate()->SetInternalFieldCount(WASI::kInternalFieldCount);
1274
1275
0
#define V(F, name)                                                             \
1276
0
  SetFunction<decltype(&WASI::F), WASI::F>(WASI::F, env, name, tmpl);
1277
1278
0
  V(ArgsGet, "args_get")
1279
0
  V(ArgsSizesGet, "args_sizes_get")
1280
0
  V(ClockResGet, "clock_res_get")
1281
0
  V(ClockTimeGet, "clock_time_get")
1282
0
  V(EnvironGet, "environ_get")
1283
0
  V(EnvironSizesGet, "environ_sizes_get")
1284
0
  V(FdAdvise, "fd_advise")
1285
0
  V(FdAllocate, "fd_allocate")
1286
0
  V(FdClose, "fd_close")
1287
0
  V(FdDatasync, "fd_datasync")
1288
0
  V(FdFdstatGet, "fd_fdstat_get")
1289
0
  V(FdFdstatSetFlags, "fd_fdstat_set_flags")
1290
0
  V(FdFdstatSetRights, "fd_fdstat_set_rights")
1291
0
  V(FdFilestatGet, "fd_filestat_get")
1292
0
  V(FdFilestatSetSize, "fd_filestat_set_size")
1293
0
  V(FdFilestatSetTimes, "fd_filestat_set_times")
1294
0
  V(FdPread, "fd_pread")
1295
0
  V(FdPrestatGet, "fd_prestat_get")
1296
0
  V(FdPrestatDirName, "fd_prestat_dir_name")
1297
0
  V(FdPwrite, "fd_pwrite")
1298
0
  V(FdRead, "fd_read")
1299
0
  V(FdReaddir, "fd_readdir")
1300
0
  V(FdRenumber, "fd_renumber")
1301
0
  V(FdSeek, "fd_seek")
1302
0
  V(FdSync, "fd_sync")
1303
0
  V(FdTell, "fd_tell")
1304
0
  V(FdWrite, "fd_write")
1305
0
  V(PathCreateDirectory, "path_create_directory")
1306
0
  V(PathFilestatGet, "path_filestat_get")
1307
0
  V(PathFilestatSetTimes, "path_filestat_set_times")
1308
0
  V(PathLink, "path_link")
1309
0
  V(PathOpen, "path_open")
1310
0
  V(PathReadlink, "path_readlink")
1311
0
  V(PathRemoveDirectory, "path_remove_directory")
1312
0
  V(PathRename, "path_rename")
1313
0
  V(PathSymlink, "path_symlink")
1314
0
  V(PathUnlinkFile, "path_unlink_file")
1315
0
  V(PollOneoff, "poll_oneoff")
1316
0
  V(ProcExit, "proc_exit")
1317
0
  V(ProcRaise, "proc_raise")
1318
0
  V(RandomGet, "random_get")
1319
0
  V(SchedYield, "sched_yield")
1320
0
  V(SockAccept, "sock_accept")
1321
0
  V(SockRecv, "sock_recv")
1322
0
  V(SockSend, "sock_send")
1323
0
  V(SockShutdown, "sock_shutdown")
1324
0
#undef V
1325
1326
0
  SetInstanceMethod(isolate, tmpl, "_setMemory", WASI::_SetMemory);
1327
1328
0
  SetConstructorFunction(context, target, "WASI", tmpl);
1329
0
}
1330
1331
}  // namespace wasi
1332
}  // namespace node
1333
1334
NODE_BINDING_CONTEXT_AWARE_INTERNAL(wasi, node::wasi::InitializePreview1)