Skip to content

Commit aa86cf0

Browse files
committed
Delete LazyMachState struct defs
1 parent f9b3935 commit aa86cf0

File tree

13 files changed

+0
-450
lines changed

13 files changed

+0
-450
lines changed

src/coreclr/vm/amd64/asmconstants.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,6 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__MachState__m_Rip
255255
ASMCONSTANTS_C_ASSERT(OFFSETOF__MachState__m_Rsp
256256
== offsetof(MachState, m_Rsp));
257257

258-
#ifdef UNIX_AMD64_ABI
259-
#define OFFSETOF__MachState__m_Ptrs 0x40
260-
#define OFFSETOF__MachState___pRetAddr 0x70
261-
#else
262-
#define OFFSETOF__MachState__m_Ptrs 0x50
263-
#define OFFSETOF__MachState___pRetAddr 0x90
264-
#endif
265-
ASMCONSTANTS_C_ASSERT(OFFSETOF__MachState__m_Ptrs
266-
== offsetof(MachState, m_Ptrs));
267-
ASMCONSTANTS_C_ASSERT(OFFSETOF__MachState___pRetAddr
268-
== offsetof(MachState, _pRetAddr));
269-
270258
#define OFFSETOF__VASigCookie__pNDirectILStub 0x8
271259
ASMCONSTANTS_C_ASSERT(OFFSETOF__VASigCookie__pNDirectILStub
272260
== offsetof(VASigCookie, pNDirectILStub));

src/coreclr/vm/amd64/gmscpu.h

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct MachState
3636
#endif
3737

3838
friend class CheckAsmOffsets;
39-
friend struct LazyMachState;
4039

4140
protected:
4241
PCODE m_Rip;
@@ -55,71 +54,4 @@ struct MachState
5554
#endif
5655
};
5756

58-
struct LazyMachState : public MachState
59-
{
60-
// compute the machine state of the processor as it will exist just
61-
// after the return after at most'funCallDepth' number of functions.
62-
// if 'testFtn' is non-NULL, the return address is tested at each
63-
// return instruction encountered. If this test returns non-NULL,
64-
// then stack walking stops (thus you can walk up to the point that the
65-
// return address matches some criteria
66-
67-
// Normally this is called with funCallDepth=1 and testFtn = 0 so that
68-
// it returns the state of the processor after the function that called 'captureState()'
69-
void setLazyStateFromUnwind(MachState* copy);
70-
71-
friend class CheckAsmOffsets;
72-
};
73-
74-
inline void LazyMachState::setLazyStateFromUnwind(MachState* copy)
75-
{
76-
LIMITED_METHOD_CONTRACT;
77-
78-
#if defined(DACCESS_COMPILE)
79-
// This function cannot be called in DAC because DAC cannot update target memory.
80-
DacError(E_FAIL);
81-
return;
82-
83-
#else // !DACCESS_COMPILE
84-
this->m_Rip = copy->m_Rip;
85-
this->m_Rsp = copy->m_Rsp;
86-
87-
#ifdef TARGET_UNIX
88-
this->m_Unwound = copy->m_Unwound;
89-
#endif
90-
91-
// Capture* has already been set, so there is no need to touch it
92-
93-
// loop over the nonvolatile context pointers and make
94-
// sure to properly copy interior pointers into the
95-
// new struct
96-
97-
PULONG64* pSrc = (PULONG64 *)&copy->m_Ptrs;
98-
PULONG64* pDst = (PULONG64 *)&this->m_Ptrs;
99-
100-
const PULONG64 LowerBoundDst = (PULONG64) this;
101-
const PULONG64 LowerBoundSrc = (PULONG64) copy;
102-
103-
const PULONG64 UpperBoundSrc = (PULONG64) ((BYTE*)LowerBoundSrc + sizeof(*copy));
104-
105-
for (int i = 0; i < NUM_CALLEE_SAVED_REGISTERS; i++)
106-
{
107-
PULONG64 valueSrc = *pSrc++;
108-
109-
if ((LowerBoundSrc <= valueSrc) && (valueSrc < UpperBoundSrc))
110-
{
111-
// make any pointer interior to 'src' interior to 'dst'
112-
valueSrc = (PULONG64)((BYTE*)valueSrc - (BYTE*)LowerBoundSrc + (BYTE*)LowerBoundDst);
113-
}
114-
115-
*pDst++ = valueSrc;
116-
}
117-
118-
// this has to be last because we depend on write ordering to
119-
// synchronize the race implicit in updating this struct
120-
VolatileStore(&_pRetAddr, (PTR_TADDR)(TADDR)&m_Rip);
121-
122-
#endif // !DACCESS_COMPILE
123-
}
124-
12557
#endif // __gmsAMD64_h__

