-
Notifications
You must be signed in to change notification settings - Fork 717
support gc opcode generated by binaryen #2110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
55a2bfe
c866ac2
f0f846f
8a2fac9
4319f5a
4ec11f8
80ef171
ab871a0
4a68e68
151fa1a
d5c096d
b9d186d
c8e0f5c
f6c9257
799e127
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2370,6 +2370,47 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, | |
&array_elem); | ||
HANDLE_OP_END(); | ||
} | ||
#if WASM_ENABLE_GC_BINARYEN != 0 | ||
case WASM_OP_ARRAY_COPY: | ||
{ | ||
uint32 dst_offset, src_offset, len, src_type_index; | ||
WASMArrayObjectRef src_obj, dst_obj; | ||
|
||
read_leb_uint32(frame_ip, frame_ip_end, type_index); | ||
read_leb_uint32(frame_ip, frame_ip_end, src_type_index); | ||
|
||
dst_obj = POP_REF(); | ||
dst_offset = POP_I32(); | ||
src_obj = POP_REF(); | ||
src_offset = POP_I32(); | ||
len = POP_I32(); | ||
|
||
if (!src_obj || !dst_obj) { | ||
wasm_set_exception(module, "null array object"); | ||
goto got_exception; | ||
} | ||
|
||
if (len > 0) { | ||
if (((uint64)dst_offset + (uint64)len >= UINT32_MAX) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|| (dst_offset + len | ||
>= wasm_array_obj_length(dst_obj)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|| ((uint64)src_offset + (uint64)len | ||
>= UINT32_MAX) | ||
|| (src_offset + len | ||
>= wasm_array_obj_length(src_obj))) { | ||
wasm_set_exception(module, | ||
"array index out of bounds"); | ||
goto got_exception; | ||
} | ||
|
||
wasm_array_obj_copy(dst_obj, dst_offset, src_obj, | ||
src_offset, len); | ||
} | ||
|
||
(void)src_type_index; | ||
HANDLE_OP_END(); | ||
} | ||
#endif | ||
case WASM_OP_ARRAY_LEN: | ||
{ | ||
uint32 array_len; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2208,6 +2208,42 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, | |
&array_elem); | ||
HANDLE_OP_END(); | ||
} | ||
#if WASM_ENABLE_GC_BINARYEN != 0 | ||
case WASM_OP_ARRAY_COPY: | ||
{ | ||
uint32 dst_offset, src_offset, len, src_type_index; | ||
WASMArrayObjectRef src_obj, dst_obj; | ||
|
||
type_idx = read_uint32(frame_ip); | ||
src_type_index = read_uint32(frame_ip); | ||
|
||
dst_obj = POP_REF(); | ||
dst_offset = POP_I32(); | ||
src_obj = POP_REF(); | ||
src_offset = POP_I32(); | ||
len = POP_I32(); | ||
|
||
if (len > 0) { | ||
if (((uint64)dst_offset + (uint64)len >= UINT32_MAX) | ||
|| (dst_offset + len | ||
>= wasm_array_obj_length(dst_obj)) | ||
|| ((uint64)src_offset + (uint64)len | ||
>= UINT32_MAX) | ||
|| (src_offset + len | ||
>= wasm_array_obj_length(src_obj))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
wasm_set_exception(module, | ||
"array index out of bounds"); | ||
goto got_exception; | ||
} | ||
|
||
wasm_array_obj_copy(dst_obj, dst_offset, src_obj, | ||
src_offset, len); | ||
} | ||
|
||
(void)src_type_index; | ||
HANDLE_OP_END(); | ||
} | ||
#endif | ||
case WASM_OP_ARRAY_LEN: | ||
{ | ||
uint32 array_len; | ||
|
Uh oh!
There was an error while loading. Please reload this page.