+ added intrinsic (for RTL internal use) that emits the WebAssembly atomic.fence instruction

This commit is contained in:
Nikolay Nikolov 2022-05-13 22:46:27 +03:00
parent ddab39dbdc
commit 1d70437017
4 changed files with 21 additions and 2 deletions

View File

@ -17,5 +17,6 @@
in_wasm32_unreachable = in_cpu_first+2,
in_wasm32_throw_fpcexception = in_cpu_first+3,
in_wasm32_memory_copy = in_cpu_first+4,
in_wasm32_memory_fill = in_cpu_first+5
in_wasm32_memory_fill = in_cpu_first+5,
in_wasm32_atomic_fence = in_cpu_first+6

View File

@ -51,6 +51,7 @@ interface
procedure second_memory_copy;
procedure second_unreachable;
procedure second_throw_fpcexception;
procedure second_atomic_fence;
protected
function first_sqr_real: tnode; override;
public
@ -396,6 +397,13 @@ implementation
end;
procedure twasminlinenode.second_atomic_fence;
begin
location_reset(location,LOC_VOID,OS_NO);
current_asmdata.CurrAsmList.Concat(taicpu.op_none(a_atomic_fence));
end;
function twasminlinenode.first_sqr_real: tnode;
begin
expectloc:=LOC_FPUREGISTER;
@ -437,6 +445,11 @@ implementation
CheckParameters(3);
resultdef:=voidtype;
end;
in_wasm32_atomic_fence:
begin
CheckParameters(0);
resultdef:=voidtype;
end;
else
Result:=inherited pass_typecheck_cpu;
end;
@ -453,7 +466,8 @@ implementation
in_wasm32_memory_fill,
in_wasm32_memory_copy,
in_wasm32_unreachable,
in_wasm32_throw_fpcexception:
in_wasm32_throw_fpcexception,
in_wasm32_atomic_fence:
expectloc:=LOC_VOID;
else
Result:=inherited first_cpu;
@ -476,6 +490,8 @@ implementation
second_unreachable;
in_wasm32_throw_fpcexception:
second_throw_fpcexception;
in_wasm32_atomic_fence:
second_atomic_fence;
else
inherited pass_generate_code_cpu;
end;

View File

@ -23,3 +23,4 @@ procedure fpc_wasm32_unreachable;[internproc:fpc_in_wasm32_unreachable];
procedure fpc_wasm32_throw_fpcexception;[internproc:fpc_in_wasm32_throw_fpcexception];
procedure fpc_wasm32_memory_fill(d,val,n: longword);[internproc:fpc_in_wasm32_memory_fill];
procedure fpc_wasm32_memory_copy(d,s,n: longword);[internproc:fpc_in_wasm32_memory_copy];
procedure fpc_wasm32_atomic_fence;[internproc:fpc_in_wasm32_atomic_fence];

View File

@ -18,3 +18,4 @@
fpc_in_wasm32_throw_fpcexception = fpc_in_cpu_first+3;
fpc_in_wasm32_memory_copy = fpc_in_cpu_first+4;
fpc_in_wasm32_memory_fill = fpc_in_cpu_first+5;
fpc_in_wasm32_atomic_fence = fpc_in_cpu_first+6;