Skip to content

Commit

Permalink
Remove StartArgs from CLR_SETTINGS struct
Browse files Browse the repository at this point in the history
- Also remove unused code from nanoclr CLRStartup.
- CLR_SETTINGS params is now passed as pointer to Initialize().
  • Loading branch information
josesimoes committed Jun 11, 2024
1 parent 25cac19 commit e354851
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 55 deletions.
14 changes: 7 additions & 7 deletions src/CLR/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
//#include <nanoCLR_Diagnostics.h>
// #include <nanoCLR_Diagnostics.h>
#include <nanoCLR_Hardware.h>
//#include <nanoCLR_Stream.h>
//#include <nanoCLR_Xml.h>
//#include <nanoCLR_Application.h>
// #include <nanoCLR_Stream.h>
// #include <nanoCLR_Xml.h>
#include <nanoCLR_Application.h>
//
//#include <nanoCLR_ParseOptions.h>
// #include <nanoCLR_ParseOptions.h>
//
#include <corlib_native.h>
//#include <SPOT_native.h>
//#include <SPOT_hardware_native.h>
// #include <SPOT_native.h>
// #include <SPOT_hardware_native.h>
#include <nanoCLR_Runtime__HeapBlock.h>

#endif // NANOCLR_CORE_H
1 change: 0 additions & 1 deletion src/CLR/Include/nanoCLR_Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ typedef struct CLR_SETTINGS
#if defined(VIRTUAL_DEVICE)
bool PerformGarbageCollection;
bool PerformHeapCompaction;
CLR_RT_StringVector StartArgs;
#endif

} CLR_SETTINGS;
Expand Down
47 changes: 1 addition & 46 deletions targets/netcore/nanoFramework.nanoCLR/CLRStartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,12 @@ struct Settings

//--//

HRESULT Initialize(CLR_SETTINGS params)
HRESULT Initialize(CLR_SETTINGS const &params)
{
NANOCLR_HEADER();

m_clrOptions = params;

#if defined(PLATFORM_WINDOWS_EMULATOR)

CLR_UINT32 clockFrequencyBaseline = 27000000;
CLR_UINT32 clockFrequency = CPU_SystemClock();
double clockFrequencyRatio = 1;

if (clockFrequency > 0)
{
clockFrequencyRatio = (double)clockFrequencyBaseline / (double)clockFrequency;
}

g_HAL_Configuration_Windows.ProductType = HAL_Configuration_Windows::Product_Aux;
g_HAL_Configuration_Windows.SlowClockPerSecond = 32768;
g_HAL_Configuration_Windows.TicksPerMethodCall = (CLR_UINT64)(45.0 * clockFrequencyRatio);
g_HAL_Configuration_Windows.TicksPerOpcode = (CLR_UINT64)(5.0 * clockFrequencyRatio);
g_HAL_Configuration_Windows.GraphHeapEnabled = false;
#endif

NANOCLR_CHECK_HRESULT(CLR_RT_ExecutionEngine::CreateInstance(params));
#if !defined(BUILD_RTM)
CLR_Debug::Printf("Created EE.\r\n");
Expand Down Expand Up @@ -362,32 +344,6 @@ struct Settings
m_assemblies.clear(); // CLR_RT_ParseOptions::BufferMap m_assemblies;
}

struct Command_Call : CLR_RT_ParseOptions::Command
{
typedef HRESULT (Settings::*FPN)(CLR_RT_ParseOptions::ParameterList *params);

Settings &m_parent;
FPN m_call;

Command_Call(Settings &parent, FPN call, const wchar_t *szName, const wchar_t *szDescription)
: CLR_RT_ParseOptions::Command(szName, szDescription), m_parent(parent), m_call(call)
{
}

virtual HRESULT Execute()
{
return (m_parent.*m_call)(&m_params);
}
};

#define PARAM_GENERIC(parm1Name, parm1Desc) \
param = new CLR_RT_ParseOptions::Parameter_Generic(parm1Name, parm1Desc); \
cmd->m_params.push_back(param)
#define OPTION_CALL(fpn, optName, optDesc) \
cmd = new Command_Call(*this, &Settings::fpn, optName, optDesc); \
m_commands.push_back(cmd)
#define PARAM_EXTRACT_STRING(lst, index) ((CLR_RT_ParseOptions::Parameter_Generic *)(*lst)[index])->m_data.c_str()

HRESULT CheckAssemblyFormat(CLR_RECORD_ASSEMBLY *header, const wchar_t *src)
{
NANOCLR_HEADER();
Expand Down Expand Up @@ -564,7 +520,6 @@ void nanoCLR_SetConfigureCallback(ConfigureRuntimeCallback configureRuntimeCallb
void ClrStartup(CLR_SETTINGS params)
{
NATIVE_PROFILE_CLR_STARTUP();
// Settings settings;
ASSERT(sizeof(CLR_RT_HeapBlock_Raw) == sizeof(struct CLR_RT_HeapBlock));
bool softReboot;

Expand Down
2 changes: 1 addition & 1 deletion targets/netcore/nanoFramework.nanoCLR/nanoCLR_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void nanoCLR_Run(NANO_CLR_SETTINGS nanoClrSettings)
BlockStorageList_InitializeDevices();

CLR_SETTINGS clrSettings;
ZeroMemory(&clrSettings, sizeof(clrSettings));
ZeroMemory(&clrSettings, sizeof(CLR_SETTINGS));

clrSettings.MaxContextSwitches = nanoClrSettings.MaxContextSwitches;
clrSettings.WaitForDebugger = nanoClrSettings.WaitForDebugger;
Expand Down

0 comments on commit e354851

Please sign in to comment.