summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2015-11-19 13:15:43 -0800
committerPat Gavlin <pagavlin@microsoft.com>2015-11-19 13:36:40 -0800
commit915d00bbdb22b60518a3f168afadd6679d1947b4 (patch)
tree1e2b3950d793499d897e4a09c50e9222455e1e0c /src
parent7b4e0b18f777ee5f7f48a4506e7dc1ba1b60dd97 (diff)
downloadcoreclr-915d00bbdb22b60518a3f168afadd6679d1947b4.tar.gz
coreclr-915d00bbdb22b60518a3f168afadd6679d1947b4.tar.bz2
coreclr-915d00bbdb22b60518a3f168afadd6679d1947b4.zip
Small cleanups in SysV classification.
- Clean up/clarify the logic in CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor - Move a static helper function off of MethodTable
Diffstat (limited to 'src')
-rw-r--r--src/vm/jitinterface.cpp48
-rw-r--r--src/vm/methodtable.cpp2
-rw-r--r--src/vm/methodtable.h3
3 files changed, 14 insertions, 39 deletions
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index c331a30001..6ca4299f63 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -2577,14 +2577,14 @@ bool CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor(
_ASSERTE(structPassInRegDescPtr != nullptr);
TypeHandle th(structHnd);
+
+ structPassInRegDescPtr->passedInRegisters = false;
// Make sure this is a value type.
if (th.IsValueType())
{
_ASSERTE(CorInfoType2UnixAmd64Classification(th.GetInternalCorElementType()) == SystemVClassificationTypeStruct);
- MethodTable* methodTablePtr = nullptr;
-
// The useNativeLayout in this case tracks whether the classification
// is for a native layout of the struct or not.
// If the struct has special marshaling it has a native layout.
@@ -2592,43 +2592,23 @@ bool CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor(
// For structs with no native layout, the managed layout should be used
// even if classified for the purposes of marshaling/PInvoke passing.
bool useNativeLayout = false;
+ MethodTable* methodTablePtr = nullptr;
if (!th.IsTypeDesc())
{
methodTablePtr = th.AsMethodTable();
- _ASSERTE(methodTablePtr != nullptr);
- }
- else if (th.IsTypeDesc())
- {
- if (th.IsNativeValueType())
- {
- methodTablePtr = th.AsNativeValueType();
- useNativeLayout = true;
- _ASSERTE(methodTablePtr != nullptr);
- }
- else
- {
- _ASSERTE(false && "Unhandled TypeHandle for struct!");
- }
- }
-
- bool isPassableInRegs = false;
-
- if (useNativeLayout)
- {
- _ASSERTE(th.IsNativeValueType());
- isPassableInRegs = methodTablePtr->GetLayoutInfo()->IsNativeStructPassedInRegisters();
}
else
{
- _ASSERTE(!th.IsNativeValueType());
- isPassableInRegs = methodTablePtr->IsRegPassedStruct();
- }
+ _ASSERTE(th.IsNativeValueType());
- if (!isPassableInRegs)
- {
- structPassInRegDescPtr->passedInRegisters = false;
+ useNativeLayout = true;
+ methodTablePtr = th.AsNativeValueType();
}
- else
+ _ASSERTE(methodTablePtr != nullptr);
+
+ bool canPassInRegisters = useNativeLayout ? methodTablePtr->GetLayoutInfo()->IsNativeStructPassedInRegisters()
+ : methodTablePtr->IsRegPassedStruct();
+ if (canPassInRegisters)
{
SystemVStructRegisterPassingHelper helper((unsigned int)th.GetSize());
bool result = methodTablePtr->ClassifyEightBytes(&helper, 0, 0, useNativeLayout);
@@ -2647,10 +2627,8 @@ bool CEEInfo::getSystemVAmd64PassStructInRegisterDescriptor(
structPassInRegDescPtr->eightByteOffsets[i] = helper.eightByteOffsets[i];
}
}
- }
- else
- {
- structPassInRegDescPtr->passedInRegisters = false;
+
+ _ASSERTE(structPassInRegDescPtr->passedInRegisters == canPassInRegisters);
}
EE_TO_JIT_TRANSITION();
diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp
index ca8ababd4f..f06138ad60 100644
--- a/src/vm/methodtable.cpp
+++ b/src/vm/methodtable.cpp
@@ -2316,7 +2316,7 @@ bool MethodTable::ClassifyEightBytes(SystemVStructRegisterPassingHelperPtr helpe
// If we have a field classification already, but there is a union, we must merge the classification type of the field. Returns the
// new, merged classification type.
/* static */
-SystemVClassificationType MethodTable::ReClassifyField(SystemVClassificationType originalClassification, SystemVClassificationType newFieldClassification)
+static SystemVClassificationType ReClassifyField(SystemVClassificationType originalClassification, SystemVClassificationType newFieldClassification)
{
_ASSERTE((newFieldClassification == SystemVClassificationTypeInteger) ||
(newFieldClassification == SystemVClassificationTypeIntegerReference) ||
diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h
index 2dd532a6b0..a7cfce779a 100644
--- a/src/vm/methodtable.h
+++ b/src/vm/methodtable.h
@@ -1046,9 +1046,6 @@ public:
void CheckRunClassInitAsIfConstructingThrowing();
#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)
- // Helper function for ClassifyEightBytesWithManagedLayout and ClassifyEightBytesWithNativeLayout
- static SystemVClassificationType ReClassifyField(SystemVClassificationType originalClassification, SystemVClassificationType newFieldClassification);
-
// Builds the internal data structures and classifies struct eightbytes for Amd System V calling convention.
bool ClassifyEightBytes(SystemVStructRegisterPassingHelperPtr helperPtr, unsigned int nestingLevel, unsigned int startOffsetOfStruct, bool isNativeStruct);
#endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF)