Skip to content

Commit

Permalink
Merge branch 'feature/fix-linux-mono-related' into devel
Browse files Browse the repository at this point in the history
It was too long, so I'm merging it once.
  • Loading branch information
kekyo committed May 3, 2022
2 parents 20d2fcd + 36c9ee9 commit fb75b1d
Show file tree
Hide file tree
Showing 63 changed files with 905 additions and 479 deletions.
4 changes: 1 addition & 3 deletions IL2C.Core/Metadata/MetadataUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,7 @@ public static IEnumerable<IMethodInformation> FilterByNewslots(
var list = new List<Tuple<IMethodInformation, List<IMethodInformation>>>();
foreach (var method in methods.Where(method => method.IsVirtual))
{
if (method.IsNewSlot ||
// In mono environment, the System.Object.Finalizer method is marked 'reuseslot' ...
method.DeclaringType.IsObjectType)
if (method.IsNewSlot)
{
list.Add(Tuple.Create(method, new List<IMethodInformation> { method }));
}
Expand Down
3 changes: 2 additions & 1 deletion IL2C.Core/Metadata/MethodInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ private IParameterInformation ToParameterInformation(ParameterReference paramete
public bool IsSealed =>
this.Definition.IsFinal || this.DeclaringType.IsSealed;
public bool IsNewSlot =>
this.Definition.IsNewSlot;
// In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ...
this.Definition.IsNewSlot || (this.Definition.IsVirtual && this.DeclaringType.IsObjectType);
public bool IsReuseSlot =>
this.Definition.IsReuseSlot;
public bool IsExtern =>
Expand Down
2 changes: 1 addition & 1 deletion IL2C.Interop/IL2C.Interop.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net40-client;net45;net462;net48;netstandard1.0;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net20;net35;net40-client;net45;net462;net48;netstandard1.0;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks>
<OutputType>Library</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down
2 changes: 1 addition & 1 deletion IL2C/IL2C.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net48;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down
2 changes: 1 addition & 1 deletion IL2C/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"IL2C": {
"commandName": "Project",
"commandLineArgs": "-g1 $(ProjectDir)..\\samples\\Calculator\\Generated $(ProjectDir)..\\samples\\Calculator\\Calculator.Core\\bin\\Debug\\netstandard2.0\\Calculator.Core.dll"
"commandLineArgs": "-g1 $(ProjectDir)../samples/Calculator/Generated $(ProjectDir)../samples/Calculator/Calculator.Core/bin/Debug/netstandard2.0/Calculator.Core.dll"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net48;netstandard2.0</TargetFrameworks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>

<OutputType>Library</OutputType>
Expand Down
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Boolean
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4.s 123
box [netstandard]System.Boolean
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4.s 123
box bool
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Boolean
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof bool
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Byte
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4.s 123
box [netstandard]System.Byte
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4.s 123
box uint8
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Byte
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof uint8
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Char
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 12345
box [netstandard]System.Char
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 12345
box char
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Char
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof char
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Double
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.r8 1234567.890123
box [netstandard]System.Double
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.r8 1234567.890123
box float64
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Double
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof float64
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Int16
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 12345
box [netstandard]System.Int16
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 12345
box int16
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Int16
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof int16
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Int32
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 1234567
box [netstandard]System.Int32
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 1234567
box int32
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Int32
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof int32
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
.class public IL2C.BasicTypes.System_Int64
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i8 1234567890123
box [netstandard]System.Int64
isinst [netstandard]System.ValueType
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i8 1234567890123
box int64
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.Int64
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof int64
ret
}
}
}
26 changes: 13 additions & 13 deletions tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
.class public IL2C.BasicTypes.System_IntPtr
{
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 1234567
.method public static bool IsValueType() cil managed
{
.maxstack 2
ldc.i4 1234567
conv.i
box [netstandard]System.IntPtr
isinst [netstandard]System.ValueType
box native int
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
ret
F1:
ldc.i4.0
ret
}
}

.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [netstandard]System.IntPtr
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof native int
ret
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace IL2C.BasicTypes
{
[TestCase(true, "IsValueType", 123)]
[TestCase(false, "IsValueType", "ABC")]
[TestCase("System.Int32", "ToString", int.MaxValue)]
[TestCase("System.String", "ToString", "ABC")]
[TestCase("System.Int32", "ToString", int.MaxValue, IgnoreILErrors = new[] { "ThisMismatch" })]
[TestCase("System.String", "ToString", "ABC", IgnoreILErrors = new[] { "ThisMismatch" })]
[TestCase("System.Int32", "GetType", int.MaxValue)]
[TestCase("System.String", "GetType", "ABC")]
[TestCase(true, "RefEquals_Same")]
Expand Down
Loading

0 comments on commit fb75b1d

Please sign in to comment.