Coverage Report

Created: 2025-10-31 09:06

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