diff --git a/Source/Mosa.Compiler.Framework/CompilerVersion.cs b/Source/Mosa.Compiler.Framework/CompilerVersion.cs index 81025fb533..9f4659d2df 100644 --- a/Source/Mosa.Compiler.Framework/CompilerVersion.cs +++ b/Source/Mosa.Compiler.Framework/CompilerVersion.cs @@ -19,7 +19,7 @@ public static Version GetVersion() if (version.Build == 0) { // Revision and build number are reversed by design - version = new Version(2, 5, 0, 0); + version = new Version(2, 6, 0, 0); } return version; diff --git a/Source/Mosa.Compiler.Framework/MosaCompiler.cs b/Source/Mosa.Compiler.Framework/MosaCompiler.cs index b5f2bdb069..9dce67b213 100644 --- a/Source/Mosa.Compiler.Framework/MosaCompiler.cs +++ b/Source/Mosa.Compiler.Framework/MosaCompiler.cs @@ -1,6 +1,5 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. -using System; using Mosa.Compiler.Framework.Linker; using Mosa.Compiler.MosaTypeSystem; using Mosa.Utility.Configuration; diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionEnd.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionEnd.cs index 6e1721fc63..11c8ce09c3 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionEnd.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionEnd.cs @@ -35,10 +35,9 @@ public override void Transform(Context context, Transform transform) } var handlerBlock = transform.BasicBlocks.GetByLabel(handler.HandlerStart); - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); context.SetInstruction(IRInstruction.MoveObject, transform.LeaveTargetRegister, Operand.CreateConstant32(target.Label)); - context.AppendInstruction(IRInstruction.MoveObject, exceptionRegister, Operand.NullObject); + context.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, Operand.NullObject); context.AppendInstruction(IRInstruction.Jmp, handlerBlock); } } diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionStart.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionStart.cs index 436e5e9eba..a2c641fb92 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionStart.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/ExceptionStart.cs @@ -14,10 +14,9 @@ public ExceptionStart() : base(IRInstruction.ExceptionStart, TransformType.Manua public override void Transform(Context context, Transform transform) { var exceptionVirtualRegister = context.Result; - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); context.SetInstruction(IRInstruction.KillAll); - context.AppendInstruction(IRInstruction.Gen, exceptionRegister); - context.AppendInstruction(IRInstruction.MoveObject, exceptionVirtualRegister, exceptionRegister); + context.AppendInstruction(IRInstruction.Gen, transform.ExceptionRegister); + context.AppendInstruction(IRInstruction.MoveObject, exceptionVirtualRegister, transform.ExceptionRegister); } } diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyEnd.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyEnd.cs index f7ef01cc0b..fd4f6ee783 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyEnd.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyEnd.cs @@ -53,9 +53,7 @@ public override void Transform(Context context, Transform transform) context.SetInstruction(IRInstruction.BranchObject, ConditionCode.NotEqual, null, exceptionVirtualRegister, Operand.NullObject, exceptionCallBlock.Block); context.AppendInstruction(IRInstruction.Jmp, newBlocks[1].Block); - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - - exceptionCallBlock.AppendInstruction(IRInstruction.MoveObject, exceptionRegister, exceptionVirtualRegister); + exceptionCallBlock.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, exceptionVirtualRegister); exceptionCallBlock.AppendInstruction(IRInstruction.CallStatic, null, Operand.CreateLabel(exceptionManager.ExceptionHandler, transform.Is32BitPlatform)); transform.MethodScanner.MethodInvoked(exceptionManager.ExceptionHandler, transform.Method); @@ -76,7 +74,7 @@ public override void Transform(Context context, Transform transform) if (next != null) { - finallyCallBlock.AppendInstruction(IRInstruction.MoveObject, exceptionRegister, Operand.NullObject); + finallyCallBlock.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, Operand.NullObject); finallyCallBlock.AppendInstruction(IRInstruction.MoveObject, transform.LeaveTargetRegister, leaveTargetRegister); finallyCallBlock.AppendInstruction(IRInstruction.Jmp, transform.BasicBlocks.GetByLabel(next.HandlerStart)); } diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyStart.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyStart.cs index 778fa91389..e38a122854 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyStart.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/FinallyStart.cs @@ -22,13 +22,12 @@ public override void Transform(Context context, Transform transform) var exceptionVirtualRegister = context.Result; var leaveTargetVirtualRegister = context.Result2; - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); context.SetInstruction(IRInstruction.KillAll); - context.AppendInstruction(IRInstruction.Gen, exceptionRegister); + context.AppendInstruction(IRInstruction.Gen, transform.ExceptionRegister); context.AppendInstruction(IRInstruction.Gen, transform.LeaveTargetRegister); - context.AppendInstruction(IRInstruction.MoveObject, exceptionVirtualRegister, exceptionRegister); + context.AppendInstruction(IRInstruction.MoveObject, exceptionVirtualRegister, transform.ExceptionRegister); context.AppendInstruction(IRInstruction.MoveObject, leaveTargetVirtualRegister, transform.LeaveTargetRegister); exceptionManager.ExceptionVirtualRegisters.Add(context.Block, exceptionVirtualRegister); diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/Throw.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/Throw.cs index daa05f5473..d7a587b835 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/Throw.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/Throw.cs @@ -14,9 +14,8 @@ public Throw() : base(IRInstruction.Throw, TransformType.Manual | TransformType. public override void Transform(Context context, Transform transform) { var method = transform.Compiler.PlatformInternalRuntimeType.FindMethodByName("ExceptionHandler"); - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - context.SetInstruction(IRInstruction.MoveObject, exceptionRegister, context.Operand1); + context.SetInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, context.Operand1); context.AppendInstruction(IRInstruction.CallStatic, null, Operand.CreateLabel(method, transform.Is32BitPlatform)); transform.MethodScanner.MethodInvoked(method, transform.Method); diff --git a/Source/Mosa.Compiler.Framework/Transforms/Exception/TryEnd.cs b/Source/Mosa.Compiler.Framework/Transforms/Exception/TryEnd.cs index 713d6f63c4..6c997639a3 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/Exception/TryEnd.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/Exception/TryEnd.cs @@ -24,10 +24,8 @@ public override void Transform(Context context, Transform transform) if (immediate.ExceptionHandlerType == ExceptionHandlerType.Finally) { - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - context.SetInstruction(IRInstruction.MoveObject, transform.LeaveTargetRegister, Operand.CreateConstant32(target.Label)); - context.AppendInstruction(IRInstruction.MoveObject, exceptionRegister, Operand.NullObject); + context.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, Operand.NullObject); context.AppendInstruction(IRInstruction.Jmp, transform.BasicBlocks.GetByLabel(immediate.HandlerStart)); return; } @@ -38,10 +36,8 @@ public override void Transform(Context context, Transform transform) if (next != null && next.HandlerEnd > immediate.HandlerEnd) { - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - context.SetInstruction(IRInstruction.MoveObject, transform.LeaveTargetRegister, Operand.CreateConstant32(target.Label)); - context.AppendInstruction(IRInstruction.MoveObject, exceptionRegister, Operand.NullObject); + context.AppendInstruction(IRInstruction.MoveObject, transform.ExceptionRegister, Operand.NullObject); context.AppendInstruction(IRInstruction.Jmp, transform.BasicBlocks.GetByLabel(next.HandlerStart)); return; } diff --git a/Source/Mosa.Compiler.x64/Intrinsic/FrameJump.cs b/Source/Mosa.Compiler.x64/Intrinsic/FrameJump.cs index 84d5cbec3c..67c25ec59a 100644 --- a/Source/Mosa.Compiler.x64/Intrinsic/FrameJump.cs +++ b/Source/Mosa.Compiler.x64/Intrinsic/FrameJump.cs @@ -24,13 +24,11 @@ private static void FrameJump(Context context, Transform transform) var rbx = transform.PhysicalRegisters.Allocate64(CPURegister.RBX); var rcx = transform.PhysicalRegisters.Allocate64(CPURegister.RCX); - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - // Move all virtual registers into physical registers - necessary since stack frame pointer will change context.SetInstruction(X64.Mov64, rax, v0); context.AppendInstruction(X64.Mov64, rbx, v1); context.AppendInstruction(X64.Mov64, rcx, v2); - context.AppendInstruction(X64.Mov64, exceptionRegister, v3); + context.AppendInstruction(X64.Mov64, transform.ExceptionRegister, v3); // Update the frame and stack registers context.AppendInstruction(X64.Mov64, rbp, rcx); diff --git a/Source/Mosa.Compiler.x86/Intrinsic/FrameJump.cs b/Source/Mosa.Compiler.x86/Intrinsic/FrameJump.cs index 8644009151..1592e57a13 100644 --- a/Source/Mosa.Compiler.x86/Intrinsic/FrameJump.cs +++ b/Source/Mosa.Compiler.x86/Intrinsic/FrameJump.cs @@ -24,13 +24,11 @@ private static void FrameJump(Context context, Transform transform) var ebx = transform.PhysicalRegisters.Allocate32(CPURegister.EBX); var ecx = transform.PhysicalRegisters.Allocate32(CPURegister.ECX); - var exceptionRegister = transform.PhysicalRegisters.AllocateObject(transform.Architecture.ExceptionRegister); - // Move all virtual registers into physical registers - necessary since stack frame pointer will change context.SetInstruction(X86.Mov32, eax, v0); context.AppendInstruction(X86.Mov32, ebx, v1); context.AppendInstruction(X86.Mov32, ecx, v2); - context.AppendInstruction(X86.Mov32, exceptionRegister, v3); + context.AppendInstruction(X86.Mov32, transform.ExceptionRegister, v3); // Update the frame and stack registers context.AppendInstruction(X86.Mov32, ebp, ecx);