91 using namespace cacao;
110 #if defined(ENABLE_INTRP)
111 u1 *intrp_main_stack = NULL;
117 #define HEAP_MAXSIZE 128 * 1024 * 1024
118 #define HEAP_STARTSIZE 2 * 1024 * 1024
119 #define STACK_SIZE 512 * 1024
167 #if defined(ENABLE_PROFILING)
181 #if defined(ENABLE_STATISTICS)
192 #if defined(ENABLE_VERIFIER)
196 #if defined(TYPECHECK_VERBOSE)
203 #if defined(ENABLE_LOOP)
207 #if defined(ENABLE_IFCONV)
211 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
215 #if defined(ENABLE_INTRP)
227 #if defined(ENABLE_JVMTI)
233 #if defined(ENABLE_DEBUG_FILTER)
259 {
"D",
true,
OPT_D },
265 {
"X",
false,
OPT_X },
273 {
"enableassertions:",
true,
OPT_EA },
274 {
"disableassertions:",
true,
OPT_DA },
279 {
"enablesystemassertions",
false,
OPT_ESA },
281 {
"disablesystemassertions",
false,
OPT_DSA },
284 #if defined(ENABLE_VERIFIER)
292 #if defined(ENABLE_VERIFIER) && defined(TYPECHECK_VERBOSE)
293 {
"verbosetc",
false, OPT_VERBOSETC },
295 #if defined(ENABLE_STATISTICS)
296 {
"time",
false, OPT_TIME },
297 {
"stat",
false, OPT_STAT },
303 #if defined(ENABLE_LOOP)
304 {
"oloop",
false, OPT_OLOOP },
306 #if defined(ENABLE_IFCONV)
309 #if defined(ENABLE_LSRA)
310 {
"lsra",
false, OPT_LSRA },
312 #if defined(ENABLE_SSA)
313 {
"lsra",
true, OPT_LSRA },
316 #if defined(ENABLE_INTRP)
319 {
"trace",
false, OPT_TRACE },
320 {
"static-supers",
true, OPT_STATIC_SUPERS },
321 {
"no-dynamic",
false, OPT_NO_DYNAMIC },
322 {
"no-replication",
false, OPT_NO_REPLICATION },
323 {
"no-quicksuper",
false, OPT_NO_QUICKSUPER },
327 #if defined(ENABLE_JVMTI)
328 {
"agentlib:",
true, OPT_AGENTLIB },
329 {
"agentpath:",
true, OPT_AGENTPATH },
341 #if defined(ENABLE_JVMTI)
344 {
"Xrun",
true, OPT_RUN },
356 #if defined(ENABLE_PROFILING)
357 {
"Xprof:",
true, OPT_PROF_OPTION },
358 {
"Xprof",
false, OPT_PROF },
366 #if defined(ENABLE_DEBUG_FILTER)
384 puts(
"Usage: cacao [-options] classname [arguments]");
385 puts(
" (to run a class file)");
386 puts(
" or cacao [-options] -jar jarfile [arguments]");
387 puts(
" (to run a standalone jar file)\n");
389 puts(
"where options include:");
390 puts(
" -d32 use 32-bit data model if available");
391 puts(
" -d64 use 64-bit data model if available");
392 puts(
" -client compatibility (currently ignored)");
393 puts(
" -server compatibility (currently ignored)");
394 puts(
" -jvm compatibility (currently ignored)");
395 puts(
" -hotspot compatibility (currently ignored)\n");
397 puts(
" -cp <path> specify a path to look for classes");
398 puts(
" -classpath <path> specify a path to look for classes");
399 puts(
" -D<name>=<value> add an entry to the property list");
400 puts(
" -verbose[:class|gc|jni] enable specific verbose output");
401 puts(
" -version print product version and exit");
402 puts(
" -fullversion print jpackage-compatible product version and exit");
403 puts(
" -showversion print product version and continue");
404 puts(
" -help, -? print this help message");
405 puts(
" -X print help on non-standard Java options");
406 puts(
" -XX print help on debugging options");
407 puts(
" -ea[:<packagename>...|:<classname>]");
408 puts(
" -enableassertions[:<packagename>...|:<classname>]");
409 puts(
" enable assertions with specified granularity");
410 puts(
" -da[:<packagename>...|:<classname>]");
411 puts(
" -disableassertions[:<packagename>...|:<classname>]");
412 puts(
" disable assertions with specified granularity");
413 puts(
" -esa | -enablesystemassertions");
414 puts(
" enable system assertions");
415 puts(
" -dsa | -disablesystemassertions");
416 puts(
" disable system assertions");
418 #if defined(ENABLE_JVMTI)
419 puts(
" -agentlib:<agent-lib-name>=<options>");
420 puts(
" load native agent library by library name");
421 puts(
" for additional help use: -agentlib:jdwp=help");
422 puts(
" -agentpath:<path-to-agent>=<options>");
423 puts(
" load native agent library by full pathname");
434 #if defined(ENABLE_JIT)
435 puts(
" -Xjit JIT mode execution (default)");
437 #if defined(ENABLE_INTRP)
438 puts(
" -Xint interpreter mode execution");
440 puts(
" -Xbootclasspath:<zip/jar files and directories separated by :>");
441 puts(
" value is set as bootstrap class path");
442 puts(
" -Xbootclasspath/a:<zip/jar files and directories separated by :>");
443 puts(
" value is appended to the bootstrap class path");
444 puts(
" -Xbootclasspath/p:<zip/jar files and directories separated by :>");
445 puts(
" value is prepended to the bootstrap class path");
446 puts(
" -Xbootclasspath/c:<zip/jar files and directories separated by :>");
447 puts(
" value is used as Java core library, but the");
448 puts(
" hardcoded VM interface classes are prepended");
449 printf(
" -Xms<size> set the initial size of the heap (default: %dMB)\n",
HEAP_STARTSIZE / 1024 / 1024);
450 printf(
" -Xmx<size> set the maximum size of the heap (default: %dMB)\n",
HEAP_MAXSIZE / 1024 / 1024);
451 printf(
" -Xss<size> set the thread stack size (default: %dkB)\n",
STACK_SIZE / 1024);
453 #if defined(ENABLE_PROFILING)
454 puts(
" -Xprof[:bb] collect and print profiling data");
464 static void XXusage(
void)
466 puts(
" -v write state-information");
468 puts(
" -verbose:jit enable specific verbose output");
469 puts(
" -debug-color colored output for ANSI terms");
471 #ifdef TYPECHECK_VERBOSE
472 puts(
" -verbosetc write debug messages while typechecking");
474 #if defined(ENABLE_VERIFIER)
475 puts(
" -noverify don't verify classfiles");
477 #if defined(ENABLE_STATISTICS)
478 puts(
" -time measure the runtime");
479 puts(
" -stat detailed compiler statistics");
481 puts(
" -log logfile specify a name for the logfile");
482 puts(
" -c(heck)b(ounds) don't check array bounds");
483 puts(
" s(ync) don't check for synchronization");
484 #if defined(ENABLE_LOOP)
485 puts(
" -oloop optimize array accesses in loops");
487 puts(
" -l don't start the class after loading");
489 puts(
" -s... show...");
490 puts(
" (c)onstants the constant pool");
491 puts(
" (m)ethods class fields and methods");
492 puts(
" (u)tf the utf - hash");
493 puts(
" (i)ntermediate intermediate representation");
494 #if defined(ENABLE_DISASSEMBLER)
495 puts(
" (a)ssembler disassembled listing");
496 puts(
" n(o)ps show NOPs in disassembler output");
498 puts(
" (d)atasegment data segment listing");
500 #if defined(ENABLE_IFCONV)
501 puts(
" -ifconv use if-conversion");
503 #if defined(ENABLE_LSRA)
504 puts(
" -lsra use linear scan register allocation");
506 #if defined(ENABLE_SSA)
507 puts(
" -lsra:... use linear scan register allocation (with SSA)");
508 puts(
" (d)ead code elimination");
509 puts(
" (c)opy propagation");
511 #if defined(ENABLE_DEBUG_FILTER)
512 puts(
" -XXfi <regex> begin of dynamic scope for verbosecall filter");
513 puts(
" -XXfx <regex> end of dynamic scope for verbosecall filter");
514 puts(
" -XXfm <regex> filter for show options");
532 puts(
"CACAO version " VERSION_FULL
"\n");
534 puts(
"Copyright (C) 1996-2014");
535 puts(
"CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO");
536 puts(
"This is free software; see the source for copying conditions. There is NO");
537 puts(
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
568 #define COMPILE_METHOD
570 #define COMPILE_METHOD
573 #if defined(COMPILE_METHOD)
593 JavaVMInitArgs* _vm_args;
596 _vm_args = (JavaVMInitArgs *) vm_args;
600 _vm =
new VM(_vm_args);
615 *p_vm = _vm->get_javavm();
616 *p_env = _vm->get_jnienv();
639 _initializing =
true;
652 #if defined(ENABLE_JNI)
661 #if defined(ENABLE_JNI)
669 char *boot_class_path;
670 char *boot_class_path_p = NULL;
676 #if defined(ENABLE_JNI)
691 os::abort(
"atexit failed: %s\n", strerror(errno));
708 print_build_time_config();
738 #if SIZEOF_VOID_P == 8
739 puts(
"Running a 32-bit JVM is not supported on this platform.");
745 #if SIZEOF_VOID_P == 4
746 puts(
"Running a 64-bit JVM is not supported on this platform.");
756 class_path = (
char*) _properties.get(
"java.class.path");
762 #if defined(ENABLE_JAVASE)
763 _properties.put(
"java.class.path", p);
766 MFREE(class_path,
char, strlen(class_path));
770 for (
unsigned int i = 0;
i < strlen(
opt_arg);
i++) {
790 if (boot_class_path_p != NULL) {
791 MFREE(boot_class_path_p,
char, len);
792 boot_class_path_p = NULL;
795 boot_class_path = (
char*) _properties.get(
"sun.boot.class.path");
801 _properties.put(
"sun.boot.class.path", p);
802 _properties.put(
"java.boot.class.path", p);
804 MFREE(boot_class_path,
char, strlen(boot_class_path));
811 boot_class_path = (
char*) _properties.get(
"sun.boot.class.path");
813 len = strlen(boot_class_path);
816 p = (
char*)
MREALLOC(boot_class_path,
820 strlen(
opt_arg) + strlen(
"0"));
825 _properties.put(
"sun.boot.class.path", p);
826 _properties.put(
"java.boot.class.path", p);
835 if (boot_class_path_p == NULL) {
836 boot_class_path_p =
MNEW(
char, strlen(
opt_arg) + strlen(
"0"));
837 strcpy(boot_class_path_p,
opt_arg);
839 len = strlen(boot_class_path_p);
840 p =
MNEW(
char, strlen(
opt_arg) + strlen(
":") + len + strlen(
"0"));
843 strcat(p, boot_class_path_p);
844 MFREE(boot_class_path_p,
char, len);
845 boot_class_path_p = p;
854 boot_class_path = (
char*) _properties.get(
"sun.boot.class.path");
857 strlen(CACAO_VM_ZIP) +
864 strcpy(p, CACAO_VM_ZIP);
868 _properties.put(
"sun.boot.class.path", p);
869 _properties.put(
"java.boot.class.path", p);
871 MFREE(boot_class_path,
char, strlen(boot_class_path));
874 #if defined(ENABLE_JVMTI)
881 _nativeagents.register_agent_library(
opt_arg, p);
890 _nativeagents.register_agent_path(
opt_arg, p);
899 _nativeagents.register_agent_library(
opt_arg, p);
912 if ((c ==
'k') || (c ==
'K')) {
915 }
else if ((c ==
'm') || (c ==
'M')) {
916 j = atoi(
opt_arg) * 1024 * 1024;
939 if (strcmp(
"class",
opt_arg) == 0) {
942 else if (strcmp(
"gc",
opt_arg) == 0) {
945 else if (strcmp(
"jni",
opt_arg) == 0) {
949 else if (strcmp(
"jit",
opt_arg) == 0) {
966 #if defined(ENABLE_VERIFIER) && defined(TYPECHECK_VERBOSE)
968 opt_typecheckverbose =
true;
985 #if defined(ENABLE_VERIFIER)
996 #if defined(ENABLE_STATISTICS)
998 opt_getcompilingtime =
true;
999 opt_getloadingtime =
true;
1012 for (
unsigned int i = 0;
i < strlen(
opt_arg);
i++) {
1032 for (
unsigned int i = 0;
i < strlen(
opt_arg);
i++) {
1051 #if defined(ENABLE_DISASSEMBLER)
1068 #if defined(ENABLE_LOOP)
1074 #if defined(ENABLE_IFCONV)
1080 #if defined(ENABLE_LSRA)
1085 #if defined(ENABLE_SSA)
1088 for (
unsigned int i = 0;
i < strlen(
opt_arg);
i++) {
1121 #if defined(ENABLE_ASSERTION)
1127 #if defined(ENABLE_ASSERTION)
1133 #if defined(ENABLE_ASSERTION)
1139 #if defined(ENABLE_ASSERTION)
1145 #if defined(ENABLE_ASSERTION)
1151 #if defined(ENABLE_ASSERTION)
1156 #if defined(ENABLE_PROFILING)
1157 case OPT_PROF_OPTION:
1160 for (
unsigned int i = 0, j = 0;
i <= strlen(
opt_arg);
i++) {
1165 if (strcmp(
"bb",
opt_arg + j) == 0)
1169 fprintf(stderr,
"Unknown option: -Xprof:%s\n",
opt_arg + j);
1186 #if defined(ENABLE_JIT)
1189 printf(
"-Xjit option not enabled.\n");
1195 #if defined(ENABLE_INTRP)
1198 printf(
"-Xint option not enabled.\n");
1203 #if defined(ENABLE_INTRP)
1204 case OPT_STATIC_SUPERS:
1205 opt_static_supers = atoi(
opt_arg);
1208 case OPT_NO_DYNAMIC:
1209 opt_no_dynamic =
true;
1212 case OPT_NO_REPLICATION:
1213 opt_no_replication =
true;
1216 case OPT_NO_QUICKSUPER:
1217 opt_no_quicksuper =
true;
1225 #if defined(ENABLE_DEBUG_FILTER)
1240 fprintf(stderr,
"Unknown option: %s\n",
1241 vm_args->options[
opt_index++].optionString);
1248 print_run_time_config();
1262 os::abort(
"vm_create: signal_init failed");
1264 #if defined(ENABLE_INTRP)
1284 #if defined(ENABLE_JVMTI)
1286 if (!_nativeagents.load_agents())
1287 os::abort(
"vm_create: load_agents failed");
1293 if (boot_class_path_p != NULL)
1294 _suckclasspath.add(boot_class_path_p);
1296 _suckclasspath.add_from_property(
"java.endorsed.dirs");
1309 boot_class_path = (
char*) _properties.get(
"sun.boot.class.path");
1310 _suckclasspath.add(boot_class_path);
1316 os::abort(
"vm_create: classcache_init failed");
1327 os::abort(
"vm_create: finalizer_init failed");
1351 #if defined(ENABLE_JIT)
1356 os::abort(
"vm_create: builtin_init failed");
1363 #if defined(ENABLE_JNI)
1369 os::abort(
"vm_create: jni_init failed");
1372 #if defined(ENABLE_JNI) || defined(ENABLE_HANDLES)
1377 os::abort(
"vm_create: localref_table_init failed");
1390 os::abort(
"vm_create: nativevm_init failed");
1392 #if defined(ENABLE_PROFILING)
1396 os::abort(
"vm_create: profile_init failed");
1401 #if defined(__LINUX__)
1403 if (threads_pthreads_implementation_nptl)
1406 os::abort(
"vm_create: signal_start_thread failed");
1411 os::abort(
"vm_create: finalizer_start_thread failed");
1413 #if !defined(NDEBUG)
1418 os::abort(
"vm_create: memory_start_thread failed");
1421 #ifdef ENABLE_THREADS
1425 _recompiler.start();
1428 #if defined(ENABLE_PROFILING)
1442 _initializing =
false;
1453 print_run_time_config();
1456 if (!start_runtime_agents())
1457 os::abort(
"vm_create: start_runtime_agents failed");
1466 puts(
"CACAO " VERSION_FULL
" configure/build options:");
1468 puts(
" ./configure: " VERSION_CONFIGURE_ARGS
"");
1469 #if defined(__VERSION__)
1470 puts(
" CC : " VERSION_CC
" (" __VERSION__
")");
1471 puts(
" CXX : " VERSION_CXX
" (" __VERSION__
")");
1473 puts(
" CC : " VERSION_CC
"");
1474 puts(
" CXX : " VERSION_CXX
"");
1476 puts(
" CFLAGS : " VERSION_CFLAGS
"");
1477 puts(
" CXXFLAGS : " VERSION_CXXFLAGS
"");
1478 puts(
" CPPFLAGS : " VERSION_CPPFLAGS
"");
1482 puts(
"Build-time (default) variables:\n");
1487 #if defined(ENABLE_JRE_LAYOUT)
1491 # if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
1492 puts(
" gnu.classpath.boot.library.path: " JAVA_RUNTIME_LIBRARY_LIBDIR);
1493 puts(
" java.boot.class.path : " CACAO_VM_ZIP
":" JAVA_RUNTIME_LIBRARY_CLASSES);
1494 # elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
1495 puts(
" sun.boot.library.path : " JAVA_RUNTIME_LIBRARY_LIBDIR);
1496 puts(
" java.boot.class.path : " JAVA_RUNTIME_LIBRARY_CLASSES);
1509 puts(
"Run-time variables:\n");
1514 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
1515 printf(
" gnu.classpath.boot.library.path: %s\n", _properties.get(
"gnu.classpath.boot.library.path"));
1516 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
1517 printf(
" sun.boot.library.path : %s\n", _properties.get(
"sun.boot.library.path"));
1520 printf(
" java.boot.class.path : %s\n", _properties.get(
"java.boot.class.path"));
1521 printf(
" java.class.path : %s\n", _properties.get(
"java.class.path"));
1533 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
1537 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
1540 if ((_properties.get(
"com.sun.management.jmxremote") != NULL) ||
1541 (_properties.get(
"com.sun.management.snmp") != NULL))
1569 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
1574 # error unknown classpath configuration
1593 #if !defined(NDEBUG)
1604 char* mainname = NULL;
1606 if (opt_index < vm_args->nOptions) {
1609 mainname = vm_args->options[
opt_index].optionString;
1615 char* p =
MNEW(
char, strlen(mainname) + strlen(
"0"));
1617 strcpy(p, mainname);
1619 #if defined(ENABLE_JAVASE)
1626 for (
unsigned int i = 0;
i < strlen(mainname);
i++)
1627 if (mainname[
i] ==
'.')
1638 if (mainname == NULL)
1641 #if defined(COMPILE_METHOD)
1652 int32_t oalength = vm_args->nOptions -
opt_index;
1659 for (
int i = 0;
i < oalength;
i++) {
1660 char* option = vm_args->options[
opt_index +
i].optionString;
1676 if (mainname == NULL)
1684 #if defined(ENABLE_JAVAME_CLDC1_1)
1694 if ((e != NULL) || (mainclass == NULL)) {
1730 #ifdef TYPEINFO_DEBUG_TEST
1750 os::abort(
"vm_run: Could not detach main thread.");
1776 JavaVMAttachArgs args;
1778 args.name = (
char*)
"DestroyJavaVM";
1818 #if defined(ENABLE_JVMTI)
1864 #
if defined(ENABLE_STATISTICS)
1865 || opt_getcompilingtime || opt_stat
1869 log_text(
"CACAO terminated by shutdown");
1870 dolog(
"Exit status: %d\n", (
s4) status);
1874 #if defined(ENABLE_JVMTI)
1884 #if defined(ENABLE_THREADS)
1905 #if !defined(NDEBUG)
1912 # if defined(ENABLE_PROFILING)
1918 #if defined(ENABLE_CYCLES_STATS)
1924 #
if defined(ENABLE_STATISTICS)
1925 || opt_getcompilingtime || opt_stat
1931 #if 0 && defined(ENABLE_STATISTICS)
1933 #ifdef TYPECHECK_STATISTICS
1935 typecheck_print_statistics(get_logfile());
1945 #if defined(ENABLE_RT_TIMING)
1946 if (!opt_RtTimingLogfile) {
1947 FILE *file = fopen(
"rt-timing.log",
"w");
1951 opt_RtTimingLogfile = file;
1954 assert(opt_RtTimingLogfile);
1956 if (!opt_RtTimingCSV) {
1957 OS <<
"\nreal-time measurment:\n" <<
cacao::nl;
1961 cacao::RTGroup::print_csv_header(OS);
1967 #if defined(ENABLE_STATISTICS)
1968 if (!opt_StatisticsLogfile) {
1969 FILE *file = fopen(
"statistics.log",
"w");
1973 opt_StatisticsLogfile = file;
1976 assert(opt_StatisticsLogfile);
1978 if (!opt_StatisticsCSV) {
1982 cacao::StatGroup::print_csv_header(OS);
2004 #if defined(ENABLE_DISASSEMBLER)
2022 #if defined(ENABLE_DISASSEMBLER)
2027 for (i = 0; i < count; i++)
2049 #if defined(ENABLE_JAVAME_CLDC1_1)
2071 utf8::java_lang_String__void,
2105 fprintf(stderr,
"Could not get manifest from %s (invalid or corrupt jarfile?)\n", mainname);
2128 fprintf(stderr,
"Could not get main attributes from %s (invalid or corrupt jarfile?)\n", mainname);
2153 fprintf(stderr,
"Failed to load Main-Class manifest attribute from\n");
2154 fprintf(stderr,
"%s\n", mainname);
2168 #if !defined(NDEBUG)
2188 for (; nmen; nmen = nmen->
hashlink) {
2191 for (clsen = nmen->
classes; clsen; clsen = clsen->
next) {
2199 fprintf(stderr,
"Error linking: ");
2201 fprintf(stderr,
"\n");
2218 if (m->
jcode != NULL) {
2220 fprintf(stderr,
"Error compiling: ");
2222 fprintf(stderr,
".");
2225 fprintf(stderr,
"\n");
2248 #if defined(COMPILE_METHOD)
2250 #if defined(ENABLE_COMPILER2)
2263 if (mainname == NULL)
2277 if ((e != NULL) || (mainclass == NULL)) {
2304 os::abort(
"vm_compile_method: java.lang.NoSuchMethodException: %s.%s",
2308 #if defined(ENABLE_COMPILER2)
2330 #define VM_CALL_ARRAY(name, type) \
2331 static type vm_call##name##_array(methodinfo *m, uint64_t *array) \
2337 assert(m->code != NULL); \
2339 md = m->parseddesc; \
2340 pv = m->code->entrypoint; \
2342 STATISTICS(count_calls_native_to_java++); \
2344 value = asm_vm_call_method##name(pv, array, md->memuse); \
2355 assert(m->
code != NULL);
2382 #define VM_CALL_METHOD(name, type) \
2383 type vm_call_##name(methodinfo *m, java_handle_t *o, ...) \
2389 value = vm_call_##name##_valist(m, o, ap); \
2409 #define VM_CALL_METHOD_VALIST(name, type) \
2410 type vm_call_method##name##valist(methodinfo *m, java_handle_t *o, \
2416 if (m->code == NULL) \
2417 if (!jit_compile(m)) \
2420 THREAD_NATIVEWORLD_EXIT; \
2422 DumpMemoryArea dma; \
2424 array = argument_vmarray_from_valist(m, o, ap); \
2425 value = vm_call##name##array(m, array); \
2427 THREAD_NATIVEWORLD_ENTER; \
2446 #define VM_CALL_METHOD_JVALUE(name, type) \
2447 type vm_call_method##name##jvalue(methodinfo *m, java_handle_t *o, \
2448 const jvalue *args) \
2453 if (m->code == NULL) \
2454 if (!jit_compile(m)) \
2457 THREAD_NATIVEWORLD_EXIT; \
2459 DumpMemoryArea dma; \
2461 array = argument_vmarray_from_jvalue(m, o, args); \
2462 value = vm_call##name##array(m, array); \
2464 THREAD_NATIVEWORLD_ENTER; \
2497 if (m->code == NULL)
2512 if (array == NULL) {
2522 switch (m->parseddesc->returntype.primitivetype) {
2532 value.
i = vm_call_int_array(m, array);
2536 value.
l = vm_call_long_array(m, array);
2540 value.
f = vm_call_float_array(m, array);
2544 value.
d = vm_call_double_array(m, array);
2552 os::abort(
"vm_call_method_objectarray: invalid return type %d", m->parseddesc->returntype.primitivetype);
2562 ro =
Primitive::box(m->parseddesc->returntype.primitivetype, value);
2590 log_println(
"vm_abort: WARNING, port me to C++ and use os::abort() instead.");
void exceptions_throw_illegalargumentexception(void)
bool localref_table_init(void)
jlong jlong jlong jlong jint jmethodID jint slot
static void write_logfiles()
#define GCMNEW(type, num)
#define STATISTICS(x)
Wrapper for statistics only code.
methodinfo * class_resolveclassmethod(classinfo *c, Utf8String name, Utf8String desc, classinfo *referer, bool throwexception)
void exceptions_print_stacktrace(void)
const JNIInvokeInterface_ _Jv_JNIInvokeInterface
void jvmti_cacaodbgserver_quit()
void gc_init(u4 heapmaxsize, u4 heapstartsize)
void threads_preinit(void)
java_object_t * asm_vm_call_method(void *pv, uint64_t *array, int32_t stackargs)
#define RT_TIMER_STOP(var)
Stop the timer var.
u1 * disassinstr(u1 *code)
#define MSET(ptr, byte, type, num)
void vm_exit_handler(void)
void jvmti_set_phase(jvmtiPhase p)
void linker_preinit(void)
int opt_ProfileGCMemoryUsage
void nativevm_preinit(void)
classinfo * load_class_from_sysloader(Utf8String name)
virtual java_handle_array_t * get_handle() const
void exceptions_throw_nosuchmethoderror(classinfo *c, Utf8String name, Utf8String desc)
static JavaString from_utf8(Utf8String)
int opt_ProfileMemoryUsage
void initialize_init(void)
bool thread_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
Attaches the current thread to the VM.
classcache_class_entry * next
#define THREAD_NATIVEWORLD_EXIT
static void fullversion(void)
Actual implementation of access class for Java Object arrays.
static void print_backtrace()
Print a C backtrace.
void jobjects_register_dyn_offsets()
typedef void(JNICALL *jvmtiEventSingleStep)(jvmtiEnv *jvmti_env
u1 * jit_compile(methodinfo *m)
bool VM_create(JavaVM **p_vm, void **p_env, void *vm_args)
C wrapper for VM::create.
hashtable hashtable_classcache
#define RT_TIMER_START(var)
Start the timer var.
static java_handle_t * vm_call_array(methodinfo *m, uint64_t *array)
void finalizer_join_thread()
MachineCode * compile(methodinfo *m)
classinfo * load_class_bootstrap(Utf8String name)
void trap_init(void)
Mmap the first memory page to support hardware exceptions and check the maximum hardware trap displac...
void utf_fprint_printable_ascii_classname(FILE *file, Utf8String u)
char * opt_CompileSignature
static void vm_compile_method(char *mainname)
java_handle_t * vm_call_method(methodinfo *m, java_handle_t *o,...)
static java_handle_t * box(int type, imm_union value)
Box a primitive of the given type.
void assertion_ea_da(const char *name, bool enabled)
void set_element(int32_t index, T value)
int vm_destroy(JavaVM *vm)
classinfo * class_java_lang_Object
void vm_preinit()
Hook point before the VM is initialized.
Second stage compiler class.
void log_println(const char *text,...)
#define VM_CALL_METHOD_VALIST(name, type)
const char * opt_filter_show_method
void vm_shutdown()
Hook point before the VM is actually destroyed.
const char * opt_filter_verbosecall_exclude
java_handle_t * builtin_new(classinfo *c)
void vm_abort(const char *text,...)
bool assertion_user_enabled
#define LLNI_class_get(obj, variable)
#define VM_CALL_METHOD_JVALUE(name, type)
void codememory_init(void)
JNINativeInterface_ _Jv_JNINativeInterface
void methodtree_init(void)
JNIEnv jthread jmethodID jlocation jobject exception
void options_xx(JavaVMInitArgs *vm_args)
#define RT_REGISTER_TIMER(var, name, description)
Register a new (toplevel) timer.
void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
static void print_build_time_config()
Print build-time (default) VM configuration.
bool opt_showddatasegment
classcache_class_entry * classes
JNIEnv jthread jmethodID method
void exceptions_print_current_exception(void)
static void initialize_table()
Fill the primitive type table with the primitive-type classes, array-classes and wrapper classes...
static void version(bool opt_exit)
Option< bool > enabled("DebugCompiler2","compiler with compiler2", false, option::xx_root())
This file contains the statistics framework.
#define STAT_REGISTER_GROUP_VAR(type, var, init, name, description, group)
Register an statistics variable and add it to a group.
#define VM_CALL_ARRAY(name, type)
void class_showconstantpool(classinfo *c)
Simple stream class for formatted output.
void profile_printstats(void)
Prints profiling statistics gathered during runtime.
void log_vprint(const char *text, va_list ap)
bool finalizer_start_thread()
Properties & get_properties()
#define exceptions_get_and_clear_exception
void loader_load_all_classes(void)
static Utf8String from_utf8(const char *, size_t)
static classinfo * mainclass
void log_init(const char *fname)
void threads_join_all_threads()
void print_run_time_config()
Print run-time VM configuration.
classinfo * class_java_lang_System
bool classcache_init(void)
bool thread_detach_current_thread(void)
Detaches the current thread from the VM.
int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
This file contains the real-time timing utilities.
void utf_fprint_printable_ascii(FILE *file, Utf8String u)
static char * vm_get_mainclass_from_jar(char *mainstring)
java_handle_t * vm_call_method_objectarray(methodinfo *m, java_handle_t *o, java_handle_objectarray_t *params)
classinfo * class_java_lang_String
void vm_init()
Hook point after the VM is initialized.
bool opt_showintermediate
void class_showmethods(classinfo *c)
bool memory_start_thread(void)
void loader_preinit(void)
static void post_initialize_table()
Finish the primitive-type table initialization.
bool assertion_system_enabled
classinfo * link_class(classinfo *c)
#define STAT_DECLARE_GROUP(var)
Declare an external group (or subgroup).
void exceptions_clear_exception(void)
uint64_t * argument_vmarray_from_objectarray(methodinfo *m, java_handle_t *o, java_handle_objectarray_t *params)
static void vm_compile_all(void)
java_handle_t * exceptions_get_exception(void)
void exceptions_throw_noclassdeffounderror_cause(java_handle_t *cause)
static bool create(JavaVM **p_vm, void **p_env, void *vm_args)
Implementation for JNI_CreateJavaVM.
s8 builtin_currenttimemillis(void)
void vm_abort_disassemble(void *pc, int count, const char *text,...)
void exceptions_throw_invocationtargetexception(java_handle_t *cause)
#define MREALLOC(ptr, type, num1, num2)
classcache_name_entry * hashlink
const char * opt_filter_verbosecall_include
#define VM_CALL_METHOD(name, type)
bool start_runtime_agents()
Start runtime agents which are provided by the JRE but need to be started explicitly by the VM...
bool jni_version_check(int version)
VM(JavaVMInitArgs *)
VM constructor.
#define THREAD_NATIVEWORLD_ENTER
bool signal_start_thread(void)
cacaodbgcommunication * dbgcom
#define PRINTF_INTPTR_NUM_HEXDIGITS
#define MFREE(ptr, type, num)
static void put(java_handle_t *p, const char *key, const char *value)
Add the given property to the given Java system properties.
Represent an instance of a VM.
static VM * get_current()