+ respect the nostackframe directive in WebAssembly inline asm routines

This commit is contained in:
Nikolay Nikolov 2024-07-16 15:25:12 +03:00
parent 83a8d584e0
commit 4adac78f85

View File

@ -2051,6 +2051,9 @@ implementation
pd:=tcpuprocdef(current_procinfo.procdef);
g_procdef(list,pd);
if not nostackframe then
begin
ttgwasm(tg).allocframepointer(list,pd.frame_pointer_ref);
if pd.base_pointer_ref.base<>NR_LOCAL_STACK_POINTER_REG then
ttgwasm(tg).allocbasepointer(list,pd.base_pointer_ref);
@ -2077,18 +2080,22 @@ implementation
decstack(list,1);
end;
end;
end;
procedure thlcgwasm.g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean);
var
pd: tcpuprocdef;
begin
pd:=tcpuprocdef(current_procinfo.procdef);
if not nostackframe then
begin
list.Concat(taicpu.op_ref(a_local_get,pd.base_pointer_ref));
incstack(list,1);
list.Concat(taicpu.op_sym(a_global_set,RefStackPointerSym));
decstack(list,1);
list.concat(taicpu.op_none(a_return));
end;
list.concat(taicpu.op_none(a_end_function));
end;