mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 17:49:07 +02:00
* fixed WebAssembly compilation error with -CR
git-svn-id: trunk@48964 -
This commit is contained in:
parent
2aab9b1f9b
commit
74854eee58
@ -350,7 +350,10 @@ implementation
|
|||||||
function thlcgwasm.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister; const paras: array of pcgpara): tcgpara;
|
function thlcgwasm.a_call_reg(list: TAsmList; pd: tabstractprocdef; reg: tregister; const paras: array of pcgpara): tcgpara;
|
||||||
begin
|
begin
|
||||||
a_load_reg_stack(list, ptrsinttype, reg);
|
a_load_reg_stack(list, ptrsinttype, reg);
|
||||||
current_asmdata.CurrAsmList.Concat(taicpu.op_functype(a_call_indirect,tcpuprocdef(pd).create_functype));
|
if pd.typ=procvardef then
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_functype(a_call_indirect,tcpuprocvardef(pd).create_functype))
|
||||||
|
else
|
||||||
|
current_asmdata.CurrAsmList.Concat(taicpu.op_functype(a_call_indirect,tcpuprocdef(pd).create_functype));
|
||||||
decstack(list,1);
|
decstack(list,1);
|
||||||
result:=hlcg.get_call_result_cgpara(pd, nil);
|
result:=hlcg.get_call_result_cgpara(pd, nil);
|
||||||
end;
|
end;
|
||||||
|
@ -94,6 +94,7 @@ type
|
|||||||
{ tcpuprocvardef }
|
{ tcpuprocvardef }
|
||||||
|
|
||||||
tcpuprocvardef = class(tprocvardef)
|
tcpuprocvardef = class(tprocvardef)
|
||||||
|
function create_functype: TWasmFuncType;
|
||||||
function is_pushleftright: boolean; override;
|
function is_pushleftright: boolean; override;
|
||||||
end;
|
end;
|
||||||
tcpuprocvardefclass = class of tcpuprocvardef;
|
tcpuprocvardefclass = class of tcpuprocvardef;
|
||||||
@ -220,26 +221,19 @@ implementation
|
|||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
|
||||||
destructor tcpuprocdef.destroy;
|
function create_functype_common(pd: tabstractprocdef): TWasmFuncType;
|
||||||
begin
|
|
||||||
exprasmlist.free;
|
|
||||||
inherited destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tcpuprocdef.create_functype: TWasmFuncType;
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
prm: tcpuparavarsym;
|
prm: tcpuparavarsym;
|
||||||
bt: TWasmBasicType;
|
bt: TWasmBasicType;
|
||||||
begin
|
begin
|
||||||
init_paraloc_info(callerside);
|
pd.init_paraloc_info(callerside);
|
||||||
result:=TWasmFuncType.Create([],[]);
|
result:=TWasmFuncType.Create([],[]);
|
||||||
if Assigned(paras) and (paras.Count>0) then
|
if Assigned(pd.paras) and (pd.paras.Count>0) then
|
||||||
begin
|
begin
|
||||||
for i:=0 to paras.Count-1 do
|
for i:=0 to pd.paras.Count-1 do
|
||||||
begin
|
begin
|
||||||
prm := tcpuparavarsym(paras[i]);
|
prm := tcpuparavarsym(pd.paras[i]);
|
||||||
case prm.paraloc[callerside].Size of
|
case prm.paraloc[callerside].Size of
|
||||||
OS_8..OS_32, OS_S8..OS_S32:
|
OS_8..OS_32, OS_S8..OS_S32:
|
||||||
result.add_param(wbt_i32);
|
result.add_param(wbt_i32);
|
||||||
@ -260,10 +254,10 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if Assigned(returndef) and (returndef.size>0) and
|
if Assigned(pd.returndef) and (pd.returndef.size>0) and
|
||||||
not paramanager.ret_in_param(returndef,self) then
|
not paramanager.ret_in_param(pd.returndef,pd) then
|
||||||
begin
|
begin
|
||||||
if not defToWasmBasic(returndef,bt) then
|
if not defToWasmBasic(pd.returndef,bt) then
|
||||||
bt:=wbt_i32;
|
bt:=wbt_i32;
|
||||||
case bt of
|
case bt of
|
||||||
wbt_i64:
|
wbt_i64:
|
||||||
@ -279,6 +273,19 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor tcpuprocdef.destroy;
|
||||||
|
begin
|
||||||
|
exprasmlist.free;
|
||||||
|
inherited destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tcpuprocdef.create_functype: TWasmFuncType;
|
||||||
|
begin
|
||||||
|
Result:=create_functype_common(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tcpuprocdef.is_pushleftright: boolean;
|
function tcpuprocdef.is_pushleftright: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -289,6 +296,11 @@ implementation
|
|||||||
tcpuprocvardef
|
tcpuprocvardef
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
function tcpuprocvardef.create_functype: TWasmFuncType;
|
||||||
|
begin
|
||||||
|
Result:=create_functype_common(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
function tcpuprocvardef.is_pushleftright: boolean;
|
function tcpuprocvardef.is_pushleftright: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user