Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Nattress <simonn@microsoft.com>2015-12-03 08:08:22 +0300
committerSimon Nattress <simonn@microsoft.com>2015-12-03 22:37:29 +0300
commit14c72d88e2d09198a3a71740b78a81a4db41d166 (patch)
tree14636fe9c9ec452b4a8d3220dbb7e9137520aea3 /src/Native
parenteea6ebd0a7154ca0d04f222ed8a97a6815a2bbd8 (diff)
Enable command line args for RyuJit bootstrapper
Create managed objects for String[] args and each string command line argument and pass them in through the call to __managed__Main. Add System.String[] as a rooted type (until we generate start-up code in managed and don't need the lib export).
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/Bootstrap/main.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp
index c49b2d556..a655be87e 100644
--- a/src/Native/Bootstrap/main.cpp
+++ b/src/Native/Bootstrap/main.cpp
@@ -95,6 +95,7 @@ extern "C" Object * __allocate_object(MethodTable * pMT)
}
extern "C" void __EEType_System_Private_CoreLib_System_String();
+extern "C" void __EEType_System_Private_CoreLib_System_String__Array();
Object * __allocate_string(int32_t len)
{
@@ -233,20 +234,22 @@ void __range_check(void * a, size_t elem)
ThrowRangeOverflowException();
}
-#ifdef CPPCODEGEN
Object * __get_commandline_args(int argc, char * argv[])
{
- System::Array * p = (System::Array *)__allocate_array(argc, System::String__Array::__getMethodTable());
-
- for (int i = 0; i < argc; i++)
- {
- // TODO: Write barrier
- ((Object **)(p->GetArrayData()))[i] = __load_string_literal(argv[i]);
- }
+#ifdef CPPCODEGEN
+ MethodTable * pStringArrayMT = System::String__Array::__getMethodTable();
+#else
+ MethodTable * pStringArrayMT = (MethodTable*)__EEType_System_Private_CoreLib_System_String__Array;
+#endif
+ System::Array * args = (System::Array *)__allocate_array(argc, pStringArrayMT);
- return (Object *)p;
+ for (int i = 0; i < argc; i++)
+ {
+ __stelem_ref(args, i, __load_string_literal(argv[i]));
+ }
+
+ return (Object *)args;
}
-#endif
extern "C" void Buffer_BlockCopy(class System::Array * src, int srcOfs, class System::Array * dst, int dstOfs, int count)
{
@@ -379,7 +382,7 @@ extern "C" void RhRethrow()
#ifndef CPPCODEGEN
SimpleModuleHeader __module = { NULL, NULL /* &__gcStatics, &__gcStaticsDescs */ };
-extern "C" int __managed__Main();
+extern "C" int __managed__Main(Object*);
namespace AsmDataFormat
{
@@ -503,7 +506,10 @@ int main(int argc, char * argv[]) {
int retval;
try
{
- retval = __managed__Main();
+ // Managed apps don't see the first args argument (full path of executable) so skip it
+ assert(argc > 0);
+ Object* args = __get_commandline_args(argc - 1, argv + 1);
+ retval = __managed__Main(args);
}
catch (const char* &e)
{