2
0
Эх сурвалжийг харах

* use objsym.size to determine the code size of the function (instead of
writing until the end of the section) in the wasm internal object writer.
This removes the extra padding of 'unreachable' instructions at the end of
each function (which are zeroes, added for alignment - they are harmless,
but are unnecessary and cause a slight increase of the size of the
resulting binaries), after the final 'return' instruction of the function.

Nikolay Nikolov 3 жил өмнө
parent
commit
77b898fe45

+ 1 - 1
compiler/ogwasm.pas

@@ -879,7 +879,7 @@ implementation
         ObjSymExtraData:=TWasmObjSymbolExtraData(FData.FObjSymbolsExtraDataList.Find(objsym.Name));
         ObjSymExtraData:=TWasmObjSymbolExtraData(FData.FObjSymbolsExtraDataList.Find(objsym.Name));
         ObjSection:=TWasmObjSection(objsym.objsection);
         ObjSection:=TWasmObjSection(objsym.objsection);
         ObjSection.Data.seek(objsym.address);
         ObjSection.Data.seek(objsym.address);
-        codeexprlen:=ObjSection.Size-objsym.address;
+        codeexprlen:=objsym.size;
 
 
         encoded_locals:=tdynamicarray.Create(64);
         encoded_locals:=tdynamicarray.Create(64);
         WriteFunctionLocals(encoded_locals,ObjSymExtraData);
         WriteFunctionLocals(encoded_locals,ObjSymExtraData);