Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate GitHub Actions #107

Merged
merged 17 commits into from
Oct 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Linux

on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
workflow_dispatch:
branches:

jobs:
build:
runs-on: ubuntu-latest
#TODO:
env:
buildConfiguration: Release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.811
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Initialize tools
run: sudo bash ./init-tools.sh
- name: Install dependencies
run: |
dotnet restore il2c.sln
dotnet restore samples/Calculator/Calculator.Core/Calculator.Core.csproj
# dotnet restore samples/GettingStartedIL2C/GettingStartedIL2C.sln
# dotnet restore samples/Calculator/Calculator.sln
- name: Build runtime library
run: bash build-runtime.sh ${{env.buildConfiguration}}
- name: Build il2c
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="Any CPU" il2c.sln
# - name: Build GettingStartedIL2C-x86
# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples/GettingStartedIL2C/GettingStartedIL2C.sln
# - name: Build GettingStartedIL2C-x64
# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples/GettingStartedIL2C/GettingStartedIL2C.sln
- name: Build Calculator.Core
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="AnyCPU" samples/Calculator/Calculator.Core/Calculator.Core.csproj
# - name: Build Calculator-x86
# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples/Calculator/Calculator.sln
# - name: Build Calculator-x64
# run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples/Calculator/Calculator.sln
- name: Build Calculator-CMake-mingw32
run: bash build.sh ${{env.buildConfiguration}}
working-directory: samples/Calculator/Calculator.CMake
- name: Test il2c
run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
timeout-minutes: 10
64 changes: 64 additions & 0 deletions .github/workflows/build-windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Windows

on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
workflow_dispatch:
branches:

jobs:
build:
runs-on: windows-latest
#TODO:
env:
buildConfiguration: Release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.811
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.404
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Initialize tools
run: init-tools.bat
shell: cmd
- name: Install dependencies
run: |
dotnet restore il2c.sln
dotnet restore samples\GettingStartedIL2C\GettingStartedIL2C.sln
dotnet restore samples\Calculator\Calculator.sln
- name: Build runtime library
run: build-runtime.bat ${{env.buildConfiguration}}
shell: cmd
- name: Build il2c
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform="Any CPU" il2c.sln
- name: Build GettingStartedIL2C-x86
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples\GettingStartedIL2C\GettingStartedIL2C.sln
- name: Build GettingStartedIL2C-x64
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples\GettingStartedIL2C\GettingStartedIL2C.sln
- name: Build Calculator-x86
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x86 samples\Calculator\Calculator.sln
- name: Build Calculator-x64
run: dotnet build --configuration ${{env.buildConfiguration}} --no-restore -p:BuildIdentifier=$GITHUB_RUN_NUMBER -p:Platform=x64 samples\Calculator\Calculator.sln
- name: Build Calculator-CMake-mingw32
run: build.bat ${{env.buildConfiguration}}
shell: cmd
working-directory: samples\Calculator\Calculator.CMake
- name: Test il2c
run: dotnet test --no-build --verbosity normal --configuration ${{env.buildConfiguration}} tests\IL2C.Core.Test.Fixture\IL2C.Core.Test.Fixture.csproj -- BuildIdentifier=$GITHUB_RUN_NUMBER Platform=x64 CITest=True
timeout-minutes: 10
8 changes: 4 additions & 4 deletions IL2C.Runtime/cmake/gcc-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ set(CMAKE_BUILD_TYPE "${CONFIGURATION}")

set(CMAKE_SYSTEM_NAME Generic)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -g2 -Wall -Werror -Wstrict-prototypes -Wno-unused -fdata-sections -ffunction-sections -Wl,--gc-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -g2 -Wall -Werror -Wstrict-prototypes -Wno-unused -fdata-sections -ffunction-sections -Wl,--gc-sections -pthread")

if("${CONFIGURATION}" STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Ofast -flto -fomit-frame-pointer -march=native -DNDEBUG")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -D_DEBUG")
endif()

