#include "vm/finalizer.hpp"
#include "vm/global.h"
#include "vm/globals.hpp"
+#include "vm/hook.hpp"
#include "vm/initialize.hpp"
#include "vm/options.h"
#include "vm/os.hpp"
*******************************************************************************/
-void usage(void)
+static void usage(void)
{
puts("Usage: cacao [-options] classname [arguments]");
puts(" (to run a class file)");
utf8_init();
+ // Hook point before the VM is initialized.
+ Hook::vm_preinit();
+
#if defined(ENABLE_JVMTI)
// AFTER: utf8_init
if (!_nativeagents.load_agents())
// Set the VM inittime.
_inittime = builtin_currenttimemillis();
+ // Hook point after the VM is initialized.
+ Hook::vm_init();
+
// Print the run-time VM configuration after all stuff is set and
// the VM is initialized.
if (opt_PrintConfig)
threads_join_all_threads();
#endif
+ // Hook point before the VM is actually destroyed.
+ Hook::vm_shutdown();
+
/* VM is gone. */
// _created = false;
extern "C" {
-JavaVM* VM_get_javavm() { return VM::get_current()->get_javavm(); }
JNIEnv* VM_get_jnienv() { return VM::get_current()->get_jnienv(); }
-bool VM_is_initializing() { return VM::get_current()->is_initializing(); }
-bool VM_is_created() { return VM::get_current()->is_created(); }
-int64_t VM_get_starttime() { return VM::get_current()->get_starttime(); }
void vm_abort(const char* text, ...)
{