mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 06:29:38 +02:00
* WebAssembly high level code generator: use the global.get and global.set
instructions to access references to symbols of type AT_WASM_GLOBAL
This commit is contained in:
parent
7cefe8a822
commit
f32ef29253
@ -1054,8 +1054,16 @@ implementation
|
|||||||
ref.index:=NR_NO;
|
ref.index:=NR_NO;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// setting up memory offset
|
if assigned(ref.symbol) and (ref.symbol.typ=AT_WASM_GLOBAL) then
|
||||||
if ref.refaddr=addr_got_tls then
|
begin
|
||||||
|
if ref.base<>NR_NO then
|
||||||
|
internalerror(2022072601);
|
||||||
|
if ref.index<>NR_NO then
|
||||||
|
internalerror(2022072602);
|
||||||
|
if ref.offset<>0 then
|
||||||
|
internalerror(2022072603);
|
||||||
|
end
|
||||||
|
else if ref.refaddr=addr_got_tls then
|
||||||
begin
|
begin
|
||||||
if not assigned(ref.symbol) then
|
if not assigned(ref.symbol) then
|
||||||
internalerror(2022071405);
|
internalerror(2022071405);
|
||||||
@ -2395,7 +2403,15 @@ implementation
|
|||||||
getputmemf32 : array [boolean] of TAsmOp = (a_f32_store, a_f32_load);
|
getputmemf32 : array [boolean] of TAsmOp = (a_f32_store, a_f32_load);
|
||||||
getputmemf64 : array [boolean] of TAsmOp = (a_f64_store, a_f64_load);
|
getputmemf64 : array [boolean] of TAsmOp = (a_f64_store, a_f64_load);
|
||||||
begin
|
begin
|
||||||
if (ref.base<>NR_LOCAL_STACK_POINTER_REG) or assigned(ref.symbol) then
|
if assigned(ref.symbol) and (ref.symbol.typ=AT_WASM_GLOBAL) then
|
||||||
|
begin
|
||||||
|
if isload then
|
||||||
|
result:=a_global_get
|
||||||
|
else
|
||||||
|
result:=a_global_set;
|
||||||
|
finishandval:=-1;
|
||||||
|
end
|
||||||
|
else if (ref.base<>NR_LOCAL_STACK_POINTER_REG) or assigned(ref.symbol) then
|
||||||
begin
|
begin
|
||||||
{ -> either a global (static) field, or a regular field. If a regular
|
{ -> either a global (static) field, or a regular field. If a regular
|
||||||
field, then ref.base contains the self pointer, otherwise
|
field, then ref.base contains the self pointer, otherwise
|
||||||
|
Loading…
Reference in New Issue
Block a user