+ added the memory.copy and memory.fill WebAssembly instructions

This commit is contained in:
Nikolay Nikolov 2021-10-02 19:35:26 +03:00
parent cc5ee6b868
commit 026d23632a
6 changed files with 25 additions and 2 deletions

View File

@ -86,7 +86,7 @@ interface
id : tasm;
idtxt : string[12];
asmbin : string[16];
asmcmd : string[100];
asmcmd : string[113];
supported_targets : set of tsystem;
flags : set of tasmflags;
labelprefix : string[3];

View File

@ -542,6 +542,10 @@ uses
a_memory_size,
a_memory_grow:
result:=2;
a_memory_copy:
result:=4;
a_memory_fill:
result:=3;
a_i32_const:
begin
if ops<>1 then
@ -873,6 +877,19 @@ uses
WriteByte($40);
WriteByte($00);
end;
a_memory_copy:
begin
WriteByte($FC);
WriteUleb(10);
WriteByte($00);
WriteByte($00);
end;
a_memory_fill:
begin
WriteByte($FC);
WriteUleb(11);
WriteByte($00);
end;
a_i32_eqz:
WriteByte($45);
a_i32_eq:

View File

@ -247,7 +247,7 @@ implementation
id : as_wasm32_llvm_mc;
idtxt : 'LLVM-MC';
asmbin : 'llvm-mc';
asmcmd : '--assemble --arch=wasm32 -mattr=+sign-ext,+exception-handling --filetype=obj -o $OBJ $EXTRAOPT $ASM';
asmcmd : '--assemble --arch=wasm32 -mattr=+sign-ext,+exception-handling,+bulk-memory --filetype=obj -o $OBJ $EXTRAOPT $ASM';
supported_targets : [system_wasm32_embedded,system_wasm32_wasi];
flags : [af_smartlink_sections];
labelprefix : '.L';

View File

@ -84,6 +84,8 @@ uses
a_i32_store8, a_i32_store16, a_i64_store8, a_i64_store16, a_i64_store32,
// additional memory
a_memory_grow, a_memory_size,
// bulk memory operations
a_memory_copy, a_memory_fill,
// exceptions
a_try,a_catch,a_catch_all,a_delegate,a_throw,a_rethrow,a_end_try
);

View File

@ -83,6 +83,8 @@ interface
'i32.store8', 'i32.store16', 'i64.store8', 'i64.store16', 'i64.store32',
// additional memory
'memory.grow 0', 'memory.size 0',
// bulk memory operations
'memory.copy 0,0', 'memory.fill 0',
// exceptions
'try','catch','catch_all','delegate','throw','rethrow','end_try'
);

View File

@ -67,6 +67,8 @@
'i32.store8', 'i32.store16', 'i64.store8', 'i64.store16', 'i64.store32',
// additional memory
'grow_memory', 'current_memory',
// bulk memory operations
'memory.copy', 'memory.fill',
// exceptions
'try','catch','catch_all','delegate','throw','rethrow','end'