void IAssemblyCompilerStage.Run(AssemblyCompiler compiler) { // Save the Compiler _compiler = compiler; // The compilation target Architecture _architecture = compiler.Architecture; // The type system _typeSystem = RuntimeBase.Instance.TypeLoader; // Enumerate all types and do an appropriate type layout ReadOnlyRuntimeTypeListView types = _typeSystem.GetTypesFromModule(compiler.Assembly); foreach (RuntimeType type in types) { switch (type.Attributes & TypeAttributes.LayoutMask) { case TypeAttributes.AutoLayout: goto case TypeAttributes.SequentialLayout; case TypeAttributes.SequentialLayout: CreateSequentialLayout(type); break; case TypeAttributes.ExplicitLayout: CreateExplicitLayout(type); break; } } }
void IAssemblyCompilerStage.Run(AssemblyCompiler compiler) { // Retrieve the provider provider ReadOnlyRuntimeTypeListView types = RuntimeBase.Instance.TypeLoader.GetTypesFromModule(compiler.Assembly); foreach (RuntimeType type in types) { // Do not compile generic types if (type.IsGeneric) { continue; } foreach (RuntimeMethod method in type.Methods) { if (method.IsGeneric) { continue; } if (method.IsNative) { Debug.WriteLine("Skipping native method: " + type + "." + method.Name); Debug.WriteLine("Method will not be available in compiled image."); continue; } // FIXME: Create a method implementation for this method... //MethodImplementation methodImpl = provider.GetRow<MethodImplementation>(method); //methodImpl.OwnerType = type; //Debug.WriteLine("\tMethod: " + method.ToString()); // Schedule the method for compilation... // FIXME: Do we really want to do it this way? Shouldn't we use some compilation service for this? // REFACTOR out of the AssemblyCompiler class MethodCompilerBase mcb = compiler.CreateMethodCompiler(type, method); ScheduleMethod(mcb); } } }