private static void MarkRefInstance(ChildRewriter cr, Expression instance) { // Primitive value types are okay because they are all readonly, // but we can't rely on this for non-primitive types. For those // we have to spill the by ref local. if (instance != null && instance.Type.GetTypeInfo().IsValueType&& instance.Type.GetTypeCode() == TypeCode.Object) { cr.MarkByRef(0); } }
private static void MarkRefArgs(ChildRewriter cr, MethodBase method, int firstIndex) { if (method != null) { var parameters = method.GetParametersCached(); for (int i = 0, j = firstIndex; i < parameters.Length; i++, j++) { var parameter = parameters[i]; if (parameter.ParameterType.IsByRef) { cr.MarkByRef(j); } } } }