use of org.graalvm.wasm.exception.WasmJsApiException in project graal by oracle.
the class WebAssembly method memSetGrowCallback.
private static Object memSetGrowCallback(Object[] args) {
InteropLibrary lib = InteropLibrary.getUncached();
if (!(args[0] instanceof WasmMemory)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "First argument must be wasm memory");
}
if (!lib.isExecutable(args[1])) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "Second argument must be executable");
}
WasmMemory memory = (WasmMemory) args[0];
return memSetGrowCallback(memory, args[1]);
}
use of org.graalvm.wasm.exception.WasmJsApiException in project graal by oracle.
the class WebAssembly method memGrow.
private static Object memGrow(Object[] args) {
checkArgumentCount(args, 2);
if (!(args[0] instanceof WasmMemory)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "First argument must be wasm memory");
}
if (!(args[1] instanceof Integer)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "Second argument must be integer");
}
WasmMemory memory = (WasmMemory) args[0];
int delta = (Integer) args[1];
return memGrow(memory, delta);
}
use of org.graalvm.wasm.exception.WasmJsApiException in project graal by oracle.
the class WebAssembly method instanceExport.
private static Object instanceExport(Object[] args) {
checkArgumentCount(args, 2);
if (!(args[0] instanceof WasmInstance)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "First argument must be wasm instance");
}
if (!(args[1] instanceof String)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "Second argument must be string");
}
WasmInstance instance = (WasmInstance) args[0];
String name = (String) args[1];
return instanceExport(instance, name);
}
use of org.graalvm.wasm.exception.WasmJsApiException in project graal by oracle.
the class WebAssembly method tableRead.
private static Object tableRead(Object[] args) {
checkArgumentCount(args, 2);
if (!(args[0] instanceof WasmTable)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "First argument must be wasm table");
}
if (!(args[1] instanceof Integer)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "Second argument must be integer");
}
WasmTable table = (WasmTable) args[0];
int index = (Integer) args[1];
return tableRead(table, index);
}
use of org.graalvm.wasm.exception.WasmJsApiException in project graal by oracle.
the class WebAssembly method tableGrow.
private static Object tableGrow(Object[] args) {
checkArgumentCount(args, 2);
if (!(args[0] instanceof WasmTable)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "First argument must be wasm table");
}
if (!(args[1] instanceof Integer)) {
throw new WasmJsApiException(WasmJsApiException.Kind.TypeError, "Second argument must be integer");
}
WasmTable table = (WasmTable) args[0];
int delta = (Integer) args[1];
return tableGrow(table, delta);
}
Aggregations