Skip to content

Commit 27d2321

Browse files
authored
Remove getTypeForBoxOnStack from jit interface (#114754)
Along with the `StackAllocatedBox` type. The JIT can now represent on-stack boxes directly via class layouts. Closes #114204
1 parent 07f3e33 commit 27d2321

File tree

17 files changed

+117
-286
lines changed

17 files changed

+117
-286
lines changed

src/coreclr/inc/corinfo.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,14 +2481,6 @@ class ICorStaticInfo
24812481
CORINFO_CLASS_HANDLE cls
24822482
) = 0;
24832483

2484-
// Get a representation for a stack-allocated boxed value type.
2485-
//
2486-
// This differs from getTypeForBox in that it includes an explicit field
2487-
// for the method table pointer.
2488-
virtual CORINFO_CLASS_HANDLE getTypeForBoxOnStack(
2489-
CORINFO_CLASS_HANDLE cls
2490-
) = 0;
2491-
24922484
// returns the correct box helper for a particular class. Note
24932485
// that if this returns CORINFO_HELP_BOX, the JIT can assume
24942486
// 'standard' boxing (allocate object and copy), and optimize

src/coreclr/inc/icorjitinfoimpl_generated.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ CorInfoHelpFunc getSharedCCtorHelper(
281281
CORINFO_CLASS_HANDLE getTypeForBox(
282282
CORINFO_CLASS_HANDLE cls) override;
283283

284-
CORINFO_CLASS_HANDLE getTypeForBoxOnStack(
285-
CORINFO_CLASS_HANDLE cls) override;
286-
287284
CorInfoHelpFunc getBoxHelper(
288285
CORINFO_CLASS_HANDLE cls) override;
289286

src/coreclr/inc/jiteeversionguid.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737

3838
#include <minipal/guid.h>
3939

40-
constexpr GUID JITEEVersionIdentifier = { /* 7139df75-63b2-4610-9a53-f9a86f474db8 */
41-
0x7139df75,
42-
0x63b2,
43-
0x4610,
44-
{0x9a, 0x53, 0xf9, 0xa8, 0x6f, 0x47, 0x4d, 0xb8}
40+
constexpr GUID JITEEVersionIdentifier = { /* ee9ed227-1567-4d4d-85ed-a183512da288 */
41+
0xee9ed227,
42+
0x1567,
43+
0x4d4d,
44+
{0x85, 0xed, 0xa1, 0x83, 0x51, 0x2d, 0xa2, 0x88}
4545
};
4646

4747
#endif // JIT_EE_VERSIONING_GUID_H

src/coreclr/jit/ICorJitInfo_names_generated.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ DEF_CLR_API(getNewArrHelper)
6969
DEF_CLR_API(getCastingHelper)
7070
DEF_CLR_API(getSharedCCtorHelper)
7171
DEF_CLR_API(getTypeForBox)
72-
DEF_CLR_API(getTypeForBoxOnStack)
7372
DEF_CLR_API(getBoxHelper)
7473
DEF_CLR_API(getUnBoxHelper)
7574
DEF_CLR_API(getRuntimeTypePointer)

src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,6 @@ CORINFO_CLASS_HANDLE WrapICorJitInfo::getTypeForBox(
647647
return temp;
648648
}
649649

650-
CORINFO_CLASS_HANDLE WrapICorJitInfo::getTypeForBoxOnStack(
651-
CORINFO_CLASS_HANDLE cls)
652-
{
653-
API_ENTER(getTypeForBoxOnStack);
654-
CORINFO_CLASS_HANDLE temp = wrapHnd->getTypeForBoxOnStack(cls);
655-
API_LEAVE(getTypeForBoxOnStack);
656-
return temp;
657-
}
658-
659650
CorInfoHelpFunc WrapICorJitInfo::getBoxHelper(
660651
CORINFO_CLASS_HANDLE cls)
661652
{

src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,30 +2653,6 @@ private CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_STRUCT_* clsHnd)
26532653
return ObjectToHandle(typeForBox);
26542654
}
26552655

2656-
private CORINFO_CLASS_STRUCT_* getTypeForBoxOnStack(CORINFO_CLASS_STRUCT_* cls)
2657-
{
2658-
TypeDesc clsTypeDesc = HandleToObject(cls);
2659-
if (clsTypeDesc.IsNullable)
2660-
{
2661-
clsTypeDesc = clsTypeDesc.Instantiation[0];
2662-
}
2663-
2664-
if (clsTypeDesc.RequiresAlign8())
2665-
{
2666-
// Conservatively give up on such types (32bit)
2667-
return null;
2668-
}
2669-
2670-
// Instantiate StackAllocatedBox<T> helper type with the type we're boxing
2671-
MetadataType placeholderType = _compilation.TypeSystemContext.SystemModule.GetType("System.Runtime.CompilerServices", "StackAllocatedBox`1", throwIfNotFound: false);
2672-
if (placeholderType == null)
2673-
{
2674-
// Give up if corelib does not have support for stackallocation
2675-
return null;
2676-
}
2677-
return ObjectToHandle(placeholderType.MakeInstantiatedType(clsTypeDesc));
2678-
}
2679-
26802656
private CorInfoHelpFunc getBoxHelper(CORINFO_CLASS_STRUCT_* cls)
26812657
{
26822658
var type = HandleToObject(cls);

src/coreclr/tools/Common/JitInterface/CorInfoImpl_generated.cs

Lines changed: 112 additions & 128 deletions
Large diffs are not rendered by default.

src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ FUNCTIONS
229229
CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
230230
CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd)
231231
CORINFO_CLASS_HANDLE getTypeForBox(CORINFO_CLASS_HANDLE cls)
232-
CORINFO_CLASS_HANDLE getTypeForBoxOnStack(CORINFO_CLASS_HANDLE cls)
233232
CorInfoHelpFunc getBoxHelper(CORINFO_CLASS_HANDLE cls)
234233
CorInfoHelpFunc getUnBoxHelper(CORINFO_CLASS_HANDLE cls)
235234
CORINFO_OBJECT_HANDLE getRuntimeTypePointer(CORINFO_CLASS_HANDLE cls)

src/coreclr/tools/aot/jitinterface/jitinterface_generated.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ struct JitInterfaceCallbacks
7676
CorInfoHelpFunc (* getCastingHelper)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing);
7777
CorInfoHelpFunc (* getSharedCCtorHelper)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE clsHnd);
7878
CORINFO_CLASS_HANDLE (* getTypeForBox)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
79-
CORINFO_CLASS_HANDLE (* getTypeForBoxOnStack)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
8079
CorInfoHelpFunc (* getBoxHelper)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
8180
CorInfoHelpFunc (* getUnBoxHelper)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
8281
CORINFO_OBJECT_HANDLE (* getRuntimeTypePointer)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_CLASS_HANDLE cls);
@@ -838,15 +837,6 @@ class JitInterfaceWrapper : public ICorJitInfo
838837
return temp;
839838
}
840839