set(IL2C_LIBRARY_NAME_BASE "il2c-gcc-linux-${PLATFORM}")
set(IL2C_LIBRARY_NAME "lib${IL2C_LIBRARY_NAME_BASE}-${CONFIGURATION}.a")
set(IL2C_LIBRARY_NAME_BASE "il2c-gcc-linux-${PLATFORM}-${CONFIGURATION}")
set(IL2C_LIBRARY_NAME "lib${IL2C_LIBRARY_NAME_BASE}.a")

set(TARGET_LIBRARY_NAME "${IL2C_LIBRARY_NAME_BASE}-${CONFIGURATION}")
set(TARGET_LIBRARY_NAME "${IL2C_LIBRARY_NAME_BASE}")

include_directories(${CMAKE_CURRENT_LIST_DIR}/../include)
link_directories(${CMAKE_CURRENT_LIST_DIR}/../lib)
3 changes: 2 additions & 1 deletion IL2C.Runtime/src/Core/il2c_exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ il2c_noreturn__ void il2c_throw_nullreferenceexception__(void)

// NOTE: Hmm, the unbox failed message different to the castclass opcode...
// IL2C choices short sentence by unbox operator message because better footprint.
// .NET 4 castclass message format: "Unable to cast object of type 'Foo.Bar' to type 'System.String'."
// .NET Framework 4 or upper castclass message format:
// "Unable to cast object of type 'Foo.Bar' to type 'System.String'."
IL2C_CONST_STRING(il2c_invalid_cast_message, L"Specified cast is not valid.");

il2c_noreturn__ void il2c_throw_invalidcastexception__(void)
Expand Down
5 changes: 4 additions & 1 deletion IL2C.Runtime/src/System/Double.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ System_String* System_Double_ToString(double* this__)
{
wchar_t buffer[26];

il2c_snwprintf(buffer, 26, L"%.15g", *this__);
// In .NET Framework CLR, the double value string precision is 15 digits,
// but .NET 5.0 CLR is 16 digits.
// IL2C runtime adjusted to .NET 5.0.
il2c_snwprintf(buffer, 26, L"%.16g", *this__);
return il2c_new_string(buffer);
}

Expand Down
5 changes: 4 additions & 1 deletion IL2C.Runtime/src/System/Single.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ System_String* System_Single_ToString(float* this__)
{
wchar_t buffer[16];

il2c_snwprintf(buffer, 16, L"%.7g", *this__);
// In .NET Framework CLR, the single value string precision is 7 digits,
// but .NET 5.0 CLR is 8 digits.
// IL2C runtime adjusted to .NET 5.0.
il2c_snwprintf(buffer, 16, L"%.8g", *this__);
return il2c_new_string(buffer);
}

Expand Down
4 changes: 2 additions & 2 deletions docs/supported-opcodes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Supported IL opcodes

* Number of opcode implementations: 140 / 219
* Number of opcode tests: 930 [81 / 219]
* Number of opcode tests: 929 [81 / 219]

