+ magically insert a void externref type in the System unit, called WasmExternRef

This commit is contained in:
Nikolay Nikolov 2023-06-05 04:26:57 +03:00
parent c925c1aaa6
commit 3e21d24098
3 changed files with 21 additions and 0 deletions

View File

@ -441,6 +441,9 @@ implementation
tarraydef(x86_m256dtype).elementdef:=s64floattype;
tarraydef(x86_m256itype).elementdef:=s32floattype;
{$endif x86}
{$ifdef wasm}
wasmvoidexternreftype:=tcpupointerdefclass.create_externref(voidtype);
{$endif wasm}
set_default_ptr_types;
openchararraytype:=carraydef.create_openarray;
tarraydef(openchararraytype).elementdef:=cansichartype;
@ -627,6 +630,10 @@ implementation
addtype('$__m256d',x86_m256dtype);
addtype('$__m256i',x86_m256itype);
{$endif x86}
{$ifdef wasm}
addtype('$wasm_void_externref',wasmvoidexternreftype);
addtype('WasmExternRef',wasmvoidexternreftype);
{$endif wasm}
addtype('$openchararray',openchararraytype);
addtype('$file',cfiletype);
if f_variants in features then
@ -791,6 +798,9 @@ implementation
loadtype('llvmbool1',llvmbool1type);
loadtype('metadata',llvm_metadatatype);
{$endif llvm}
{$ifdef wasm}
loadtype('wasm_void_externref',wasmvoidexternreftype);
{$endif wasm}
loadtype('file',cfiletype);
if target_info.system=system_i386_watcom then
pvmt_name:='lower__pvmt'

View File

@ -1157,6 +1157,9 @@ interface
longintfarpointertype, { used for MemL[] }
{$endif i8086}
{$endif x86}
{$ifdef wasm}
wasmvoidexternreftype,
{$endif wasm}
cundefinedtype,
cformaltype, { unique formal definition }
ctypedformaltype, { unique typed formal definition }

View File

@ -66,6 +66,7 @@ type
public
{ flag, indicating whether the pointer is a WebAssembly externref reference type }
is_wasm_externref: boolean;
constructor create_externref(def: tdef);
function getcopy: tstoreddef; override;
function GetTypeName: string; override;
end;
@ -248,6 +249,13 @@ implementation
end;
constructor tcpupointerdef.create_externref(def: tdef);
begin
inherited create(def);
is_wasm_externref:=true;
end;
function tcpupointerdef.getcopy: tstoreddef;
begin
result:=inherited;