src/coreclr/vm/arm/asmconstants.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ ASMCONSTANTS_C_ASSERT(MachState___R4_R11 == offsetof(MachState, _R4_R11))
5353
#define MachState__isValid 0x48
5454
ASMCONSTANTS_C_ASSERT(MachState__isValid == offsetof(MachState, _isValid))
5555

56-
#define LazyMachState_captureR4_R11 MachState__captureR4_R11
57-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureR4_R11 == offsetof(LazyMachState, captureR4_R11))
58-
59-
#define LazyMachState_captureSp (MachState__isValid+4)
60-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureSp == offsetof(LazyMachState, captureSp))
61-
62-
#define LazyMachState_captureIp (LazyMachState_captureSp+4)
63-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureIp == offsetof(LazyMachState, captureIp))
64-
6556
#define OFFSETOF__MethodTable__m_dwFlags 0x00
6657
ASMCONSTANTS_C_ASSERT(OFFSETOF__MethodTable__m_dwFlags == offsetof(MethodTable, m_dwFlags));
6758

src/coreclr/vm/arm/gmscpu.h

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ struct MachState {
2828
TADDR GetRetAddr() { LIMITED_METHOD_DAC_CONTRACT; return _pc; }
2929

3030
friend class CheckAsmOffsets;
31-
friend struct LazyMachState;
3231

3332

3433
protected:
@@ -52,93 +51,4 @@ struct MachState {
5251
BOOL _isValid;
5352
};
5453

55-
/********************************************************************/
56-
/* This allows you to defer the computation of the Machine state
57-
until later. Note that we don't reuse slots, because we want
58-
this to be threadsafe without locks */
59-
60-
struct LazyMachState : public MachState {
61-
// compute the machine state of the processor as it will exist just
62-
// after the return after at most'funCallDepth' number of functions.
63-
// if 'testFtn' is non-NULL, the return address is tested at each
64-
// return instruction encountered. If this test returns non-NULL,
65-
// then stack walking stops (thus you can walk up to the point that the
66-
// return address matches some criteria
67-
68-
// Normally this is called with funCallDepth=1 and testFtn = 0 so that
69-
// it returns the state of the processor after the function that called 'captureState()'
70-
void setLazyStateFromUnwind(MachState* copy);
71-
72-
friend class CheckAsmOffsets;
73-
private:
74-
TADDR captureSp; // Stack pointer at the time of capture
75-
TADDR captureIp; // Instruction pointer at the time of capture
76-
};
77-
78-
// R4 - R11
79-
#define NUM_NONVOLATILE_CONTEXT_POINTERS 8
80-
81-
inline void LazyMachState::setLazyStateFromUnwind(MachState* copy)
82-
{
83-
LIMITED_METHOD_CONTRACT;
84-
85-
#if defined(DACCESS_COMPILE)
86-
// This function cannot be called in DAC because DAC cannot update target memory.
87-
DacError(E_FAIL);
88-
return;
89-
90-
#else // !DACCESS_COMPILE
91-
this->_pc = copy->_pc;
92-
this->_sp = copy->_sp;
93-
94-
// Capture* has already been set, so there is no need to touch it.
95-
// This was setup in LazyMachState::unwindLazyState just before we
96-
// called into the OS for unwind.
97-
98-
// Prepare to loop over the nonvolatile context pointers for and
99-
// make sure to properly copy interior pointers into the new struct.
100-
101-
PDWORD* pSrc = &copy->_R4_R11[0];
102-
PDWORD* pDst = &this->_R4_R11[0];
103-
104-
const PDWORD LowerBoundDst = (PDWORD) this;
105-
const PDWORD LowerBoundSrc = (PDWORD) copy;
106-
107-
// Calculate the upperbound till which we need to loop (i.e. the highest address till
108-
// which we have saved non-volatile pointers).
109-
const PDWORD UpperBoundSrc = (PDWORD) (((BYTE*)LowerBoundSrc) + offsetof(LazyMachState, _pc));
110-
111-
#ifdef _DEBUG
112-
int count = 0;
113-
#endif // _DEBUG
114-
115-
while (((PDWORD)pSrc) < UpperBoundSrc)
116-
{
117-
#ifdef _DEBUG
118-
count++;
119-
#endif // _DEBUG
120-
121-
PDWORD valueSrc = *pSrc++;
122-
123-
// If any non-volatile register pointer is pointing to the corresponding register field
124-
// in the MachState, then make the corresponding pointer in "this" MachState point
125-
// to the corresponding field.
126-
if ((LowerBoundSrc <= valueSrc) && (valueSrc < UpperBoundSrc))
127-
{
128-
valueSrc = (PDWORD)((BYTE*)valueSrc - (BYTE*)LowerBoundSrc + (BYTE*)LowerBoundDst);
129-
}
130-
131-
*pDst++ = valueSrc;
132-
}
133-
134-
CONSISTENCY_CHECK_MSGF(count == NUM_NONVOLATILE_CONTEXT_POINTERS, ("count != NUM_NONVOLATILE_CONTEXT_POINTERS, actually = %d", count));
135-
136-
// this has to be last because we depend on write ordering to
137-
// synchronize the race implicit in updating this struct
138-
VolatileStore(&_isValid, TRUE);
139-
140-
#endif // !DACCESS_COMPILE
141-
142-
}
143-
14454
#endif

src/coreclr/vm/arm64/asmconstants.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,6 @@ ASMCONSTANTS_C_ASSERT(MachState__ptrX19_X29 == offsetof(MachState, ptrX19_X29))
100100
#define MachState__isValid 0xc0
101101
ASMCONSTANTS_C_ASSERT(MachState__isValid == offsetof(MachState, _isValid))
102102

103-
#define LazyMachState_captureX19_X29 MachState__captureX19_X29
104-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureX19_X29 == offsetof(LazyMachState, captureX19_X29))
105-
106-
#ifdef __APPLE__
107-
#define LazyMachState_captureSp (MachState__isValid+8+88) // padding for alignment
108-
#else // __APPLE__
109-
#define LazyMachState_captureSp (MachState__isValid+8) // padding for alignment
110-
#endif // __APPLE
111-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureSp == offsetof(LazyMachState, captureSp))
112-
113-
#define LazyMachState_captureIp (LazyMachState_captureSp+8)
114-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureIp == offsetof(LazyMachState, captureIp))
115-
116103
#define VASigCookie__pNDirectILStub 0x8
117104
ASMCONSTANTS_C_ASSERT(VASigCookie__pNDirectILStub == offsetof(VASigCookie, pNDirectILStub))
118105

