You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2006/07/12 22:37:56 UTC
svn commit: r421406 - in /incubator/harmony/enhanced/drlvm/trunk/vm:
include/jni.h vmcore/include/init.h vmcore/src/init/init.h
vmcore/src/init/parse_arguments.cpp vmcore/src/init/vm_main.cpp
vmcore/src/jni/jni.cpp
Author: hindessm
Date: Wed Jul 12 13:37:55 2006
New Revision: 421406
URL: http://svn.apache.org/viewvc?rev=421406&view=rev
Log:
Applied patch from "[#HARMONY-857] Quick impl for invocation API - make drlvm work with classlib launcher".
Added:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h
- copied, changed from r421402, incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/init.h
Removed:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/init.h
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h?rev=421406&r1=421405&r2=421406&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/include/jni.h Wed Jul 12 13:37:55 2006
@@ -1727,4 +1727,17 @@
#endif
};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jint JNICALL JNI_CreateJavaVM(JavaVM **p_vm, JNIEnv **p_env, void *vm_args);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
#endif /* _JNI_H_ */
Copied: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h (from r421402, incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/init.h)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h?p2=incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h&p1=incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/init.h&r1=421402&r2=421406&rev=421406&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/init.h (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/include/init.h Wed Jul 12 13:37:55 2006
@@ -36,4 +36,8 @@
void parse_jit_arguments(JavaVMInitArgs* vm_arguments);
void print_generic_help();
+void create_vm(Global_Env *p_env, JavaVMInitArgs* vm_arguments);
+void destroy_vm(Global_Env *p_env);
+extern Global_Env env;
+
#endif //_INIT_H
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp?rev=421406&r1=421405&r2=421406&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp Wed Jul 12 13:37:55 2006
@@ -277,6 +277,9 @@
else if (strcmp(option, "-XcleanupOnExit") == 0) {
add_pair_to_properties(p_env->properties, "vm.cleanupOnExit", "true");
}
+ else if (strcmp(option, "_org.apache.harmony.vmi.portlib") == 0) {
+ // Ignore _org.apache.harmony.vmi.portlib for now;
+ }
else {
ECHO("Unknown option " << option << USE_JAVA_HELP);
LOGGER_EXIT(1);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp?rev=421406&r1=421405&r2=421406&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_main.cpp Wed Jul 12 13:37:55 2006
@@ -281,7 +281,7 @@
return 0;
} //run_java_shutdown
-static void create_vm(Global_Env *p_env, JavaVMInitArgs* vm_arguments)
+void create_vm(Global_Env *p_env, JavaVMInitArgs* vm_arguments)
{
#ifdef PLATFORM_POSIX
init_linux_thread_system();
@@ -541,7 +541,7 @@
return result;
} //run_main
-static void destroy_vm(Global_Env *p_env)
+void destroy_vm(Global_Env *p_env)
{
assert(p_TLS_vmthread->app_status == thread_is_running);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?rev=421406&r1=421405&r2=421406&view=diff
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Wed Jul 12 13:37:55 2006
@@ -42,6 +42,7 @@
#include "stack_trace.h"
#include "m2n.h"
#include "nogc.h"
+#include "init.h"
#include "Verifier_stub.h"
@@ -1216,11 +1217,30 @@
return (jlong)CallStaticIntMethod(env, bbcl, id, buf);
}
+
+VMEXPORT jint JNICALL JNI_CreateJavaVM(JavaVM **p_vm, JNIEnv **p_env, void *vm_args) {
+ static int called = 0; // this function can only be called once for now;
+
+ init_log_system();
+ TRACE2("jni", "CreateJavaVM called");
+ if (called) {
+ WARN("Java Invoke :: multiple VM instances are not implemented");
+ ASSERT(0, "Not implemented");
+ return JNI_ERR;
+ } else {
+ create_vm(&env, (JavaVMInitArgs *)vm_args);
+ *p_env = &jni_env;
+ *p_vm = jni_env.vm;
+ return JNI_OK;
+ }
+}
+
+
VMEXPORT jint JNICALL DestroyVM(JavaVM*)
{
- WARN("Java Invoke :: DestroyVM not implemented");
- ASSERT(0, "Not implemented");
- return JNI_ERR;
+ TRACE2("jni", "DestroyVM called");
+ destroy_vm(&env);
+ return JNI_OK;
}
VMEXPORT jint JNICALL AttachCurrentThread(JavaVM* vm, void** penv, void* UNREF args)