mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 16:59:11 +02:00
+ introduced is_wasm_externref(tdef) helper
This commit is contained in:
parent
022d2804a9
commit
c33f47a707
@ -208,6 +208,9 @@ const
|
|||||||
{# Returns true if p is a WebAssembly funcref reference type }
|
{# Returns true if p is a WebAssembly funcref reference type }
|
||||||
function is_wasm_funcref(p : tdef): boolean;
|
function is_wasm_funcref(p : tdef): boolean;
|
||||||
|
|
||||||
|
{# Returns true if p is a WebAssembly externref reference type }
|
||||||
|
function is_wasm_externref(p : tdef): boolean;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -225,6 +228,11 @@ implementation
|
|||||||
result:=(p.typ=procvardef) and (po_wasm_funcref in tprocvardef(p).procoptions);
|
result:=(p.typ=procvardef) and (po_wasm_funcref in tprocvardef(p).procoptions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function is_wasm_externref(p: tdef): boolean;
|
||||||
|
begin
|
||||||
|
result:=(p.typ=pointerdef) and (tcpupointerdef(p).is_wasm_externref);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
tcpuproptertysym
|
tcpuproptertysym
|
||||||
@ -298,7 +306,7 @@ implementation
|
|||||||
prm := tcpuparavarsym(pd.paras[i]);
|
prm := tcpuparavarsym(pd.paras[i]);
|
||||||
if is_wasm_funcref(prm.vardef) then
|
if is_wasm_funcref(prm.vardef) then
|
||||||
result.add_param(wbt_funcref)
|
result.add_param(wbt_funcref)
|
||||||
else if (prm.vardef.typ=pointerdef) and (tcpupointerdef(prm.vardef).is_wasm_externref) then
|
else if is_wasm_externref(prm.vardef) then
|
||||||
result.add_param(wbt_externref)
|
result.add_param(wbt_externref)
|
||||||
else case prm.paraloc[callerside].Size of
|
else case prm.paraloc[callerside].Size of
|
||||||
OS_8..OS_32, OS_S8..OS_S32:
|
OS_8..OS_32, OS_S8..OS_S32:
|
||||||
|
@ -107,7 +107,7 @@ unit tgcpu;
|
|||||||
|
|
||||||
if is_wasm_funcref(def) then
|
if is_wasm_funcref(def) then
|
||||||
wbt := wbt_funcref
|
wbt := wbt_funcref
|
||||||
else if (def.typ=pointerdef) and (tcpupointerdef(def).is_wasm_externref) then
|
else if is_wasm_externref(def) then
|
||||||
wbt := wbt_externref
|
wbt := wbt_externref
|
||||||
else if is_pointer(def) then
|
else if is_pointer(def) then
|
||||||
wbt := wbt_i32 // wasm32
|
wbt := wbt_i32 // wasm32
|
||||||
|
Loading…
Reference in New Issue
Block a user