src/coreclr/vm/arm64/gmscpu.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -35,62 +35,4 @@ struct MachState {
3535
TADDR GetRetAddr() { LIMITED_METHOD_DAC_CONTRACT; return _pc; }
3636
};
3737

38-
struct LazyMachState : public MachState{
39-
40-
TADDR captureSp; // Stack pointer at the time of capture
41-
TADDR captureIp; // Instruction pointer at the time of capture
42-
43-
void setLazyStateFromUnwind(MachState* copy);
44-
};
45-
46-
inline void LazyMachState::setLazyStateFromUnwind(MachState* copy)
47-
{
48-
#if defined(DACCESS_COMPILE)
49-
// This function cannot be called in DAC because DAC cannot update target memory.
50-
DacError(E_FAIL);
51-
return;
52-
53-
#else // !DACCESS_COMPILE
54-
55-
_sp = copy->_sp;
56-
_pc = copy->_pc;
57-
58-
#ifdef __APPLE__
59-
memcpy(unwoundX19_X29, copy->unwoundX19_X29, sizeof(unwoundX19_X29));
60-
#endif // __APPLE__
61-
62-
// Capture* has already been set, so there is no need to touch it
63-
64-
// loop over the nonvolatile context pointers and make
65-
// sure to properly copy interior pointers into the
66-
// new struct
67-
68-
PULONG64* pSrc = (PULONG64 *)&copy->ptrX19_X29;
69-
PULONG64* pDst = (PULONG64 *)&this->ptrX19_X29;
70-
71-
const PULONG64 LowerBoundDst = (PULONG64) this;
72-
const PULONG64 LowerBoundSrc = (PULONG64) copy;
73-
74-
const PULONG64 UpperBoundSrc = (PULONG64) ((BYTE*)LowerBoundSrc + sizeof(*copy));
75-
76-
for (int i = 0; i < NUM_NONVOLATILE_CONTEXT_POINTERS; i++)
77-
{
78-
PULONG64 valueSrc = *pSrc++;
79-
80-
if ((LowerBoundSrc <= valueSrc) && (valueSrc < UpperBoundSrc))
81-
{
82-
// make any pointer interior to 'src' interior to 'dst'
83-
valueSrc = (PULONG64)((BYTE*)valueSrc - (BYTE*)LowerBoundSrc + (BYTE*)LowerBoundDst);
84-
}
85-
86-
*pDst++ = valueSrc;
87-
}
88-
89-
90-
// this has to be last because we depend on write ordering to
91-
// synchronize the race implicit in updating this struct
92-
VolatileStore(&_isValid, TRUE);
93-
#endif // DACCESS_COMPILE
94-
}
95-
9638
#endif

