예제 #1
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(MethodEntrypoint(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }

                // On CLR this would throw a SecurityException with "ECall methods must be packaged into a system module."
                // This is a corner case that nobody is likely to care about.
                throw new TypeSystemException.InvalidProgramException(ExceptionStringID.InvalidProgramSpecific, method);
            }

            if (CompilationModuleGroup.ContainsMethod(method))
            {
                return(new MethodCodeNode(method));
            }
            else
            {
                return(new ExternMethodSymbolNode(method));
            }
        }
예제 #2
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                // TODO: come up with a scheme where this can be shared between codegen backends and the scanner
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(new ScannedMethodNode(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }
            }

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                return(new ScannedMethodNode(method));
            }
            else
            {
                return(new ExternMethodSymbolNode(this, method));
            }
        }
예제 #3
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(MethodEntrypoint(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }
            }

            // MethodDesc that represents an unboxing thunk is a thing that is internal to the JitInterface.
            // It should not leak out of JitInterface.
            Debug.Assert(!Internal.JitInterface.UnboxingMethodDescExtensions.IsUnboxingThunk(method));

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                return(new MethodCodeNode(method));
            }
            else
            {
                return(_importedNodeProvider.ImportedMethodCodeNode(this, method, false));
            }
        }
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                // TODO: come up with a scheme where this can be shared between codegen backends and the scanner
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return new ScannedMethodNode(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return new RuntimeImportMethodNode(method);
                }

                // On CLR this would throw a SecurityException with "ECall methods must be packaged into a system module."
                // This is a corner case that nobody is likely to care about.
                ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, method);
            }

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                return new ScannedMethodNode(method);
            }
            else
            {
                return new ExternMethodSymbolNode(this, method);
            }
        }
예제 #5
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(MethodEntrypoint(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }
            }

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                return(new MethodCodeNode(method));
            }
            else
            {
                return(_importedNodeProvider.ImportedMethodCodeNode(this, method, false));
            }
        }
 protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
 {
     if (method.IsInternalCall)
     {
         if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
         {
             return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
         }
     }
     if (CompilationModuleGroup.ContainsMethodBody(method, false))
     {
         return(new WebAssemblyMethodBodyNode(method));
     }
     else
     {
         return(new ExternMethodSymbolNode(this, method));
     }
 }
예제 #7
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (TypeSystemContext.IsDefaultInterfaceMethodImplementationThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealDefaultInterfaceMethodImplementationThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(MethodEntrypoint(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }
            }

            // MethodDesc that represents an unboxing thunk is a thing that is internal to the JitInterface.
            // It should not leak out of JitInterface.
            Debug.Assert(!Internal.JitInterface.UnboxingMethodDescExtensions.IsUnboxingThunk(method));

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                // We might be able to optimize the method body away if the owning type was never seen as allocated.
                if (method.NotCallableWithoutOwningEEType() && CompilationModuleGroup.AllowInstanceMethodOptimization(method))
                {
                    return(new TentativeInstanceMethodNode(new MethodCodeNode(method)));
                }

                return(new MethodCodeNode(method));
            }
            else
            {
                return(_importedNodeProvider.ImportedMethodCodeNode(this, method, false));
            }
        }
예제 #8
0
        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (method.IsInternalCall)
            {
                // TODO: come up with a scheme where this can be shared between codegen backends and the scanner
                if (TypeSystemContext.IsSpecialUnboxingThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealSpecialUnboxingThunkTargetMethod(method)));
                }
                else if (TypeSystemContext.IsDefaultInterfaceMethodImplementationThunkTargetMethod(method))
                {
                    return(MethodEntrypoint(TypeSystemContext.GetRealDefaultInterfaceMethodImplementationThunkTargetMethod(method)));
                }
                else if (method.IsArrayAddressMethod())
                {
                    return(new ScannedMethodNode(((ArrayType)method.OwningType).GetArrayMethod(ArrayMethodKind.AddressWithHiddenArg)));
                }
                else if (method.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute"))
                {
                    return(new RuntimeImportMethodNode(method));
                }
            }

            if (CompilationModuleGroup.ContainsMethodBody(method, false))
            {
                // We might be able to optimize the method body away if the owning type was never seen as allocated.
                if (method.NotCallableWithoutOwningEEType() && CompilationModuleGroup.AllowInstanceMethodOptimization(method))
                {
                    return(new TentativeInstanceMethodNode(new ScannedMethodNode(method)));
                }

                return(new ScannedMethodNode(method));
            }
            else
            {
                return(new ExternMethodSymbolNode(this, method));
            }
        }