/* * We can't run the VM in the main thread (because it has to handle events). * So we run the VM in this thread. */ static DWORD WINAPI vm_thread_routine(LPVOID lpvParam) { // Print arguments that we are using JVMSPI_PrintRaw("Running VM"); JVMSPI_PrintRaw("\n"); for (int i = 1; i < _argc; i++) { JVMSPI_PrintRaw(" "); JVMSPI_PrintRaw(_argv[i]); JVMSPI_PrintRaw("\n"); } // Call this before any other Jvm_ functions. JVM_Initialize(); int argc = _argc; char ** argv = _argv; // Ignore arg[0] -- the name of the program. argc --; argv ++; while (true) { int n = JVM_ParseOneArg(argc, argv); if (n < 0) { JVMSPI_DisplayUsage(NULL); return -1; } else if (n == 0) { break; } argc -= n; argv += n; } if (LogConsole) { write_console("Console output logged at \n"); write_console(logfilename); write_console("\n"); for (int index=0; index<_argc; index++) { log_console(_argv[index]); log_console(" "); } log_console("\n"); } if (!WriteConsole) { write_console("On-screen console output disabled.\n"); } int code = JVM_Start(NULL, NULL, argc, argv); JVMSPI_Exit(code); SHOULD_NOT_REACH_HERE(); return 0; }
void DefaultStream::print_raw(const char* s) { JVMSPI_PrintRaw(s); // print to log file if (LogVMOutput && has_log_file()) { OsFile_write(_log_file, s, sizeof(char), jvm_strlen(s)); // OsFile_flush(_log_file); if (++__charcount == 200000000) { OsFile_flush(_log_file); JvmPathChar z = 'z'; JvmPathChar a = 'a'; __charcount = 0; OsFile_close(_log_file); _log_file = OsFile_open(__log_name, "w"); if (__log_name[5] == z) { __log_name[5] = a; } else { __log_name[5]++; } } } #if !defined(PRODUCT) || ENABLE_PROFILER || ENABLE_TTY_TRACE while (true) { char ch = *s++; if (ch == 0) { break; } else if (ch == '\n') { _position = 0; } else { _position += 1; } } #endif }