Skip to content

Commit

Permalink
Refactoring - Decoupling Type System from Compiler (#1044)
Browse files Browse the repository at this point in the history
* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP

* - WIP-1

* - WIP-2

* - WIP-3

* - WIP-4

* - WIP-5

* - WIP-6

* - WIP-7

* - WIP-8

* - WIP-9

* - WIP-10

* - WIP-11

* - WIP-12

* - WIP-13

* - WIP-14

* - WIP-15

* - WIP-16

* - WIP-17

* - WIP-18

* - WIP-19

* - WIP-19

* - WIP-20

* - WIP-21

* - WIP-22

* - WIP-22

* - WIP-23

* - WIP-24

* - WIP-25

* - WIP-26

* - WIP-27

* - Updated to Qemu 8.0

* - Minor

* - Final-1

* - Final-2

* - Final-3

* - Final-4

* - Final-5

* - Final-6

* - Final-7

* - Final-8

* - Final-9

* Squashed commit of the following:

commit d31ac3a
Author: ShiningLea <49339966+AnErrupTion@users.noreply.github.com>
Date:   Wed May 10 05:49:58 2023 +0200

    Bug fixes (#1045)

    Co-authored-by: AnErrupTion <anerruption@disroot.org>

commit 880607b
Author: ShiningLea <49339966+AnErrupTion@users.noreply.github.com>
Date:   Wed Apr 19 17:32:21 2023 +0200

    Add new guide in documentation + bug fix (#1043)

    * Add new guide in documentation, fix bug

    * Regenerate docs, add .nojekyll file

    ---------

    Co-authored-by: AnErrupTion <anerruption@disroot.org>

commit 0608196
Author: Phil Garcia <phil@thinkedge.com>
Date:   Sun Apr 9 09:41:07 2023 -0700

    Update CNAME

commit a9aee4b
Author: Phil Garcia <phil@thinkedge.com>
Date:   Sun Apr 9 09:40:42 2023 -0700

    Update CNAME

commit 04ce986
Author: Phil Garcia <phil@thinkedge.com>
Date:   Sun Apr 9 09:39:25 2023 -0700

    Update CNAME

commit a6b97c9
Author: Phil Garcia <phil@thinkedge.com>
Date:   Sun Apr 9 09:38:57 2023 -0700

    Create CNAME

commit e56ab97
Author: ShiningLea <49339966+AnErrupTion@users.noreply.github.com>
Date:   Sun Apr 9 17:23:32 2023 +0200

    Update documentation (#1039)

    * Update documentation

    * Update name of each target plaform in introduction.rst

    * Remove useless tools.rst page

    * Update USB flash drive installation guide

    * Delete unneeded image

    * Update get-involved.rst

    * Fix missing link

    * Re-generate HTML docs

    * Remove references of Rider

    ---------

    Co-authored-by: AnErrupTion <anerruption@disroot.org>

* - Final-10

* - Final-11

* - Final-12

* - Final-13
  • Loading branch information
tgiphil committed May 11, 2023
1 parent d31ac3a commit 666f01a
Show file tree
Hide file tree
Showing 1,057 changed files with 6,463 additions and 13,537 deletions.
2 changes: 1 addition & 1 deletion Demos/Run-Demo.SVGAWorld.x86.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd %~dp0
cd ..\bin
start Mosa.Tool.Launcher -autostart -o0 -output-asm -output-debug -output-hash -vmdk -vmware-svga -inline-off -threading-off -inline-explicit-off -include Include Mosa.Demo.SVGAWorld.x86.dll
start Mosa.Tool.Launcher -autostart -oMax -output-asm -output-debug -output-hash -vmdk -vmware-svga -threading-off -inline-off -inline-explicit-off -include Include Mosa.Demo.SVGAWorld.x86.dll
2 changes: 1 addition & 1 deletion Source/Docs/compiler-transformations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ This is translated into the following C# code:
var t1 = context.Operand1;
var t2 = context.Operand2;
var e1 = transform.CreateConstant(Add32(To32(t1), To32(t2)));
var e1 = Operand.CreateConstant(Add32(To32(t1), To32(t2)));
context.SetInstruction(IRInstruction.Move32, result, e1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyTitle>Mosa.Compiler.Framework.xUnit</AssemblyTitle>
<Company>MOSA Project</Company>
<Product>Mosa.Compiler.Framework.xUnit</Product>
<copyright>Copyright © MOSA Project 2023</copyright>
<Copyright>Copyright © MOSA Project 2023</Copyright>
<BaseAddress>285212672</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -44,4 +44,4 @@
<ProjectReference Include="..\Mosa.Compiler.Common\Mosa.Compiler.Common.csproj" />
<ProjectReference Include="..\Mosa.Compiler.Framework\Mosa.Compiler.Framework.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ namespace Mosa.Compiler.Framework.Analysis.LiveVariableAnalysis;
/// <summary>
/// Register Allocator Environment
/// </summary>
/// <seealso cref="Mosa.Compiler.Framework.Analysis.LiveVariableAnalysis .BaseLivenessAnalysisEnvironment" />
/// <seealso cref="Mosa.Compiler.Framework.Analysis.LiveVariableAnalysis.BaseLivenessAnalysisEnvironment" />
public class GCEnvironment : BaseLivenessAnalysisEnvironment
{
protected Dictionary<Operand, int> stackLookup = new Dictionary<Operand, int>();
protected Dictionary<int, Operand> stackLookupReverse = new Dictionary<int, Operand>();

protected int PhysicalRegisterCount { get; }
protected bool[] StackLocalReference;

public GCEnvironment(BasicBlocks basicBlocks, BaseArchitecture architecture, List<Operand> localStack)
public GCEnvironment(BasicBlocks basicBlocks, BaseArchitecture architecture, LocalStack localStack)
{
BasicBlocks = basicBlocks;
StackLocalReference = new bool[localStack.Count];
Expand All @@ -38,7 +39,7 @@ protected bool ContainsObjectReference(Operand operand)
{
return true;
}
else if (operand.IsStackLocal && StackLocalReference[operand.Index])
else if (operand.IsLocalStack && StackLocalReference[operand.Index])
{
return true;
}
Expand Down Expand Up @@ -119,7 +120,7 @@ public override IEnumerable<int> GetKills(InstructionNode node)

public bool ContainsReference(Operand operand)
{
if (operand.IsReferenceType || operand.IsManagedPointer)
if (operand.IsObject || operand.IsManagedPointer)
return true;

if (!operand.IsValueType)
Expand All @@ -137,7 +138,7 @@ public bool ContainsReference(Operand operand)
return false;
}

protected void CollectReferenceStackObjects(List<Operand> localStack)
protected void CollectReferenceStackObjects(LocalStack localStack)
{
foreach (var local in localStack)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ namespace Mosa.Compiler.Framework.Analysis.LiveVariableAnalysis;
public class LivenessAnalysis
{
protected BaseLivenessAnalysisEnvironment Environment;

protected BasicBlocks BasicBlocks => Environment.BasicBlocks;

protected int IndexCount => Environment.IndexCount;

protected List<ExtendedBlock2> ExtendedBlocks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public VariableState(Operand operand)
Operand = operand;

IsVirtualRegister = operand.IsVirtualRegister;
IsReferenceType = operand.IsReferenceType;
IsReferenceType = operand.IsObject;
ConstantsContainZero = false;

if (IsVirtualRegister)
Expand Down
5 changes: 0 additions & 5 deletions Source/Mosa.Compiler.Framework/BaseArchitecture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public abstract class BaseArchitecture
/// </summary>
public abstract uint NativePointerSize { get; }

/// <summary>
/// Gets the size of the native instruction.
/// </summary>
public virtual InstructionSize NativeInstructionSize => NativePointerSize == 4 ? InstructionSize.Size32 : InstructionSize.Size64;

/// <summary>
/// Is the platform is 32 bit
/// </summary>
Expand Down

This file was deleted.

16 changes: 8 additions & 8 deletions Source/Mosa.Compiler.Framework/BaseCompilerStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,32 +140,32 @@ protected void PostTraceLog(TraceLog traceLog)

protected Operand CreateConstant(int value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.I4, value);
return Operand.CreateConstant32((uint)value);
}

protected Operand CreateConstant(uint value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.I4, value);
return Operand.CreateConstant32(value);
}

protected Operand CreateConstant(long value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.I8, value);
return Operand.CreateConstant64((ulong)value);
}

protected Operand CreateConstant(ulong value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.I8, value);
return Operand.CreateConstant64(value);
}

protected Operand CreateConstant(float value)
protected Operand CreateConstantR4(float value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.R4, value);
return Operand.CreateConstantR4(value);
}

protected Operand CreateConstant(double value)
protected Operand CreateConstantR8(double value)
{
return Operand.CreateConstant(TypeSystem.BuiltIn.R8, value);
return Operand.CreateConstantR8(value);
}

#endregion Constant Helper Methods
Expand Down

0 comments on commit 666f01a

Please sign in to comment.