Browse files

Fill the VariableDescription ReferenceType and MethodTable in lvaSetS…

…truct. Let the CEEInfo::getClassGCLayout working on class.
  • Loading branch information...
xoofx committed Oct 1, 2015
1 parent a5270f4 commit a232a0d27de942c5e684ac752608a9624fde92d9
Showing with 15 additions and 2 deletions.
  1. +12 −1 src/jit/lclvars.cpp
  2. +3 −1 src/vm/jitinterface.cpp
@@ -1733,7 +1733,18 @@ void Compiler::lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, boo
if (setTypeInfo)
varDsc->lvVerTypeInfo = typeInfo(TI_STRUCT, typeHnd);

varDsc->lvExactSize = info.compCompHnd->getClassSize(typeHnd);
// ClassAsValue: If this is a reference type used as a valuetype, get the full size of the type (including the method table and minimum size)
varDsc->lvIsReferenceType = !info.compCompHnd->isValueClass(typeHnd);
if (varDsc->lvIsReferenceType)
// Grab reference of method table here, as we are going to use it later for codegen in method to store the actual methodtable pointer
varDsc->lvReferenceTypeMethodTable = info.compCompHnd->getMethodTable(typeHnd);
varDsc->lvExactSize = info.compCompHnd->getBaseSize(typeHnd);
varDsc->lvExactSize = info.compCompHnd->getClassSize(typeHnd);

size_t lvSize = varDsc->lvSize();
assert((lvSize % sizeof(void*)) == 0); // The struct needs to be a multiple of sizeof(void*) bytes for getClassGClayout() to be valid.
@@ -2550,7 +2550,9 @@ unsigned CEEInfo::getClassGClayout (CORINFO_CLASS_HANDLE clsHnd, BYTE* gcPtrs)
// ClassAsValue: Disable check for valuetype, as we are going to allow them on the stack
// TODO: Check that the following code return all (inherited) fields even for a class and not only for a valuetype.
_ASSERTE(sizeof(BYTE) == 1);

// assume no GC pointers at first

0 comments on commit a232a0d

Please sign in to comment.