From c7fda0bc3a11fb41a2e4d3e75db3d7eacd65b430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Mon, 4 Nov 2019 15:53:57 +0000 Subject: [PATCH] Extract System.Collections from mscorlib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update CMakes to remove files from mscorlib. - Add build option to expose new API. - Update templates accordingly. - Add CMake and source files to support new API. - Update CLR CMake to accomodate required changes. - Update target templates to surface the new build option as a compiler define. - Update build options for all targets to include System.Collections. Signed-off-by: José Simões --- CMake/ChibiOS_target_os.h.in | 2 + CMake/ESP32_target_os.h.in | 2 + CMake/Modules/FindNF_CoreCLR.cmake | 10 +- ...FindnanoFramework.System.Collections.cmake | 42 +++++ CMake/Modules/NF_NativeAssemblies.cmake | 7 + CMake/TI_SimpleLink_target_os.h.in | 2 + CMakeLists.txt | 16 ++ azure-pipelines.yml | 12 +- cmake-variants.TEMPLATE-ESP32.json | 1 + cmake-variants.TEMPLATE.json | 1 + src/CLR/CorLib/CorLib-vs2019.vcxproj | 2 - src/CLR/CorLib/CorLib.vcxproj | 2 - src/CLR/CorLib/corlib_native.cpp | 176 +----------------- src/CLR/CorLib/corlib_native.h | 41 ---- src/CLR/Core/CLR_RT_HeapBlock_Queue.cpp | 13 +- src/CLR/Core/CLR_RT_HeapBlock_Stack.cpp | 9 +- src/CLR/Include/nanoCLR_Runtime__HeapBlock.h | 39 ++-- .../nf_system_collections.cpp | 100 ++++++++++ .../nf_system_collections.h | 113 +++++++++++ ..._collections_System_Collections_Queue.cpp} | 13 +- ..._collections_System_Collections_Stack.cpp} | 11 +- 21 files changed, 354 insertions(+), 260 deletions(-) create mode 100644 CMake/Modules/FindnanoFramework.System.Collections.cmake create mode 100644 src/nanoFramework.System.Collections/nf_system_collections.cpp create mode 100644 src/nanoFramework.System.Collections/nf_system_collections.h rename src/{CLR/CorLib/corlib_native_System_Collections_Queue.cpp => nanoFramework.System.Collections/nf_system_collections_System_Collections_Queue.cpp} (74%) rename src/{CLR/CorLib/corlib_native_System_Collections_Stack.cpp => nanoFramework.System.Collections/nf_system_collections_System_Collections_Stack.cpp} (73%) diff --git a/CMake/ChibiOS_target_os.h.in b/CMake/ChibiOS_target_os.h.in index abf446e1d1..2439b32733 100644 --- a/CMake/ChibiOS_target_os.h.in +++ b/CMake/ChibiOS_target_os.h.in @@ -27,4 +27,6 @@ #define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@ +#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@ + #endif /* _TARGET_OS_H_ */ diff --git a/CMake/ESP32_target_os.h.in b/CMake/ESP32_target_os.h.in index b8da845d11..9ba772df76 100644 --- a/CMake/ESP32_target_os.h.in +++ b/CMake/ESP32_target_os.h.in @@ -24,4 +24,6 @@ #define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@ +#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@ + #endif /* _TARGET_OS_H_ */ diff --git a/CMake/Modules/FindNF_CoreCLR.cmake b/CMake/Modules/FindNF_CoreCLR.cmake index 9613c72ad1..76cae905c1 100644 --- a/CMake/Modules/FindNF_CoreCLR.cmake +++ b/CMake/Modules/FindNF_CoreCLR.cmake @@ -40,9 +40,7 @@ set(NF_CoreCLR_SRCS CLR_RT_HeapBlock_Finalizer.cpp CLR_RT_HeapBlock_Lock.cpp CLR_RT_HeapBlock_LockRequest.cpp - CLR_RT_HeapBlock_Queue.cpp CLR_RT_HeapBlock_Node.cpp - CLR_RT_HeapBlock_Stack.cpp CLR_RT_HeapBlock_String.cpp CLR_RT_HeapBlock_Timer.cpp CLR_RT_HeapBlock_WaitForObject.cpp @@ -79,8 +77,6 @@ set(NF_CoreCLR_SRCS corlib_native_System_Attribute.cpp corlib_native_System_BitConverter.cpp corlib_native_System_Collections_ArrayList.cpp - corlib_native_System_Collections_Queue.cpp - corlib_native_System_Collections_Stack.cpp corlib_native_System_Console.cpp corlib_native_System_Convert.cpp corlib_native_System_DateTime.cpp @@ -179,6 +175,12 @@ if(NF_FEATURE_SUPPORT_REFLECTION) list(APPEND NF_CoreCLR_SRCS corlib_native_System_Type.cpp) endif() +# include Collection support files depending on build option +if(API_nanoFramework.System.Collections) + list(APPEND NF_CoreCLR_SRCS CLR_RT_HeapBlock_Queue.cpp) + list(APPEND NF_CoreCLR_SRCS CLR_RT_HeapBlock_Stack.cpp) +endif() + # need a conditional include because of ESP32 building network as a library if(NOT USE_SECURITY_MBEDTLS_OPTION) list(APPEND NF_CoreCLR_SRCS base64.c) diff --git a/CMake/Modules/FindnanoFramework.System.Collections.cmake b/CMake/Modules/FindnanoFramework.System.Collections.cmake new file mode 100644 index 0000000000..afa84191f2 --- /dev/null +++ b/CMake/Modules/FindnanoFramework.System.Collections.cmake @@ -0,0 +1,42 @@ +# +# Copyright (c) 2019 The nanoFramework project contributors +# See LICENSE file in the project root for full license information. +# + + +# set include directories +list(APPEND nanoFramework.System.Collections_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/HAL/Include") +list(APPEND nanoFramework.System.Collections_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Collections") + + +# the following CLR support files are required and added to the build by FindNF_CoreCLR.cmake +# CLR_RT_HeapBlock_Queue.cpp +# CLR_RT_HeapBlock_Stack.cpp + +# source files +set(nanoFramework.System.Collections_SRCS + + # source files of the assembly + nf_system_collections_System_Collections_Queue.cpp + nf_system_collections_System_Collections_Stack.cpp + nf_system_collections.cpp +) + +foreach(SRC_FILE ${nanoFramework.System.Collections_SRCS}) + set(nanoFramework.System.Collections_SRC_FILE SRC_FILE-NOTFOUND) + find_file(nanoFramework.System.Collections_SRC_FILE ${SRC_FILE} + PATHS + + # path for source files of this module + ${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Collections + + CMAKE_FIND_ROOT_PATH_BOTH + ) + # message("${SRC_FILE} >> ${nanoFramework.System.Collections_SRC_FILE}") # debug helper + list(APPEND nanoFramework.System.Collections_SOURCES ${nanoFramework.System.Collections_SRC_FILE}) +endforeach() + + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.System.Collections DEFAULT_MSG nanoFramework.System.Collections_INCLUDE_DIRS nanoFramework.System.Collections_SOURCES) diff --git a/CMake/Modules/NF_NativeAssemblies.cmake b/CMake/Modules/NF_NativeAssemblies.cmake index 07d80745e4..35387d7383 100644 --- a/CMake/Modules/NF_NativeAssemblies.cmake +++ b/CMake/Modules/NF_NativeAssemblies.cmake @@ -14,6 +14,7 @@ option(API_nanoFramework.Devices.OneWire "option for nanoFramework.Device option(API_nanoFramework.Networking.Sntp "option for nanoFramework.Networking.Sntp") option(API_nanoFramework.Runtime.Events "option for nanoFramework.Runtime.Events API") option(API_nanoFramework.ResourceManager "option for nanoFramework.ResourceManager") +option(API_nanoFramework.System.Collections "option for nanoFramework.System.Collections") option(API_System.Math "option for System.Math") option(API_System.Net "option for System.Net") option(API_Windows.Devices.Adc "option for Windows.Devices.Adc API") @@ -111,6 +112,12 @@ macro(ParseNativeAssemblies) PerformSettingsForApiEntry("nanoFramework.ResourceManager") endif() + # nanoFramework.System.Collections + if(API_nanoFramework.System.Collections) + ##### API name here (doted name) + PerformSettingsForApiEntry("nanoFramework.System.Collections") + endif() + # nanoFramework.Runtime.Events if(API_nanoFramework.Runtime.Events) ##### API name here (doted name) diff --git a/CMake/TI_SimpleLink_target_os.h.in b/CMake/TI_SimpleLink_target_os.h.in index e42609c1b2..812de39ab0 100644 --- a/CMake/TI_SimpleLink_target_os.h.in +++ b/CMake/TI_SimpleLink_target_os.h.in @@ -24,4 +24,6 @@ #define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@ +#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@ + #endif /* _TARGET_OS_H_ */ diff --git a/CMakeLists.txt b/CMakeLists.txt index aaabff5ec3..a2d3a5f6ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,6 +430,22 @@ endif() ################################################################# +################################################################# + +############################################# +# handles inclusion of System.Collections API +############################################# + +if(API_nanoFramework.System.Collections) + set(TARGET_SYSTEM_COLLECTIONS TRUE CACHE INTERNAL "enable support for System.Collections API") + message(STATUS "Support for System.Collections API enabled") +else() + set(TARGET_SYSTEM_COLLECTIONS FALSE CACHE INTERNAL "DISABLE support for System.Collections API") + message(STATUS "Support for System.Collections API **IS NOT** enabled") +endif() + +################################################################# + ################################################################# # manage HAL/PAL required for API namespaces ################################################################# diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5580e069e8..58951139fa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -130,17 +130,17 @@ jobs: matrix: MBN_QUAIL: BoardName: MBN_QUAIL - BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON + BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON GccArm_Version: NeedsDFU: true NETDUINO3_WIFI: BoardName: NETDUINO3_WIFI - BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Devices.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON + BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Devices.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON GccArm_Version: NeedsDFU: true ST_STM32F429I_DISCOVERY: BoardName: ST_STM32F429I_DISCOVERY - BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_nanoFramework.ResourceManager=ON + BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON GccArm_Version: NeedsDFU: false ST_NUCLEO64_F091RC: @@ -150,7 +150,7 @@ jobs: NeedsDFU: false ST_STM32F769I_DISCOVERY: BoardName: ST_STM32F769I_DISCOVERY - BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Devices.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON + BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Devices.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON GccArm_Version: NeedsDFU: false @@ -191,7 +191,7 @@ jobs: matrix: ESP32_WROOM_32: BoardName: ESP32_WROOM_32 - BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_WP_IMPLEMENTS_CRC32=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DAPI_Windows.Storage=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON + BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_WP_IMPLEMENTS_CRC32=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=ON -DAPI_Windows.Storage=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON variables: ESP32_TOOLCHAIN_PATH: $(Agent.TempDirectory)\ESP32_Tools @@ -234,7 +234,7 @@ jobs: matrix: TI_CC3220SF_LAUNCHXL: BoardName: TI_CC3220SF_LAUNCHXL - BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON + BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_nanoFramework.System.Collections=ON GccArm_Version: variables: diff --git a/cmake-variants.TEMPLATE-ESP32.json b/cmake-variants.TEMPLATE-ESP32.json index e9b6cba112..6ffef05440 100644 --- a/cmake-variants.TEMPLATE-ESP32.json +++ b/cmake-variants.TEMPLATE-ESP32.json @@ -58,6 +58,7 @@ "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "API_nanoFramework.ResourceManager" : "ON", + "API_nanoFramework.System.Collections" : "ON", "API_Windows.Devices.Wifi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Devices.Dac" : "OFF", diff --git a/cmake-variants.TEMPLATE.json b/cmake-variants.TEMPLATE.json index 8c7a20eef5..a988368221 100644 --- a/cmake-variants.TEMPLATE.json +++ b/cmake-variants.TEMPLATE.json @@ -71,6 +71,7 @@ "API_nanoFramework.Devices.Can" : "OFF-default-ON-to-add-this-API", "API_nanoFramework.Devices.OneWire" : "OFF-default-ON-to-add-this-API", "API_nanoFramework.ResourceManager" : "OFF-default-ON-to-add-this-API", + "API_nanoFramework.System.Collections" : "OFF-default-ON-to-add-this-API", "API_System.Math" : "OFF-default-ON-to-add-this-API", "API_System.Net" : "OFF-default-ON-to-add-this-API", "API_Windows.Devices.Adc" : "OFF-default-ON-to-add-this-API", diff --git a/src/CLR/CorLib/CorLib-vs2019.vcxproj b/src/CLR/CorLib/CorLib-vs2019.vcxproj index de2827000b..1f9a8abd58 100644 --- a/src/CLR/CorLib/CorLib-vs2019.vcxproj +++ b/src/CLR/CorLib/CorLib-vs2019.vcxproj @@ -30,8 +30,6 @@ - - diff --git a/src/CLR/CorLib/CorLib.vcxproj b/src/CLR/CorLib/CorLib.vcxproj index 8efdbecfbd..206d6e6616 100644 --- a/src/CLR/CorLib/CorLib.vcxproj +++ b/src/CLR/CorLib/CorLib.vcxproj @@ -30,8 +30,6 @@ - - diff --git a/src/CLR/CorLib/corlib_native.cpp b/src/CLR/CorLib/corlib_native.cpp index 7f5a914164..63255698a7 100644 --- a/src/CLR/CorLib/corlib_native.cpp +++ b/src/CLR/CorLib/corlib_native.cpp @@ -22,59 +22,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, Library_corlib_native_System_Exception::get_StackTrace___STRING, NULL, NULL, @@ -145,6 +92,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, Library_corlib_native_System_Array::get_Length___I4, NULL, + NULL, Library_corlib_native_System_Array::CreateInstance___STATIC__SystemArray__SystemType__I4, NULL, Library_corlib_native_System_Array::Copy___STATIC__VOID__SystemArray__I4__SystemArray__I4__I4, @@ -239,30 +187,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Queue::Clear___VOID, - Library_corlib_native_System_Collections_Queue::CopyTo___VOID__SystemArray__I4, - Library_corlib_native_System_Collections_Queue::Enqueue___VOID__OBJECT, - NULL, - Library_corlib_native_System_Collections_Queue::Dequeue___OBJECT, - Library_corlib_native_System_Collections_Queue::Peek___OBJECT, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Stack::Clear___VOID, - NULL, - NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Stack::Peek___OBJECT, - Library_corlib_native_System_Collections_Stack::Pop___OBJECT, - Library_corlib_native_System_Collections_Stack::Push___VOID__OBJECT, - NULL, - NULL, Library_corlib_native_System_Console::OutNative___STATIC__VOID__STRING__BOOLEAN, NULL, NULL, @@ -874,12 +798,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, }; #elif (NANOCLR_REFLECTION == FALSE) @@ -899,59 +817,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, Library_corlib_native_System_Exception::get_StackTrace___STRING, NULL, NULL, @@ -1006,7 +871,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, Library_corlib_native_System_Array::System_Collections_IList_get_Item___OBJECT__I4, Library_corlib_native_System_Array::System_Collections_IList_set_Item___VOID__I4__OBJECT, NULL, @@ -1022,6 +886,7 @@ static const CLR_RT_MethodHandler method_lookup[] = Library_corlib_native_System_Array::get_Length___I4, NULL, NULL, + NULL, Library_corlib_native_System_Array::Copy___STATIC__VOID__SystemArray__I4__SystemArray__I4__I4, Library_corlib_native_System_Array::Clear___STATIC__VOID__SystemArray__I4__I4, NULL, @@ -1085,6 +950,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Collections_ArrayList::get_Item___OBJECT__I4, Library_corlib_native_System_Collections_ArrayList::set_Item___VOID__I4__OBJECT, Library_corlib_native_System_Collections_ArrayList::Add___I4__OBJECT, @@ -1109,30 +975,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Queue::Clear___VOID, - Library_corlib_native_System_Collections_Queue::CopyTo___VOID__SystemArray__I4, - Library_corlib_native_System_Collections_Queue::Enqueue___VOID__OBJECT, - NULL, - Library_corlib_native_System_Collections_Queue::Dequeue___OBJECT, - Library_corlib_native_System_Collections_Queue::Peek___OBJECT, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Stack::Clear___VOID, - NULL, - NULL, - NULL, - NULL, - Library_corlib_native_System_Collections_Stack::Peek___OBJECT, - Library_corlib_native_System_Collections_Stack::Pop___OBJECT, - Library_corlib_native_System_Collections_Stack::Push___VOID__OBJECT, - NULL, - NULL, Library_corlib_native_System_Console::OutNative___STATIC__VOID__STRING__BOOLEAN, NULL, NULL, @@ -1630,12 +1472,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, }; #else @@ -1647,11 +1483,11 @@ const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib = "mscorlib", #if (NANOCLR_REFLECTION == TRUE) - 0x031379FD, + 0xE69C4858, #else - 0xFD365EFD, + 0xCE9CF574, #endif method_lookup, - { 100, 4, 1, 0 } + { 100, 4, 3, 0 } }; diff --git a/src/CLR/CorLib/corlib_native.h b/src/CLR/CorLib/corlib_native.h index 9e5e2e434c..45c1ce8317 100644 --- a/src/CLR/CorLib/corlib_native.h +++ b/src/CLR/CorLib/corlib_native.h @@ -264,47 +264,6 @@ struct Library_corlib_native_System_Collections_ArrayList }; -struct Library_corlib_native_System_Collections_DictionaryEntry -{ - static const int FIELD__Key = 1; - static const int FIELD__Value = 2; - - - //--// - -}; - -struct Library_corlib_native_System_Collections_Queue -{ - static const int FIELD___array = 1; - static const int FIELD___head = 2; - static const int FIELD___tail = 3; - static const int FIELD___size = 4; - - NANOCLR_NATIVE_DECLARE(Clear___VOID); - NANOCLR_NATIVE_DECLARE(CopyTo___VOID__SystemArray__I4); - NANOCLR_NATIVE_DECLARE(Enqueue___VOID__OBJECT); - NANOCLR_NATIVE_DECLARE(Dequeue___OBJECT); - NANOCLR_NATIVE_DECLARE(Peek___OBJECT); - - //--// - -}; - -struct Library_corlib_native_System_Collections_Stack -{ - static const int FIELD___array = 1; - static const int FIELD___size = 2; - - NANOCLR_NATIVE_DECLARE(Clear___VOID); - NANOCLR_NATIVE_DECLARE(Peek___OBJECT); - NANOCLR_NATIVE_DECLARE(Pop___OBJECT); - NANOCLR_NATIVE_DECLARE(Push___VOID__OBJECT); - - //--// - -}; - struct Library_corlib_native_System_Console { NANOCLR_NATIVE_DECLARE(OutNative___STATIC__VOID__STRING__BOOLEAN); diff --git a/src/CLR/Core/CLR_RT_HeapBlock_Queue.cpp b/src/CLR/Core/CLR_RT_HeapBlock_Queue.cpp index 59995786aa..85b6c1764e 100644 --- a/src/CLR/Core/CLR_RT_HeapBlock_Queue.cpp +++ b/src/CLR/Core/CLR_RT_HeapBlock_Queue.cpp @@ -5,6 +5,9 @@ // #include "Core.h" +#if (NANOCLR_SYSTEM_COLLECTIONS == TRUE) +#include + HRESULT CLR_RT_HeapBlock_Queue::Dequeue( CLR_RT_HeapBlock*& value ) { NATIVE_PROFILE_CLR_CORE(); @@ -162,7 +165,9 @@ HRESULT CLR_RT_HeapBlock_Queue::CopyTo( CLR_RT_HeapBlock_Array* toArray, CLR_INT //--// -CT_ASSERT(Library_corlib_native_System_Collections_Queue__FIELD___array == Library_corlib_native_System_Collections_Queue::FIELD___array); -CT_ASSERT(Library_corlib_native_System_Collections_Queue__FIELD___head == Library_corlib_native_System_Collections_Queue::FIELD___head ); -CT_ASSERT(Library_corlib_native_System_Collections_Queue__FIELD___tail == Library_corlib_native_System_Collections_Queue::FIELD___tail ); -CT_ASSERT(Library_corlib_native_System_Collections_Queue__FIELD___size == Library_corlib_native_System_Collections_Queue::FIELD___size ); +CT_ASSERT(Library_nf_system_collections_System_Collections_Queue__FIELD___array == Library_nf_system_collections_System_Collections_Queue::FIELD___array); +CT_ASSERT(Library_nf_system_collections_System_Collections_Queue__FIELD___head == Library_nf_system_collections_System_Collections_Queue::FIELD___head ); +CT_ASSERT(Library_nf_system_collections_System_Collections_Queue__FIELD___tail == Library_nf_system_collections_System_Collections_Queue::FIELD___tail ); +CT_ASSERT(Library_nf_system_collections_System_Collections_Queue__FIELD___size == Library_nf_system_collections_System_Collections_Queue::FIELD___size ); + +#endif diff --git a/src/CLR/Core/CLR_RT_HeapBlock_Stack.cpp b/src/CLR/Core/CLR_RT_HeapBlock_Stack.cpp index 58997ba396..0b64745a24 100644 --- a/src/CLR/Core/CLR_RT_HeapBlock_Stack.cpp +++ b/src/CLR/Core/CLR_RT_HeapBlock_Stack.cpp @@ -3,8 +3,12 @@ // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // + #include "Core.h" +#if (NANOCLR_SYSTEM_COLLECTIONS == TRUE) +#include + //////////////////////////////////////////////////////////////////////////////////////////////////// HRESULT CLR_RT_HeapBlock_Stack::Pop( CLR_RT_HeapBlock*& value ) { @@ -101,6 +105,7 @@ HRESULT CLR_RT_HeapBlock_Stack::Clear() //--// -CT_ASSERT(Library_corlib_native_System_Collections_Stack__FIELD___array == Library_corlib_native_System_Collections_Stack::FIELD___array); -CT_ASSERT(Library_corlib_native_System_Collections_Stack__FIELD___size == Library_corlib_native_System_Collections_Stack::FIELD___size ); +CT_ASSERT(Library_nf_system_collections_System_Collections_Stack__FIELD___array == Library_nf_system_collections_System_Collections_Stack::FIELD___array); +CT_ASSERT(Library_nf_system_collections_System_Collections_Stack__FIELD___size == Library_nf_system_collections_System_Collections_Stack::FIELD___size ); +#endif diff --git a/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h b/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h index 64c5dd5270..374c811eb2 100644 --- a/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h +++ b/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h @@ -2368,11 +2368,12 @@ struct CLR_RT_HeapBlock_ArrayList : public CLR_RT_HeapBlock __inline void SetSize ( CLR_INT32 size ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_ArrayList__FIELD___size ].SetInteger ( size ); } }; +#if (NANOCLR_SYSTEM_COLLECTIONS == TRUE) -#define Library_corlib_native_System_Collections_Queue__FIELD___array 1 -#define Library_corlib_native_System_Collections_Queue__FIELD___head 2 -#define Library_corlib_native_System_Collections_Queue__FIELD___tail 3 -#define Library_corlib_native_System_Collections_Queue__FIELD___size 4 +#define Library_nf_system_collections_System_Collections_Queue__FIELD___array 1 +#define Library_nf_system_collections_System_Collections_Queue__FIELD___head 2 +#define Library_nf_system_collections_System_Collections_Queue__FIELD___tail 3 +#define Library_nf_system_collections_System_Collections_Queue__FIELD___size 4 struct CLR_RT_HeapBlock_Queue : public CLR_RT_HeapBlock { @@ -2387,7 +2388,7 @@ struct CLR_RT_HeapBlock_Queue : public CLR_RT_HeapBlock //--// - __inline CLR_INT32 GetSize() { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___size ].NumericByRef().s4; } + __inline CLR_INT32 GetSize() { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___size ].NumericByRef().s4; } private: @@ -2396,19 +2397,19 @@ struct CLR_RT_HeapBlock_Queue : public CLR_RT_HeapBlock static HRESULT ObjArrayMemcpy( CLR_RT_HeapBlock_Array* arraySrc, int indexSrc, CLR_RT_HeapBlock_Array* arrayDst, int indexDst, int length ); - __inline CLR_RT_HeapBlock_Array* GetArray() { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___array ].DereferenceArray(); } - __inline CLR_INT32 Head () { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___head ].NumericByRef().s4; } - __inline CLR_INT32 GetTail () { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___tail ].NumericByRef().s4; } + __inline CLR_RT_HeapBlock_Array* GetArray() { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___array ].DereferenceArray(); } + __inline CLR_INT32 Head () { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___head ].NumericByRef().s4; } + __inline CLR_INT32 GetTail () { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___tail ].NumericByRef().s4; } - __inline void SetArray( CLR_RT_HeapBlock_Array* array ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___array ].SetObjectReference( array ); } - __inline void SetHead ( CLR_INT32 head ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___head ].SetInteger ( head ); } - __inline void SetTail ( CLR_INT32 tail ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___tail ].SetInteger ( tail ); } - __inline void SetSize ( CLR_INT32 size ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Queue__FIELD___size ].SetInteger ( size ); } + __inline void SetArray( CLR_RT_HeapBlock_Array* array ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___array ].SetObjectReference( array ); } + __inline void SetHead ( CLR_INT32 head ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___head ].SetInteger ( head ); } + __inline void SetTail ( CLR_INT32 tail ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___tail ].SetInteger ( tail ); } + __inline void SetSize ( CLR_INT32 size ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Queue__FIELD___size ].SetInteger ( size ); } }; -#define Library_corlib_native_System_Collections_Stack__FIELD___array 1 -#define Library_corlib_native_System_Collections_Stack__FIELD___size 2 +#define Library_nf_system_collections_System_Collections_Stack__FIELD___array 1 +#define Library_nf_system_collections_System_Collections_Stack__FIELD___size 2 struct CLR_RT_HeapBlock_Stack : public CLR_RT_HeapBlock { @@ -2421,19 +2422,21 @@ struct CLR_RT_HeapBlock_Stack : public CLR_RT_HeapBlock //--// - __inline CLR_INT32 GetSize() { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Stack__FIELD___size ].NumericByRef().s4; } + __inline CLR_INT32 GetSize() { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Stack__FIELD___size ].NumericByRef().s4; } protected: // Keep in-sync with _defaultCapacity in System.Collections.Stack class in Stack.cs static const CLR_INT32 c_DefaultCapacity = 4; - __inline CLR_RT_HeapBlock_Array* GetArray() { return ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Stack__FIELD___array ].DereferenceArray(); } + __inline CLR_RT_HeapBlock_Array* GetArray() { return ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Stack__FIELD___array ].DereferenceArray(); } - __inline void SetArray( CLR_RT_HeapBlock_Array* array ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Stack__FIELD___array ].SetObjectReference( array ); } - __inline void SetSize ( CLR_INT32 size ) { ((CLR_RT_HeapBlock*)this)[ Library_corlib_native_System_Collections_Stack__FIELD___size ].SetInteger ( size ); } + __inline void SetArray( CLR_RT_HeapBlock_Array* array ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Stack__FIELD___array ].SetObjectReference( array ); } + __inline void SetSize ( CLR_INT32 size ) { ((CLR_RT_HeapBlock*)this)[ Library_nf_system_collections_System_Collections_Stack__FIELD___size ].SetInteger ( size ); } }; +#endif // (NANOCLR_SYSTEM_COLLECTIONS == TRUE) + //////////////////////////////////////////////////////////////////////////////////////////////////// #endif // _NANOCLR_RUNTIME__HEAPBLOCK_H_ diff --git a/src/nanoFramework.System.Collections/nf_system_collections.cpp b/src/nanoFramework.System.Collections/nf_system_collections.cpp new file mode 100644 index 0000000000..2b59644b19 --- /dev/null +++ b/src/nanoFramework.System.Collections/nf_system_collections.cpp @@ -0,0 +1,100 @@ +#include "nf_system_collections.h" + + +static const CLR_RT_MethodHandler method_lookup[] = +{ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_nf_system_collections_System_Collections_Queue::Clear___VOID, + Library_nf_system_collections_System_Collections_Queue::CopyTo___VOID__mscorlibSystemArray__I4, + Library_nf_system_collections_System_Collections_Queue::Enqueue___VOID__OBJECT, + NULL, + Library_nf_system_collections_System_Collections_Queue::Dequeue___OBJECT, + Library_nf_system_collections_System_Collections_Queue::Peek___OBJECT, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_nf_system_collections_System_Collections_Stack::Clear___VOID, + NULL, + NULL, + NULL, + NULL, + Library_nf_system_collections_System_Collections_Stack::Peek___OBJECT, + Library_nf_system_collections_System_Collections_Stack::Pop___OBJECT, + Library_nf_system_collections_System_Collections_Stack::Push___VOID__OBJECT, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_System_Collections = +{ + "nanoFramework.System.Collections", + 0xC7167094, + method_lookup, + //////////////////////////////////////////////////////////////////////////////////// + // check if the version bellow matches the one in AssemblyNativeVersion attribute // + //////////////////////////////////////////////////////////////////////////////////// + { 100, 0, 0, 0 } +}; diff --git a/src/nanoFramework.System.Collections/nf_system_collections.h b/src/nanoFramework.System.Collections/nf_system_collections.h new file mode 100644 index 0000000000..ae439b85a9 --- /dev/null +++ b/src/nanoFramework.System.Collections/nf_system_collections.h @@ -0,0 +1,113 @@ +// +// Copyright (c) 2019 The nanoFramework project contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#ifndef _NF_SYSTEM_COLLECTIONS_H_ +#define _NF_SYSTEM_COLLECTIONS_H_ + +#include +#include + +struct Library_nf_system_collections_System_Collections_Hashtable +{ + static const int FIELD___buckets = 1; + static const int FIELD___numberOfBuckets = 2; + static const int FIELD___count = 3; + static const int FIELD___loadFactor = 4; + static const int FIELD___maxLoadFactor = 5; + static const int FIELD___growthFactor = 6; + + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Hashtable__Entry +{ + static const int FIELD__key = 1; + static const int FIELD__value = 2; + static const int FIELD__next = 3; + + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Hashtable__HashtableEnumerator +{ + static const int FIELD__ht = 1; + static const int FIELD__temp = 2; + static const int FIELD__index = 3; + static const int FIELD__returnType = 4; + + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Hashtable__KeyCollection +{ + static const int FIELD__ht = 1; + + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_DictionaryEntry +{ + static const int FIELD__Key = 1; + static const int FIELD__Value = 2; + + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Queue +{ + static const int FIELD___array = 1; + static const int FIELD___head = 2; + static const int FIELD___tail = 3; + static const int FIELD___size = 4; + + NANOCLR_NATIVE_DECLARE(Clear___VOID); + NANOCLR_NATIVE_DECLARE(CopyTo___VOID__mscorlibSystemArray__I4); + NANOCLR_NATIVE_DECLARE(Enqueue___VOID__OBJECT); + NANOCLR_NATIVE_DECLARE(Dequeue___OBJECT); + NANOCLR_NATIVE_DECLARE(Peek___OBJECT); + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Stack +{ + static const int FIELD___array = 1; + static const int FIELD___size = 2; + + NANOCLR_NATIVE_DECLARE(Clear___VOID); + NANOCLR_NATIVE_DECLARE(Peek___OBJECT); + NANOCLR_NATIVE_DECLARE(Pop___OBJECT); + NANOCLR_NATIVE_DECLARE(Push___VOID__OBJECT); + + //--// + +}; + +struct Library_nf_system_collections_System_Collections_Hashtable__ValueCollection +{ + static const int FIELD__ht = 1; + + + //--// + +}; + + + +extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_System_Collections; + +#endif //_NF_SYSTEM_COLLECTIONS_H_ diff --git a/src/CLR/CorLib/corlib_native_System_Collections_Queue.cpp b/src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Queue.cpp similarity index 74% rename from src/CLR/CorLib/corlib_native_System_Collections_Queue.cpp rename to src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Queue.cpp index 3ddb607c25..806c19e801 100644 --- a/src/CLR/CorLib/corlib_native_System_Collections_Queue.cpp +++ b/src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Queue.cpp @@ -3,10 +3,11 @@ // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // -#include "CorLib.h" +#include "nf_system_collections.h" -HRESULT Library_corlib_native_System_Collections_Queue::CopyTo___VOID__SystemArray__I4( CLR_RT_StackFrame& stack ) + +HRESULT Library_nf_system_collections_System_Collections_Queue::CopyTo___VOID__mscorlibSystemArray__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -24,7 +25,7 @@ HRESULT Library_corlib_native_System_Collections_Queue::CopyTo___VOID__SystemArr NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Queue::Clear___VOID( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Queue::Clear___VOID( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -36,7 +37,7 @@ HRESULT Library_corlib_native_System_Collections_Queue::Clear___VOID( CLR_RT_Sta NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Queue::Enqueue___VOID__OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Queue::Enqueue___VOID__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -48,7 +49,7 @@ HRESULT Library_corlib_native_System_Collections_Queue::Enqueue___VOID__OBJECT( NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Queue::Dequeue___OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Queue::Dequeue___OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -63,7 +64,7 @@ HRESULT Library_corlib_native_System_Collections_Queue::Dequeue___OBJECT( CLR_RT NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Queue::Peek___OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Queue::Peek___OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); diff --git a/src/CLR/CorLib/corlib_native_System_Collections_Stack.cpp b/src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Stack.cpp similarity index 73% rename from src/CLR/CorLib/corlib_native_System_Collections_Stack.cpp rename to src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Stack.cpp index 366666d24a..d5449c2463 100644 --- a/src/CLR/CorLib/corlib_native_System_Collections_Stack.cpp +++ b/src/nanoFramework.System.Collections/nf_system_collections_System_Collections_Stack.cpp @@ -3,10 +3,11 @@ // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // -#include "CorLib.h" +#include "nf_system_collections.h" -HRESULT Library_corlib_native_System_Collections_Stack::Clear___VOID( CLR_RT_StackFrame& stack ) + +HRESULT Library_nf_system_collections_System_Collections_Stack::Clear___VOID( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -18,7 +19,7 @@ HRESULT Library_corlib_native_System_Collections_Stack::Clear___VOID( CLR_RT_Sta NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Stack::Peek___OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Stack::Peek___OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -34,7 +35,7 @@ HRESULT Library_corlib_native_System_Collections_Stack::Peek___OBJECT( CLR_RT_St } -HRESULT Library_corlib_native_System_Collections_Stack::Pop___OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Stack::Pop___OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -49,7 +50,7 @@ HRESULT Library_corlib_native_System_Collections_Stack::Pop___OBJECT( CLR_RT_Sta NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Collections_Stack::Push___VOID__OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_nf_system_collections_System_Collections_Stack::Push___VOID__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER();