VM_Magic.invokeMain(mainArgs, mainMethod.getCurrentEntryCodeArray());
VM_Reflection.invoke(mainMethod, null, new Object[] {mainArgs}, false);
  public void run () {    if (dbg) VM.sysWriteln("MainThread.run() starting ");      //-#if RVM_WITH_GCSPY      // start the GCSpy interpreter server      MM_Interface.startGCspyServer();      //-#endif    // Set up application class loader    ClassLoader cl = VM_ClassLoader.getApplicationClassLoader();    setContextClassLoader(cl);     if (dbg) VM.sysWrite("[MainThread.run() loading class to run... ");    // find method to run    // load class specified by args[0]    VM_Class cls = null;    try {      VM_Atom mainAtom = VM_Atom.findOrCreateUnicodeAtom(args[0].replace('.','/'));      VM_TypeReference mainClass = VM_TypeReference.findOrCreate(cl, mainAtom.descriptorFromClassName());      cls = mainClass.resolve().asClass();      cls.resolve();      cls.instantiate();      cls.initialize();    } catch (NoClassDefFoundError e) {       if (dbg) VM.sysWrite("failed.]");      // no such class      VM.sysWrite(e+"\n");      return;    }    if (dbg) VM.sysWriteln("loaded.]");    // find "main" method    //    mainMethod = cls.findMainMethod();    if (mainMethod == null) {       // no such method      VM.sysWrite(cls + " doesn't have a \"public static void main(String[])\" method to execute\n");      return;    }    if (dbg) VM.sysWrite("[MainThread.run() making arg list... ");    // create "main" argument list    //    String[] mainArgs = new String[args.length - 1];    for (int i = 0, n = mainArgs.length; i < n; ++i)      mainArgs[i] = args[i + 1];    if (dbg) VM.sysWriteln("made.]");        if (dbg) VM.sysWrite("[MainThread.run() compiling main(String[])... ");    mainMethod.compile();    if (dbg) VM.sysWriteln("compiled.]");        // Notify other clients that the startup is complete.    //    VM_Callbacks.notifyStartup();    launched = true;    if (dbg) VM.sysWriteln("[MainThread.run() invoking \"main\" method... ");    // invoke "main" method with argument list    VM_Magic.invokeMain(mainArgs, mainMethod.getCurrentEntryCodeArray());    if (dbg) VM.sysWriteln("  MainThread.run(): \"main\" method completed.]");  }