841-
virtual CORINFO_CLASS_HANDLE getTypeForBoxOnStack(
842-
CORINFO_CLASS_HANDLE cls)
843-
{
844-
CorInfoExceptionClass* pException = nullptr;
845-
CORINFO_CLASS_HANDLE temp = _callbacks->getTypeForBoxOnStack(_thisHandle, &pException, cls);
846-
if (pException != nullptr) throw pException;
847-
return temp;
848-
}
849-
850840
virtual CorInfoHelpFunc getBoxHelper(
851841
CORINFO_CLASS_HANDLE cls)
852842
{

src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -735,15 +735,6 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls)
735735
return temp;
736736
}
737737

738-
// Class handle for a boxed value type, on the stack.
739-
CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBoxOnStack(CORINFO_CLASS_HANDLE cls)
740-
{
741-
mc->cr->AddCall("getTypeForBoxOnStack");
742-
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getTypeForBoxOnStack(cls);
743-
mc->recGetTypeForBoxOnStack(cls, temp);
744-
return temp;
745-
}
746-
747738
// returns the correct box helper for a particular class. Note
748739
// that if this returns CORINFO_HELP_BOX, the JIT can assume
749740
// 'standard' boxing (allocate object and copy), and optimize

0 commit comments

Comments
 (0)