mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 12:39:09 +02:00
* fixed bug in the handling of WebAssembly goto
This commit is contained in:
parent
21ffa221e6
commit
f65e4f2385
@ -918,15 +918,17 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure check_goto_br_instructions(list: TAsmList);
|
procedure check_goto_br_instructions(list: TAsmList; out HasGotoBrInstructions: boolean);
|
||||||
var
|
var
|
||||||
hp: tai;
|
hp: tai;
|
||||||
begin
|
begin
|
||||||
|
HasGotoBrInstructions:=False;
|
||||||
hp:=tai(list.first);
|
hp:=tai(list.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if (hp.typ=ait_instruction) and (taicpu(hp).is_br_generated_by_goto) then
|
if (hp.typ=ait_instruction) and (taicpu(hp).is_br_generated_by_goto) then
|
||||||
begin
|
begin
|
||||||
|
HasGotoBrInstructions:=True;
|
||||||
if (taicpu(hp).opcode<>a_br) or
|
if (taicpu(hp).opcode<>a_br) or
|
||||||
(taicpu(hp).ops<>1) or
|
(taicpu(hp).ops<>1) or
|
||||||
(taicpu(hp).oper[0]^.typ<>top_ref) or
|
(taicpu(hp).oper[0]^.typ<>top_ref) or
|
||||||
@ -944,15 +946,18 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
localslist: TAsmList;
|
localslist: TAsmList;
|
||||||
labels_resolved: Boolean;
|
labels_resolved, has_goto: Boolean;
|
||||||
begin
|
begin
|
||||||
check_goto_br_instructions(aktproccode);
|
check_goto_br_instructions(aktproccode,has_goto);
|
||||||
|
|
||||||
localslist:=prepare_locals;
|
localslist:=prepare_locals;
|
||||||
|
|
||||||
replace_local_frame_pointer(aktproccode);
|
replace_local_frame_pointer(aktproccode);
|
||||||
|
|
||||||
labels_resolved:=resolve_labels_simple(aktproccode);
|
labels_resolved:=false;
|
||||||
|
if not has_goto then
|
||||||
|
{ TODO: make resolve_labels_simple handle goto labels correctly }
|
||||||
|
labels_resolved:=resolve_labels_simple(aktproccode);
|
||||||
{$ifndef DEBUG_WASM_GOTO}
|
{$ifndef DEBUG_WASM_GOTO}
|
||||||
if not labels_resolved then
|
if not labels_resolved then
|
||||||
{$endif DEBUG_WASM_GOTO}
|
{$endif DEBUG_WASM_GOTO}
|
||||||
|
Loading…
Reference in New Issue
Block a user