projects
/
cacao.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/vm/vm.cpp: Ignore all unknown options, but report them.
[cacao.git]
/
src
/
vm
/
vm.cpp
diff --git
a/src/vm/vm.cpp
b/src/vm/vm.cpp
index bfff3db1eac8d31050172e627a4fc411d4805567..d57a2ee99d61aa541b6126e6a343781102b272a1 100644
(file)
--- a/
src/vm/vm.cpp
+++ b/
src/vm/vm.cpp
@@
-1,6
+1,6
@@
/* src/vm/vm.cpp - VM startup and shutdown functions
/* src/vm/vm.cpp - VM startup and shutdown functions
- Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
+ Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
, 2010
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
@@
-71,6
+71,7
@@
#include "vm/globals.hpp"
#include "vm/hook.hpp"
#include "vm/initialize.hpp"
#include "vm/globals.hpp"
#include "vm/hook.hpp"
#include "vm/initialize.hpp"
+#include "vm/javaobjects.hpp"
#include "vm/options.h"
#include "vm/os.hpp"
#include "vm/primitive.hpp"
#include "vm/options.h"
#include "vm/os.hpp"
#include "vm/primitive.hpp"
@@
-390,7
+391,7
@@
opt_struct opts[] = {
*******************************************************************************/
*******************************************************************************/
-void usage(void)
+
static
void usage(void)
{
puts("Usage: cacao [-options] classname [arguments]");
puts(" (to run a class file)");
{
puts("Usage: cacao [-options] classname [arguments]");
puts(" (to run a class file)");
@@
-540,9
+541,9
@@
static void XXusage(void)
static void version(bool opt_exit)
{
puts("java version \""JAVA_VERSION"\"");
static void version(bool opt_exit)
{
puts("java version \""JAVA_VERSION"\"");
- puts("CACAO version "VERSION"\n");
+ puts("CACAO version "VERSION
_FULL
"\n");
- puts("Copyright (C) 1996-2005, 2006, 2007, 2008, 2009");
+ puts("Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
, 2010, 2011
");
puts("CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO");
puts("This is free software; see the source for copying conditions. There is NO");
puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
puts("CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO");
puts("This is free software; see the source for copying conditions. There is NO");
puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
@@
-718,7
+719,7
@@
VM::VM(JavaVMInitArgs* vm_args)
is smaller or equal than the assumption made in
src/vm/class.hpp. */
is smaller or equal than the assumption made in
src/vm/class.hpp. */
-
#warning
FIXME We need to check the size of java.lang.Class!!!
+
//
FIXME We need to check the size of java.lang.Class!!!
// if (sizeof(java_lang_Class) > sizeof(dummy_java_lang_Class))
// vm_abort("vm_create: java_lang_Class structure is bigger than classinfo.object (%d > %d)", sizeof(java_lang_Class), sizeof(dummy_java_lang_Class));
// if (sizeof(java_lang_Class) > sizeof(dummy_java_lang_Class))
// vm_abort("vm_create: java_lang_Class structure is bigger than classinfo.object (%d > %d)", sizeof(java_lang_Class), sizeof(dummy_java_lang_Class));
@@
-1168,7
+1169,7
@@
VM::VM(JavaVMInitArgs* vm_args)
opt_prof_bb = true;
else {
opt_prof_bb = true;
else {
-
printf(
"Unknown option: -Xprof:%s\n", opt_arg + j);
+
fprintf(stderr,
"Unknown option: -Xprof:%s\n", opt_arg + j);
usage();
}
usage();
}
@@
-1239,9
+1240,8
@@
VM::VM(JavaVMInitArgs* vm_args)
#endif
default:
#endif
default:
- printf("Unknown option: %s\n",
- vm_args->options[opt_index].optionString);
- usage();
+ fprintf(stderr, "Unknown option: %s\n",
+ vm_args->options[opt_index++].optionString);
}
}
}
}
@@
-1284,6
+1284,9
@@
VM::VM(JavaVMInitArgs* vm_args)
utf8_init();
utf8_init();
+ // Hook point before the VM is initialized.
+ Hook::vm_preinit();
+
#if defined(ENABLE_JVMTI)
// AFTER: utf8_init
if (!_nativeagents.load_agents())
#if defined(ENABLE_JVMTI)
// AFTER: utf8_init
if (!_nativeagents.load_agents())
@@
-1344,6
+1347,7
@@
VM::VM(JavaVMInitArgs* vm_args)
Primitive::initialize_table();
loader_init();
Primitive::initialize_table();
loader_init();
+ jobjects_register_dyn_offsets();
linker_init();
// AFTER: loader_init, linker_init
linker_init();
// AFTER: loader_init, linker_init
@@
-1468,7
+1472,7
@@
VM::VM(JavaVMInitArgs* vm_args)
*/
void VM::print_build_time_config(void)
{
*/
void VM::print_build_time_config(void)
{
- puts("CACAO "VERSION" configure/build options:");
+ puts("CACAO "VERSION
_FULL
" configure/build options:");
puts("");
puts(" ./configure: "VERSION_CONFIGURE_ARGS"");
#if defined(__VERSION__)
puts("");
puts(" ./configure: "VERSION_CONFIGURE_ARGS"");
#if defined(__VERSION__)
@@
-1786,10
+1790,12
@@
int vm_destroy(JavaVM *vm)
threads_join_all_threads();
#endif
threads_join_all_threads();
#endif
+ // Hook point before the VM is actually destroyed.
+ Hook::vm_shutdown();
+
/* VM is gone. */
// _created = false;
/* VM is gone. */
// _created = false;
-#warning Move to C++
/* Everything is ok. */
/* Everything is ok. */
@@
-1810,7
+1816,6
@@
void vm_exit(s4 status)
/* signal that we are exiting */
// _exiting = true;
/* signal that we are exiting */
// _exiting = true;
-#warning Move to C++
assert(class_java_lang_System);
assert(class_java_lang_System->state & CLASS_LOADED);
assert(class_java_lang_System);
assert(class_java_lang_System->state & CLASS_LOADED);
@@
-2508,11
+2513,7
@@
java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o,
extern "C" {
extern "C" {
-JavaVM* VM_get_javavm() { return VM::get_current()->get_javavm(); }
JNIEnv* VM_get_jnienv() { return VM::get_current()->get_jnienv(); }
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, ...)
{
void vm_abort(const char* text, ...)
{