diff --git a/Source/Inno-Setup-Script/Mosa-Installer.iss b/Source/Inno-Setup-Script/Mosa-Installer.iss index 76b465ebe6..05df15c3ee 100644 --- a/Source/Inno-Setup-Script/Mosa-Installer.iss +++ b/Source/Inno-Setup-Script/Mosa-Installer.iss @@ -58,6 +58,14 @@ Source: "..\..\bin\MOSA Project\packages.config"; DestDir: "{userdocs}\Visual St Source: "..\..\bin\MOSA Project\Program.cs"; DestDir: "{userdocs}\Visual Studio 2017\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion Source: "..\..\bin\MOSA Project\__TemplateIcon.ico"; DestDir: "{userdocs}\Visual Studio 2017\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion Source: "..\..\bin\Mosa.Tool.Bootstrap.exe"; DestDir: "{app}\bin"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\app.config"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\Boot.cs"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\Mosa.Starter.x86.csproj"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\MyTemplate.vstemplate"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\packages.config"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\Program.cs"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion +Source: "..\..\bin\MOSA Project\__TemplateIcon.ico"; DestDir: "{userdocs}\Visual Studio 2019\Templates\ProjectTemplates\Mosa Project"; Flags: ignoreversion + [ThirdParty] UseRelativePaths=True diff --git a/Source/Mosa.ClassLib/Mosa.ClassLib.nuspec b/Source/Mosa.ClassLib/Mosa.ClassLib.nuspec index d49735e40d..d6a289d8db 100644 --- a/Source/Mosa.ClassLib/Mosa.ClassLib.nuspec +++ b/Source/Mosa.ClassLib/Mosa.ClassLib.nuspec @@ -16,6 +16,6 @@ MOSA Compiler - + diff --git a/Source/Mosa.Compiler.Extension.Dwarf/DwarfCompilerStage.cs b/Source/Mosa.Compiler.Extension.Dwarf/DwarfCompilerStage.cs index 4552faf5b5..e8b4be5660 100644 --- a/Source/Mosa.Compiler.Extension.Dwarf/DwarfCompilerStage.cs +++ b/Source/Mosa.Compiler.Extension.Dwarf/DwarfCompilerStage.cs @@ -291,7 +291,7 @@ private void EmitDebugLineTypes(EndianAwareBinaryWriter wr) if (symbol.VirtualAddress == 0) continue; - var methodData = Compiler.CompilerData.GetMethodData(method); + var methodData = Compiler.GetMethodData(method); if (methodData == null) continue; diff --git a/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs b/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs index 5f951c3315..b985142b82 100644 --- a/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs +++ b/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs @@ -105,7 +105,7 @@ public override string ToString() /// Name of the method. /// The linker. /// The stream the machine code is written to. - public void Initialize(string methodName, Linker.MosaLinker linker, Stream codeStream) + public void Initialize(string methodName, MosaLinker linker, Stream codeStream) { Debug.Assert(codeStream != null); Debug.Assert(linker != null); @@ -114,10 +114,6 @@ public void Initialize(string methodName, Linker.MosaLinker linker, Stream codeS Linker = linker; CodeStream = codeStream; - // only necessary if method is being recompiled (due to inline optimization, for example) - var symbol = linker.GetSymbol(MethodName); - symbol.RemovePatches(); - Labels = new Dictionary(); OpcodeEncoder = new OpcodeEncoder(this); diff --git a/Source/Mosa.Compiler.Framework/BaseMethodCompilerStage.cs b/Source/Mosa.Compiler.Framework/BaseMethodCompilerStage.cs index 06910ade06..4401df5cfd 100644 --- a/Source/Mosa.Compiler.Framework/BaseMethodCompilerStage.cs +++ b/Source/Mosa.Compiler.Framework/BaseMethodCompilerStage.cs @@ -165,20 +165,17 @@ public abstract class BaseMethodCompilerStage : ITraceFactory /// /// Gets the stack frame. /// - protected Operand StackFrame { get { return MethodCompiler.StackFrame; } } + protected Operand StackFrame { get { return MethodCompiler.Compiler.StackFrame; } } /// /// Gets the stack pointer. /// - protected Operand StackPointer { get { return MethodCompiler.StackPointer; } } + protected Operand StackPointer { get { return MethodCompiler.Compiler.StackPointer; } } /// /// Gets a value indicating whether this instance has protected regions. /// - /// - /// true if this instance has protected regions; otherwise, false. - /// - protected bool HasProtectedRegions { get { return Method.ExceptionHandlers.Count != 0; } } + protected bool HasProtectedRegions { get { return MethodCompiler.HasProtectedRegions; } } /// /// Gets a value indicating whether this instance has code. diff --git a/Source/Mosa.Compiler.Framework/Compiler.cs b/Source/Mosa.Compiler.Framework/Compiler.cs index bc37d2871e..cd74c03088 100644 --- a/Source/Mosa.Compiler.Framework/Compiler.cs +++ b/Source/Mosa.Compiler.Framework/Compiler.cs @@ -110,6 +110,16 @@ public sealed class Compiler /// public bool IsStopped { get; private set; } + /// + /// The stack frame + /// + internal Operand StackFrame { get; } + + /// + /// The stack frame + /// + internal Operand StackPointer { get; } + #endregion Properties #region Static Methods @@ -117,7 +127,9 @@ public sealed class Compiler private static List GetDefaultCompilerPipeline(CompilerOptions compilerOptions) { return new List { + new UnitTestStage(), new TypeInitializerStage(), + new DevirtualizationStage(), new StaticFieldStage(), new MethodTableStage(), new ExceptionTableStage(), @@ -141,8 +153,10 @@ private static List GetDefaultMethodPipeline(CompilerOp new ExceptionStage(), new CILStaticAllocationResolutionStage(), new CILTransformationStage(), + new DevirtualizeCallStage(), new PlugStage(), new UnboxValueTypeStage(), + new LowerIRStage(), (compilerOptions.EnableInlinedMethods) ? new InlineStage() : null, (compilerOptions.EnableInlinedMethods) ? new BlockMergeStage() : null, (compilerOptions.EnableInlinedMethods) ? new DeadBlockStage() : null, @@ -152,12 +166,12 @@ private static List GetDefaultMethodPipeline(CompilerOp (compilerOptions.EnableSSA) ? new EnterSSAStage() : null, //(compilerOptions.EnableBitTracker) ? new BitTrackerStage() : null, + (compilerOptions.EnableValueNumbering && compilerOptions.EnableSSA) ? new ValueNumberingStage() : null, (compilerOptions.EnableLoopInvariantCodeMotion && compilerOptions.EnableSSA) ? new LoopInvariantCodeMotionStage() : null, (compilerOptions.EnableSparseConditionalConstantPropagation && compilerOptions.EnableSSA) ? new SparseConditionalConstantPropagationStage() : null, (compilerOptions.EnableIROptimizations) ? new IROptimizationStage() : null, (compilerOptions.EnableIRLongExpansion && compilerOptions.Architecture.NativePointerSize == 4) ? new IRLongDecompositionStage() : null, - new LowerIRStage(), (compilerOptions.EnableBitTracker) ? new BitTrackerStage() : null, (compilerOptions.TwoPassOptimizations && compilerOptions.EnableValueNumbering && compilerOptions.EnableSSA) ? new ValueNumberingStage() : null, (compilerOptions.TwoPassOptimizations && compilerOptions.EnableLoopInvariantCodeMotion && compilerOptions.EnableSSA) ? new LoopInvariantCodeMotionStage() : null, @@ -167,10 +181,11 @@ private static List GetDefaultMethodPipeline(CompilerOp new DeadBlockStage(), new BlockMergeStage(), new IRCleanupStage(), + new NewObjectIRStage(), (compilerOptions.EnableInlinedMethods) ? new InlineEvaluationStage() : null, //new StopStage(), - new DevirtualizeCallStage(), + new CallStage(), new PlatformIntrinsicStage(), new PlatformEdgeSplitStage(), @@ -183,7 +198,6 @@ private static List GetDefaultMethodPipeline(CompilerOp //new PreciseGCStage(), new CodeGenerationStage(compilerOptions.EmitBinary), - (compilerOptions.EmitBinary) ? new ProtectedRegionLayoutStage() : null, }; } @@ -201,6 +215,9 @@ public Compiler(MosaCompiler mosaCompiler) CompilerTrace = mosaCompiler.CompilerTrace; Architecture = CompilerOptions.Architecture; + StackFrame = Operand.CreateCPURegister(TypeSystem.BuiltIn.Pointer, Architecture.StackFrameRegister); + StackPointer = Operand.CreateCPURegister(TypeSystem.BuiltIn.Pointer, Architecture.StackPointerRegister); + PostCompilerTraceEvent(CompilerEvent.CompilerStart); CompilerExtensions.AddRange(mosaCompiler.CompilerExtensions); @@ -575,6 +592,11 @@ private MosaType GeInternalRuntimeType() return TypeSystem.GetTypeByName("Mosa.Runtime", "Internal"); } + public MethodData GetMethodData(MosaMethod method) + { + return CompilerData.GetMethodData(method); + } + #endregion Helper Methods #region Type Methods diff --git a/Source/Mosa.Compiler.Framework/CompilerData.cs b/Source/Mosa.Compiler.Framework/CompilerData.cs index c8d4fd46a0..689e95cefc 100644 --- a/Source/Mosa.Compiler.Framework/CompilerData.cs +++ b/Source/Mosa.Compiler.Framework/CompilerData.cs @@ -49,23 +49,23 @@ public MethodData GetMethodData(MosaMethod method) { lock (methods) { - if (!methods.TryGetValue(method, out MethodData compilerMethod)) + if (!methods.TryGetValue(method, out MethodData methodData)) { - compilerMethod = new MethodData(method); - methods.Add(method, compilerMethod); + methodData = new MethodData(method) + { + HasProtectedRegions = method.ExceptionHandlers.Count != 0, + IsLinkerGenerated = method.IsCompilerGenerated, + HasDoNotInlineAttribute = method.IsNoInlining, + HasAggressiveInliningAttribute = method.IsAggressiveInlining + }; + + methods.Add(method, methodData); } - return compilerMethod; + return methodData; } } - public bool IsMethodInlined(MosaMethod method) - { - var methodData = GetMethodData(method); - - return methodData.Inlined; - } - #endregion Methods } } diff --git a/Source/Mosa.Compiler.Framework/CompilerOptions.cs b/Source/Mosa.Compiler.Framework/CompilerOptions.cs index 60a20d26d0..8fecdd0c15 100644 --- a/Source/Mosa.Compiler.Framework/CompilerOptions.cs +++ b/Source/Mosa.Compiler.Framework/CompilerOptions.cs @@ -156,6 +156,11 @@ public class CompilerOptions /// public bool EnableMethodScanner { get; set; } + /// + /// Gets or sets a value indicating whether [emit inline methods]. + /// + public bool EmitInlinedMethods { get; set; } + /// /// Adds additional sections to the Elf-File. /// @@ -334,6 +339,7 @@ public CompilerOptions() EnablePlatformOptimizations = true; EnableMethodScanner = false; EnableBitTracker = true; + EmitInlinedMethods = false; } } } diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/DebugFileStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/DebugFileStage.cs index 6b92c8c766..189d7d7c12 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/DebugFileStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/DebugFileStage.cs @@ -131,7 +131,7 @@ private void EmitMethods() continue; var symbol = Linker.GetSymbol(method.FullName); - var methodData = Compiler.CompilerData.GetMethodData(method); + var methodData = Compiler.GetMethodData(method); writer.WriteLine( "{0}\t{1:x8}\t{2}\t{3:x8}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}", diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/DevirtualizationStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/DevirtualizationStage.cs new file mode 100644 index 0000000000..f63965d862 --- /dev/null +++ b/Source/Mosa.Compiler.Framework/CompilerStages/DevirtualizationStage.cs @@ -0,0 +1,76 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.Framework.IR; +using Mosa.Compiler.Framework.Trace; +using Mosa.Compiler.MosaTypeSystem; + +namespace Mosa.Compiler.Framework.CompilerStages +{ + /// + /// Devirtualization Stage + /// + /// + public sealed class DevirtualizationStage : BaseCompilerStage + { + private Counter DevirtualizedMethodsCount = new Counter("DevirtualizationStage.DevirtualizedMethodsCount"); + + #region Overrides + + protected override void Setup() + { + foreach (var type in TypeSystem.AllTypes) + { + // If type has an interface - don't consider either type for devirtualization + // FUTURE: be more specific and check each method + if (HasInterface(type)) + continue; + + foreach (var method in type.Methods) + { + if (method.IsStatic || !method.IsVirtual) + continue; + + if (!method.HasImplementation && method.IsAbstract) + continue; + + if (TypeLayout.IsMethodOverridden(method)) + continue; + + var methodData = Compiler.GetMethodData(method); + + methodData.IsDevirtualized = true; + DevirtualizedMethodsCount++; + } + } + } + + protected override void Finalization() + { + if (CompilerOptions.EnableStatistics) + { + //var log = new TraceLog(TraceType.MethodCounters, null, string.Empty); + //log.Log(MethodData.Counters.Export()); + //CompilerTrace.PostTraceLog(log); + } + } + + #endregion Overrides + + private bool HasInterface(MosaType type) + { + var baseType = type; + + while (baseType != null) + { + foreach (var interfaceType in baseType.Interfaces) + { + return true; + } + + baseType = baseType.BaseType; + } + + return false; + } + } +} diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/ExceptionTableStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/ExceptionTableStage.cs index e30ba9a19c..0f217a126b 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/ExceptionTableStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/ExceptionTableStage.cs @@ -31,8 +31,8 @@ protected override void Finalization() protected void CreateMethodExceptionLookupTable() { // Emit assembly list - var methodLookupTable = Linker.DefineSymbol(Metadata.MethodExceptionLookupTable, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); - var writer = new EndianAwareBinaryWriter(methodLookupTable.Stream, Architecture.Endianness); + var exceptionMethodLookupTable = Linker.DefineSymbol(Metadata.MethodExceptionLookupTable, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); + var writer = new EndianAwareBinaryWriter(exceptionMethodLookupTable.Stream, Architecture.Endianness); // 1. Number of methods int count = 0; @@ -55,25 +55,24 @@ protected void CreateMethodExceptionLookupTable() foreach (var method in methodList) { - if ((!method.HasImplementation && method.IsAbstract) || method.HasOpenGenericParams || method.DeclaringType.HasOpenGenericParams) - continue; + var targetMethodData = GetTargetMethodData(method); - if (method.ExceptionHandlers.Count == 0) + if (!targetMethodData.HasCode) continue; - if (!Compiler.MethodScanner.IsMethodInvoked(method)) + if (!targetMethodData.HasProtectedRegions) continue; // 1. Pointer to Method - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodLookupTable, writer.Position, method.FullName, 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, exceptionMethodLookupTable, writer.Position, targetMethodData.Method.FullName, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); // 2. Size of Method - Linker.Link(LinkType.Size, NativePatchType, methodLookupTable, writer.Position, method.FullName, 0); + Linker.Link(LinkType.Size, NativePatchType, exceptionMethodLookupTable, writer.Position, targetMethodData.Method.FullName, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); // 3. Pointer to Method Definition - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodLookupTable, writer.Position, Metadata.MethodDefinition + method.FullName, 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, exceptionMethodLookupTable, writer.Position, Metadata.MethodDefinition + method.FullName, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); count++; @@ -87,5 +86,15 @@ protected void CreateMethodExceptionLookupTable() // emit null entry (FUTURE) //writer.WriteZeroBytes(TypeLayout.NativePointerSize * 3); } + + private MethodData GetTargetMethodData(MosaMethod method) + { + var methodData = Compiler.GetMethodData(method); + + if (methodData.ReplacedBy == null) + return methodData; + + return Compiler.GetMethodData(methodData.ReplacedBy); + } } } diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/MetadataStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/MetadataStage.cs index fc11afe049..31d4faac48 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/MetadataStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/MetadataStage.cs @@ -50,6 +50,16 @@ private LinkerSymbol EmitStringWithLength(string name, string value) return symbol; } + private MethodData GetTargetMethodData(MosaMethod method) + { + var methodData = Compiler.GetMethodData(method); + + if (methodData.ReplacedBy == null) + return methodData; + + return Compiler.GetMethodData(methodData.ReplacedBy); + } + #endregion Helper Functions #region Assembly Tables @@ -185,14 +195,12 @@ private LinkerSymbol CreateTypeDefinition(MosaType type, LinkerSymbol assemblyTa if (!method.IsConstructor || method.Signature.Parameters.Count != 0 || method.HasOpenGenericParams) continue; - // TODO: Inline - //if (Compiler.CompilerData.IsMethodInlined(method)) - // continue; + var targetMethodData = GetTargetMethodData(method); - if (!Compiler.MethodScanner.IsMethodInvoked(method)) - break; - - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, Metadata.MethodDefinition + method.FullName, 0); + if (targetMethodData.HasCode) + { + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, Metadata.MethodDefinition + targetMethodData.Method.FullName, 0); + } break; } @@ -247,16 +255,11 @@ private LinkerSymbol CreateTypeDefinition(MosaType type, LinkerSymbol assemblyTa // 15. Pointer to Methods foreach (var method in methodList) { - Debug.Assert((!(!method.HasImplementation && method.IsAbstract)) == (method.HasImplementation || !method.IsAbstract)); + var targetMethodData = GetTargetMethodData(method); - if ((!(!method.HasImplementation && method.IsAbstract)) - && !method.HasOpenGenericParams - && !method.DeclaringType.HasOpenGenericParams - - //&& !Compiler.CompilerData.IsMethodInlined(method) // TODO: Inline - && Compiler.MethodScanner.IsMethodInvoked(method)) + if (targetMethodData.HasCode) { - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, GetMethodNameConsiderPlug(method), 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, targetMethodData.Method.FullName, 0); } writer.WriteZeroBytes(TypeLayout.NativePointerSize); } @@ -264,14 +267,10 @@ private LinkerSymbol CreateTypeDefinition(MosaType type, LinkerSymbol assemblyTa // 16. Pointer to Method Definitions foreach (var method in methodList) { - if ((!(!method.HasImplementation && method.IsAbstract)) && !method.HasOpenGenericParams && !method.DeclaringType.HasOpenGenericParams) - { - // Create definition and get the symbol - var methodDefinitionSymbol = CreateMethodDefinition(method); - - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, methodDefinitionSymbol, 0); - } + // Create definition and get the symbol + var methodDefinitionSymbol = CreateMethodDefinition(method); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, typeTableSymbol, writer.Position, methodDefinitionSymbol, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); } } @@ -506,15 +505,16 @@ private LinkerSymbol CreatePropertyDefinitions(MosaType type) Linker.Link(LinkType.AbsoluteAddress, NativePatchType, propertyDefSymbol, writer2.Position, Metadata.TypeDefinition + property.PropertyType.FullName, 0); writer2.WriteZeroBytes(TypeLayout.NativePointerSize); - // If the type is a property then skip linking the methods + // If the type is a interface then skip linking the methods if (!type.IsInterface) { + // TODO: Replace .HasImpelement with .HasCode + // 5. Pointer to Getter Method Definition if (property.GetterMethod != null && property.GetterMethod.HasImplementation && !property.GetterMethod.HasOpenGenericParams) { Linker.Link(LinkType.AbsoluteAddress, NativePatchType, propertyDefSymbol, writer2.Position, Metadata.MethodDefinition + property.GetterMethod.FullName, 0); } - writer2.WriteZeroBytes(TypeLayout.NativePointerSize); // 6. Pointer to Setter Method Definition @@ -522,7 +522,6 @@ private LinkerSymbol CreatePropertyDefinitions(MosaType type) { Linker.Link(LinkType.AbsoluteAddress, NativePatchType, propertyDefSymbol, writer2.Position, Metadata.MethodDefinition + property.SetterMethod.FullName, 0); } - writer2.WriteZeroBytes(TypeLayout.NativePointerSize); } else @@ -545,11 +544,17 @@ private LinkerSymbol CreatePropertyDefinitions(MosaType type) private LinkerSymbol CreateMethodDefinition(MosaMethod method) { + var symbolName = Metadata.MethodDefinition + method.FullName; + var methodTableSymbol = Linker.GetSymbol(symbolName); + + if (methodTableSymbol.Size != 0) + return methodTableSymbol; + // Emit method name var methodNameSymbol = EmitStringWithLength(Metadata.NameString + method.FullName, method.FullName); // Emit method table - var methodTableSymbol = Linker.DefineSymbol(Metadata.MethodDefinition + method.FullName, SectionKind.ROData, TypeLayout.NativePointerAlignment, (method.Signature.Parameters.Count + 9) * TypeLayout.NativePointerSize); + methodTableSymbol = Linker.DefineSymbol(symbolName, SectionKind.ROData, TypeLayout.NativePointerAlignment, (method.Signature.Parameters.Count + 9) * TypeLayout.NativePointerSize); var writer = new EndianAwareBinaryWriter(methodTableSymbol.Stream, Architecture.Endianness); // 1. Pointer to Name @@ -567,18 +572,15 @@ private LinkerSymbol CreateMethodDefinition(MosaMethod method) // 3. Attributes writer.Write((uint)method.MethodAttributes, TypeLayout.NativePointerSize); + var targetMethodData = GetTargetMethodData(method); + // 4. Local Stack Size (16 Bits) && Parameter Stack Size (16 Bits) - var methodData = Compiler.CompilerData.GetMethodData(method); - int value = methodData.LocalMethodStackSize | (methodData.ParameterStackSize << 16); - writer.Write(value, TypeLayout.NativePointerSize); + writer.Write(targetMethodData.LocalMethodStackSize | (targetMethodData.ParameterStackSize << 16), TypeLayout.NativePointerSize); // 5. Pointer to Method - if (method.HasImplementation && !method.HasOpenGenericParams && !method.DeclaringType.HasOpenGenericParams /*&& !methodData.Inlined*/) // TODO: Inline + if (targetMethodData.HasCode) { - if (Compiler.MethodScanner.IsMethodInvoked(method)) - { - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodTableSymbol, writer.Position, GetMethodNameConsiderPlug(method), 0); - } + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodTableSymbol, writer.Position, targetMethodData.Method.FullName, 0); } writer.WriteZeroBytes(TypeLayout.NativePointerSize); @@ -587,9 +589,9 @@ private LinkerSymbol CreateMethodDefinition(MosaMethod method) writer.WriteZeroBytes(TypeLayout.NativePointerSize); // 7. Pointer to Exception Handler Table - if (method.ExceptionHandlers.Count != 0 && Compiler.MethodScanner.IsMethodInvoked(method)) + if (targetMethodData.HasProtectedRegions && targetMethodData.HasCode) { - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodTableSymbol, writer.Position, Metadata.ProtectedRegionTable + method.FullName, 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodTableSymbol, writer.Position, Metadata.ProtectedRegionTable + targetMethodData.Method.FullName, 0); } writer.WriteZeroBytes(TypeLayout.NativePointerSize); @@ -655,8 +657,15 @@ private LinkerSymbol CreateParameterDefinition(MosaParameter parameter) private LinkerSymbol CreateCustomAttributesTable(MosaUnit unit) { + var symbolName = Metadata.CustomAttributesTable + unit.FullName; + + var customAttributesTableSymbol = Linker.GetSymbol(symbolName); + + if (customAttributesTableSymbol.Size != 0) + return customAttributesTableSymbol; + // Emit custom attributes table - var customAttributesTableSymbol = Linker.DefineSymbol(Metadata.CustomAttributesTable + unit.FullName, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); + customAttributesTableSymbol = Linker.DefineSymbol(symbolName, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); var writer = new EndianAwareBinaryWriter(customAttributesTableSymbol.Stream, Architecture.Endianness); // 1. Number of Custom Attributes @@ -683,6 +692,7 @@ private LinkerSymbol CreateCustomAttribute(MosaUnit unit, MosaCustomAttribute ca { // Emit custom attribute list string name = unit.FullName + ">>" + position.ToString() + ":" + ca.Constructor.DeclaringType.Name; + var customAttributeSymbol = Linker.DefineSymbol(Metadata.CustomAttribute + name, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); var writer1 = new EndianAwareBinaryWriter(customAttributeSymbol.Stream, Architecture.Endianness); @@ -722,18 +732,24 @@ private LinkerSymbol CreateCustomAttribute(MosaUnit unit, MosaCustomAttribute ca return customAttributeSymbol; } - private LinkerSymbol CreateCustomAttributeArgument(string symbolName, int count, string name, MosaCustomAttribute.Argument arg, bool isField) + private LinkerSymbol CreateCustomAttributeArgument(string name, int count, string argName, MosaCustomAttribute.Argument arg, bool isField) { - string nameForSymbol = name ?? count.ToString(); - nameForSymbol = symbolName + ":" + nameForSymbol; - var symbol = Linker.DefineSymbol(Metadata.CustomAttributeArgument + nameForSymbol, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); - var writer1 = new EndianAwareBinaryWriter(symbol.Stream, Architecture.Endianness); + var attributeName = name + ":" + (argName ?? count.ToString()); + var symbolName = Metadata.CustomAttributeArgument + attributeName; + + var customAttributeArgumentSymbol = Linker.GetSymbol(symbolName); + + if (customAttributeArgumentSymbol.Size != 0) + return customAttributeArgumentSymbol; + + customAttributeArgumentSymbol = Linker.DefineSymbol(symbolName, SectionKind.ROData, TypeLayout.NativePointerAlignment, 0); + var writer1 = new EndianAwareBinaryWriter(customAttributeArgumentSymbol.Stream, Architecture.Endianness); // 1. Pointer to name (if named) - if (name != null) + if (argName != null) { - var nameSymbol = EmitStringWithLength(Metadata.NameString + nameForSymbol, name); - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, symbol, writer1.Position, nameSymbol, 0); + var nameSymbol = EmitStringWithLength(Metadata.NameString + attributeName, argName); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, customAttributeArgumentSymbol, writer1.Position, nameSymbol, 0); } writer1.WriteZeroBytes(TypeLayout.NativePointerSize); @@ -741,16 +757,16 @@ private LinkerSymbol CreateCustomAttributeArgument(string symbolName, int count, writer1.Write(isField, TypeLayout.NativePointerSize); // 3. Argument Type Pointer - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, symbol, writer1.Position, Metadata.TypeDefinition + arg.Type.FullName, 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, customAttributeArgumentSymbol, writer1.Position, Metadata.TypeDefinition + arg.Type.FullName, 0); writer1.WriteZeroBytes(TypeLayout.NativePointerSize); // 4. Argument Size writer1.Write(ComputeArgumentSize(arg.Type, arg.Value), TypeLayout.NativePointerSize); // 5. Argument Value - WriteArgument(writer1, symbol, arg.Type, arg.Value); + WriteArgument(writer1, customAttributeArgumentSymbol, arg.Type, arg.Value); - return symbol; + return customAttributeArgumentSymbol; } private int ComputeArgumentSize(MosaType type, object value) @@ -903,12 +919,5 @@ private void WriteArgument(EndianAwareBinaryWriter writer, LinkerSymbol symbol, } #endregion Custom Attributes - - private string GetMethodNameConsiderPlug(MosaMethod method) - { - var plugMethod = Compiler.PlugSystem.GetReplacement(method); - - return (plugMethod == null) ? method.FullName : plugMethod.FullName; - } } } diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/MethodCompileTimeStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/MethodCompileTimeStage.cs index 29be83fd4e..c51274e207 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/MethodCompileTimeStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/MethodCompileTimeStage.cs @@ -25,7 +25,7 @@ protected override void Finalization() foreach (var data in methods) { - writer.WriteLine($"{data.ElapsedTicks}{'\t'}{data.ElapsedTicks / TimeSpan.TicksPerMillisecond}{'\t'}{data.CompileCount}{'\t'}{data.Method.FullName}"); + writer.WriteLine($"{data.ElapsedTicks}{'\t'}{data.ElapsedTicks / TimeSpan.TicksPerMillisecond}{'\t'}{data.Version}{'\t'}{data.Method.FullName}"); } } } @@ -38,7 +38,7 @@ protected List GetAndSortMethodData() { foreach (var method in type.Methods) { - var data = Compiler.CompilerData.GetMethodData(method); + var data = Compiler.GetMethodData(method); if (data == null) continue; diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/MethodTableStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/MethodTableStage.cs index a410f41f0f..b44e6fe375 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/MethodTableStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/MethodTableStage.cs @@ -50,22 +50,17 @@ protected override void Finalization() foreach (var method in methodList) { - if ((!method.HasImplementation && method.IsAbstract) || method.HasOpenGenericParams || method.DeclaringType.HasOpenGenericParams) - continue; - - if (!Compiler.MethodScanner.IsMethodInvoked(method)) - continue; + var targetMethodData = GetTargetMethodData(method); - // Don't emit entry for plug methods - if (Compiler.PlugSystem.GetReplacement(method) != null) + if (!targetMethodData.HasCode) continue; // 1. Pointer to Method - Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodLookupTable, writer.Position, method.FullName, 0); + Linker.Link(LinkType.AbsoluteAddress, NativePatchType, methodLookupTable, writer.Position, targetMethodData.Method.FullName, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); // 2. Size of Method - Linker.Link(LinkType.Size, NativePatchType, methodLookupTable, writer.Position, method.FullName, 0); + Linker.Link(LinkType.Size, NativePatchType, methodLookupTable, writer.Position, targetMethodData.Method.FullName, 0); writer.WriteZeroBytes(TypeLayout.NativePointerSize); // 3. Pointer to Method Definition @@ -80,5 +75,15 @@ protected override void Finalization() writer.Position = 0; writer.Write(count); } + + private MethodData GetTargetMethodData(MosaMethod method) + { + var methodData = Compiler.GetMethodData(method); + + if (methodData.ReplacedBy == null) + return methodData; + + return Compiler.GetMethodData(methodData.ReplacedBy); + } } } diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/SetupStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/SetupStage.cs deleted file mode 100644 index eca00692c3..0000000000 --- a/Source/Mosa.Compiler.Framework/CompilerStages/SetupStage.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) MOSA Project. Licensed under the New BSD License. - -using Mosa.Compiler.Framework.IR; -using Mosa.Compiler.MosaTypeSystem; -using System.Collections.Generic; - -namespace Mosa.Compiler.Framework.CompilerStages -{ - /// - /// Setup Stage - experimental - not fully implemented!!!! - /// - /// - public sealed class SetupStage : BaseCompilerStage - { - public const string SetupStagerName = "SetupStage"; - - #region Data Members - - private MosaMethod setupMethod; - - #endregion Data Members - - #region Construction - - /// - /// Initializes a new instance of the class. - /// - public SetupStage() - { - } - - #endregion Construction - - #region Overrides - - protected override void Setup() - { - setupMethod = Compiler.CreateLinkerMethod(SetupStagerName); - - Compiler.CompilerData.GetMethodData(setupMethod).DoNotInline = true; - MethodScanner.MethodInvoked(setupMethod, setupMethod); - - Linker.EntryPoint = Linker.GetSymbol(setupMethod.FullName); - } - - protected override void Finalization() - { - var basicBlocks = new BasicBlocks(); - - // Create the blocks - var prologueBlock = basicBlocks.CreateBlock(BasicBlock.PrologueLabel); - var startBlock = basicBlocks.CreateBlock(BasicBlock.StartLabel); - var epilogueBlock = basicBlocks.CreateBlock(BasicBlock.EpilogueLabel); - - // Create the prologue instructions - basicBlocks.AddHeadBlock(prologueBlock); - var prologue = new Context(prologueBlock); - prologue.AppendInstruction(IRInstruction.Prologue); - prologue.Label = -1; - prologue.AppendInstruction(IRInstruction.Jmp, startBlock); - - // Create the epilogue instruction - var epilogue = new Context(epilogueBlock); - epilogue.AppendInstruction(IRInstruction.Epilogue); - - var context = new Context(startBlock); - - var entrySymbol = Operand.CreateSymbolFromMethod(TypeSystem.EntryPoint, TypeSystem); - context.AppendInstruction(IRInstruction.CallStatic, null, entrySymbol); - - var methods = new List(); - - // TODO! - - foreach (var method in methods) - { - var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); - - context.AppendInstruction(IRInstruction.CallStatic, null, symbol); - } - - context.AppendInstruction(IRInstruction.Jmp, epilogueBlock); - - Compiler.CompileMethod(setupMethod, basicBlocks); - } - - #endregion Overrides - } -} diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/TypeInitializerStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/TypeInitializerStage.cs index 47c089fa2d..432a32bb70 100644 --- a/Source/Mosa.Compiler.Framework/CompilerStages/TypeInitializerStage.cs +++ b/Source/Mosa.Compiler.Framework/CompilerStages/TypeInitializerStage.cs @@ -79,8 +79,8 @@ protected override void Setup() Compiler.PlugSystem.CreatePlug(initializeAssemblyMethod, typeInitializerMethod); - Compiler.CompilerData.GetMethodData(initializeAssemblyMethod).DoNotInline = true; - Compiler.CompilerData.GetMethodData(typeInitializerMethod).DoNotInline = true; + Compiler.GetMethodData(initializeAssemblyMethod).DoNotInline = true; + Compiler.GetMethodData(typeInitializerMethod).DoNotInline = true; MethodScanner.MethodInvoked(initializeAssemblyMethod, initializeAssemblyMethod); MethodScanner.MethodInvoked(typeInitializerMethod, typeInitializerMethod); diff --git a/Source/Mosa.Compiler.Framework/CompilerStages/UnitTestStage.cs b/Source/Mosa.Compiler.Framework/CompilerStages/UnitTestStage.cs new file mode 100644 index 0000000000..de760f7da4 --- /dev/null +++ b/Source/Mosa.Compiler.Framework/CompilerStages/UnitTestStage.cs @@ -0,0 +1,37 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.MosaTypeSystem; + +namespace Mosa.Compiler.Framework.CompilerStages +{ + /// + /// UnitTest Stage - Do no inline the unit test methods + /// + /// + public sealed class UnitTestStage : BaseCompilerStage + { + private const string MosaUnitTestAttribute = "Mosa.UnitTests.MosaUnitTestAttribute"; + + #region Overrides + + protected override void Setup() + { + foreach (var type in TypeSystem.AllTypes) + { + foreach (var method in type.Methods) + { + var methodAttribute = method.FindCustomAttribute(MosaUnitTestAttribute); + + if (methodAttribute != null) + { + var methodData = Compiler.GetMethodData(method); + + methodData.DoNotInline = true; + } + } + } + } + + #endregion Overrides + } +} diff --git a/Source/Mosa.Compiler.Framework/CompilerVersion.cs b/Source/Mosa.Compiler.Framework/CompilerVersion.cs index ece5a8e120..2d14748009 100644 --- a/Source/Mosa.Compiler.Framework/CompilerVersion.cs +++ b/Source/Mosa.Compiler.Framework/CompilerVersion.cs @@ -9,7 +9,7 @@ public static class CompilerVersion { public static int Major = 1; public static int Minor = 9; - public static int Build = 6; + public static int Build = 7; public static string Version { diff --git a/Source/Mosa.Compiler.Framework/InlineMethodData.cs b/Source/Mosa.Compiler.Framework/InlineMethodData.cs new file mode 100644 index 0000000000..788a50d029 --- /dev/null +++ b/Source/Mosa.Compiler.Framework/InlineMethodData.cs @@ -0,0 +1,36 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.MosaTypeSystem; +using System.Collections.Generic; + +namespace Mosa.Compiler.Framework +{ + /// + /// Inline Method Data + /// + public sealed class InlineMethodData + { + public BasicBlocks BasicBlocks { get; } + + public int Version { get; } + + public HashSet References { get; private set; } + + public bool IsInlined { get { return BasicBlocks != null; } } + + public InlineMethodData(BasicBlocks basicBlocks, int version) + { + References = new HashSet(); + BasicBlocks = basicBlocks; + Version = version; + } + + public void AddReference(MosaMethod method) + { + if (!References.Contains(method)) + { + References.Add(method); + } + } + } +} diff --git a/Source/Mosa.Compiler.Framework/Linker/LinkRequest.cs b/Source/Mosa.Compiler.Framework/Linker/LinkRequest.cs index ae8fc59c5c..c0a9741137 100644 --- a/Source/Mosa.Compiler.Framework/Linker/LinkRequest.cs +++ b/Source/Mosa.Compiler.Framework/Linker/LinkRequest.cs @@ -29,23 +29,16 @@ public sealed class LinkRequest /// /// Gets the patch offset. /// - /// - /// The symbol offset. - /// public int PatchOffset { get; } /// /// Gets the reference symbol. /// - /// - /// The reference symbol. - /// public LinkerSymbol ReferenceSymbol { get; } /// /// Gets the offset to apply to the reference target. /// - /// The offset. public int ReferenceOffset { get; } #endregion Properties diff --git a/Source/Mosa.Compiler.Framework/Linker/LinkerSymbol.cs b/Source/Mosa.Compiler.Framework/Linker/LinkerSymbol.cs index d5106be546..ff3c029ab8 100644 --- a/Source/Mosa.Compiler.Framework/Linker/LinkerSymbol.cs +++ b/Source/Mosa.Compiler.Framework/Linker/LinkerSymbol.cs @@ -1,6 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. using Mosa.Compiler.Common; +using Mosa.Compiler.MosaTypeSystem; using System.Collections.Generic; using System.IO; @@ -39,6 +40,12 @@ public sealed class LinkerSymbol private readonly object _lock = new object(); + public int Version { get; set; } // for debugging + + public MosaMethod MosaMethod { get; set; } // for debugging + + public MethodData MethodData { get; set; } // for debugging + internal LinkerSymbol(string name, uint alignment = 0, SectionKind kind = SectionKind.Unknown) { Name = name; diff --git a/Source/Mosa.Compiler.Framework/Linker/MosaLinker.cs b/Source/Mosa.Compiler.Framework/Linker/MosaLinker.cs index ebe751ebbd..5381b3870c 100644 --- a/Source/Mosa.Compiler.Framework/Linker/MosaLinker.cs +++ b/Source/Mosa.Compiler.Framework/Linker/MosaLinker.cs @@ -5,6 +5,7 @@ using Mosa.Compiler.Framework.Linker.Elf; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; namespace Mosa.Compiler.Framework.Linker @@ -217,6 +218,9 @@ private void ApplyPatch(LinkRequest linkRequest) } else { + Debug.Assert(linkRequest.ReferenceSymbol.VirtualAddress != 0); + Debug.Assert(linkRequest.PatchSymbol.VirtualAddress != 0); + value = linkRequest.ReferenceSymbol.VirtualAddress + (ulong)linkRequest.ReferenceOffset; if (linkRequest.LinkType == LinkType.RelativeOffset) diff --git a/Source/Mosa.Compiler.Framework/MethodCompiler.cs b/Source/Mosa.Compiler.Framework/MethodCompiler.cs index b522f958c7..d7478d641a 100644 --- a/Source/Mosa.Compiler.Framework/MethodCompiler.cs +++ b/Source/Mosa.Compiler.Framework/MethodCompiler.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework.Analysis; -using Mosa.Compiler.Framework.IR; using Mosa.Compiler.Framework.Linker; using Mosa.Compiler.Framework.Trace; using Mosa.Compiler.MosaTypeSystem; @@ -15,8 +14,7 @@ namespace Mosa.Compiler.Framework /// Base class of a method compiler. /// /// - /// A method compiler is responsible for compiling a single method - /// of an object. + /// A method compiler is responsible for compiling a single method of an object. /// public sealed class MethodCompiler { @@ -119,11 +117,10 @@ public sealed class MethodCompiler /// /// Gets the protected regions. /// - /// - /// The protected regions. - /// public List ProtectedRegions { get; set; } + public bool HasProtectedRegions { get; private set; } + /// /// The labels /// @@ -139,16 +136,6 @@ public sealed class MethodCompiler /// public MethodData MethodData { get; } - /// - /// The stack frame - /// - public Operand StackFrame { get; } - - /// - /// The stack frame - /// - public Operand StackPointer { get; } - /// /// Gets the platform constant zero /// @@ -233,8 +220,6 @@ public MethodCompiler(Compiler compiler, MosaMethod method, BasicBlocks basicBlo LocalStack = new List(); VirtualRegisters = new VirtualRegisters(); - StackFrame = Operand.CreateCPURegister(TypeSystem.BuiltIn.Pointer, Architecture.StackFrameRegister); - StackPointer = Operand.CreateCPURegister(TypeSystem.BuiltIn.Pointer, Architecture.StackPointerRegister); Parameters = new Operand[method.Signature.Parameters.Count + (method.HasThis || method.HasExplicitThis ? 1 : 0)]; ConstantZero32 = CreateConstant((uint)0); @@ -249,13 +234,21 @@ public MethodCompiler(Compiler compiler, MosaMethod method, BasicBlocks basicBlo IsCILDecodeRequired = true; IsStackFrameRequired = true; IsMethodInlined = false; + HasProtectedRegions = Method.ExceptionHandlers.Count != 0; - MethodData = compiler.CompilerData.GetMethodData(Method); - + MethodData = Compiler.GetMethodData(Method); MethodData.Counters.Reset(); + MethodData.Version++; + MethodData.IsMethodImplementationReplaced = IsMethodPlugged; + // Both defines the symbol and also clears the data Symbol = Linker.DefineSymbol(Method.FullName, SectionKind.Text, 0, 0); + Symbol.RemovePatches(); + + Symbol.MethodData = MethodData; // for debugging + Symbol.MosaMethod = Method; // for debugging + Symbol.Version = MethodData.Version; EvaluateParameterOperands(); @@ -372,12 +365,16 @@ private void EvaluateParameterOperands() /// public void Compile() { + MethodData.HasCode = false; + if (Method.IsCompilerGenerated) { IsCILDecodeRequired = false; IsStackFrameRequired = false; } + //Debug.WriteLine($"{MethodScheduler.GetTimestamp()} - Compiling: [{MethodData.Version}] {Method}"); //DEBUGREMOVE + PlugMethod(); PatchDelegate(); @@ -388,7 +385,9 @@ public void Compile() ExecutePipeline(); - //Symbol.SetReplacementStatus(MethodData.Inlined); // TOTO + //Debug.WriteLine($"{MethodScheduler.GetTimestamp()} - Compiled: [{MethodData.Version}] {Method}"); //DEBUGREMOVE + + Symbol.SetReplacementStatus(MethodData.Inlined); if (Compiler.CompilerOptions.EnableStatistics) { @@ -405,7 +404,7 @@ private void ExecutePipeline() var executionTimes = new long[Pipeline.Count]; - var startTicks = Stopwatch.ElapsedTicks; + var startTick = Stopwatch.ElapsedTicks; for (int i = 0; i < Pipeline.Count; i++) { @@ -418,29 +417,30 @@ private void ExecutePipeline() InstructionLogger.Run(this, stage); - if (IsStopped/* || IsMethodInlined*/) // TOTO + if (IsStopped || IsMethodInlined) break; } - if (Compiler.CompilerOptions.EnableStatistics && !IsStopped) + if (Compiler.CompilerOptions.EnableStatistics) { - var totalTicks = Stopwatch.ElapsedTicks; + var lastTick = Stopwatch.ElapsedTicks; - MethodData.ElapsedTicks = totalTicks; + MethodData.ElapsedTicks = lastTick; - MethodData.Counters.NewCountSkipLock("ExecutionTime.StageStart.Ticks", (int)startTicks); - MethodData.Counters.NewCountSkipLock("ExecutionTime.Total.Ticks", (int)totalTicks); + MethodData.Counters.NewCountSkipLock("ExecutionTime.StageStart.Ticks", (int)startTick); + MethodData.Counters.NewCountSkipLock("ExecutionTime.Total.Ticks", (int)lastTick); var executionTimeLog = new TraceLog(TraceType.MethodDebug, Method, "Execution Time/Ticks"); - long previousTicks = startTicks; + long previousTick = startTick; + var totalTick = lastTick - startTick; for (int i = 0; i < Pipeline.Count; i++) { - var pipelineTicks = executionTimes[i]; - var ticks = pipelineTicks == 0 ? 0 : pipelineTicks - previousTicks; - var percentage = (ticks * 100) / (double)(totalTicks - startTicks); - previousTicks = pipelineTicks; + var pipelineTick = executionTimes[i]; + var ticks = pipelineTick == 0 ? 0 : pipelineTick - previousTick; + var percentage = totalTick == 0 ? 0 : (ticks * 100) / (double)(totalTick); + previousTick = pipelineTick; int per = (int)percentage / 5; @@ -451,7 +451,7 @@ private void ExecutePipeline() MethodData.Counters.NewCountSkipLock($"ExecutionTime.{i:00}.{Pipeline[i].Name}.Ticks", (int)ticks); } - executionTimeLog.Log($"{"****Total Time".PadRight(57)}({totalTicks})"); + executionTimeLog.Log($"{"****Total Time".PadRight(57)}({lastTick})"); Trace.PostTraceLog(executionTimeLog); } @@ -464,6 +464,8 @@ private void PlugMethod() if (plugMethod == null) return; + MethodData.ReplacedBy = plugMethod; + Compiler.MethodScanner.MethodInvoked(plugMethod, Method); IsMethodPlugged = true; diff --git a/Source/Mosa.Compiler.Framework/MethodData.cs b/Source/Mosa.Compiler.Framework/MethodData.cs index 4cbf122d41..3c9d9d7671 100644 --- a/Source/Mosa.Compiler.Framework/MethodData.cs +++ b/Source/Mosa.Compiler.Framework/MethodData.cs @@ -2,6 +2,7 @@ using Mosa.Compiler.Common; using Mosa.Compiler.MosaTypeSystem; +using System; using System.Collections.Generic; namespace Mosa.Compiler.Framework @@ -17,14 +18,10 @@ public sealed class MethodData public MosaMethod Method { get; } - public bool IsCompiled { get; set; } - public bool IsLinkerGenerated { get; set; } public bool HasProtectedRegions { get; set; } - public bool Inlined { get; set; } - public bool HasDoNotInlineAttribute { get; set; } public bool HasAggressiveInliningAttribute { get; set; } @@ -41,11 +38,9 @@ public sealed class MethodData public int NonIRInstructionCount { get; set; } - public bool IsVirtual { get; set; } - public bool IsDevirtualized { get; set; } - public int CompileCount { get; set; } + public int Version { get; set; } public int ParameterStackSize { get; set; } @@ -57,39 +52,15 @@ public sealed class MethodData public bool DoNotInline { get; set; } - public int InlineTimestamp - { - get { lock (_lock) { return inlinedTimestamp; } } - set { lock (_lock) { inlinedTimestamp = value; } } - } + public bool HasMethodPointerReferenced { get; set; } - public int InlineEvalulationTimestamp - { - get { lock (_lock) { return inlineEvalulationTimestamp; } } - set { lock (_lock) { inlineEvalulationTimestamp = value; } } - } + public bool HasCode { get; set; } - public BasicBlocks BasicBlocks - { - get { lock (_lock) { return inlinedBasicBlocks; } } - set { lock (_lock) { inlinedBasicBlocks = value; } } - } + public bool Inlined { get { lock (_lock) { return InlineMethodData.IsInlined; } } } - public List CalledBy - { - get - { - lock (calledBy) - { - if (cachedCallBy == null) - { - cachedCallBy = new List(calledBy); - } - - return cachedCallBy; - } - } - } + public MosaMethod ReplacedBy { get; set; } + + public bool IsInvoked { get; set; } #endregion Properties @@ -97,15 +68,7 @@ public List CalledBy private readonly object _lock = new object(); - private BasicBlocks inlinedBasicBlocks; - - private int inlinedTimestamp; - - private int inlineEvalulationTimestamp; - - private List calledBy; - - private List cachedCallBy; + private InlineMethodData InlineMethodData; #endregion Data Members @@ -113,25 +76,19 @@ public MethodData(MosaMethod mosaMethod) { Method = mosaMethod; - calledBy = new List(); LabelRegions = new List(); Counters = new Counters(); - CompileCount = 0; + Version = 0; DoNotInline = false; - BasicBlocks = null; + InlineMethodData = new InlineMethodData(null, 0); + IsDevirtualized = false; + HasMethodPointerReferenced = false; + HasCode = false; + IsInvoked = false; } #region Methods - public void AddCalledBy(MosaMethod method) - { - lock (calledBy) - { - calledBy.AddIfNew(method); - cachedCallBy = null; - } - } - public void AddLabelRegion(int label, int start, int length) { LabelRegions.Add(new LabelRegion() @@ -142,6 +99,35 @@ public void AddLabelRegion(int label, int start, int length) }); } + public InlineMethodData GetInlineMethodDataForUseBy(MosaMethod method) + { + lock (_lock) + { + InlineMethodData.AddReference(method); + return InlineMethodData; + } + } + + public InlineMethodData SwapInlineMethodData(BasicBlocks basicBlocks) + { + lock (_lock) + { + var tmp = InlineMethodData; + + InlineMethodData = new InlineMethodData(basicBlocks, Version); + + return tmp; + } + } + + public InlineMethodData GetInlineMethodData() + { + lock (_lock) + { + return InlineMethodData; + } + } + #endregion Methods } } diff --git a/Source/Mosa.Compiler.Framework/MethodScanner.cs b/Source/Mosa.Compiler.Framework/MethodScanner.cs index 85e087ef38..a934bc3fed 100644 --- a/Source/Mosa.Compiler.Framework/MethodScanner.cs +++ b/Source/Mosa.Compiler.Framework/MethodScanner.cs @@ -91,6 +91,21 @@ public void Complete() Compiler.PostTrace(trace); } + private void MarkMethodInvoked(MosaMethod method) + { + var methodData = Compiler.GetMethodData(method); + + if (methodData.IsInvoked) + return; + + methodData.IsInvoked = true; + + lock (invokedMethods) + { + invokedMethods.Add(method); + } + } + public void TypeAllocated(MosaType type, MosaMethod source) { if (!IsEnabled) @@ -173,13 +188,7 @@ public void InterfaceMethodInvoked(MosaMethod method, MosaMethod source) if (!IsEnabled) return; - lock (invokedMethods) - { - if (invokedMethods.Contains(method)) - return; - - invokedMethods.Add(method); - } + MarkMethodInvoked(method); if (trace != null) { @@ -234,13 +243,7 @@ private void MethodInvoked(MosaMethod method, MosaMethod source, bool direct) if (!IsEnabled) return; - lock (invokedMethods) - { - if (invokedMethods.Contains(method)) - return; - - invokedMethods.Add(method); - } + MarkMethodInvoked(method); if (trace != null) { @@ -303,13 +306,7 @@ private void ScheduleDerivedMethods(MosaType type, int slot) { var derivedMethod = TypeLayout.GetMethodBySlot(derived, slot); - lock (invokedMethods) - { - if (!invokedMethods.Contains(derivedMethod)) - { - invokedMethods.Add(derivedMethod); - } - } + MarkMethodInvoked(derivedMethod); ScheduleMethod(derivedMethod); } @@ -381,7 +378,7 @@ public void Initialize() if (entryPoint != null) { - invokedMethods.Add(entryPoint); + MarkMethodInvoked(entryPoint); ScheduleMethod(entryPoint); } @@ -417,7 +414,8 @@ public void Initialize() if (methodAttribute != null) { - invokedMethods.Add(method); + MarkMethodInvoked(method); + ScheduleMethod(method); allocateType = true; } diff --git a/Source/Mosa.Compiler.Framework/MethodScheduler.cs b/Source/Mosa.Compiler.Framework/MethodScheduler.cs index 3cca3bc760..cc97798e00 100644 --- a/Source/Mosa.Compiler.Framework/MethodScheduler.cs +++ b/Source/Mosa.Compiler.Framework/MethodScheduler.cs @@ -3,7 +3,6 @@ using Mosa.Compiler.Framework.Trace; using Mosa.Compiler.MosaTypeSystem; using System.Collections.Generic; -using System.Diagnostics; namespace Mosa.Compiler.Framework { @@ -23,7 +22,9 @@ public sealed class MethodScheduler private readonly HashSet methods = new HashSet(); - private readonly Dictionary inlineQueue = new Dictionary(); + //private readonly Dictionary inlineQueue = new Dictionary(); + + private readonly HashSet recompileSet = new HashSet(); private readonly object _timestamplock = new object(); @@ -94,20 +95,25 @@ public void Schedule(MosaMethod method) if (method.IsCompilerGenerated) return; - lock (scheduleQueue) + AddToQueue(method); + + lock (methods) { - if (!scheduleSet.Contains(method)) + if (!methods.Contains(method)) { - scheduleSet.Add(method); - scheduleQueue.Enqueue(method); + methods.Add(method); } } + } - lock (methods) + private void AddToQueue(MosaMethod method) + { + lock (scheduleQueue) { - if (!methods.Contains(method)) + if (!scheduleSet.Contains(method)) { - methods.Add(method); + scheduleSet.Add(method); + scheduleQueue.Enqueue(method); } } } @@ -157,27 +163,19 @@ public int GetTimestamp() } } - public void AddToInlineQueueByCallee(MethodData calleeMethod) + public void AddToRecompileQueue(HashSet methods) { - var timestamp = GetTimestamp(); - - lock (inlineQueue) + lock (recompileSet) { - foreach (var method in calleeMethod.CalledBy) - { - if (!inlineQueue.TryGetValue(method, out int existingtimestamp)) - { - inlineQueue.Add(method, timestamp); - } - else - { - if (existingtimestamp < timestamp) - return; + recompileSet.UnionWith(methods); + } + } - inlineQueue.Remove(method); - inlineQueue.Add(method, existingtimestamp); - } - } + public void AddToRecompileQueue(MosaMethod method) + { + lock (recompileSet) + { + recompileSet.Add(method); } } @@ -185,30 +183,18 @@ public void FlushInlineQueue() { bool action = false; - lock (inlineQueue) + lock (recompileSet) { - foreach (var item in inlineQueue) + foreach (var method in recompileSet) { - var method = item.Key; - var timestamp = item.Value; - - var methodData = Compiler.CompilerData.GetMethodData(method); - - if (methodData.InlineTimestamp > timestamp) - continue; // nothing to do - lock (scheduleQueue) { - if (!scheduleSet.Contains(method)) - { - scheduleQueue.Enqueue(method); - scheduleSet.Add(method); - action = true; - } + AddToQueue(method); } } - inlineQueue.Clear(); + recompileSet.Clear(); + action = recompileSet.Count != 0; } if (action) diff --git a/Source/Mosa.Compiler.Framework/MosaCompiler.cs b/Source/Mosa.Compiler.Framework/MosaCompiler.cs index f1a61a4491..495136c69a 100644 --- a/Source/Mosa.Compiler.Framework/MosaCompiler.cs +++ b/Source/Mosa.Compiler.Framework/MosaCompiler.cs @@ -39,7 +39,7 @@ public MosaCompiler(List compilerExtensions = null, int m public MosaCompiler(CompilerOptions compilerOptions = null, List compilerExtensions = null, int maxThreads = 0) { - MaxThreads = (maxThreads == 0) ? Environment.ProcessorCount + 1 : maxThreads; + MaxThreads = (maxThreads == 0) ? Environment.ProcessorCount * 2 : maxThreads; CompilerOptions = compilerOptions ?? new CompilerOptions(); CompilerTrace = new CompilerTrace(CompilerOptions); diff --git a/Source/Mosa.Compiler.Framework/PlugSystem.cs b/Source/Mosa.Compiler.Framework/PlugSystem.cs index 0da329dabf..ad34e3fb2d 100644 --- a/Source/Mosa.Compiler.Framework/PlugSystem.cs +++ b/Source/Mosa.Compiler.Framework/PlugSystem.cs @@ -80,12 +80,7 @@ public void CreatePlug(MosaMethod targetMethod, MosaMethod newMethod) { lock (_lock) { - if (PlugMethods.ContainsKey(targetMethod)) - { - //Debug.Assert(PlugMethods[targetMethod] == newMethod); - return; - } - else + if (!PlugMethods.ContainsKey(targetMethod)) { PlugMethods.Add(targetMethod, newMethod); } @@ -141,9 +136,6 @@ private static bool MatchesWithStaticThis(MosaMethod targetMethod, MosaMethod pl if (targetMethod.Signature.Parameters.Count != plugMethod.Signature.Parameters.Count - 1) return false; - //if (plugMethod.Signature.Parameters[0].ParameterType.IsValueType && !plugMethod.Signature.Parameters[0].ParameterType.IsManagedPointer) - // return false; - for (int i = 0; i < targetMethod.Signature.Parameters.Count; i++) { if (!targetMethod.Signature.Parameters[i].Equals(plugMethod.Signature.Parameters[i + 1])) diff --git a/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs b/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs index d42682778a..1c91d2f861 100644 --- a/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs @@ -541,6 +541,18 @@ private void Callvirt(Context context) } else { + // Check if method can be devirtualized (called directly) + //var methodData = MethodCompiler.Compiler.GetMethodData(method); + + //if (methodData.IsDevirtualized) + //{ + // context.SetInstruction(IRInstruction.CallStatic, result, symbol, operands); + //} + //else + //{ + // context.SetInstruction(IRInstruction.CallVirtual, result, symbol, operands); + //} + context.SetInstruction(IRInstruction.CallVirtual, result, symbol, operands); } } @@ -978,6 +990,17 @@ private void Ldftn(InstructionNode node) MethodScanner.MethodInvoked(invokedMethod, Method); node.SetInstruction(Select(node.Result, IRInstruction.MoveInt32, IRInstruction.MoveInt64), node.Result, Operand.CreateSymbolFromMethod(invokedMethod, TypeSystem)); + + var methodData = MethodCompiler.Compiler.GetMethodData(invokedMethod); + + if (!methodData.HasMethodPointerReferenced) + { + methodData.HasMethodPointerReferenced = true; + + MethodScheduler.AddToRecompileQueue(invokedMethod); // FUTURE: Optimize this not to re-schedule when not necessary + + //Debug.WriteLine($" Method Reference: [{MethodData.Version}] {invokedMethod}"); //DEBUGREMOVE + } } /// diff --git a/Source/Mosa.Compiler.Framework/Stages/CallStage.cs b/Source/Mosa.Compiler.Framework/Stages/CallStage.cs index 71e2393402..8933af11cf 100644 --- a/Source/Mosa.Compiler.Framework/Stages/CallStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/CallStage.cs @@ -88,19 +88,6 @@ private void CallStatic(InstructionNode node) Debug.Assert(method != null); - if (MethodCompiler.Compiler.CompilerData.IsMethodInlined(method)) - { - // If above is true, then a race condition occurred between: - // 1) after inline stage of this method, and - // 2) theinline evaluation stage of the target method - // the only best option at this point is to stop compiling this method. - // Note: It should already be scheduled to be re-compiled! - //MethodCompiler.Stop(); - //return; - } - - //Debug.Assert(!MethodCompiler.Compiler.CompilerData.IsMethodInlined(method)); - operands.RemoveAt(0); var context = new Context(node); @@ -109,8 +96,6 @@ private void CallStatic(InstructionNode node) MakeCall(context, call, result, operands); - Debug.Assert(method == call.Method); - MethodScanner.MethodDirectInvoked(call.Method, Method); } diff --git a/Source/Mosa.Compiler.Framework/Stages/CodeGenerationStage.cs b/Source/Mosa.Compiler.Framework/Stages/CodeGenerationStage.cs index c6d723fdea..174de01343 100644 --- a/Source/Mosa.Compiler.Framework/Stages/CodeGenerationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/CodeGenerationStage.cs @@ -88,6 +88,7 @@ protected override void Run() EndGenerate(); symbol.SetData(codeStream); + MethodData.HasCode = true; } protected override void Finish() diff --git a/Source/Mosa.Compiler.Framework/Stages/DevirtualizeCallStage.cs b/Source/Mosa.Compiler.Framework/Stages/DevirtualizeCallStage.cs index b49ee3d102..944f8fe343 100644 --- a/Source/Mosa.Compiler.Framework/Stages/DevirtualizeCallStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/DevirtualizeCallStage.cs @@ -24,7 +24,6 @@ protected override void Initialize() protected override void PopulateVisitationDictionary() { - //AddVisitation(IRInstruction.CallInterface, CallInterface); AddVisitation(IRInstruction.CallVirtual, CallVirtual); } @@ -40,13 +39,15 @@ protected override void Finish() private void CallVirtual(InstructionNode node) { - var call = node.Operand1; - var method = call.Method; + var method = node.Operand1.Method; - if (TypeLayout.IsMethodOverridden(method)) + // Next lines are not necessary but faster then getting the method data + if (!method.HasImplementation && method.IsAbstract) return; - if (!method.HasImplementation && method.IsAbstract) + var methodData = MethodCompiler.Compiler.GetMethodData(method); + + if (!methodData.IsDevirtualized) return; var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); diff --git a/Source/Mosa.Compiler.Framework/Stages/InlineEvaluationStage.cs b/Source/Mosa.Compiler.Framework/Stages/InlineEvaluationStage.cs index 8c0b1623f1..4c8e9a837c 100644 --- a/Source/Mosa.Compiler.Framework/Stages/InlineEvaluationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/InlineEvaluationStage.cs @@ -1,5 +1,6 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; using Mosa.Compiler.Framework.IR; using Mosa.Compiler.MosaTypeSystem; using System.Collections.Generic; @@ -29,36 +30,32 @@ protected override void Run() { var trace = CreateTraceLog(); - MethodData.IsCompiled = false; - MethodData.BasicBlocks = null; - MethodData.HasProtectedRegions = HasProtectedRegions; - MethodData.IsLinkerGenerated = Method.IsCompilerGenerated; - MethodData.IsMethodImplementationReplaced = MethodCompiler.IsMethodPlugged; - MethodData.HasDoNotInlineAttribute = Method.IsNoInlining; - MethodData.HasAggressiveInliningAttribute = Method.IsAggressiveInlining; MethodData.HasAddressOfInstruction = false; MethodData.HasLoops = false; - MethodData.IsVirtual = Method.IsVirtual; - MethodData.IsDevirtualized = Method.IsVirtual && !TypeLayout.IsMethodOverridden(Method); + + //MethodData.IsDevirtualized = Method.IsVirtual && !TypeLayout.IsMethodOverridden(Method); trace?.Log($"DoNotInline: {MethodData.DoNotInline}"); - trace?.Log($"IsVirtual: {MethodData.IsVirtual}"); + trace?.Log($"IsVirtual: {Method.IsVirtual}"); trace?.Log($"IsDevirtualized: {MethodData.IsDevirtualized}"); trace?.Log($"HasProtectedRegions: {MethodData.HasProtectedRegions}"); trace?.Log($"HasDoNotInlineAttribute: {MethodData.HasDoNotInlineAttribute}"); trace?.Log($"HasAggressiveInliningAttribute: {MethodData.HasAggressiveInliningAttribute}"); trace?.Log($"IsMethodImplementationReplaced (Plugged): {MethodData.IsMethodImplementationReplaced}"); - trace?.Log($"CompileCount: {MethodData.CompileCount}"); + trace?.Log($"CompileCount: {MethodData.Version}"); - if (StaticCanNotInline(MethodData, Method)) + if (StaticCanNotInline(MethodData)) { + SetInlinedBasicBlocks(null); + trace?.Log($"** Staticly Evaluated"); trace?.Log($"Inlined: {MethodData.Inlined}"); + + //Debug.WriteLine($">Inlined: No"); //DEBUGREMOVE + return; } - var currentInlineStatus = MethodData.Inlined; - int totalIRCount = 0; int totalNonIRCount = 0; int totalStackParameterInstruction = 0; @@ -127,21 +124,16 @@ protected override void Run() MethodData.NonIRInstructionCount = totalNonIRCount; MethodData.IRStackParameterInstructionCount = totalStackParameterInstruction; - bool inline = CanInline(MethodData, Method); - - MethodData.Inlined = inline; - MethodCompiler.IsMethodInlined = inline; - - bool triggerReschedules = inline || (currentInlineStatus && !inline); + bool inline = CanInline(MethodData); if (inline) { - MethodData.BasicBlocks = CopyInstructions(); + var inlineBlocks = CopyInstructions(); + SetInlinedBasicBlocks(inlineBlocks); } - - if (triggerReschedules) + else { - MethodScheduler.AddToInlineQueueByCallee(MethodData); + SetInlinedBasicBlocks(null); } trace?.Log($"IRInstructionCount: {MethodData.IRInstructionCount}"); @@ -154,10 +146,40 @@ protected override void Run() trace?.Log($"Inlined: {MethodData.Inlined}"); InlinedMethodsCount.Set(inline); - ReversedInlinedMethodsCount.Set(MethodData.CompileCount >= MaximumCompileCount); + ReversedInlinedMethodsCount.Set(MethodData.Version >= MaximumCompileCount); + + //Debug.WriteLine($">Inlined: {(inline ? "Yes" : "No")}"); //DEBUGREMOVE + } + + private void SetInlinedBasicBlocks(BasicBlocks inlineBlocks) + { + MethodCompiler.IsMethodInlined = inlineBlocks != null; + + var previousInlineMethodData = MethodData.SwapInlineMethodData(inlineBlocks); + + ScheduleReferenceMethods(previousInlineMethodData); + } + + private void ScheduleReferenceMethods(InlineMethodData previous) + { + var current = MethodData.GetInlineMethodData(); + + // If previous was not inlined and current is not inline, do nothing + if (!current.IsInlined && !previous.IsInlined) + { + foreach (var method in previous.References) + { + MethodData.GetInlineMethodDataForUseBy(method); + } + + return; + } + + // If previous or current is inline, schedule all references from previous + MethodScheduler.AddToRecompileQueue(previous.References); } - public bool StaticCanNotInline(MethodData methodData, MosaMethod method) + private bool StaticCanNotInline(MethodData methodData) { if (methodData.HasDoNotInlineAttribute) return true; @@ -168,7 +190,12 @@ public bool StaticCanNotInline(MethodData methodData, MosaMethod method) if (methodData.HasProtectedRegions) return true; - if (methodData.IsVirtual && !methodData.IsDevirtualized) + if (methodData.HasMethodPointerReferenced) + return true; + + var method = methodData.Method; + + if (method.IsVirtual && !methodData.IsDevirtualized) return true; if (methodData.DoNotInline) @@ -186,12 +213,16 @@ public bool StaticCanNotInline(MethodData methodData, MosaMethod method) if (MosaTypeLayout.IsStoredOnStack(returnType) && !returnType.IsUI8 && !returnType.IsR8) return true; + // FUTURE: Don't hardcode namepsace + if (((method.MethodAttributes & MosaMethodAttributes.Public) == MosaMethodAttributes.Public) && method.DeclaringType.BaseType != null && method.DeclaringType.BaseType.Namespace == "Mosa.UnitTests") + return true; + return false; } - public bool CanInline(MethodData methodData, MosaMethod method) + private bool CanInline(MethodData methodData) { - if (StaticCanNotInline(methodData, method)) + if (StaticCanNotInline(methodData)) return false; // current implementation limitation - can't include methods with addressOf instruction @@ -201,7 +232,7 @@ public bool CanInline(MethodData methodData, MosaMethod method) if (methodData.NonIRInstructionCount > 0) return false; - if (MethodData.CompileCount >= MaximumCompileCount) + if (MethodData.Version >= MaximumCompileCount) return false; // too many compiles - cyclic loop suspected // methods with aggressive inline attribute will double the allow IR instruction count @@ -218,6 +249,7 @@ protected BasicBlocks CopyInstructions() var newBasicBlocks = new BasicBlocks(); var mapBlocks = new Dictionary(BasicBlocks.Count); var map = new Dictionary(); + var staticCalls = new List(); foreach (var block in BasicBlocks) { @@ -255,13 +287,19 @@ protected BasicBlocks CopyInstructions() for (var node = block.AfterFirst; !node.IsBlockEndInstruction; node = node.Next) { - if (node.IsEmpty) + if (node.IsEmptyOrNop) continue; + if (node.Instruction == IRInstruction.CallStatic) + { + staticCalls.AddIfNew(node.Operand1.Method); + } + var newNode = new InstructionNode(node.Instruction, node.OperandCount, node.ResultCount) { ConditionCode = node.ConditionCode }; + if (node.BranchTargets != null) { // copy targets @@ -300,7 +338,7 @@ protected BasicBlocks CopyInstructions() } } - var trace = CreateTraceLog("InlineMap"); + var trace = CreateTraceLog("InlineMap", 9); if (trace != null) { diff --git a/Source/Mosa.Compiler.Framework/Stages/InlineStage.cs b/Source/Mosa.Compiler.Framework/Stages/InlineStage.cs index 82613d6c0e..2d369026d0 100644 --- a/Source/Mosa.Compiler.Framework/Stages/InlineStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/InlineStage.cs @@ -1,8 +1,6 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. -using Mosa.Compiler.Framework.CompilerStages; using Mosa.Compiler.Framework.IR; -using Mosa.Compiler.MosaTypeSystem; using System.Collections.Generic; using System.Diagnostics; @@ -24,81 +22,53 @@ protected override void Initialize() protected override void Run() { - MethodData.CompileCount++; + var trace = CreateTraceLog("Inlined"); - var callSites = new List(); - var methodCalls = new List(); + int callSiteCount = 0; // find all call sites + var callSites = new List(); + foreach (var block in BasicBlocks) { for (var node = block.AfterFirst; !node.IsBlockEndInstruction; node = node.Next) { - if (node.IsEmpty) + if (node.IsEmptyOrNop) continue; if (node.Instruction != IRInstruction.CallStatic) continue; - if (!node.Operand1.IsSymbol) - continue; - - var invokedMethod = node.Operand1.Method; - - if (invokedMethod == null) - continue; - callSites.Add(node); - - if (methodCalls.Contains(invokedMethod)) - continue; - - methodCalls.Add(invokedMethod); - - var invoked = MethodCompiler.Compiler.CompilerData.GetMethodData(invokedMethod); - - invoked.AddCalledBy(MethodCompiler.Method); } } - if (callSites.Count == 0) - return; - - var trace = CreateTraceLog("Inlined"); - - int callSiteCount = 0; - foreach (var callSiteNode in callSites) { var invokedMethod = callSiteNode.Operand1.Method; - var callee = MethodCompiler.Compiler.CompilerData.GetMethodData(invokedMethod); - - if (!callee.Inlined) - continue; - // don't inline self - if (callee.Method == MethodCompiler.Method) + if (invokedMethod == Method) continue; - var inlineBlocks = callee.BasicBlocks; + Debug.Assert(callSiteNode.Operand1.IsSymbol); - if (inlineBlocks == null) - continue; + var callee = MethodCompiler.Compiler.GetMethodData(invokedMethod); - trace?.Log(callee.Method.FullName); + var inlineMethodData = callee.GetInlineMethodDataForUseBy(Method); - Inline(callSiteNode, inlineBlocks); + //Debug.WriteLine($"{MethodScheduler.GetTimestamp()} - Inline: {(inlineMethodData.IsInlined ? "Inlined" : "NOT Inlined")} [{MethodData.Version}] {Method} -> [{inlineMethodData.Version}] {callee.Method}"); //DEBUGREMOVE + + if (!inlineMethodData.IsInlined) + continue; + + Inline(callSiteNode, inlineMethodData.BasicBlocks); callSiteCount++; - //if (!BasicBlocks.RuntimeValidation()) - //{ - // throw new CompilerException($"InlineStage: Block Validation after inlining: {invokedMethod} into {Method}"); - //} - } + trace?.Log($" -> Inlined: [{callee.Version}] {callee.Method}"); - // Captures point in time - immediately after inlined blocks were used - MethodData.InlineTimestamp = MethodScheduler.GetTimestamp(); + //Debug.WriteLine($" -> Inlined: [{callee.Version}] {callee.Method}");//DEBUGREMOVE + } InlinedMethodsCount.Set(1); InlinedCallSitesCount.Set(callSiteCount); diff --git a/Source/Mosa.Compiler.Framework/Stages/LowerIRStage.cs b/Source/Mosa.Compiler.Framework/Stages/LowerIRStage.cs index 84c0329bfc..c7f7cccf34 100644 --- a/Source/Mosa.Compiler.Framework/Stages/LowerIRStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/LowerIRStage.cs @@ -15,9 +15,6 @@ public sealed class LowerIRStage : BaseCodeTransformationStage { protected override void PopulateVisitationDictionary() { - AddVisitation(IRInstruction.NewObject, NewObject); - AddVisitation(IRInstruction.NewArray, NewArray); - AddVisitation(IRInstruction.MemorySet, MemorySet); AddVisitation(IRInstruction.MemoryCopy, MemoryCopy); AddVisitation(IRInstruction.IsInstanceOfInterfaceType, IsInstanceOfInterfaceType); @@ -43,7 +40,7 @@ private MosaMethod GetVMCallMethod(VmCall vmcall) Debug.Assert(method != null, "Cannot find method: " + methodName); - MethodScanner.MethodInvoked(method, this.Method); + MethodScanner.MethodInvoked(method, Method); return method; } @@ -56,28 +53,6 @@ private void SetVMCall(InstructionNode node, VmCall vmcall, Operand result, List node.SetInstruction(IRInstruction.CallStatic, result, symbol, operands); } - private void NewObject(InstructionNode node) - { - var method = GetVMCallMethod(VmCall.AllocateObject); - var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); - var classType = node.MosaType; - - node.SetInstruction(IRInstruction.CallStatic, node.Result, symbol, node.GetOperands()); - - MethodScanner.TypeAllocated(classType, Method); - } - - private void NewArray(InstructionNode node) - { - var method = GetVMCallMethod(VmCall.AllocateArray); - var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); - var arrayType = node.MosaType; - - node.SetInstruction(IRInstruction.CallStatic, node.Result, symbol, node.GetOperands()); - - MethodScanner.TypeAllocated(arrayType, method); - } - private void MemorySet(InstructionNode node) { SetVMCall(node, VmCall.MemorySet, node.Result, node.GetOperands()); diff --git a/Source/Mosa.Compiler.Framework/Stages/NewObjectIRStage.cs b/Source/Mosa.Compiler.Framework/Stages/NewObjectIRStage.cs new file mode 100644 index 0000000000..85f4aff9c2 --- /dev/null +++ b/Source/Mosa.Compiler.Framework/Stages/NewObjectIRStage.cs @@ -0,0 +1,56 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.Framework.IR; +using Mosa.Compiler.MosaTypeSystem; +using System.Diagnostics; + +namespace Mosa.Compiler.Framework.Stages +{ + /// + /// New Object IR Stage + /// + /// + public sealed class NewObjectIRStage : BaseCodeTransformationStage + { + protected override void PopulateVisitationDictionary() + { + AddVisitation(IRInstruction.NewObject, NewObject); + AddVisitation(IRInstruction.NewArray, NewArray); + } + + private MosaMethod GetVMCallMethod(VmCall vmcall) + { + string methodName = vmcall.ToString(); + + var method = InternalRuntimeType.FindMethodByName(methodName) ?? PlatformInternalRuntimeType.FindMethodByName(methodName); + + Debug.Assert(method != null, "Cannot find method: " + methodName); + + MethodScanner.MethodInvoked(method, Method); + + return method; + } + + private void NewObject(InstructionNode node) + { + var method = GetVMCallMethod(VmCall.AllocateObject); + var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); + var classType = node.MosaType; + + node.SetInstruction(IRInstruction.CallStatic, node.Result, symbol, node.GetOperands()); + + MethodScanner.TypeAllocated(classType, Method); + } + + private void NewArray(InstructionNode node) + { + var method = GetVMCallMethod(VmCall.AllocateArray); + var symbol = Operand.CreateSymbolFromMethod(method, TypeSystem); + var arrayType = node.MosaType; + + node.SetInstruction(IRInstruction.CallStatic, node.Result, symbol, node.GetOperands()); + + MethodScanner.TypeAllocated(arrayType, method); + } + } +} diff --git a/Source/Mosa.Compiler.Framework/Stages/SparseConditionalConstantPropagationStage.cs b/Source/Mosa.Compiler.Framework/Stages/SparseConditionalConstantPropagationStage.cs index 132107f86e..49be901554 100644 --- a/Source/Mosa.Compiler.Framework/Stages/SparseConditionalConstantPropagationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/SparseConditionalConstantPropagationStage.cs @@ -67,7 +67,10 @@ protected void ReplaceVirtualRegistersWithConstants(List> protected void ReplaceVirtualRegisterWithConstant(Operand target, ulong value) { - trace?.Log($"{target} = {value.ToString()} Uses: {target.Uses.Count.ToString()}"); + trace?.Log($"{target} = {value.ToString()} Uses: {target.Uses.Count}"); + + if (target.Definitions.Count == 0) + return; Debug.Assert(target.Definitions.Count == 1); diff --git a/Source/Mosa.Kernel.x86/IDT.cs b/Source/Mosa.Kernel.x86/IDT.cs index 82b48f3885..295e751541 100644 --- a/Source/Mosa.Kernel.x86/IDT.cs +++ b/Source/Mosa.Kernel.x86/IDT.cs @@ -347,1536 +347,1792 @@ private static void SetTableEntries() #region IRQ Implementation Methods + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ0() { Intrinsic.SuppressStackFrame(); Native.IRQ0(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ1() { Intrinsic.SuppressStackFrame(); Native.IRQ1(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ2() { Intrinsic.SuppressStackFrame(); Native.IRQ2(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ3() { Intrinsic.SuppressStackFrame(); Native.IRQ3(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ4() { Intrinsic.SuppressStackFrame(); Native.IRQ4(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ5() { Intrinsic.SuppressStackFrame(); Native.IRQ5(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ6() { Intrinsic.SuppressStackFrame(); Native.IRQ6(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ7() { Intrinsic.SuppressStackFrame(); Native.IRQ7(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ8() { Intrinsic.SuppressStackFrame(); Native.IRQ8(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ9() { Intrinsic.SuppressStackFrame(); Native.IRQ9(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ10() { Intrinsic.SuppressStackFrame(); Native.IRQ10(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ11() { Intrinsic.SuppressStackFrame(); Native.IRQ11(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ12() { Intrinsic.SuppressStackFrame(); Native.IRQ12(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ13() { Intrinsic.SuppressStackFrame(); Native.IRQ13(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ14() { Intrinsic.SuppressStackFrame(); Native.IRQ14(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ15() { Intrinsic.SuppressStackFrame(); Native.IRQ15(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ16() { Intrinsic.SuppressStackFrame(); Native.IRQ16(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ17() { Intrinsic.SuppressStackFrame(); Native.IRQ17(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ18() { Intrinsic.SuppressStackFrame(); Native.IRQ18(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ19() { Intrinsic.SuppressStackFrame(); Native.IRQ19(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ20() { Intrinsic.SuppressStackFrame(); Native.IRQ20(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ21() { Intrinsic.SuppressStackFrame(); Native.IRQ21(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ22() { Intrinsic.SuppressStackFrame(); Native.IRQ22(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ23() { Intrinsic.SuppressStackFrame(); Native.IRQ23(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ24() { Intrinsic.SuppressStackFrame(); Native.IRQ24(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ25() { Intrinsic.SuppressStackFrame(); Native.IRQ25(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ26() { Intrinsic.SuppressStackFrame(); Native.IRQ26(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ27() { Intrinsic.SuppressStackFrame(); Native.IRQ27(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ28() { Intrinsic.SuppressStackFrame(); Native.IRQ28(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ29() { Intrinsic.SuppressStackFrame(); Native.IRQ29(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ30() { Intrinsic.SuppressStackFrame(); Native.IRQ30(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ31() { Intrinsic.SuppressStackFrame(); Native.IRQ31(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ32() { Intrinsic.SuppressStackFrame(); Native.IRQ32(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ33() { Intrinsic.SuppressStackFrame(); Native.IRQ33(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ34() { Intrinsic.SuppressStackFrame(); Native.IRQ34(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ35() { Intrinsic.SuppressStackFrame(); Native.IRQ35(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ36() { Intrinsic.SuppressStackFrame(); Native.IRQ36(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ37() { Intrinsic.SuppressStackFrame(); Native.IRQ37(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ38() { Intrinsic.SuppressStackFrame(); Native.IRQ38(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ39() { Intrinsic.SuppressStackFrame(); Native.IRQ39(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ40() { Intrinsic.SuppressStackFrame(); Native.IRQ40(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ41() { Intrinsic.SuppressStackFrame(); Native.IRQ41(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ42() { Intrinsic.SuppressStackFrame(); Native.IRQ42(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ43() { Intrinsic.SuppressStackFrame(); Native.IRQ43(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ44() { Intrinsic.SuppressStackFrame(); Native.IRQ44(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ45() { Intrinsic.SuppressStackFrame(); Native.IRQ45(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ46() { Intrinsic.SuppressStackFrame(); Native.IRQ46(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ47() { Intrinsic.SuppressStackFrame(); Native.IRQ47(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ48() { Intrinsic.SuppressStackFrame(); Native.IRQ48(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ49() { Intrinsic.SuppressStackFrame(); Native.IRQ49(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ50() { Intrinsic.SuppressStackFrame(); Native.IRQ50(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ51() { Intrinsic.SuppressStackFrame(); Native.IRQ51(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ52() { Intrinsic.SuppressStackFrame(); Native.IRQ52(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ53() { Intrinsic.SuppressStackFrame(); Native.IRQ53(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ54() { Intrinsic.SuppressStackFrame(); Native.IRQ54(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ55() { Intrinsic.SuppressStackFrame(); Native.IRQ55(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ56() { Intrinsic.SuppressStackFrame(); Native.IRQ56(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ57() { Intrinsic.SuppressStackFrame(); Native.IRQ57(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ58() { Intrinsic.SuppressStackFrame(); Native.IRQ58(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ59() { Intrinsic.SuppressStackFrame(); Native.IRQ59(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ60() { Intrinsic.SuppressStackFrame(); Native.IRQ60(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ61() { Intrinsic.SuppressStackFrame(); Native.IRQ61(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ62() { Intrinsic.SuppressStackFrame(); Native.IRQ62(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ63() { Intrinsic.SuppressStackFrame(); Native.IRQ63(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ64() { Intrinsic.SuppressStackFrame(); Native.IRQ64(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ65() { Intrinsic.SuppressStackFrame(); Native.IRQ65(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ66() { Intrinsic.SuppressStackFrame(); Native.IRQ66(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ67() { Intrinsic.SuppressStackFrame(); Native.IRQ67(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ68() { Intrinsic.SuppressStackFrame(); Native.IRQ68(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ69() { Intrinsic.SuppressStackFrame(); Native.IRQ69(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ70() { Intrinsic.SuppressStackFrame(); Native.IRQ70(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ71() { Intrinsic.SuppressStackFrame(); Native.IRQ71(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ72() { Intrinsic.SuppressStackFrame(); Native.IRQ72(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ73() { Intrinsic.SuppressStackFrame(); Native.IRQ73(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ74() { Intrinsic.SuppressStackFrame(); Native.IRQ74(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ75() { Intrinsic.SuppressStackFrame(); Native.IRQ75(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ76() { Intrinsic.SuppressStackFrame(); Native.IRQ76(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ77() { Intrinsic.SuppressStackFrame(); Native.IRQ77(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ78() { Intrinsic.SuppressStackFrame(); Native.IRQ78(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ79() { Intrinsic.SuppressStackFrame(); Native.IRQ79(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ80() { Intrinsic.SuppressStackFrame(); Native.IRQ80(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ81() { Intrinsic.SuppressStackFrame(); Native.IRQ81(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ82() { Intrinsic.SuppressStackFrame(); Native.IRQ82(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ83() { Intrinsic.SuppressStackFrame(); Native.IRQ83(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ84() { Intrinsic.SuppressStackFrame(); Native.IRQ84(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ85() { Intrinsic.SuppressStackFrame(); Native.IRQ85(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ86() { Intrinsic.SuppressStackFrame(); Native.IRQ86(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ87() { Intrinsic.SuppressStackFrame(); Native.IRQ87(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ88() { Intrinsic.SuppressStackFrame(); Native.IRQ88(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ89() { Intrinsic.SuppressStackFrame(); Native.IRQ89(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ90() { Intrinsic.SuppressStackFrame(); Native.IRQ90(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ91() { Intrinsic.SuppressStackFrame(); Native.IRQ91(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ92() { Intrinsic.SuppressStackFrame(); Native.IRQ92(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ93() { Intrinsic.SuppressStackFrame(); Native.IRQ93(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ94() { Intrinsic.SuppressStackFrame(); Native.IRQ94(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ95() { Intrinsic.SuppressStackFrame(); Native.IRQ95(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ96() { Intrinsic.SuppressStackFrame(); Native.IRQ96(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ97() { Intrinsic.SuppressStackFrame(); Native.IRQ97(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ98() { Intrinsic.SuppressStackFrame(); Native.IRQ98(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ99() { Intrinsic.SuppressStackFrame(); Native.IRQ99(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ100() { Intrinsic.SuppressStackFrame(); Native.IRQ100(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ101() { Intrinsic.SuppressStackFrame(); Native.IRQ101(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ102() { Intrinsic.SuppressStackFrame(); Native.IRQ102(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ103() { Intrinsic.SuppressStackFrame(); Native.IRQ103(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ104() { Intrinsic.SuppressStackFrame(); Native.IRQ104(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ105() { Intrinsic.SuppressStackFrame(); Native.IRQ105(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ106() { Intrinsic.SuppressStackFrame(); Native.IRQ106(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ107() { Intrinsic.SuppressStackFrame(); Native.IRQ107(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ108() { Intrinsic.SuppressStackFrame(); Native.IRQ108(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ109() { Intrinsic.SuppressStackFrame(); Native.IRQ109(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ110() { Intrinsic.SuppressStackFrame(); Native.IRQ110(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ111() { Intrinsic.SuppressStackFrame(); Native.IRQ111(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ112() { Intrinsic.SuppressStackFrame(); Native.IRQ112(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ113() { Intrinsic.SuppressStackFrame(); Native.IRQ113(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ114() { Intrinsic.SuppressStackFrame(); Native.IRQ114(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ115() { Intrinsic.SuppressStackFrame(); Native.IRQ115(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ116() { Intrinsic.SuppressStackFrame(); Native.IRQ116(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ117() { Intrinsic.SuppressStackFrame(); Native.IRQ117(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ118() { Intrinsic.SuppressStackFrame(); Native.IRQ118(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ119() { Intrinsic.SuppressStackFrame(); Native.IRQ119(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ120() { Intrinsic.SuppressStackFrame(); Native.IRQ120(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ121() { Intrinsic.SuppressStackFrame(); Native.IRQ121(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ122() { Intrinsic.SuppressStackFrame(); Native.IRQ122(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ123() { Intrinsic.SuppressStackFrame(); Native.IRQ123(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ124() { Intrinsic.SuppressStackFrame(); Native.IRQ124(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ125() { Intrinsic.SuppressStackFrame(); Native.IRQ125(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ126() { Intrinsic.SuppressStackFrame(); Native.IRQ126(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ127() { Intrinsic.SuppressStackFrame(); Native.IRQ127(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ128() { Intrinsic.SuppressStackFrame(); Native.IRQ128(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ129() { Intrinsic.SuppressStackFrame(); Native.IRQ129(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ130() { Intrinsic.SuppressStackFrame(); Native.IRQ130(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ131() { Intrinsic.SuppressStackFrame(); Native.IRQ131(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ132() { Intrinsic.SuppressStackFrame(); Native.IRQ132(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ133() { Intrinsic.SuppressStackFrame(); Native.IRQ133(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ134() { Intrinsic.SuppressStackFrame(); Native.IRQ134(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ135() { Intrinsic.SuppressStackFrame(); Native.IRQ135(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ136() { Intrinsic.SuppressStackFrame(); Native.IRQ136(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ137() { Intrinsic.SuppressStackFrame(); Native.IRQ137(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ138() { Intrinsic.SuppressStackFrame(); Native.IRQ138(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ139() { Intrinsic.SuppressStackFrame(); Native.IRQ139(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ140() { Intrinsic.SuppressStackFrame(); Native.IRQ140(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ141() { Intrinsic.SuppressStackFrame(); Native.IRQ141(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ142() { Intrinsic.SuppressStackFrame(); Native.IRQ142(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ143() { Intrinsic.SuppressStackFrame(); Native.IRQ143(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ144() { Intrinsic.SuppressStackFrame(); Native.IRQ144(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ145() { Intrinsic.SuppressStackFrame(); Native.IRQ145(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ146() { Intrinsic.SuppressStackFrame(); Native.IRQ146(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ147() { Intrinsic.SuppressStackFrame(); Native.IRQ147(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ148() { Intrinsic.SuppressStackFrame(); Native.IRQ148(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ149() { Intrinsic.SuppressStackFrame(); Native.IRQ149(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ150() { Intrinsic.SuppressStackFrame(); Native.IRQ150(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ151() { Intrinsic.SuppressStackFrame(); Native.IRQ151(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ152() { Intrinsic.SuppressStackFrame(); Native.IRQ152(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ153() { Intrinsic.SuppressStackFrame(); Native.IRQ153(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ154() { Intrinsic.SuppressStackFrame(); Native.IRQ154(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ155() { Intrinsic.SuppressStackFrame(); Native.IRQ155(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ156() { Intrinsic.SuppressStackFrame(); Native.IRQ156(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ157() { Intrinsic.SuppressStackFrame(); Native.IRQ157(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ158() { Intrinsic.SuppressStackFrame(); Native.IRQ158(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ159() { Intrinsic.SuppressStackFrame(); Native.IRQ159(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ160() { Intrinsic.SuppressStackFrame(); Native.IRQ160(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ161() { Intrinsic.SuppressStackFrame(); Native.IRQ161(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ162() { Intrinsic.SuppressStackFrame(); Native.IRQ162(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ163() { Intrinsic.SuppressStackFrame(); Native.IRQ163(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ164() { Intrinsic.SuppressStackFrame(); Native.IRQ164(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ165() { Intrinsic.SuppressStackFrame(); Native.IRQ165(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ166() { Intrinsic.SuppressStackFrame(); Native.IRQ166(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ167() { Intrinsic.SuppressStackFrame(); Native.IRQ167(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ168() { Intrinsic.SuppressStackFrame(); Native.IRQ168(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ169() { Intrinsic.SuppressStackFrame(); Native.IRQ169(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ170() { Intrinsic.SuppressStackFrame(); Native.IRQ170(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ171() { Intrinsic.SuppressStackFrame(); Native.IRQ171(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ172() { Intrinsic.SuppressStackFrame(); Native.IRQ172(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ173() { Intrinsic.SuppressStackFrame(); Native.IRQ173(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ174() { Intrinsic.SuppressStackFrame(); Native.IRQ174(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ175() { Intrinsic.SuppressStackFrame(); Native.IRQ175(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ176() { Intrinsic.SuppressStackFrame(); Native.IRQ176(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ177() { Intrinsic.SuppressStackFrame(); Native.IRQ177(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ178() { Intrinsic.SuppressStackFrame(); Native.IRQ178(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ179() { Intrinsic.SuppressStackFrame(); Native.IRQ179(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ180() { Intrinsic.SuppressStackFrame(); Native.IRQ180(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ181() { Intrinsic.SuppressStackFrame(); Native.IRQ181(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ182() { Intrinsic.SuppressStackFrame(); Native.IRQ182(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ183() { Intrinsic.SuppressStackFrame(); Native.IRQ183(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ184() { Intrinsic.SuppressStackFrame(); Native.IRQ184(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ185() { Intrinsic.SuppressStackFrame(); Native.IRQ185(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ186() { Intrinsic.SuppressStackFrame(); Native.IRQ186(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ187() { Intrinsic.SuppressStackFrame(); Native.IRQ187(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ188() { Intrinsic.SuppressStackFrame(); Native.IRQ188(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ189() { Intrinsic.SuppressStackFrame(); Native.IRQ189(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ190() { Intrinsic.SuppressStackFrame(); Native.IRQ190(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ191() { Intrinsic.SuppressStackFrame(); Native.IRQ191(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ192() { Intrinsic.SuppressStackFrame(); Native.IRQ192(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ193() { Intrinsic.SuppressStackFrame(); Native.IRQ193(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ194() { Intrinsic.SuppressStackFrame(); Native.IRQ194(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ195() { Intrinsic.SuppressStackFrame(); Native.IRQ195(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ196() { Intrinsic.SuppressStackFrame(); Native.IRQ196(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ197() { Intrinsic.SuppressStackFrame(); Native.IRQ197(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ198() { Intrinsic.SuppressStackFrame(); Native.IRQ198(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ199() { Intrinsic.SuppressStackFrame(); Native.IRQ199(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ200() { Intrinsic.SuppressStackFrame(); Native.IRQ200(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ201() { Intrinsic.SuppressStackFrame(); Native.IRQ201(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ202() { Intrinsic.SuppressStackFrame(); Native.IRQ202(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ203() { Intrinsic.SuppressStackFrame(); Native.IRQ203(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ204() { Intrinsic.SuppressStackFrame(); Native.IRQ204(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ205() { Intrinsic.SuppressStackFrame(); Native.IRQ205(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ206() { Intrinsic.SuppressStackFrame(); Native.IRQ206(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ207() { Intrinsic.SuppressStackFrame(); Native.IRQ207(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ208() { Intrinsic.SuppressStackFrame(); Native.IRQ208(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ209() { Intrinsic.SuppressStackFrame(); Native.IRQ209(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ210() { Intrinsic.SuppressStackFrame(); Native.IRQ210(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ211() { Intrinsic.SuppressStackFrame(); Native.IRQ211(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ212() { Intrinsic.SuppressStackFrame(); Native.IRQ212(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ213() { Intrinsic.SuppressStackFrame(); Native.IRQ213(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ214() { Intrinsic.SuppressStackFrame(); Native.IRQ214(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ215() { Intrinsic.SuppressStackFrame(); Native.IRQ215(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ216() { Intrinsic.SuppressStackFrame(); Native.IRQ216(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ217() { Intrinsic.SuppressStackFrame(); Native.IRQ217(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ218() { Intrinsic.SuppressStackFrame(); Native.IRQ218(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ219() { Intrinsic.SuppressStackFrame(); Native.IRQ219(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ220() { Intrinsic.SuppressStackFrame(); Native.IRQ220(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ221() { Intrinsic.SuppressStackFrame(); Native.IRQ221(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ222() { Intrinsic.SuppressStackFrame(); Native.IRQ222(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ223() { Intrinsic.SuppressStackFrame(); Native.IRQ223(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ224() { Intrinsic.SuppressStackFrame(); Native.IRQ224(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ225() { Intrinsic.SuppressStackFrame(); Native.IRQ225(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ226() { Intrinsic.SuppressStackFrame(); Native.IRQ226(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ227() { Intrinsic.SuppressStackFrame(); Native.IRQ227(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ228() { Intrinsic.SuppressStackFrame(); Native.IRQ228(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ229() { Intrinsic.SuppressStackFrame(); Native.IRQ229(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ230() { Intrinsic.SuppressStackFrame(); Native.IRQ230(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ231() { Intrinsic.SuppressStackFrame(); Native.IRQ231(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ232() { Intrinsic.SuppressStackFrame(); Native.IRQ232(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ233() { Intrinsic.SuppressStackFrame(); Native.IRQ233(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ234() { Intrinsic.SuppressStackFrame(); Native.IRQ234(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ235() { Intrinsic.SuppressStackFrame(); Native.IRQ235(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ236() { Intrinsic.SuppressStackFrame(); Native.IRQ236(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ237() { Intrinsic.SuppressStackFrame(); Native.IRQ237(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ238() { Intrinsic.SuppressStackFrame(); Native.IRQ238(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ239() { Intrinsic.SuppressStackFrame(); Native.IRQ239(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ240() { Intrinsic.SuppressStackFrame(); Native.IRQ240(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ241() { Intrinsic.SuppressStackFrame(); Native.IRQ241(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ242() { Intrinsic.SuppressStackFrame(); Native.IRQ242(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ243() { Intrinsic.SuppressStackFrame(); Native.IRQ243(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ244() { Intrinsic.SuppressStackFrame(); Native.IRQ244(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ245() { Intrinsic.SuppressStackFrame(); Native.IRQ245(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ246() { Intrinsic.SuppressStackFrame(); Native.IRQ246(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ247() { Intrinsic.SuppressStackFrame(); Native.IRQ247(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ248() { Intrinsic.SuppressStackFrame(); Native.IRQ248(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ249() { Intrinsic.SuppressStackFrame(); Native.IRQ249(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ250() { Intrinsic.SuppressStackFrame(); Native.IRQ250(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ251() { Intrinsic.SuppressStackFrame(); Native.IRQ251(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ252() { Intrinsic.SuppressStackFrame(); Native.IRQ252(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ253() { Intrinsic.SuppressStackFrame(); Native.IRQ253(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ254() { Intrinsic.SuppressStackFrame(); Native.IRQ254(); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IRQ255() { Intrinsic.SuppressStackFrame(); diff --git a/Source/Mosa.Kernel.x86/Mosa.Kernel.x86.nuspec b/Source/Mosa.Kernel.x86/Mosa.Kernel.x86.nuspec index 782a0bf934..ed31c4605b 100644 --- a/Source/Mosa.Kernel.x86/Mosa.Kernel.x86.nuspec +++ b/Source/Mosa.Kernel.x86/Mosa.Kernel.x86.nuspec @@ -22,6 +22,6 @@ - + diff --git a/Source/Mosa.Kernel.x86/Scheduler.cs b/Source/Mosa.Kernel.x86/Scheduler.cs index 4754c2ef2f..e596c4ebe4 100644 --- a/Source/Mosa.Kernel.x86/Scheduler.cs +++ b/Source/Mosa.Kernel.x86/Scheduler.cs @@ -3,6 +3,7 @@ using Mosa.Runtime; using Mosa.Runtime.x86; using System; +using System.Runtime.CompilerServices; using System.Threading; namespace Mosa.Kernel.x86 @@ -52,6 +53,7 @@ public static void Start() Native.Int(ClockIRQ); } + [MethodImpl(MethodImplOptions.NoInlining)] private static void IdleThread() { while (true) @@ -80,6 +82,7 @@ private static void ScheduleNextThread(uint threadID) SwitchToThread(threadID); } + [MethodImpl(MethodImplOptions.NoInlining)] public static void SignalThreadTerminationMethod() { Native.Int(ThreadTerminationSignalIRQ); diff --git a/Source/Mosa.Korlib/Mosa.Korlib.nuspec b/Source/Mosa.Korlib/Mosa.Korlib.nuspec index 2c2c0b6327..ded4826cb0 100644 --- a/Source/Mosa.Korlib/Mosa.Korlib.nuspec +++ b/Source/Mosa.Korlib/Mosa.Korlib.nuspec @@ -16,8 +16,8 @@ MOSA Compiler corlib - - - + + + diff --git a/Source/Mosa.Platform.Intel/CompilerStages/MultibootV1Stage.cs b/Source/Mosa.Platform.Intel/CompilerStages/MultibootV1Stage.cs index 9422f4fece..79366b77bc 100644 --- a/Source/Mosa.Platform.Intel/CompilerStages/MultibootV1Stage.cs +++ b/Source/Mosa.Platform.Intel/CompilerStages/MultibootV1Stage.cs @@ -100,13 +100,14 @@ protected override void Setup() Linker.EntryPoint = Linker.GetSymbol(multibootMethod.FullName); - Compiler.CompilerData.GetMethodData(multibootMethod).DoNotInline = true; + Compiler.GetMethodData(multibootMethod).DoNotInline = true; MethodScanner.MethodInvoked(multibootMethod, multibootMethod); var startUpType = TypeSystem.GetTypeByName("Mosa.Runtime", "StartUp"); var initializeMethod = startUpType.FindMethodByName("Initialize"); - Compiler.CompilerData.GetMethodData(initializeMethod).DoNotInline = true; + Compiler.GetMethodData(initializeMethod).DoNotInline = true; + MethodScanner.MethodInvoked(initializeMethod, multibootMethod); } diff --git a/Source/Mosa.Platform.Intel/CompilerStages/StartUpStage.cs b/Source/Mosa.Platform.Intel/CompilerStages/StartUpStage.cs index 92fa1d8b1a..c4e89e0400 100644 --- a/Source/Mosa.Platform.Intel/CompilerStages/StartUpStage.cs +++ b/Source/Mosa.Platform.Intel/CompilerStages/StartUpStage.cs @@ -18,6 +18,8 @@ protected override void Setup() Compiler.PlugSystem.CreatePlug(startUpMethod, TypeSystem.EntryPoint); + Compiler.GetMethodData(startUpMethod).DoNotInline = true; + MethodScanner.MethodInvoked(startUpMethod, startUpMethod); if (Linker.EntryPoint == null) @@ -26,12 +28,14 @@ protected override void Setup() Linker.EntryPoint = Linker.GetSymbol(initializeMethod.FullName); - Compiler.CompilerData.GetMethodData(initializeMethod).DoNotInline = true; + Compiler.GetMethodData(initializeMethod).DoNotInline = true; MethodScanner.MethodInvoked(initializeMethod, initializeMethod); } else { + Compiler.GetMethodData(TypeSystem.EntryPoint).DoNotInline = true; + MethodScanner.MethodInvoked(TypeSystem.EntryPoint, TypeSystem.EntryPoint); } } diff --git a/Source/Mosa.Platform.x64/CompilerStages/MultibootV1Stage.cs b/Source/Mosa.Platform.x64/CompilerStages/MultibootV1Stage.cs index 4334e7e7a6..25a6c98171 100644 --- a/Source/Mosa.Platform.x64/CompilerStages/MultibootV1Stage.cs +++ b/Source/Mosa.Platform.x64/CompilerStages/MultibootV1Stage.cs @@ -12,6 +12,9 @@ protected override void CreateMultibootMethod() { var startUpType = TypeSystem.GetTypeByName("Mosa.Runtime", "StartUp"); var initializeMethod = startUpType.FindMethodByName("Initialize"); + + Compiler.GetMethodData(initializeMethod).DoNotInline = true; + var entryPoint = Operand.CreateSymbolFromMethod(initializeMethod, TypeSystem); var eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I8, GeneralPurposeRegister.EAX); diff --git a/Source/Mosa.Platform.x86/CompilerStages/MultibootV1Stage.cs b/Source/Mosa.Platform.x86/CompilerStages/MultibootV1Stage.cs index 974c892391..f8be586d02 100644 --- a/Source/Mosa.Platform.x86/CompilerStages/MultibootV1Stage.cs +++ b/Source/Mosa.Platform.x86/CompilerStages/MultibootV1Stage.cs @@ -12,6 +12,9 @@ protected override void CreateMultibootMethod() { var startUpType = TypeSystem.GetTypeByName("Mosa.Runtime", "StartUp"); var initializeMethod = startUpType.FindMethodByName("Initialize"); + + Compiler.GetMethodData(initializeMethod).DoNotInline = true; + var entryPoint = Operand.CreateSymbolFromMethod(initializeMethod, TypeSystem); var eax = Operand.CreateCPURegister(TypeSystem.BuiltIn.I4, GeneralPurposeRegister.EAX); diff --git a/Source/Mosa.Runtime.x64/Math/Division.cs b/Source/Mosa.Runtime.x64/Math/Division.cs index 69d56983eb..1b16641dd6 100644 --- a/Source/Mosa.Runtime.x64/Math/Division.cs +++ b/Source/Mosa.Runtime.x64/Math/Division.cs @@ -1,6 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. using Mosa.Runtime.x64; +using System.Runtime.CompilerServices; namespace Mosa.Runtime.Math.x64 { @@ -8,6 +9,7 @@ internal static class Division { /* Single and Double Remainder */ + [MethodImpl(MethodImplOptions.NoInlining)] public static double RemR8(double n, double d) { if (double.IsInfinity(d)) @@ -39,6 +41,7 @@ public static double RemR8(double n, double d) return Native.Remainder(n, d); } + [MethodImpl(MethodImplOptions.NoInlining)] public static float RemR4(float n, float d) { if (float.IsInfinity(d)) diff --git a/Source/Mosa.Runtime.x64/Mosa.Runtime.x64.nuspec b/Source/Mosa.Runtime.x64/Mosa.Runtime.x64.nuspec index c9efadd0f5..e56462069e 100644 --- a/Source/Mosa.Runtime.x64/Mosa.Runtime.x64.nuspec +++ b/Source/Mosa.Runtime.x64/Mosa.Runtime.x64.nuspec @@ -20,6 +20,6 @@ - + diff --git a/Source/Mosa.Runtime.x86/Math/Division.cs b/Source/Mosa.Runtime.x86/Math/Division.cs index dfec075b52..9b4a1414bd 100644 --- a/Source/Mosa.Runtime.x86/Math/Division.cs +++ b/Source/Mosa.Runtime.x86/Math/Division.cs @@ -1,6 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. using Mosa.Runtime.x86; +using System.Runtime.CompilerServices; namespace Mosa.Runtime.Math.x86 { @@ -8,6 +9,7 @@ internal static class Division { /* Single and Double Remainder */ + [MethodImpl(MethodImplOptions.NoInlining)] public static double RemR8(double n, double d) { if (double.IsInfinity(d)) @@ -39,6 +41,7 @@ public static double RemR8(double n, double d) return Native.Remainder(n, d); } + [MethodImpl(MethodImplOptions.NoInlining)] public static float RemR4(float n, float d) { if (float.IsInfinity(d)) diff --git a/Source/Mosa.Runtime.x86/Mosa.Runtime.x86.nuspec b/Source/Mosa.Runtime.x86/Mosa.Runtime.x86.nuspec index 3fdb27fd9e..1173e97957 100644 --- a/Source/Mosa.Runtime.x86/Mosa.Runtime.x86.nuspec +++ b/Source/Mosa.Runtime.x86/Mosa.Runtime.x86.nuspec @@ -20,6 +20,6 @@ - + diff --git a/Source/Mosa.Runtime.x86/Native.cs b/Source/Mosa.Runtime.x86/Native.cs index 83420bf0ca..9387d30991 100644 --- a/Source/Mosa.Runtime.x86/Native.cs +++ b/Source/Mosa.Runtime.x86/Native.cs @@ -1,6 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Mosa.Runtime.x86 @@ -220,771 +221,1027 @@ public static unsafe class Native #region IRQs Intrinsic + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ0")] public extern static void IRQ0(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ1")] public extern static void IRQ1(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ2")] public extern static void IRQ2(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ3")] public extern static void IRQ3(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ4")] public extern static void IRQ4(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ5")] public extern static void IRQ5(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ6")] public extern static void IRQ6(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ7")] public extern static void IRQ7(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ8")] public extern static void IRQ8(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ9")] public extern static void IRQ9(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ10")] public extern static void IRQ10(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ11")] public extern static void IRQ11(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ12")] public extern static void IRQ12(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ13")] public extern static void IRQ13(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ14")] public extern static void IRQ14(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ15")] public extern static void IRQ15(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ16")] public extern static void IRQ16(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ17")] public extern static void IRQ17(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ18")] public extern static void IRQ18(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ19")] public extern static void IRQ19(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ20")] public extern static void IRQ20(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ21")] public extern static void IRQ21(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ22")] public extern static void IRQ22(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ23")] public extern static void IRQ23(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ24")] public extern static void IRQ24(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ25")] public extern static void IRQ25(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ26")] public extern static void IRQ26(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ27")] public extern static void IRQ27(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ28")] public extern static void IRQ28(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ29")] public extern static void IRQ29(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ30")] public extern static void IRQ30(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ31")] public extern static void IRQ31(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ32")] public extern static void IRQ32(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ33")] public extern static void IRQ33(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ34")] public extern static void IRQ34(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ35")] public extern static void IRQ35(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ36")] public extern static void IRQ36(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ37")] public extern static void IRQ37(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ38")] public extern static void IRQ38(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ39")] public extern static void IRQ39(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ40")] public extern static void IRQ40(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ41")] public extern static void IRQ41(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ42")] public extern static void IRQ42(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ43")] public extern static void IRQ43(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ44")] public extern static void IRQ44(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ45")] public extern static void IRQ45(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ46")] public extern static void IRQ46(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ47")] public extern static void IRQ47(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ48")] public extern static void IRQ48(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ49")] public extern static void IRQ49(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ50")] public extern static void IRQ50(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ51")] public extern static void IRQ51(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ52")] public extern static void IRQ52(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ53")] public extern static void IRQ53(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ54")] public extern static void IRQ54(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ55")] public extern static void IRQ55(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ56")] public extern static void IRQ56(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ57")] public extern static void IRQ57(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ58")] public extern static void IRQ58(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ59")] public extern static void IRQ59(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ60")] public extern static void IRQ60(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ61")] public extern static void IRQ61(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ62")] public extern static void IRQ62(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ63")] public extern static void IRQ63(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ64")] public extern static void IRQ64(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ65")] public extern static void IRQ65(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ66")] public extern static void IRQ66(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ67")] public extern static void IRQ67(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ68")] public extern static void IRQ68(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ69")] public extern static void IRQ69(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ70")] public extern static void IRQ70(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ71")] public extern static void IRQ71(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ72")] public extern static void IRQ72(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ73")] public extern static void IRQ73(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ74")] public extern static void IRQ74(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ75")] public extern static void IRQ75(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ76")] public extern static void IRQ76(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ77")] public extern static void IRQ77(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ78")] public extern static void IRQ78(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ79")] public extern static void IRQ79(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ80")] public extern static void IRQ80(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ81")] public extern static void IRQ81(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ82")] public extern static void IRQ82(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ83")] public extern static void IRQ83(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ84")] public extern static void IRQ84(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ85")] public extern static void IRQ85(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ86")] public extern static void IRQ86(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ87")] public extern static void IRQ87(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ88")] public extern static void IRQ88(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ89")] public extern static void IRQ89(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ90")] public extern static void IRQ90(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ91")] public extern static void IRQ91(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ92")] public extern static void IRQ92(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ93")] public extern static void IRQ93(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ94")] public extern static void IRQ94(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ95")] public extern static void IRQ95(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ96")] public extern static void IRQ96(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ97")] public extern static void IRQ97(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ98")] public extern static void IRQ98(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ99")] public extern static void IRQ99(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ100")] public extern static void IRQ100(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ101")] public extern static void IRQ101(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ102")] public extern static void IRQ102(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ103")] public extern static void IRQ103(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ14")] public extern static void IRQ104(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ105")] public extern static void IRQ105(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ106")] public extern static void IRQ106(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ107")] public extern static void IRQ107(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ108")] public extern static void IRQ108(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ109")] public extern static void IRQ109(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ110")] public extern static void IRQ110(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ111")] public extern static void IRQ111(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ112")] public extern static void IRQ112(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ113")] public extern static void IRQ113(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ114")] public extern static void IRQ114(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ115")] public extern static void IRQ115(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ116")] public extern static void IRQ116(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ117")] public extern static void IRQ117(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ118")] public extern static void IRQ118(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ119")] public extern static void IRQ119(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ120")] public extern static void IRQ120(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ121")] public extern static void IRQ121(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ122")] public extern static void IRQ122(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ123")] public extern static void IRQ123(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ124")] public extern static void IRQ124(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ125")] public extern static void IRQ125(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ126")] public extern static void IRQ126(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ127")] public extern static void IRQ127(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ128")] public extern static void IRQ128(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ129")] public extern static void IRQ129(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ130")] public extern static void IRQ130(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ131")] public extern static void IRQ131(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ132")] public extern static void IRQ132(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ133")] public extern static void IRQ133(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ134")] public extern static void IRQ134(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ135")] public extern static void IRQ135(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ136")] public extern static void IRQ136(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ137")] public extern static void IRQ137(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ138")] public extern static void IRQ138(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ139")] public extern static void IRQ139(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ140")] public extern static void IRQ140(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ141")] public extern static void IRQ141(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ142")] public extern static void IRQ142(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ143")] public extern static void IRQ143(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ144")] public extern static void IRQ144(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ145")] public extern static void IRQ145(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ146")] public extern static void IRQ146(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ147")] public extern static void IRQ147(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ148")] public extern static void IRQ148(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ149")] public extern static void IRQ149(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ150")] public extern static void IRQ150(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ151")] public extern static void IRQ151(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ152")] public extern static void IRQ152(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ153")] public extern static void IRQ153(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ154")] public extern static void IRQ154(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ155")] public extern static void IRQ155(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ156")] public extern static void IRQ156(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ157")] public extern static void IRQ157(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ158")] public extern static void IRQ158(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ159")] public extern static void IRQ159(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ160")] public extern static void IRQ160(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ161")] public extern static void IRQ161(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ162")] public extern static void IRQ162(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ163")] public extern static void IRQ163(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ164")] public extern static void IRQ164(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ165")] public extern static void IRQ165(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ166")] public extern static void IRQ166(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ167")] public extern static void IRQ167(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ168")] public extern static void IRQ168(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ169")] public extern static void IRQ169(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ170")] public extern static void IRQ170(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ171")] public extern static void IRQ171(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ172")] public extern static void IRQ172(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ173")] public extern static void IRQ173(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ174")] public extern static void IRQ174(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ175")] public extern static void IRQ175(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ176")] public extern static void IRQ176(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ177")] public extern static void IRQ177(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ178")] public extern static void IRQ178(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ179")] public extern static void IRQ179(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ180")] public extern static void IRQ180(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ181")] public extern static void IRQ181(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ182")] public extern static void IRQ182(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ183")] public extern static void IRQ183(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ184")] public extern static void IRQ184(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ185")] public extern static void IRQ185(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ186")] public extern static void IRQ186(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ187")] public extern static void IRQ187(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ188")] public extern static void IRQ188(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ189")] public extern static void IRQ189(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ190")] public extern static void IRQ190(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ191")] public extern static void IRQ191(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ192")] public extern static void IRQ192(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ193")] public extern static void IRQ193(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ194")] public extern static void IRQ194(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ195")] public extern static void IRQ195(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ196")] public extern static void IRQ196(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ197")] public extern static void IRQ197(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ198")] public extern static void IRQ198(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ199")] public extern static void IRQ199(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ200")] public extern static void IRQ200(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ201")] public extern static void IRQ201(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ202")] public extern static void IRQ202(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ203")] public extern static void IRQ203(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ204")] public extern static void IRQ204(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ205")] public extern static void IRQ205(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ206")] public extern static void IRQ206(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ207")] public extern static void IRQ207(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ208")] public extern static void IRQ208(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ209")] public extern static void IRQ209(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ210")] public extern static void IRQ210(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ211")] public extern static void IRQ211(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ212")] public extern static void IRQ212(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ213")] public extern static void IRQ213(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ214")] public extern static void IRQ214(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ215")] public extern static void IRQ215(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ216")] public extern static void IRQ216(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ217")] public extern static void IRQ217(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ218")] public extern static void IRQ218(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ219")] public extern static void IRQ219(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ220")] public extern static void IRQ220(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ221")] public extern static void IRQ221(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ222")] public extern static void IRQ222(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ223")] public extern static void IRQ223(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ224")] public extern static void IRQ224(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ225")] public extern static void IRQ225(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ226")] public extern static void IRQ226(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ227")] public extern static void IRQ227(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ228")] public extern static void IRQ228(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ229")] public extern static void IRQ229(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ230")] public extern static void IRQ230(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ231")] public extern static void IRQ231(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ232")] public extern static void IRQ232(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ233")] public extern static void IRQ233(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ234")] public extern static void IRQ234(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ235")] public extern static void IRQ235(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ236")] public extern static void IRQ236(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ237")] public extern static void IRQ237(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ238")] public extern static void IRQ238(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ239")] public extern static void IRQ239(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ240")] public extern static void IRQ240(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ241")] public extern static void IRQ241(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ242")] public extern static void IRQ242(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ243")] public extern static void IRQ243(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ244")] public extern static void IRQ244(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ245")] public extern static void IRQ245(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ246")] public extern static void IRQ246(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ247")] public extern static void IRQ247(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ248")] public extern static void IRQ248(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ249")] public extern static void IRQ249(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ250")] public extern static void IRQ250(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ251")] public extern static void IRQ251(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ252")] public extern static void IRQ252(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ253")] public extern static void IRQ253(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ254")] public extern static void IRQ254(); + [MethodImpl(MethodImplOptions.NoInlining)] [DllImportAttribute("Mosa.Platform.x86.Intrinsic:IRQ255")] public extern static void IRQ255(); diff --git a/Source/Mosa.Runtime/Internal.cs b/Source/Mosa.Runtime/Internal.cs index 5924d8c878..edb00054a9 100644 --- a/Source/Mosa.Runtime/Internal.cs +++ b/Source/Mosa.Runtime/Internal.cs @@ -10,7 +10,7 @@ public static class Internal { #region Allocation - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public static IntPtr AllocateObject(RuntimeTypeHandle handle, uint classSize) { // An object has the following memory layout: @@ -34,13 +34,13 @@ public static IntPtr AllocateObject(RuntimeTypeHandle handle, uint classSize) return memory; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public static IntPtr AllocateObject(RuntimeTypeHandle handle, int classSize) { return AllocateObject(handle, (uint)classSize); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public static IntPtr AllocateArray(RuntimeTypeHandle handle, uint elementSize, uint elements) { // An array has the following memory layout: @@ -71,7 +71,7 @@ public static IntPtr AllocateArray(RuntimeTypeHandle handle, uint elementSize, u return memory; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public static IntPtr AllocateString(RuntimeTypeHandle handle, uint length) { return AllocateArray(handle, sizeof(char), length); @@ -114,7 +114,7 @@ public static IntPtr Box32(RuntimeTypeHandle handle, uint value) return memory; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public static IntPtr Box64(RuntimeTypeHandle handle, ulong value) { var memory = AllocateObject(handle, IntPtr.Size * 2); diff --git a/Source/Mosa.Runtime/Math/Division.cs b/Source/Mosa.Runtime/Math/Division.cs index e3469c90c9..614393011d 100644 --- a/Source/Mosa.Runtime/Math/Division.cs +++ b/Source/Mosa.Runtime/Math/Division.cs @@ -1,11 +1,14 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using System.Runtime.CompilerServices; + namespace Mosa.Runtime.Math { internal static class Division { /* Divides unsigned 64-bit N by unsigned 64-bit D and returns the quotient. */ + [MethodImpl(MethodImplOptions.NoInlining)] public static ulong udiv64(ulong n, ulong d) { DivUmod(n, d, out ulong quotient, out ulong remainder); @@ -14,6 +17,7 @@ public static ulong udiv64(ulong n, ulong d) /* Divides unsigned 64-bit N by unsigned 64-bit D and returns the remainder. */ + [MethodImpl(MethodImplOptions.NoInlining)] public static ulong umod64(ulong n, ulong d) { DivUmod(n, d, out ulong quotient, out ulong remainder); @@ -22,6 +26,7 @@ public static ulong umod64(ulong n, ulong d) /* Divides signed 64-bit N by signed 64-bit D and returns the quotient. */ + [MethodImpl(MethodImplOptions.NoInlining)] public static long sdiv64(long n, long d) { DivMod(n, d, out long quotient, out long remainder); @@ -30,6 +35,7 @@ public static long sdiv64(long n, long d) /* Divides signed 64-bit N by signed 64-bit D and returns the remainder. */ + [MethodImpl(MethodImplOptions.NoInlining)] public static long smod64(long n, long d) { DivMod(n, d, out long quotient, out long remainder); diff --git a/Source/Mosa.Runtime/Mosa.Runtime.nuspec b/Source/Mosa.Runtime/Mosa.Runtime.nuspec index c39da4f8c9..56a16f4d15 100644 --- a/Source/Mosa.Runtime/Mosa.Runtime.nuspec +++ b/Source/Mosa.Runtime/Mosa.Runtime.nuspec @@ -19,6 +19,6 @@ - + diff --git a/Source/Mosa.TestWorld.x86/Boot.cs b/Source/Mosa.TestWorld.x86/Boot.cs index ab02c7dab9..3247d0d910 100644 --- a/Source/Mosa.TestWorld.x86/Boot.cs +++ b/Source/Mosa.TestWorld.x86/Boot.cs @@ -5,6 +5,8 @@ using Mosa.Runtime.Plug; using Mosa.Runtime.x86; using Mosa.TestWorld.x86.Tests; +using Mosa.UnitTests; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Mosa.TestWorld.x86 @@ -69,6 +71,8 @@ public static void Main() Screen.WriteLine(); Screen.WriteLine(); + UnitTest(); + KernelTest.RunTests(); StackTrace(); StartThreadTest(); @@ -122,6 +126,7 @@ private static void UpdateThreadTicks(uint thread, uint ticks) } } + [MethodImpl(MethodImplOptions.NoInlining)] public static void Thread1() { uint ticks = 0; @@ -132,6 +137,7 @@ public static void Thread1() } } + [MethodImpl(MethodImplOptions.NoInlining)] public static void Thread2() { uint ticks = 0; @@ -142,6 +148,7 @@ public static void Thread2() } } + [MethodImpl(MethodImplOptions.NoInlining)] public static void Thread3() { uint ticks = 0; @@ -152,6 +159,7 @@ public static void Thread3() } } + [MethodImpl(MethodImplOptions.NoInlining)] public static void Thread4() { uint ticks = 0; @@ -162,6 +170,7 @@ public static void Thread4() } } + [MethodImpl(MethodImplOptions.NoInlining)] public static void Thread5() { uint ticks = 0; @@ -240,5 +249,10 @@ public static int CallApple() { return Apple(); } + + public static void UnitTest() + { + GenericInterfaceTests.InterfaceTest2(5); + } } } diff --git a/Source/Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj b/Source/Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj index 452a67f412..5876436ba5 100644 --- a/Source/Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj +++ b/Source/Mosa.Tool.Compiler/Mosa.Tool.Compiler.csproj @@ -113,7 +113,7 @@ - 2.4.3 + 2.5.0 diff --git a/Source/Mosa.Tool.CreateBootImage/Mosa.Tool.CreateBootImage.csproj b/Source/Mosa.Tool.CreateBootImage/Mosa.Tool.CreateBootImage.csproj index f8a83f7cfe..683f16d825 100644 --- a/Source/Mosa.Tool.CreateBootImage/Mosa.Tool.CreateBootImage.csproj +++ b/Source/Mosa.Tool.CreateBootImage/Mosa.Tool.CreateBootImage.csproj @@ -68,7 +68,7 @@ - 2.4.3 + 2.5.0 diff --git a/Source/Mosa.Tool.Disassembler.Intel/Mosa.Tool.Disassembler.Intel.csproj b/Source/Mosa.Tool.Disassembler.Intel/Mosa.Tool.Disassembler.Intel.csproj index 60fd509aec..688110b089 100644 --- a/Source/Mosa.Tool.Disassembler.Intel/Mosa.Tool.Disassembler.Intel.csproj +++ b/Source/Mosa.Tool.Disassembler.Intel/Mosa.Tool.Disassembler.Intel.csproj @@ -115,7 +115,7 @@ - 2.4.3 + 2.5.0 1.1.11 diff --git a/Source/Mosa.Tool.Explorer/CompilerStage/ExplorerMethodCompileTimeStage.cs b/Source/Mosa.Tool.Explorer/CompilerStage/ExplorerMethodCompileTimeStage.cs index 5d721e8893..74b58dfa56 100644 --- a/Source/Mosa.Tool.Explorer/CompilerStage/ExplorerMethodCompileTimeStage.cs +++ b/Source/Mosa.Tool.Explorer/CompilerStage/ExplorerMethodCompileTimeStage.cs @@ -22,7 +22,7 @@ protected override void Finalization() foreach (var data in methods) { - log.Log($"{data.ElapsedTicks}{'\t'}{data.ElapsedTicks / TimeSpan.TicksPerMillisecond}{'\t'}{data.CompileCount}{'\t'}{data.Method.FullName}"); + log.Log($"{data.ElapsedTicks}{'\t'}{data.ElapsedTicks / TimeSpan.TicksPerMillisecond}{'\t'}{data.Version}{'\t'}{data.Method.FullName}"); } PostTrace(log); diff --git a/Source/Mosa.Tool.Explorer/MainForm.cs b/Source/Mosa.Tool.Explorer/MainForm.cs index 451dfd4e31..2ec1216eb1 100644 --- a/Source/Mosa.Tool.Explorer/MainForm.cs +++ b/Source/Mosa.Tool.Explorer/MainForm.cs @@ -259,6 +259,9 @@ public void LoadAssembly(string filename, string includeDirectory = null) ClearAllLogs(); methodStore.Clear(); + if (filename == null) + return; + LoadAssembly(filename, cbPlatform.Text, includeDirectory); CreateTree(); @@ -763,15 +766,6 @@ protected void LoadAssembly(string filename, string platform, string includeDire Compiler.CompilerOptions.AddSourceFile("Mosa.Plug.Korlib.dll"); Compiler.CompilerOptions.AddSourceFile("Mosa.Plug.Korlib." + platform + ".dll"); - //var moduleLoader = new MosaModuleLoader(); - - //moduleLoader.AddSearchPaths(Compiler.CompilerOptions.SearchPaths); - //moduleLoader.LoadModuleFromFiles(Compiler.CompilerOptions.SourceFiles); - - //var metadata = moduleLoader.CreateMetadata(); - - //var typeSystem = TypeSystem.Load(metadata); - Compiler.Load(); } diff --git a/Source/Mosa.Tool.Explorer/Mosa.Tool.Explorer.csproj b/Source/Mosa.Tool.Explorer/Mosa.Tool.Explorer.csproj index 4b81d548ad..61cb9e2447 100644 --- a/Source/Mosa.Tool.Explorer/Mosa.Tool.Explorer.csproj +++ b/Source/Mosa.Tool.Explorer/Mosa.Tool.Explorer.csproj @@ -151,7 +151,7 @@ - 2.4.3 + 2.5.0 3.2.0 diff --git a/Source/Mosa.Tool.Explorer/Options.cs b/Source/Mosa.Tool.Explorer/Options.cs index a2588d00fa..c8b620c50d 100644 --- a/Source/Mosa.Tool.Explorer/Options.cs +++ b/Source/Mosa.Tool.Explorer/Options.cs @@ -34,9 +34,6 @@ internal class Options [Option("x86")] public bool X86 { get; set; } - [Option("esp32")] - public bool ESP32 { get; set; } - [Option("armv6")] public bool ARMv6 { get; set; } @@ -50,7 +47,6 @@ public Options() { X86 = true; X64 = false; - ESP32 = false; } } } diff --git a/Source/Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj b/Source/Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj index 2f4ec16ddd..8a6fb0be0b 100644 --- a/Source/Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj +++ b/Source/Mosa.Tool.GDBDebugger/Mosa.Tool.GDBDebugger.csproj @@ -304,7 +304,7 @@ - 2.4.3 + 2.5.0 3.2.0 diff --git a/Source/Mosa.Tool.Launcher/Mosa.Tool.Launcher.csproj b/Source/Mosa.Tool.Launcher/Mosa.Tool.Launcher.csproj index 83999471fd..5ae01c201e 100644 --- a/Source/Mosa.Tool.Launcher/Mosa.Tool.Launcher.csproj +++ b/Source/Mosa.Tool.Launcher/Mosa.Tool.Launcher.csproj @@ -164,7 +164,7 @@ - 2.4.3 + 2.5.0 1.4.0 diff --git a/Source/Mosa.Tools.Package/Mosa.Tools.Package.csproj b/Source/Mosa.Tools.Package/Mosa.Tools.Package.csproj index 1cb5dd585b..916afb9877 100644 --- a/Source/Mosa.Tools.Package/Mosa.Tools.Package.csproj +++ b/Source/Mosa.Tools.Package/Mosa.Tools.Package.csproj @@ -66,8 +66,8 @@ - - ..\packages\CommandLineParser.2.4.3\lib\netstandard2.0\CommandLine.dll + + ..\packages\CommandLineParser.2.5.0\lib\net461\CommandLine.dll ..\packages\dnlib.3.2.0\lib\net45\dnlib.dll diff --git a/Source/Mosa.Tools.Package/packages.config b/Source/Mosa.Tools.Package/packages.config index a29738e39d..840e7a5339 100644 --- a/Source/Mosa.Tools.Package/packages.config +++ b/Source/Mosa.Tools.Package/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Source/Mosa.UnitTests/ReflectionTests.cs b/Source/Mosa.UnitTests/ReflectionTests.cs index cf20ac8b9c..7ab45bb792 100644 --- a/Source/Mosa.UnitTests/ReflectionTests.cs +++ b/Source/Mosa.UnitTests/ReflectionTests.cs @@ -1,6 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. using System; +using System.Runtime.CompilerServices; namespace Mosa.UnitTests { @@ -90,6 +91,7 @@ private class TestClass123 { public int i = 0; + [MethodImpl(MethodImplOptions.NoInlining)] public TestClass123() { i = 52; diff --git a/Source/Mosa.Utility.Launcher/Mosa.Utility.Launcher.csproj b/Source/Mosa.Utility.Launcher/Mosa.Utility.Launcher.csproj index de136e2341..1ca288c722 100644 --- a/Source/Mosa.Utility.Launcher/Mosa.Utility.Launcher.csproj +++ b/Source/Mosa.Utility.Launcher/Mosa.Utility.Launcher.csproj @@ -65,8 +65,8 @@ - - ..\packages\CommandLineParser.2.4.3\lib\netstandard2.0\CommandLine.dll + + ..\packages\CommandLineParser.2.5.0\lib\net461\CommandLine.dll ..\packages\SharpDisasm.1.1.11\lib\net45\SharpDisasm.dll diff --git a/Source/Mosa.Utility.Launcher/packages.config b/Source/Mosa.Utility.Launcher/packages.config index 370a6ada62..dc49fdbdb4 100644 --- a/Source/Mosa.Utility.Launcher/packages.config +++ b/Source/Mosa.Utility.Launcher/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Source/Mosa.Utility.UnitTests/UnitTestEngine.cs b/Source/Mosa.Utility.UnitTests/UnitTestEngine.cs index b6d2629374..b03d198c80 100644 --- a/Source/Mosa.Utility.UnitTests/UnitTestEngine.cs +++ b/Source/Mosa.Utility.UnitTests/UnitTestEngine.cs @@ -66,7 +66,7 @@ public UnitTestEngine(bool display = false) TwoPassOptimizations = true, EnableMethodScanner = false, EnableBitTracker = true, - EnableMultiThreading = false, + EnableMultiThreading = true, Emulator = EmulatorType.Qemu, ImageFormat = ImageFormat.IMG, diff --git a/Source/Mosa.VisualStudio.Template/MOSA Project/Mosa.Starter.x86.csproj b/Source/Mosa.VisualStudio.Template/MOSA Project/Mosa.Starter.x86.csproj index 7a2637c957..ea21745fb6 100644 --- a/Source/Mosa.VisualStudio.Template/MOSA Project/Mosa.Starter.x86.csproj +++ b/Source/Mosa.VisualStudio.Template/MOSA Project/Mosa.Starter.x86.csproj @@ -73,19 +73,19 @@ - ..\packages\Mosa.ClassLib.1.0.0.0\lib\Mosa.ClassLib.dll + ..\packages\Mosa.ClassLib.1.0.0.1\lib\net472\Mosa.ClassLib.dll True - ..\packages\Mosa.Kernel.x86.1.0.0.0\lib\Mosa.Kernel.x86.dll + ..\packages\Mosa.Kernel.x86.1.0.0.1\lib\net472\Mosa.Kernel.x86.dll True - ..\packages\Mosa.Runtime.1.0.0.0\lib\Mosa.Runtime.dll + ..\packages\Mosa.Runtime.1.0.0.1\lib\net472\Mosa.Runtime.dll True - ..\packages\Mosa.Runtime.x86.1.0.0.0\lib\Mosa.Runtime.x86.dll + ..\packages\Mosa.Runtime.x86.1.0.0.1\lib\net472\Mosa.Runtime.x86.dll True diff --git a/Source/Mosa.VisualStudio.Template/MOSA Project/packages.config b/Source/Mosa.VisualStudio.Template/MOSA Project/packages.config index 45c3aff7a9..f6198110c7 100644 --- a/Source/Mosa.VisualStudio.Template/MOSA Project/packages.config +++ b/Source/Mosa.VisualStudio.Template/MOSA Project/packages.config @@ -1,9 +1,9 @@  - - - - - - + + + + + + diff --git a/appveyor.yml b/appveyor.yml index 3468de1bc3..0dfcd27170 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,7 @@ configuration: Release platform: Any CPU image: - Visual Studio 2017 +- Visual Studio 2019 - Ubuntu1804 shallow_clone: true @@ -12,7 +13,7 @@ build: off for: -# Windows Build: +# Windows Build - Visual Studio 2017: - matrix: only: @@ -57,6 +58,51 @@ for: artifacts: - path: 'bin/MOSA Installer/MOSA-Installer.exe' +# Windows Build - Visual Studio 2019: + - + matrix: + only: + - image: Visual Studio 2019 + + install: + - cmd: SET PATH=%PATH%;C:\Program Files (x86)\Inno Setup 5 + + before_build: + - nuget restore -Verbosity quiet Source/Mosa.sln + + build: + verbosity: minimal + parallel: true + project: Source/Mosa.sln + publish_nuget: true + + after_build: + - cmd: ISCC.exe Source/Inno-Setup-Script/Mosa-Installer.iss + - ps: ./mosactl.ps1 unittest +# - ps: ./mosactl.ps1 test + + build_script: + + test_script: +# - cmd: ./mosactl.ps1 test + + after_test: + + nuget: + project_feed: true + + test: off + + assembly_info: + patch: true + file: AssemblyInfo.* + assembly_version: "{version}" + assembly_file_version: "{version}" + assembly_informational_version: "{version}" + + artifacts: + - path: 'bin/MOSA Installer/MOSA-Installer.exe' + # Linux Build: - matrix: