@@ -28,92 +28,11 @@ enum GCRefKind : unsigned char
2828 GCRK_Scalar = 0x00 ,
2929 GCRK_Object = 0x01 ,
3030 GCRK_Byref = 0x02 ,
31- #ifdef TARGET_64BIT
32- // Composite return kinds for value types returned in two registers (encoded with two bits per register)
33- GCRK_Scalar_Obj = (GCRK_Object << 2 ) | GCRK_Scalar,
34- GCRK_Obj_Obj = (GCRK_Object << 2 ) | GCRK_Object,
35- GCRK_Byref_Obj = (GCRK_Object << 2 ) | GCRK_Byref,
36- GCRK_Scalar_Byref = (GCRK_Byref << 2 ) | GCRK_Scalar,
37- GCRK_Obj_Byref = (GCRK_Byref << 2 ) | GCRK_Object,
38- GCRK_Byref_Byref = (GCRK_Byref << 2 ) | GCRK_Byref,
39-
40- GCRK_LastValid = GCRK_Byref_Byref,
41- #else // TARGET_ARM64
4231 GCRK_LastValid = GCRK_Byref,
43- #endif // TARGET_ARM64
4432 GCRK_Unknown = 0xFF ,
4533};
4634
47- #ifdef TARGET_ARM64
48- // Verify that we can use bitwise shifts to convert from GCRefKind to PInvokeTransitionFrameFlags and back
49- C_ASSERT (PTFF_X0_IS_GCREF == ((uint64_t )GCRK_Object << 32));
50- C_ASSERT (PTFF_X0_IS_BYREF == ((uint64_t )GCRK_Byref << 32));
51- C_ASSERT (PTFF_X1_IS_GCREF == ((uint64_t )GCRK_Scalar_Obj << 32));
52- C_ASSERT (PTFF_X1_IS_BYREF == ((uint64_t )GCRK_Scalar_Byref << 32));
53-
54- inline uint64_t ReturnKindToTransitionFrameFlags (GCRefKind returnKind)
55- {
56- // just need to report gc ref bits here.
57- // appropriate PTFF_SAVE_ bits will be added by the frame building routine.
58- return ((uint64_t )returnKind << 32 );
59- }
60-
61- inline GCRefKind TransitionFrameFlagsToReturnKind (uint64_t transFrameFlags)
62- {
63- GCRefKind returnKind = (GCRefKind)((transFrameFlags & (PTFF_X0_IS_GCREF | PTFF_X0_IS_BYREF | PTFF_X1_IS_GCREF | PTFF_X1_IS_BYREF)) >> 32 );
64- ASSERT ((returnKind == GCRK_Scalar) || ((transFrameFlags & PTFF_SAVE_X0) && (transFrameFlags & PTFF_SAVE_X1)));
65- return returnKind;
66- }
67-
68- #elif defined(TARGET_LOONGARCH64)
69- // Verify that we can use bitwise shifts to convert from GCRefKind to PInvokeTransitionFrameFlags and back
70- C_ASSERT (PTFF_R4_IS_GCREF == ((uint64_t )GCRK_Object << 31));
71- C_ASSERT (PTFF_R4_IS_BYREF == ((uint64_t )GCRK_Byref << 31));
72- C_ASSERT (PTFF_R5_IS_GCREF == ((uint64_t )GCRK_Scalar_Obj << 31));
73- C_ASSERT (PTFF_R5_IS_BYREF == ((uint64_t )GCRK_Scalar_Byref << 31));
74-
75- inline uint64_t ReturnKindToTransitionFrameFlags (GCRefKind returnKind)
76- {
77- // just need to report gc ref bits here.
78- // appropriate PTFF_SAVE_ bits will be added by the frame building routine.
79- return ((uint64_t )returnKind << 31 );
80- }
81-
82- inline GCRefKind TransitionFrameFlagsToReturnKind (uint64_t transFrameFlags)
83- {
84- GCRefKind returnKind = (GCRefKind)((transFrameFlags & (PTFF_R4_IS_GCREF | PTFF_R4_IS_BYREF | PTFF_R5_IS_GCREF | PTFF_R5_IS_BYREF)) >> 31 );
85- ASSERT ((returnKind == GCRK_Scalar) || ((transFrameFlags & PTFF_SAVE_R4) && (transFrameFlags & PTFF_SAVE_R5)));
86- return returnKind;
87- }
88-
89- #elif defined(TARGET_AMD64)
90-
91- // Verify that we can use bitwise shifts to convert from GCRefKind to PInvokeTransitionFrameFlags and back
92- C_ASSERT (PTFF_RAX_IS_GCREF == ((uint64_t )GCRK_Object << 16));
93- C_ASSERT (PTFF_RAX_IS_BYREF == ((uint64_t )GCRK_Byref << 16));
94- C_ASSERT (PTFF_RDX_IS_GCREF == ((uint64_t )GCRK_Scalar_Obj << 16));
95- C_ASSERT (PTFF_RDX_IS_BYREF == ((uint64_t )GCRK_Scalar_Byref << 16));
96-
97- inline uint64_t ReturnKindToTransitionFrameFlags (GCRefKind returnKind)
98- {
99- // just need to report gc ref bits here.
100- // appropriate PTFF_SAVE_ bits will be added by the frame building routine.
101- return ((uint64_t )returnKind << 16 );
102- }
103-
104- inline GCRefKind TransitionFrameFlagsToReturnKind (uint64_t transFrameFlags)
105- {
106- GCRefKind returnKind = (GCRefKind)((transFrameFlags & (PTFF_RAX_IS_GCREF | PTFF_RAX_IS_BYREF | PTFF_RDX_IS_GCREF | PTFF_RDX_IS_BYREF)) >> 16 );
107- #if defined(TARGET_UNIX)
108- ASSERT ((returnKind == GCRK_Scalar) || ((transFrameFlags & PTFF_SAVE_RAX) && (transFrameFlags & PTFF_SAVE_RDX)));
109- #else
110- ASSERT ((returnKind == GCRK_Scalar) || (transFrameFlags & PTFF_SAVE_RAX));
111- #endif
112- return returnKind;
113- }
114-
115- #elif defined(TARGET_X86)
116-
35+ #if defined(TARGET_X86)
11736// Verify that we can use bitwise shifts to convert from GCRefKind to PInvokeTransitionFrameFlags and back
11837C_ASSERT (PTFF_RAX_IS_GCREF == ((uint64_t )GCRK_Object << 16));
11938C_ASSERT (PTFF_RAX_IS_BYREF == ((uint64_t )GCRK_Byref << 16));
@@ -132,40 +51,13 @@ inline GCRefKind TransitionFrameFlagsToReturnKind(uintptr_t transFrameFlags)
13251 return returnKind;
13352}
13453
135- #elif defined(TARGET_ARM)
136-
137- // Verify that we can use bitwise shifts to convert from GCRefKind to PInvokeTransitionFrameFlags and back
138- C_ASSERT (PTFF_R0_IS_GCREF == ((uint64_t )GCRK_Object << 14));
139- C_ASSERT (PTFF_R0_IS_BYREF == ((uint64_t )GCRK_Byref << 14));
140-
141- inline uint64_t ReturnKindToTransitionFrameFlags (GCRefKind returnKind)
142- {
143- // just need to report gc ref bits here.
144- // appropriate PTFF_SAVE_ bits will be added by the frame building routine.
145- return ((uint64_t )returnKind << 14 );
146- }
147-
148- inline GCRefKind TransitionFrameFlagsToReturnKind (uint64_t transFrameFlags)
149- {
150- GCRefKind returnKind = (GCRefKind)((transFrameFlags & (PTFF_R0_IS_GCREF | PTFF_R0_IS_BYREF)) >> 14 );
151- ASSERT ((returnKind == GCRK_Scalar) || (transFrameFlags & PTFF_SAVE_R0));
152- return returnKind;
153- }
154-
155- #endif
156-
15754// Extract individual GCRefKind components from a composite return kind
158- inline GCRefKind ExtractReg0ReturnKind (GCRefKind returnKind)
55+ inline GCRefKind ExtractReturnKind (GCRefKind returnKind)
15956{
16057 ASSERT (returnKind <= GCRK_LastValid);
16158 return (GCRefKind)(returnKind & (GCRK_Object | GCRK_Byref));
16259}
163-
164- inline GCRefKind ExtractReg1ReturnKind (GCRefKind returnKind)
165- {
166- ASSERT (returnKind <= GCRK_LastValid);
167- return (GCRefKind)(returnKind >> 2 );
168- }
60+ #endif
16961
17062//
17163// MethodInfo is placeholder type used to allocate space for MethodInfo. Maximum size
@@ -272,9 +164,14 @@ class ICodeManager
272164 virtual bool IsUnwindable(PTR_VOID pvAddress) PURE_VIRTUAL
273165
274166 virtual bool GetReturnAddressHijackInfo(MethodInfo * pMethodInfo,
275- REGDISPLAY * pRegisterSet, // in
276- PTR_PTR_VOID * ppvRetAddrLocation, // out
277- GCRefKind * pRetValueKind) PURE_VIRTUAL // out
167+ REGDISPLAY * pRegisterSet, // in
168+ PTR_PTR_VOID * ppvRetAddrLocation // out
169+ ) PURE_VIRTUAL
170+
171+ #ifdef TARGET_X86
172+ virtual GCRefKind GetReturnValueKind (MethodInfo * pMethodInfo,
173+ REGDISPLAY * pRegisterSet) PURE_VIRTUAL
174+ #endif
278175
279176 virtual PTR_VOID RemapHardwareFaultToGCSafePoint (MethodInfo * pMethodInfo, PTR_VOID controlPC) PURE_VIRTUAL
280177
0 commit comments