OpCode | Binary | Implement | Test | ILConverter
|:---|:---|:---|:---|:---|
Expand Down Expand Up @@ -81,7 +81,7 @@ OpCode | Binary | Implement | Test | ILConverter
| [conv.u1](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_u1) | 0xd2 | Implemented | [Test [22]](../tests/IL2C.Core.Test.ILConverters/Conv_u1) | IL2C.ILConverters.Conv_u1Converter |
| [conv.u2](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_u2) | 0xd1 | Implemented | [Test [21]](../tests/IL2C.Core.Test.ILConverters/Conv_u2) | IL2C.ILConverters.Conv_u2Converter |
| [conv.u4](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_u4) | 0x6d | Implemented | [Test [19]](../tests/IL2C.Core.Test.ILConverters/Conv_u4) | IL2C.ILConverters.Conv_u4Converter |
| [conv.u8](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_u8) | 0x6e | Implemented | [Test [19]](../tests/IL2C.Core.Test.ILConverters/Conv_u8) | IL2C.ILConverters.Conv_u8Converter |
| [conv.u8](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.conv_u8) | 0x6e | Implemented | [Test [18]](../tests/IL2C.Core.Test.ILConverters/Conv_u8) | IL2C.ILConverters.Conv_u8Converter |
| [cpblk](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.cpblk) | 0xfe17 | | | |
| [cpobj](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.cpobj) | 0x70 | | | |
| [div](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.div) | 0x5b | Implemented | [Test [9]](../tests/IL2C.Core.Test.ILConverters/Div) | IL2C.ILConverters.DivConverter |
Expand Down
2 changes: 2 additions & 0 deletions il2c.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D105E6CD-626A-4C04-8AF6-0AA34A4E9CF4}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.github\workflows\build-linux.yaml = .github\workflows\build-linux.yaml
build-runtime.bat = build-runtime.bat
build-runtime.sh = build-runtime.sh
.github\workflows\build-windows.yaml = .github\workflows\build-windows.yaml
il2c.sln.licenseheader = il2c.sln.licenseheader
init-tools.bat = init-tools.bat
init-tools.sh = init-tools.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<OutputType>Library</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i4.s 123
box [mscorlib]System.Boolean
isinst [mscorlib]System.ValueType
box [netstandard]System.Boolean
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Boolean
sizeof [netstandard]System.Boolean
ret
}
}
6 changes: 3 additions & 3 deletions tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i4.s 123
box [mscorlib]System.Byte
isinst [mscorlib]System.ValueType
box [netstandard]System.Byte
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Byte
sizeof [netstandard]System.Byte
ret
}
}
6 changes: 3 additions & 3 deletions tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i4 12345
box [mscorlib]System.Char
isinst [mscorlib]System.ValueType
box [netstandard]System.Char
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Char
sizeof [netstandard]System.Char
ret
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace IL2C.BasicTypes
// Some tests are using the IgnoreInvokeResult flag, because float string format is bit different (but no problem.)
[TestCase(true, "IsValueType")]
[TestCase(8, "SizeOf")]
[TestCase("1.79769313486232e+308", "ToString", double.MaxValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is 1.7976931348623157E+308
[TestCase("-1.79769313486232e+308", "ToString", double.MinValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is -1.7976931348623157E+308
[TestCase("1.797693134862316e+308", "ToString", double.MaxValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is 1.7976931348623157E+308
[TestCase("-1.797693134862316e+308", "ToString", double.MinValue, Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Real value is -1.7976931348623157E+308
[TestCase(double.MaxValue, "TryParse", "1.7976931348623157E+308")]
[TestCase(double.MinValue, "TryParse", "-1.7976931348623157E+308")]
public sealed class System_Double
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.r8 1234567.890123
box [mscorlib]System.Double
isinst [mscorlib]System.ValueType
box [netstandard]System.Double
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Double
sizeof [netstandard]System.Double
ret
}
}
6 changes: 3 additions & 3 deletions tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i4 12345
box [mscorlib]System.Int16
isinst [mscorlib]System.ValueType
box [netstandard]System.Int16
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Int16
sizeof [netstandard]System.Int16
ret
}
}
6 changes: 3 additions & 3 deletions tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i4 1234567
box [mscorlib]System.Int32
isinst [mscorlib]System.ValueType
box [netstandard]System.Int32
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Int32
sizeof [netstandard]System.Int32
ret
}
}
6 changes: 3 additions & 3 deletions tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
.maxstack 2
ldc.i8 1234567890123
box [mscorlib]System.Int64
isinst [mscorlib]System.ValueType
box [netstandard]System.Int64
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -17,7 +17,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.Int64
sizeof [netstandard]System.Int64
ret
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.maxstack 2
ldc.i4 1234567
conv.i
box [mscorlib]System.IntPtr
isinst [mscorlib]System.ValueType
box [netstandard]System.IntPtr
isinst [netstandard]System.ValueType
brnull.s F1
ldc.i4.1
ret
Expand All @@ -18,7 +18,7 @@
.method public static int32 SizeOf() cil managed
{
.maxstack 1
sizeof [mscorlib]System.IntPtr
sizeof [netstandard]System.IntPtr
ret
}
}
Loading