src/coreclr/vm/i386/asmconstants.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,6 @@ ASMCONSTANTS_C_ASSERT(MachState__esp == offsetof(MachState, _esp))
139139
#define MachState__pRetAddr 36
140140
ASMCONSTANTS_C_ASSERT(MachState__pRetAddr == offsetof(MachState, _pRetAddr))
141141

142-
#define LazyMachState_captureEbp 40
143-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureEbp == offsetof(LazyMachState, captureEbp))
144-
145-
#define LazyMachState_captureEsp 44
146-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureEsp == offsetof(LazyMachState, captureEsp))
147-
148-
#define LazyMachState_captureEip 48
149-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureEip == offsetof(LazyMachState, captureEip))
150-
151-
152142
#define VASigCookie__StubOffset 4
153143
ASMCONSTANTS_C_ASSERT(VASigCookie__StubOffset == offsetof(VASigCookie, pNDirectILStub))
154144

src/coreclr/vm/i386/gmscpu.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct MachState {
4343
#endif
4444

4545
friend class CheckAsmOffsets;
46-
friend struct LazyMachState;
4746

4847
protected:
4948
// Note the fields are laid out to make generating a
@@ -66,41 +65,4 @@ struct MachState {
6665
PTR_TADDR _pRetAddr; // The address of the stored IP address (points into the stack)
6766
};
6867

69-
/********************************************************************/
70-
/* This allows you to defer the computation of the Machine state
71-
until later. Note that we don't reuse slots, because we want
72-
this to be threadsafe without locks */
73-
74-
struct LazyMachState : public MachState {
75-
// compute the machine state of the processor as it will exist just
76-
// after the return after at most'funCallDepth' number of functions.
77-
// if 'testFtn' is non-NULL, the return address is tested at each
78-
// return instruction encountered. If this test returns non-NULL,
79-
// then stack walking stops (thus you can walk up to the point that the
80-
// return address matches some criteria
81-
82-
// Normally this is called with funCallDepth=1 and testFtn = 0 so that
83-
// it returns the state of the processor after the function that called 'captureState()'
84-
void setLazyStateFromUnwind(MachState* copy);
85-
86-
friend class CheckAsmOffsets;
87-
private:
88-
TADDR captureEbp; // Ebp at the time of capture
89-
TADDR captureEsp; // Esp at the time of capture
90-
TADDR captureEip; // Eip at the time of capture
91-
};
92-
93-
inline void LazyMachState::setLazyStateFromUnwind(MachState* copy)
94-
{
95-
// _pRetAddr has to be the last thing updated when we make the copy (because its
96-
// is the _pRetAddr becoming non-zero that flips this from invalid to valid.
97-
// we assert that it is the last field in the struct.
98-
static_assert_no_msg(offsetof(MachState, _pRetAddr) + sizeof(_pRetAddr) == sizeof(MachState));
99-
100-
memcpy(this, copy, offsetof(MachState, _pRetAddr));
101-
102-
// this has to be last
103-
VolatileStore((TADDR*)&_pRetAddr, dac_cast<TADDR>(copy->_pRetAddr));
104-
}
105-
10668
#endif

src/coreclr/vm/loongarch64/asmconstants.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@ ASMCONSTANTS_C_ASSERT(MachState__ptrCalleeSavedRegisters == offsetof(MachState,
102102
#define MachState__isValid 0xb0
103103
ASMCONSTANTS_C_ASSERT(MachState__isValid == offsetof(MachState, _isValid))
104104

105-
#define LazyMachState_captureCalleeSavedRegisters MachState__captureCalleeSavedRegisters
106-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureCalleeSavedRegisters == offsetof(LazyMachState, captureCalleeSavedRegisters))
107-
108-
#define LazyMachState_captureSp (MachState__isValid+8) // padding for alignment
109-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureSp == offsetof(LazyMachState, captureSp))
110-
111-
#define LazyMachState_captureIp (LazyMachState_captureSp+8)
112-
ASMCONSTANTS_C_ASSERT(LazyMachState_captureIp == offsetof(LazyMachState, captureIp))
113-
114105
#define VASigCookie__pNDirectILStub 0x8
115106
ASMCONSTANTS_C_ASSERT(VASigCookie__pNDirectILStub == offsetof(VASigCookie, pNDirectILStub))
116107

0 commit comments

Comments
 (0)