Skip to content

Commit

Permalink
Update Rutime.Native and mscorlib assemblies (#1650)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored May 29, 2020
1 parent a8aa314 commit 279ab4a
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 41 deletions.
1 change: 1 addition & 0 deletions CMake/Modules/FindNF_CoreCLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ set(NF_CoreCLR_SRCS
corlib_native_System_Convert.cpp
corlib_native_System_DateTime.cpp
corlib_native_System_Delegate.cpp
corlib_native_System_Diagnostics_Debug.cpp
corlib_native_System_Diagnostics_Debugger.cpp
corlib_native_System_Double.cpp
corlib_native_System_Enum.cpp
Expand Down
1 change: 1 addition & 0 deletions src/CLR/CorLib/CorLib-vs2019.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<ClCompile Include="corlib_native_System_Convert.cpp" />
<ClCompile Include="corlib_native_System_DateTime.cpp" />
<ClCompile Include="corlib_native_System_Delegate.cpp" />
<ClCompile Include="corlib_native_System_Diagnostics_Debug.cpp" />
<ClCompile Include="corlib_native_System_Diagnostics_Debugger.cpp" />
<ClCompile Include="corlib_native_System_Double.cpp" />
<ClCompile Include="corlib_native_System_Enum.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions src/CLR/CorLib/CorLib-vs2019.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<ClCompile Include="corlib_native_System_Collections_Stack.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="corlib_native_System_Diagnostics_Debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="corlib_native_System_Diagnostics_Debugger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
1 change: 1 addition & 0 deletions src/CLR/CorLib/CorLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<ClCompile Include="corlib_native_System_Convert.cpp" />
<ClCompile Include="corlib_native_System_DateTime.cpp" />
<ClCompile Include="corlib_native_System_Delegate.cpp" />
<ClCompile Include="corlib_native_System_Diagnostics_Debug.cpp" />
<ClCompile Include="corlib_native_System_Diagnostics_Debugger.cpp" />
<ClCompile Include="corlib_native_System_Double.cpp" />
<ClCompile Include="corlib_native_System_Enum.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions src/CLR/CorLib/CorLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<ClCompile Include="corlib_native_System_Collections_Stack.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="corlib_native_System_Diagnostics_Debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="corlib_native_System_Diagnostics_Debugger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
38 changes: 26 additions & 12 deletions src/CLR/CorLib/corlib_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ static const CLR_RT_MethodHandler method_lookup[] =
Library_corlib_native_System_Delegate::Remove___STATIC__SystemDelegate__SystemDelegate__SystemDelegate,
Library_corlib_native_System_Delegate::op_Equality___STATIC__BOOLEAN__SystemDelegate__SystemDelegate,
Library_corlib_native_System_Delegate::op_Inequality___STATIC__BOOLEAN__SystemDelegate__SystemDelegate,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_corlib_native_System_Diagnostics_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN,
Library_corlib_native_System_Diagnostics_Debugger::get_IsAttached___STATIC__BOOLEAN,
Library_corlib_native_System_Diagnostics_Debugger::Break___STATIC__VOID,
NULL,
Expand Down Expand Up @@ -1098,23 +1104,25 @@ static const CLR_RT_MethodHandler method_lookup[] =
NULL,
NULL,
NULL,
Library_corlib_native_System_DateTime::get_Day___I4,
Library_corlib_native_System_DateTime::get_DayOfWeek___SystemDayOfWeek,
Library_corlib_native_System_DateTime::get_DayOfYear___I4,
Library_corlib_native_System_DateTime::get_Hour___I4,
NULL,
Library_corlib_native_System_DateTime::get_Millisecond___I4,
Library_corlib_native_System_DateTime::get_Minute___I4,
Library_corlib_native_System_DateTime::get_Month___I4,
Library_corlib_native_System_DateTime::get_Second___I4,
NULL,
NULL,
Library_corlib_native_System_DateTime::get_Year___I4,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_corlib_native_System_DateTime::GetDateTimePart___I4__SystemDateTimeDateTimePart,
NULL,
Library_corlib_native_System_DateTime::DaysInMonth___STATIC__I4__I4__I4,
NULL,
Library_corlib_native_System_DateTime::get_UtcNow___STATIC__SystemDateTime,
Expand All @@ -1136,6 +1144,12 @@ static const CLR_RT_MethodHandler method_lookup[] =
Library_corlib_native_System_Delegate::Remove___STATIC__SystemDelegate__SystemDelegate__SystemDelegate,
Library_corlib_native_System_Delegate::op_Equality___STATIC__BOOLEAN__SystemDelegate__SystemDelegate,
Library_corlib_native_System_Delegate::op_Inequality___STATIC__BOOLEAN__SystemDelegate__SystemDelegate,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_corlib_native_System_Diagnostics_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN,
Library_corlib_native_System_Diagnostics_Debugger::get_IsAttached___STATIC__BOOLEAN,
Library_corlib_native_System_Diagnostics_Debugger::Break___STATIC__VOID,
NULL,
Expand Down Expand Up @@ -1363,16 +1377,16 @@ const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib =

#if (NANOCLR_REFLECTION == TRUE)

0x65E9CC45,
0x9D93AC29,

#elif (NANOCLR_REFLECTION == FALSE)

0xF3FB563C,
0x1F09272F,

#else
#error "NANOCLR_REFLECTION has to be define either TRUE or FALSE. Check the build options."
#endif

method_lookup,
{ 100, 4, 9, 0 }
{ 100, 4, 10, 0 }
};
8 changes: 8 additions & 0 deletions src/CLR/CorLib/corlib_native.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,14 @@ struct Library_corlib_native_System_Delegate
static CLR_RT_HeapBlock_Delegate* GetLastDelegate( CLR_RT_HeapBlock_Delegate* dlg );
};

