--- build\make\components\vm\vmcore.xml 2006-09-01 16:32:32.000000000 +-0700 +++ build\make\components\vm\vmcore.xml 2006-09-05 23:36:07.000000000 +-0700 @@ -31,13 +31,13 @@ extra.aprutil, extra.log4cxx, extra.zlib, vm.encoder, vm.port, vm.hythr, vm.jthread" /> - + --- build\make\components\vm\vmstart.xml 2006-09-01 16:32:28.000000000 +-0700 +++ @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- build\make\components\vm.xml 2006-09-01 16:32:50.000000000 +-0700 +++ build\make\components\vm.xml 2006-09-05 23:27:59.000000000 +-0700 @@ -33,37 +33,34 @@ vm.em, vm.gc, vm.vmi, vm.interpreter, vm.hythr, vm.jitrino, - vm.kernel_classes, - vm.vmstart" /> + vm.kernel_classes" /> --- build\make\build.xml 2006-09-05 18:12:35.000000000 +-0700 +++ build\make\build.xml 2006-09-05 23:21:19.000000000 +-0700 @@ -501,13 +501,12 @@ - --- build\make\deploy.xml 2006-09-05 18:13:37.000000000 +-0700 +++ build\make\deploy.xml 2006-09-05 23:22:57.000000000 +-0700 @@ -21,46 +21,42 @@ - - bin:drlvm:java - - - bin:encoder + bin/drlvm:encoder - bin:em + bin/drlvm:em - bin:vmcore - bin:vmcore + bin/drlvm:harmonyvm + bin/drlvm:harmonyvm - bin:interpreter + bin/drlvm:interpreter - bin:gc + bin/drlvm:gc lib/boot:kernel @@ -80,23 +76,16 @@ lib:* - - - - - --- build\make\setup.xml 2006-09-01 16:33:00.000000000 +-0700 +++ build\make\setup.xml 2006-09-05 23:25:56.000000000 +-0700 @@ -102,13 +102,13 @@ - + --- vm\em\src\DrlEMImpl.cpp 2006-09-01 16:33:08.000000000 +-0700 +++ vm\em\src\DrlEMImpl.cpp 2006-09-05 22:17:25.000000000 +-0700 @@ -31,14 +31,14 @@ #include #include #include #include -#define DEFAULT_JIT_DLL "jitrino" -#define DEFAULT_INTERPRETER_DLL "interpreter" +#define DEFAULT_JIT_DLL "drlvm/jitrino" +#define DEFAULT_INTERPRETER_DLL "drlvm/interpreter" #define LOG_DOMAIN "em" DrlEMImpl* DrlEMFactory::emInstance = NULL; DrlEMImpl* DrlEMFactory::createAndInitEMInstance() { assert(emInstance == NULL); --- vm\launcher\src\main.cpp 2006-09-01 16:33:10.000000000 +-0700 +++ @@ -1,28 +0,0 @@ -/* - * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Intel, Alexei Fedotov - * @version $Revision: 1.1.2.1.4.3 $ - * - */ - -int vm_main(int argc, char *argv[]); - -int main(int argc, char *argv[]) -{ - // delegate control to vm-provided initialization function - return vm_main(argc, argv); -} --- vm\vmcore\src\init\parse_arguments.cpp 2006-09-01 16:45:29.000000000 +-0700 +++ vm\vmcore\src\init\parse_arguments.cpp 2006-09-05 23:15:42.000000000 +-0700 @@ -116,12 +116,93 @@ " -? -help print this help message\n" " -help properties\n" " help on system properties\n" " -X print help on non-standard options"); } +static void print_help_on_nonstandard_options() +{ +#ifdef _DEBUG +# define DEBUG_OPTIONS_HELP \ + " -Xlog[:[:]\n" \ + " Switch debug logging on [for specified category only\n" \ + " [and log that category to a file]]\n" \ + " -Xtrace[:[:]\n" \ + " Switch trace logging on [for specified category only\n" \ + " [and log that category to a file]]\n" +#else +# define DEBUG_OPTIONS_HELP +#endif //_DEBUG +#ifdef VM_STATS +# define STATS_OPTIONS_HELP \ + " -Xstats \n" \ + " Generates different statistics\n" +#else +# define STATS_OPTIONS_HELP +#endif // VM_STATS + + ECHO(" -Xbootclasspath:\n" + " Set bootclasspath to the specified value\n" + " -Xbootclasspath/a:\n" + " Append specified directories and files to bootclasspath\n" + " -Xbootclasspath/p:\n" + " Prepend specified directories and files to bootclasspath\n" + " -Xjit \n" + " Specify JIT specific options\n" + " -Xms\n" + " Set Java heap size\n" + " -Xmx\n" + " Set maximum Java heap size\n" + " -Xdebug\n" + " Does nothing, this is a compatibility option\n" + " -Xnoagent\n" + " Does nothing, this is a compatibility option\n" + " -Xrun\n" + " Specify debugger agent library\n" + " -Xverbose[:[:]\n" + " Switch logging on [for specified category only\n" + " [and log that category to a file]]\n" + " -Xwarn[:[:]\n" + " Switch verbose logging off [for specified category only\n" + " [and log that category to a file]]\n" + " -Xverboseconf:\n" + " Set up logging via log4cxx configuration file\n" + " -Xverboselog:\n" + " Log verbose output to a file\n" + " -Xverify\n" + " Do full bytecode verification\n" + " -Xfileline\n" + " Add source information to logging messages\n" + " -Xthread\n" + " Add thread id to logging messages\n" + " -Xcategory\n" + " Add category name to logging messages\n" + " -Xtimestamp\n" + " Add timestamp to logging messages\n" + " -Xfunction\n" + " Add function signature to logging messages\n" + DEBUG_OPTIONS_HELP + STATS_OPTIONS_HELP + " -Xint\n" + " Use interpreter to execute the program\n" + " -Xgc \n" + " Specify gc specific options\n" + " -Xem \n" + " Specify em specific options\n" + " -Xdumpstubs\n" + " Writes stubs generated by LIL to disk\n" + " -Xparallel_jit\n" + " Launch compilation in parallel (default)\n" + " -Xno_parallel_jit\n" + " Do not launch compilation in parallel\n" + " -Xdumpfile \n" + " Specifies a file name for the dump\n" + " -XcleanupOnExit\n" + " Excplicitly free VM resources before exit\n"); +} //print_help_on_nonstandard_options + void parse_vm_arguments(Global_Env *p_env) { #ifdef _DEBUG TRACE2("arguments", "p_env->vm_arguments.nOptions = " << p_env->vm_arguments.nOptions); for (int _i = 0; _i < p_env->vm_arguments.nOptions; _i++) TRACE2("arguments", "p_env->vm_arguments.options[ " << _i << "] = " << p_env->vm_arguments.options[_i].optionString); @@ -274,12 +355,17 @@ const char* arg = option + strlen("-Xdumpfile:"); dump_file_name = arg; } else if (strcmp(option, "-XcleanupOnExit") == 0) { add_pair_to_properties(p_env->properties, "vm.cleanupOnExit", "true"); } + else if (strcmp(option, "-help") == 0 || strcmp(option, "-?") == 0) { + // out a generic help message + print_generic_help(); + LOGGER_EXIT(0); + } else if (strcmp(option, "_org.apache.harmony.vmi.portlib") == 0) { // Store a pointer to the portlib p_env->portLib = p_env->vm_arguments.options[i].extraInfo; } else { ECHO("Unknown option " << option << USE_JAVA_HELP); @@ -417,382 +503,39 @@ #ifdef _DEBUG } else if (begins_with(option, "-Xlog")) { parse_logger_arg(option, "-Xlog", LOG); } else if (begins_with(option, "-Xtrace")) { parse_logger_arg(option, "-Xtrace", TRACE); #endif //_DEBUG + } else if (begins_with(option, "-X")) { + print_help_on_nonstandard_options(); + LOGGER_EXIT(0); } + } // for (arg_num) } //set_log_levels_from_cmd struct cmd_arg { bool substring; char *param; int length; int args; }; -static const cmd_arg supported_parameters[] = -{ - {false, "-classpath", strlen("-classpath"), 1}, - {false, "-cp", strlen("-cp"), 1}, - {true, "-Xbootclasspath:", strlen("-Xbootclasspath:"), 0}, - {true, "-Xbootclasspath/a:", strlen("-Xbootclasspath/a:"), 0}, - {true, "-Xbootclasspath/p:", strlen("-Xbootclasspath/p:"), 0}, - {false, "-?", strlen("-?"), 0}, - {false, "-help", strlen("-help"), 1}, - {true, "-Xjit", strlen("-Xjit"), 1}, - {false, "-Xint", strlen("-Xint"), 0}, -#ifdef VM_STATS - {false, "-Xstats", strlen("-Xstats"), 1}, -#endif - {false, "-version", strlen("-version"), 0}, - {false, "-showversion", strlen("-showversion"), 0}, - {false, "-fullversion", strlen("-fullversion"), 0}, - {true, "-ea", strlen("-ea"), 0}, - {true, "-enableassertions", strlen("-enableassertions"), 0}, - {false, "-Xgc", strlen("-Xgc"), 1}, - {true, "-Xem", strlen("-Xem"), 1}, - {true, "-Xms", strlen("-Xms"), 0}, - {true, "-Xmx", strlen("-Xmx"), 0}, - {true, "-agentlib:", strlen("-agentlib:"), 0}, - {true, "-agentpath:", strlen("-agentpath:"), 0}, - {false, "-Xdebug", strlen("-Xdebug"), 0}, - {false, "-Xverify", strlen("-Xverify"), 0}, - {false, "-verify", strlen("-verify"), 0}, - {false, "-Xnoagent", strlen("-Xnoagent"), 0}, - {true, "-Xrun", strlen("-Xrun"), 0}, - {true, "-verbose", strlen("-verbose"), 0}, - {true, "-Xverbose", strlen("-Xverbose"), 0}, - {true, "-Xverboseconf:", strlen("-Xverboseconf:"), 0}, - {true, "-Xverboselog:", strlen("-Xverboselog:"), 0}, - {true, "-Xfileline", strlen("-Xfileline"), 0}, - {true, "-Xthread", strlen("-Xthread"), 0}, - {true, "-Xcategory", strlen("-Xcategory"), 0}, - {true, "-Xtimestamp", strlen("-Xtimestamp"), 0}, - {true, "-Xwarn", strlen("-Xwarn"), 0}, - {true, "-Xfunction", strlen("-Xfunction"), 0}, -#ifdef _DEBUG - {true, "-Xtrace", strlen("-Xtrace"), 0}, - {true, "-Xlog", strlen("-Xlog"), 0}, -#endif //_DEBUG - {true, "-D", strlen("-D"), 0}, - {false, "-Xdumpstubs", strlen("-Xdumpstubs"), 0}, - {false, "-Xparallel_jit", strlen("-Xparallel_jit"), 0}, - {false, "-Xno_parallel_jit", strlen("-Xno_parallel_jit"), 0}, - {false, "-Xdumpfile", strlen("-Xdumpfile"), 1}, - {false, "-XcleanupOnExit", strlen("-XcleanupOnExit"), 0}, - {false, "-jar", strlen("-jar"), 0} -}; //supported_parameters - -static void print_help_on_nonstandard_options() -{ -#ifdef _DEBUG -# define DEBUG_OPTIONS_HELP \ - " -Xlog[:[:]\n" \ - " Switch debug logging on [for specified category only\n" \ - " [and log that category to a file]]\n" \ - " -Xtrace[:[:]\n" \ - " Switch trace logging on [for specified category only\n" \ - " [and log that category to a file]]\n" -#else -# define DEBUG_OPTIONS_HELP -#endif //_DEBUG -#ifdef VM_STATS -# define STATS_OPTIONS_HELP \ - " -Xstats \n" \ - " Generates different statistics\n" -#else -# define STATS_OPTIONS_HELP -#endif // VM_STATS - - ECHO(" -Xbootclasspath:\n" - " Set bootclasspath to the specified value\n" - " -Xbootclasspath/a:\n" - " Append specified directories and files to bootclasspath\n" - " -Xbootclasspath/p:\n" - " Prepend specified directories and files to bootclasspath\n" - " -Xjit \n" - " Specify JIT specific options\n" - " -Xms\n" - " Set Java heap size\n" - " -Xmx\n" - " Set maximum Java heap size\n" - " -Xdebug\n" - " Does nothing, this is a compatibility option\n" - " -Xnoagent\n" - " Does nothing, this is a compatibility option\n" - " -Xrun\n" - " Specify debugger agent library\n" - " -Xverbose[:[:]\n" - " Switch logging on [for specified category only\n" - " [and log that category to a file]]\n" - " -Xwarn[:[:]\n" - " Switch verbose logging off [for specified category only\n" - " [and log that category to a file]]\n" - " -Xverboseconf:\n" - " Set up logging via log4cxx configuration file\n" - " -Xverboselog:\n" - " Log verbose output to a file\n" - " -Xverify\n" - " Do full bytecode verification\n" - " -Xfileline\n" - " Add source information to logging messages\n" - " -Xthread\n" - " Add thread id to logging messages\n" - " -Xcategory\n" - " Add category name to logging messages\n" - " -Xtimestamp\n" - " Add timestamp to logging messages\n" - " -Xfunction\n" - " Add function signature to logging messages\n" - DEBUG_OPTIONS_HELP - STATS_OPTIONS_HELP - " -Xint\n" - " Use interpreter to execute the program\n" - " -Xgc \n" - " Specify gc specific options\n" - " -Xem \n" - " Specify em specific options\n" - " -Xdumpstubs\n" - " Writes stubs generated by LIL to disk\n" - " -Xparallel_jit\n" - " Launch compilation in parallel (default)\n" - " -Xno_parallel_jit\n" - " Do not launch compilation in parallel\n" - " -Xdumpfile \n" - " Specifies a file name for the dump\n" - " -XcleanupOnExit\n" - " Excplicitly free VM resources before exit\n"); -} //print_help_on_nonstandard_options - -static JavaVMInitArgs* create_vm_arguments(int options_capacity) -{ - JavaVMInitArgs* vm_arguments = (JavaVMInitArgs*) STD_MALLOC(sizeof(JavaVMInitArgs)); - assert(vm_arguments); - vm_arguments->version = JNI_VERSION_1_4; - vm_arguments->nOptions = 0; - vm_arguments->ignoreUnrecognized = JNI_FALSE; - vm_arguments->options = - (JavaVMOption*)STD_MALLOC(sizeof(JavaVMOption) * (options_capacity)); - assert(vm_arguments->options); - - return vm_arguments; -} //create_vm_arguments - void clear_vm_arguments(JavaVMInitArgs* vm_args) { STD_FREE(vm_args->options); STD_FREE(vm_args); -} - -static void vm_arguments_append_classpath(JavaVMInitArgs* vm_arguments, const char* jar_file) -{ - static const char prefix[] = "-Djava.class.path="; - - // search for the last java.class.path property declaration - for (int i = vm_arguments->nOptions - 1; i >= 0 ; i--) - { - const char* option = vm_arguments->options[i].optionString; - if (strncmp(option, prefix, strlen(prefix)) == 0) - { - // if found, append jar file name - char* new_option = (char*) STD_MALLOC(strlen(option) + - strlen(PORT_PATH_SEPARATOR_STR) + strlen(jar_file) + 1); - assert(new_option); - - strcpy(new_option, option); - strcat(new_option, PORT_PATH_SEPARATOR_STR); - strcat(new_option, jar_file); - - vm_arguments->options[i].optionString = new_option; - return; - } - } - - // if not found, define java.class.path with jar file name - char* option = (char*) STD_MALLOC(strlen(prefix) + strlen(jar_file) + 1); - assert(option); - - strcpy(option, prefix); - strcat(option, jar_file); - - vm_arguments->options[vm_arguments->nOptions].optionString = option; - vm_arguments->nOptions ++; - return; -} //vm_arguments_append_classpath - -static int parse_vm_option(JavaVMInitArgs* vm_arguments, int argc, char *argv[], int i) -{ - // return 0, if arguments are over - if (i >= argc) - return 0; - - // if '-jar' met, thean vm options are over - if (strcmp(argv[i], "-jar") == 0) - return 0; - - const cmd_arg* supported_parameter; - bool found = false; - for (unsigned j = 0; j < sizeof(supported_parameters) / sizeof(cmd_arg); j++) - { - supported_parameter = &(supported_parameters[j]); - if ((supported_parameters[j].substring && - strncmp(argv[i], supported_parameters[j].param, - supported_parameters[j].length) == 0) || - (!supported_parameters[j].substring && - strcmp(argv[i], supported_parameters[j].param) == 0)) - { - found = true; - break; - } - } - - if (found) - { - char* option; - - if (strcmp(argv[i], "-classpath") == 0 || strcmp(argv[i], "-cp") == 0) - { - if (i + 1 >= argc) { - ECHO("Classpath option " - << argv[i] - << " should be followed by classpath value" - USE_JAVA_HELP); - LOGGER_EXIT(1); - } - - char* class_path = argv[i + 1]; - static const char prefix[] = "-Djava.class.path="; - - option = (char*) STD_MALLOC(strlen(prefix) + strlen(class_path) + 1); - assert(option); - - strcpy(option, prefix); - strcat(option, class_path); - } - else if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-?") == 0) - { - if (i + 1 >= argc) - { - // out a generic help message - print_generic_help(); - LOGGER_EXIT(0); - } - - const char* arg = argv[i + 1]; - if (strcmp(arg, "jit") != 0 && !begins_with(arg, "prop")) - { - // out a generic help message - print_generic_help(); - LOGGER_EXIT(0); - } - - static const char prefix[] = "-Xhelp:"; - - option = (char*) STD_MALLOC(strlen(prefix) + strlen(arg) + 1); - assert(option); - - strcpy(option, prefix); - strcat(option, arg); - - } - else if (supported_parameter->args == 1) - { - if (i + 1 >= argc) - { - ECHO("Option " << argv[i] << " should be followed by a additional parameter"); - LOGGER_EXIT(1); - } - - option = (char*) STD_MALLOC(strlen(argv[i]) + 1 + strlen(argv[i + 1]) + 1); - assert(option); - - strcpy(option, argv[i]); - strcat(option, ":"); - strcat(option, argv[i + 1]); - } - else if (strncmp(argv[i], "-enableassertions", - strlen("-enableassertions")) == 0 || - strncmp(argv[i], "-ea", strlen("-ea")) == 0) - { - ECHO("Error: Assertions are not supported.\n" - << " please invoke VM without -ea and -enableassertions options..."); - LOGGER_EXIT(1); - } - else - { - option = argv[i]; - } - - vm_arguments->options[vm_arguments->nOptions].optionString = option; - vm_arguments->nOptions ++; - - return 1 + supported_parameter->args; - } - - if (argv[i][0] != '-') - return 0; - - if (strcmp(argv[i], "-X") == 0) - { - print_help_on_nonstandard_options(); - LOGGER_EXIT(0); - } else { - ECHO("Unknown option " << argv[i] << USE_JAVA_HELP); - LOGGER_EXIT(1); - } - -} //parse_vm_option - -JavaVMInitArgs* parse_cmd_arguments(int argc, char *argv[], - char **p_class_name, char **p_jar_file, int *p_java_arg_num) -{ - *p_class_name = NULL; - *p_jar_file = NULL; - - JavaVMInitArgs* vm_arguments = create_vm_arguments(argc); - - int i = 1; // skip argv[0], since it is a program name - int inc = 0; - do - { - inc = parse_vm_option(vm_arguments, argc, argv, i); - i += inc; - } while (inc > 0); - - if (i < argc) - { - if (strcmp(argv[i], "-jar") == 0) - { - i++; - if (i >= argc) { - ECHO("Option -jar must be followed by a jar file name"); - LOGGER_EXIT(1); - } - - *p_jar_file = argv[i]; - vm_arguments_append_classpath(vm_arguments, *p_jar_file); - } - else - { - *p_class_name = argv[i]; - } - } - - *p_java_arg_num = argc - i - 1; - - return vm_arguments; -} //parse_cmd_arguments +} void initialize_vm_cmd_state(Global_Env *p_env, JavaVMInitArgs* arguments) { p_env->vm_arguments.version = arguments->version; p_env->vm_arguments.nOptions = arguments->nOptions; p_env->vm_arguments.ignoreUnrecognized = arguments->ignoreUnrecognized; JavaVMOption *options = p_env->vm_arguments.options = (JavaVMOption*)STD_MALLOC(sizeof(JavaVMOption) * (arguments->nOptions)); assert(options); memcpy(options, arguments->options, sizeof(JavaVMOption) * (arguments->nOptions)); } //initialize_vm_cmd_state --- vm\vmcore\src\init\properties.cpp 2006-09-01 16:45:31.000000000 +-0700 +++ vm\vmcore\src\init\properties.cpp 2006-09-05 23:45:26.000000000 +-0700 @@ -88,25 +88,25 @@ "java.vm.info=no info", NULL }; -#define API_DLL1 "vmcore" +#define API_DLL1 "drlvm/harmonyvm" #define API_DLL2 "hythr" #define API_DLL3 "hysig" #define API_DLL4 "hyprt" #define API_DLL5 "hyzlib" #define API_DLL6 "hytext" #define API_DLL7 "hypool" -#define API_DLL8 "vmi" +#define API_DLL8 "drlvm/vmi" #define API_DLLA "hyluni" #define API_DLLB "hyarchive" -#define GC_DLL "gc" -#define EM_DLL "em" +#define GC_DLL "drlvm/gc" +#define EM_DLL "drlvm/em" // Compose a string of file names each of them beginning with path, // names separated by PORT_PATH_SEPARATOR static char *compose_full_files_path_names_list(const char *path, const char **dll_names, const int names_number, --- vm\vmcore\src\init\vm_main.cpp 2006-09-01 16:45:30.000000000 +-0700 +++ vm\vmcore\src\init\vm_main.cpp 2006-09-05 23:10:17.000000000 +-0700 @@ -485,101 +485,24 @@ { WARN("Failed execute starter class initialize() method."); vm_exit(1); } } //create_vm -static int run_main(Global_Env *p_env, char* class_name, char* jar_file, - int java_args_num, char* java_args[]) -{ - if (jar_file) - { - // check if file is archive - if(!file_is_archive(jar_file)) { - ECHO("You must specify a jar file to run."); - LOGGER_EXIT(1); - } - - // create archive file structure - void *mem_jar = STD_ALLOCA(sizeof(JarFile)); - JarFile* jarfl = new (mem_jar) JarFile(); - if(!jarfl || !(jarfl->Parse(jar_file)) ) { - ECHO("VM can't find the jar file you want to run."); - LOGGER_EXIT(1); - } - - // extract main class name from jar's manifest - class_name = strdup(archive_get_main_class_name(jarfl)); - if(!class_name) { - ECHO("Your jar file hasn't specified Main-Class manifest attribute."); - LOGGER_EXIT(1); - } - - // close archive file - jarfl->~JarFile(); - - } else if (class_name) { - // convert class name: change '.' to '/' - for (char* pointer = class_name; *pointer; pointer++) { - if (*pointer == '/') { - *pointer = '.'; - } - } - } - - // if class_name unknown print help and exit - if (!class_name) { - p_env->TI->setDisabled(); - print_generic_help(); - vm_exit(1); - } - - // run a given class - int result = run_java_main(class_name, java_args, java_args_num); - - return result; -} //run_main - void destroy_vm(Global_Env *p_env) { run_java_shutdown(); // usually shutdown hooks do vm_exit(). // so we do not reach this point // but in case ... - WARN("Error occured in starter class shutdown() method."); + //WARN("Error occured in starter class shutdown() method."); vm_exit(-1); -} //destroy_vm - - -VMEXPORT int vm_main(int argc, char *argv[]) -{ - init_log_system(); - - char** java_args; - int java_args_num; - char* class_name; - char* jar_file; - - JavaVMInitArgs* vm_arguments = - parse_cmd_arguments(argc, argv, &class_name, &jar_file, &java_args_num); - - java_args = argv + argc - java_args_num; - - create_vm(&env, vm_arguments); - - clear_vm_arguments(vm_arguments); - - run_main(&env, class_name, jar_file, java_args_num, java_args); - - destroy_vm(&env); - - return 33; -} //vm_main +} //destroy_vm static inline void dump_all_java_stacks() { hythread_iterator_t iterator; hythread_suspend_all(&iterator, NULL); VM_thread *thread = get_vm_thread (hythread_iterator_next(&iterator)); --- vm\vmcore\src\kernel_classes\native\org_apache_harmony_vm_VMStack.cpp 2006-09-01 16:46:23.000000000 +-0700 +++ vm\vmcore\src\kernel_classes\native\org_apache_harmony_vm_VMStack.cpp 2006-09-05 22:44:41.000000000 +-0700 @@ -278,26 +278,31 @@ || old_this != frames[skip].outdated_this) { break; } } } } + /* + TODO: This code doesn't work with the launcher. There is no runImpl + method on the stack. + // skip Thread.runImpl() - size--; + size--; // skip the VMStart$MainThread if one exits from the bottom of the stack // along with 2 reflection frames used to invoke method main - static String* starter_String = genv->string_pool.lookup("java/lang/VMStart$MainThread"); - Method_Handle method = frames[size].method; - assert(method); + static String* starter_String = genv->string_pool.lookup("java/lang/VMStart$MainThread"); + Method_Handle method = frames[size].method; + assert(method); // skip only for main application thread - if (!strcmp(method_get_name(method), "runImpl") - && method->get_class()->name == starter_String) { - int rem = size - skip-1; - size -= rem < 3 ? rem : 3; - } + if (!strcmp(method_get_name(method), "runImpl") + && method->get_class()->name == starter_String) { + int rem = size - skip-1; + size -= rem < 2 ? rem : 2; + } + */ ASSERT(size >= skip, "Trying to skip " << skip << " frames but there are only " << size << " frames in stack"); assert(hythread_is_suspend_enabled()); --- vm\vmstart\src\main.cpp 2006-09-01 16:33:06.000000000 +-0700 +++ @@ -1,31 +0,0 @@ -/* - * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Intel, Alexei Fedotov - * @version $Revision: 1.1.2.1.4.3 $ - */ - -int vm_main(int argc, char *argv[]); - -int main(int argc, char *argv[]) -{ - /* - * delegate control to vm-provided initialization function - * currently found in vmcore/src/init/vm_main.cpp - */ - - return vm_main(argc, argv); -}