+ print_run_time_config();
+
+ // Start runtime agents after the VM is created.
+ if (!start_runtime_agents())
+ os::abort("vm_create: start_runtime_agents failed");
+}
+
+
+/**
+ * Print build-time (default) VM configuration.
+ */
+void VM::print_build_time_config(void)
+{
+ puts("CACAO "VERSION_FULL" configure/build options:");
+ puts("");
+ puts(" ./configure: "VERSION_CONFIGURE_ARGS"");
+#if defined(__VERSION__)
+ puts(" CC : "VERSION_CC" ("__VERSION__")");
+ puts(" CXX : "VERSION_CXX" ("__VERSION__")");
+#else
+ puts(" CC : "VERSION_CC"");
+ puts(" CXX : "VERSION_CXX"");
+#endif
+ puts(" CFLAGS : "VERSION_CFLAGS"");
+ puts(" CXXFLAGS : "VERSION_CXXFLAGS"");
+
+ puts("");
+
+ puts("Build-time (default) variables:\n");
+ printf(" maximum heap size : %d\n", HEAP_MAXSIZE);
+ printf(" initial heap size : %d\n", HEAP_STARTSIZE);
+ printf(" stack size : %d\n", STACK_SIZE);
+
+#if defined(ENABLE_JRE_LAYOUT)
+ // When we're building with JRE-layout, the default paths are the
+ // same as the runtime paths.
+#else
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+ puts(" gnu.classpath.boot.library.path: "JAVA_RUNTIME_LIBRARY_LIBDIR);
+ puts(" java.boot.class.path : "CACAO_VM_ZIP":"JAVA_RUNTIME_LIBRARY_CLASSES"");
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+ puts(" sun.boot.library.path : "JAVA_RUNTIME_LIBRARY_LIBDIR);
+ puts(" java.boot.class.path : "JAVA_RUNTIME_LIBRARY_CLASSES);
+# endif
+#endif
+
+ puts("");
+}
+
+
+/**
+ * Print run-time VM configuration.
+ */
+void VM::print_run_time_config()
+{
+ puts("Run-time variables:\n");
+ printf(" maximum heap size : %d\n", opt_heapmaxsize);
+ printf(" initial heap size : %d\n", opt_heapstartsize);
+ printf(" stack size : %d\n", opt_stacksize);
+
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+ printf(" gnu.classpath.boot.library.path: %s\n", _properties.get("gnu.classpath.boot.library.path"));
+#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+ printf(" sun.boot.library.path : %s\n", _properties.get("sun.boot.library.path"));
+#endif
+
+ printf(" java.boot.class.path : %s\n", _properties.get("java.boot.class.path"));
+ printf(" java.class.path : %s\n", _properties.get("java.class.path"));
+
+ puts("");
+}
+
+
+/**
+ * Start runtime agents which are provided by the JRE but need to be
+ * started explicitly by the VM.
+ */
+bool VM::start_runtime_agents()
+{
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+
+ // Nothing to do.
+
+#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+
+ // Check whether the management agent should be loaded.
+ if ((_properties.get("com.sun.management.jmxremote") != NULL) ||
+ (_properties.get("com.sun.management.snmp") != NULL))
+ {
+
+ // Load the management agent class.
+ classinfo* class_sun_management_Agent;
+ if (!(class_sun_management_Agent = load_class_from_sysloader(utf_new_char("sun/management/Agent"))))
+ return false;
+
+ // Link the management agent class.
+ if (!link_class(class_sun_management_Agent))
+ return false;
+
+ // Actually start the management agent.
+ methodinfo* m = class_resolveclassmethod(class_sun_management_Agent,
+ utf_new_char("startAgent"),
+ utf_void__void,
+ class_java_lang_Object,
+ false);
+
+ if (m == NULL)
+ return false;
+
+ (void) vm_call_method(m, NULL);
+
+ if (exceptions_get_exception() != NULL)
+ return false;
+ }
+
+#elif defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
+
+ // Nothing to do.
+
+#else
+# error unknown classpath configuration
+#endif
+
+ return true;