From af4abe49d39e705032a787d8620e185a1c8d7ce0 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 3 Jun 2025 22:52:25 +0100 Subject: [PATCH] fix: Make LoadPtrArray reusable methods for x64 --- .../Generating/Templates/ZoneLoadTemplate.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp index 24c7d4a2..bd72e5ea 100644 --- a/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp +++ b/src/ZoneCodeGeneratorLib/Generating/Templates/ZoneLoadTemplate.cpp @@ -952,7 +952,14 @@ namespace LINE("{") m_intendation++; - LINEF("*{0} = m_stream.ConvertOffsetToPointerNative(*{0});", MakeTypePtrVarName(def)) + if (info && !info->m_has_matching_cross_platform_structure) + { + LINEF("*{0} = m_stream.ConvertOffsetToPointerRedirect(*{0});", MakeTypePtrVarName(def)) + } + else + { + LINEF("*{0} = m_stream.ConvertOffsetToPointerNative(*{0});", MakeTypePtrVarName(def)) + } m_intendation--; LINE("}") @@ -984,9 +991,19 @@ namespace m_intendation++; LINEF("const auto ptrArrayFill = m_stream.LoadWithFill({0} * count);", m_env.m_pointer_size) LINE("for (size_t index = 0; index < count; index++)") + LINE("{") m_intendation++; LINEF("ptrArrayFill.FillPtr({0}[index], {1} * index);", MakeTypePtrVarName(def), m_env.m_pointer_size) + + if (reusable) + { + LINEF("ptrArrayFill.InsertPointerRedirect(m_stream.AllocRedirectEntry({0}[index]), {1} * index);", + MakeTypePtrVarName(def), + m_env.m_pointer_size) + } + m_intendation--; + LINE("}") m_intendation--; LINE("}") }