struct Library_corlib_native_System_Diagnostics_Debug
{
NANOCLR_NATIVE_DECLARE(WriteLineNative___STATIC__VOID__STRING__BOOLEAN);

//--//

};

struct Library_corlib_native_System_Diagnostics_Debugger
{

Expand Down
2 changes: 1 addition & 1 deletion src/CLR/CorLib/corlib_native_System_Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ HRESULT Library_corlib_native_System_Console::OutNative___STATIC__VOID__STRING__
#if defined(_WIN32)
return stack.NotImplementedStub();
#else
NANOCLR_CHECK_HRESULT(Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN( stack ));
NANOCLR_CHECK_HRESULT(Library_corlib_native_System_Diagnostics_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN( stack ));
#endif

NANOCLR_NOCLEANUP();
Expand Down
28 changes: 28 additions & 0 deletions src/CLR/CorLib/corlib_native_System_Diagnostics_Debug.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Copyright (c) 2020 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//

#include "CorLib.h"


HRESULT Library_corlib_native_System_Diagnostics_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN( CLR_RT_StackFrame& stack )
{
NANOCLR_HEADER();

const char * szText0 = stack.Arg0().RecoverString();
bool addLineFeed = (bool)stack.Arg1().NumericByRef().u1;

if(!szText0) szText0 = "<null>";

CLR_Debug::Emit( szText0, -1 );

if(addLineFeed)
{
CLR_Debug::Emit( "\r\n" , -1 );
}

NANOCLR_NOCLEANUP_NOLABEL();
}

10 changes: 2 additions & 8 deletions src/nanoFramework.Runtime.Native/nf_rt_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ static const CLR_RT_MethodHandler method_lookup[] =
NULL,
Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::GC___STATIC__U4__BOOLEAN,
Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::EnableGCMessages___STATIC__VOID__BOOLEAN,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN,
Library_nf_rt_native_nanoFramework_Runtime_Native_ExecutionConstraint::Install___STATIC__VOID__I4__I4,
NULL,
NULL,
Expand Down Expand Up @@ -46,7 +40,7 @@ static const CLR_RT_MethodHandler method_lookup[] =
const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Runtime_Native =
{
"nanoFramework.Runtime.Native",
0x210110C2,
0xE79F9BC2,
method_lookup,
{ 100, 0, 6, 2 }
{ 100, 0, 7, 0 }
};
1 change: 0 additions & 1 deletion src/nanoFramework.Runtime.Native/nf_rt_native.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_Debug
{
NANOCLR_NATIVE_DECLARE(GC___STATIC__U4__BOOLEAN);
NANOCLR_NATIVE_DECLARE(EnableGCMessages___STATIC__VOID__BOOLEAN);
NANOCLR_NATIVE_DECLARE(WriteLineNative___STATIC__VOID__STRING__BOOLEAN);

//--//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,3 @@ HRESULT Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::EnableGCMessage

NANOCLR_NOCLEANUP_NOLABEL();
}

HRESULT Library_nf_rt_native_nanoFramework_Runtime_Native_Debug::WriteLineNative___STATIC__VOID__STRING__BOOLEAN( CLR_RT_StackFrame& stack )
{
NANOCLR_HEADER();

const char * szText0 = stack.Arg0().RecoverString();
bool addLineFeed = (bool)stack.Arg1().NumericByRef().u1;

if(!szText0) szText0 = "<null>";

CLR_Debug::Emit( szText0, -1 );

if(addLineFeed)
{
CLR_Debug::Emit( "\r\n" , -1 );
}

NANOCLR_NOCLEANUP_NOLABEL();
}

0 comments on commit 279ab4a

Please sign in to comment.