public BoxedValueType(ModuleDesc owningModule, MetadataType valuetype) { // BoxedValueType has the same genericness as the valuetype it's wrapping. // Making BoxedValueType wrap the genericness (and be itself nongeneric) would // require a crazy name mangling scheme to allow generating stable and unique names // for the wrappers. Debug.Assert(valuetype.IsTypeDefinition); Debug.Assert(valuetype.IsValueType); Module = owningModule; ValueTypeRepresented = valuetype; // Unboxing thunks for byref-like types don't make sense. Byref-like types cannot be boxed. // We still allow these to exist in the system, because it's easier than trying to prevent // their creation. We create them as if they existed (in lieu of e.g. pointing all of them // to the same __unreachable method body) so that the various places that store pointers to // them because they want to be able to extract the target instance method can use the same // mechanism they use for everything else at runtime. // The main difference is that the "Boxed_ValueType" version has no fields. Reference types // cannot have byref-like fields. if (!valuetype.IsByRefLike) { BoxedValue = new BoxedValueField(this); } }
public BoxedValueType(ModuleDesc owningModule, MetadataType valuetype) { // BoxedValueType has the same genericness as the valuetype it's wrapping. // Making BoxedValueType wrap the genericness (and be itself nongeneric) would // require a crazy name mangling scheme to allow generating stable and unique names // for the wrappers. Debug.Assert(valuetype.IsTypeDefinition); Debug.Assert(valuetype.IsValueType); Module = owningModule; ValueTypeRepresented = valuetype; BoxedValue = new BoxedValueField(this); }