Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
specialize and return ASCII-8BIT data
  • Loading branch information
@krmbn0576
krmbn0576 committed Feb 5, 2024
commit edc438e68ce043abdc2667a207aeb1c8e5836f0b
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,9 +69,17 @@ export function addRbJsAbiHostToImports(imports, obj, get_export){
imports["rb-js-abi-host"]["js-value-to-string: func(value: handle<js-abi-value>) -> string"] = function(arg0, arg1){
const memory = get_export("memory");
const realloc = get_export("cabi_realloc");
const ret0 = obj.jsValueToString(resources0.get(arg0));
const ptr0 = utf8_encode(ret0, realloc, memory);
const len0 = UTF8_ENCODED_LEN;
let ret0, ptr0, len0;
ret0 = resources0.get(arg0);
if (ret0 instanceof ArrayBuffer){
ptr0 = realloc(0, 0, 1, ret0.byteLength);
len0 = ret0.byteLength;
new Uint8Array(memory.buffer).set(new Uint8Array(ret0), ptr0);
} else{
ret0 = obj.jsValueToString(ret0);
ptr0 = utf8_encode(ret0, realloc, memory);
len0 = UTF8_ENCODED_LEN;
}
data_view(memory).setInt32(arg1 + 4, len0, true);
data_view(memory).setInt32(arg1 + 0, ptr0, true);
};
Expand DownExpand Up@@ -275,4 +283,4 @@ export function addRbJsAbiHostToImports(imports, obj, get_export){
if (obj.dropJsAbiValue)
obj.dropJsAbiValue(val);
};
}
}