From 853838c39a1b2281ca365e24210eb0d651cf262f Mon Sep 17 00:00:00 2001 From: Max Charlamb <44248479+max-charlamb@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:25:01 -0400 Subject: [PATCH 1/3] use defined width types in PatchpointInfo --- src/coreclr/inc/patchpointinfo.h | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/coreclr/inc/patchpointinfo.h b/src/coreclr/inc/patchpointinfo.h index bdff46def7ef99..5657928a4d068f 100644 --- a/src/coreclr/inc/patchpointinfo.h +++ b/src/coreclr/inc/patchpointinfo.h @@ -12,7 +12,7 @@ // -------------------------------------------------------------------------------- // Describes information needed to make an OSR transition -// - location of IL-visible locals and other important state on the +// - location of IL-visible locals and other important state on the // original (Tier0) method frame, with respect to top of frame // (hence these offsets will be negative as stack grows down) // - total size of the original frame @@ -26,16 +26,16 @@ struct PatchpointInfo { // Determine how much storage is needed to hold this info - static unsigned ComputeSize(unsigned localCount) + static uint32_t ComputeSize(uint32_t localCount) { - unsigned baseSize = sizeof(PatchpointInfo); - unsigned variableSize = localCount * sizeof(int); - unsigned totalSize = baseSize + variableSize; + uint32_t baseSize = sizeof(PatchpointInfo); + uint32_t variableSize = localCount * sizeof(int); + uint32_t totalSize = baseSize + variableSize; return totalSize; } // Initialize - void Initialize(unsigned localCount, int totalFrameSize) + void Initialize(uint32_t localCount, int32_t totalFrameSize) { m_calleeSaveRegisters = 0; m_tier0Version = 0; @@ -57,32 +57,32 @@ struct PatchpointInfo m_securityCookieOffset = original->m_securityCookieOffset; m_monitorAcquiredOffset = original->m_monitorAcquiredOffset; - for (unsigned i = 0; i < original->m_numberOfLocals; i++) + for (uint32_t i = 0; i < original->m_numberOfLocals; i++) { m_offsetAndExposureData[i] = original->m_offsetAndExposureData[i]; } } - // Total size of this patchpoint info record, in bytes - unsigned PatchpointInfoSize() const + // Total size of this patchpoint32_t info record, in bytes + uint32_t PatchpointInfoSize() const { return ComputeSize(m_numberOfLocals); } // Total frame size of the original method - int TotalFrameSize() const + int32_t TotalFrameSize() const { return m_totalFrameSize; } // Number of locals in the original method (including special locals) - unsigned NumberOfLocals() const + uint32_t NumberOfLocals() const { return m_numberOfLocals; } // Original method caller SP offset for generic context arg - int GenericContextArgOffset() const + int32_t GenericContextArgOffset() const { return m_genericContextArgOffset; } @@ -92,13 +92,13 @@ struct PatchpointInfo return m_genericContextArgOffset != -1; } - void SetGenericContextArgOffset(int offset) + void SetGenericContextArgOffset(int32_t offset) { m_genericContextArgOffset = offset; } // Original method FP relative offset for kept-alive this - int KeptAliveThisOffset() const + int32_t KeptAliveThisOffset() const { return m_keptAliveThisOffset; } @@ -108,13 +108,13 @@ struct PatchpointInfo return m_keptAliveThisOffset != -1; } - void SetKeptAliveThisOffset(int offset) + void SetKeptAliveThisOffset(int32_t offset) { m_keptAliveThisOffset = offset; } // Original method FP relative offset for security cookie - int SecurityCookieOffset() const + int32_t SecurityCookieOffset() const { return m_securityCookieOffset; } @@ -124,13 +124,13 @@ struct PatchpointInfo return m_securityCookieOffset != -1; } - void SetSecurityCookieOffset(int offset) + void SetSecurityCookieOffset(int32_t offset) { m_securityCookieOffset = offset; } // Original method FP relative offset for monitor acquired flag - int MonitorAcquiredOffset() const + int32_t MonitorAcquiredOffset() const { return m_monitorAcquiredOffset; } @@ -140,24 +140,24 @@ struct PatchpointInfo return m_monitorAcquiredOffset != -1; } - void SetMonitorAcquiredOffset(int offset) + void SetMonitorAcquiredOffset(int32_t offset) { m_monitorAcquiredOffset = offset; } // True if this local was address exposed in the original method - bool IsExposed(unsigned localNum) const + bool IsExposed(uint32_t localNum) const { return ((m_offsetAndExposureData[localNum] & EXPOSURE_MASK) != 0); } // FP relative offset of this local in the original method - int Offset(unsigned localNum) const + int32_t Offset(uint32_t localNum) const { return (m_offsetAndExposureData[localNum] >> OFFSET_SHIFT); } - void SetOffsetAndExposure(unsigned localNum, int offset, bool isExposed) + void SetOffsetAndExposure(uint32_t localNum, int32_t offset, bool isExposed) { m_offsetAndExposureData[localNum] = (offset << OFFSET_SHIFT) | (isExposed ? EXPOSURE_MASK : 0); } @@ -194,13 +194,13 @@ struct PatchpointInfo uint64_t m_calleeSaveRegisters; PCODE m_tier0Version; - unsigned m_numberOfLocals; - int m_totalFrameSize; - int m_genericContextArgOffset; - int m_keptAliveThisOffset; - int m_securityCookieOffset; - int m_monitorAcquiredOffset; - int m_offsetAndExposureData[]; + uint32_t m_numberOfLocals; + int32_t m_totalFrameSize; + int32_t m_genericContextArgOffset; + int32_t m_keptAliveThisOffset; + int32_t m_securityCookieOffset; + int32_t m_monitorAcquiredOffset; + int32_t m_offsetAndExposureData[]; }; typedef DPTR(struct PatchpointInfo) PTR_PatchpointInfo; From 515826b9b53760a86ce211566f416b04ac93912c Mon Sep 17 00:00:00 2001 From: Max Charlamb <44248479+max-charlamb@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:29:57 -0400 Subject: [PATCH 2/3] Update src/coreclr/inc/patchpointinfo.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/coreclr/inc/patchpointinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/inc/patchpointinfo.h b/src/coreclr/inc/patchpointinfo.h index 5657928a4d068f..4a1218707c7f0a 100644 --- a/src/coreclr/inc/patchpointinfo.h +++ b/src/coreclr/inc/patchpointinfo.h @@ -29,7 +29,7 @@ struct PatchpointInfo static uint32_t ComputeSize(uint32_t localCount) { uint32_t baseSize = sizeof(PatchpointInfo); - uint32_t variableSize = localCount * sizeof(int); + uint32_t variableSize = localCount * sizeof(int32_t); uint32_t totalSize = baseSize + variableSize; return totalSize; } From 98e99d16e0c3e279883b750a7a657ea2395894fe Mon Sep 17 00:00:00 2001 From: Max Charlamb <44248479+max-charlamb@users.noreply.github.com> Date: Thu, 26 Jun 2025 11:43:43 -0400 Subject: [PATCH 3/3] fix mistake --- src/coreclr/inc/patchpointinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/inc/patchpointinfo.h b/src/coreclr/inc/patchpointinfo.h index 4a1218707c7f0a..f2c01d351c67c2 100644 --- a/src/coreclr/inc/patchpointinfo.h +++ b/src/coreclr/inc/patchpointinfo.h @@ -63,7 +63,7 @@ struct PatchpointInfo } } - // Total size of this patchpoint32_t info record, in bytes + // Total size of this patchpoint info record, in bytes uint32_t PatchpointInfoSize() const { return ComputeSize(m_numberOfLocals);