* WebAssembly: generate the final bashB opcode of a function via the

end_function instruction, instead of adding it magically in the object writer.
  This makes the WebAssembly debug line info more accurate, covering the
  end_function instruction as well.
This commit is contained in:
Nikolay Nikolov 2024-09-11 07:46:17 +03:00
parent d81170ab23
commit 99943610cb
2 changed files with 4 additions and 7 deletions

View File

@ -1322,14 +1322,13 @@ implementation
encoded_locals:=tdynamicarray.Create(64);
WriteFunctionLocals(encoded_locals,ObjSymExtraData);
codelen:=encoded_locals.size+codeexprlen+1;
codelen:=encoded_locals.size+codeexprlen;
WriteUleb(dest,codelen);
encoded_locals.seek(0);
CopyDynamicArray(encoded_locals,dest,encoded_locals.size);
ObjSection.FileSectionOfs:=dest.size-objsym.offset;
ObjSection.EncodedLocalsSize:=encoded_locals.size;
CopyDynamicArray(ObjSection.Data,dest,codeexprlen);
WriteByte(dest,$0B);
encoded_locals.Free;
end;

View File

@ -2236,6 +2236,7 @@ uses
a_end_if,
a_end_loop,
a_end_try,
a_end_function,
a_catch_all,
a_ref_is_null:
result:=1;
@ -2350,8 +2351,6 @@ uses
internalerror(2021092011);
end;
end;
a_end_function:
result:=0;
a_block,
a_loop,
a_if,
@ -2993,7 +2992,8 @@ uses
a_end_block,
a_end_if,
a_end_loop,
a_end_try:
a_end_try,
a_end_function:
WriteByte($0B);
a_catch_all:
WriteByte($19);
@ -3132,8 +3132,6 @@ uses
internalerror(2021092011);
end;
end;
a_end_function:
;
a_block,
a_loop,
a_if,