aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2006-06-20 19:25:32 +0000
committerThomas Fitzsimmons <fitzsim@gcc.gnu.org>2006-06-20 19:25:32 +0000
commitfb5b5d977f7ea0fbbdf67380c5b4c114328994b7 (patch)
tree0045d406677ce30008114e5f5c2fe72d66197382
parent0ccff66da6bfbd08891576a1074e6ef46f252a15 (diff)
downloadgcc-fb5b5d977f7ea0fbbdf67380c5b4c114328994b7.zip
gcc-fb5b5d977f7ea0fbbdf67380c5b4c114328994b7.tar.gz
gcc-fb5b5d977f7ea0fbbdf67380c5b4c114328994b7.tar.bz2
Makefile.am (AM_CXXFLAGS): Define GCJ_VERSIONED_LIBDIR to "$(dbexecdir)".
2006-06-20 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (AM_CXXFLAGS): Define GCJ_VERSIONED_LIBDIR to "$(dbexecdir)". Build libjvm.la. * Makefile.in: Regenerate. * jni.cc (the_vm): Rename and export as ... (_Jv_the_vm): New exported symbol. (_Jv_JNI_AttachCurrentThread): Export. (_Jv_JNI_DestroyJavaVM): Replace the_vm references with _Jv_the_vm references. (_Jv_GetJavaVM): Likewise. (JNI_GetDefaultJavaVMInitArgs, JNI_CreateJavaVM, JNI_GetCreatedJavaVMs): Move to ... * jni-libjvm.cc: New file. From-SVN: r114824
-rw-r--r--libjava/ChangeLog16
-rw-r--r--libjava/Makefile.am13
-rw-r--r--libjava/Makefile.in125
-rw-r--r--libjava/jni-libjvm.cc89
-rw-r--r--libjava/jni.cc80
5 files changed, 208 insertions, 115 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 92ed467..0be4911 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,19 @@
+2006-06-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * Makefile.am (AM_CXXFLAGS): Define GCJ_VERSIONED_LIBDIR to
+ "$(dbexecdir)".
+ Build libjvm.la.
+ * Makefile.in: Regenerate.
+ * jni.cc (the_vm): Rename and export as ...
+ (_Jv_the_vm): New exported symbol.
+ (_Jv_JNI_AttachCurrentThread): Export.
+ (_Jv_JNI_DestroyJavaVM): Replace the_vm references with _Jv_the_vm
+ references.
+ (_Jv_GetJavaVM): Likewise.
+ (JNI_GetDefaultJavaVMInitArgs, JNI_CreateJavaVM,
+ JNI_GetCreatedJavaVMs): Move to ...
+ * jni-libjvm.cc: New file.
+
2006-06-19 Andrew Haley <aph@redhat.com>
* testsuite/libjava.lang/PR27908.out: New.
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index d3a6376..b7221b5 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -40,6 +40,8 @@ if XLIB_AWT
toolexeclib_LTLIBRARIES += lib-gnu-awt-xlib.la
endif
+dbexec_LTLIBRARIES = libjvm.la
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgcj.pc
@@ -122,7 +124,7 @@ AM_CXXFLAGS = \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
-DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \
-DGCJ_ENDORSED_DIRS="\"$(jardir)/gcj-endorsed\"" \
- -DGCJ_VERSIONED_LIBDIR="\"$(libdir)/gcj-$(gcc_version)\"" \
+ -DGCJ_VERSIONED_LIBDIR="\"$(dbexecdir)\"" \
-DPATH_SEPARATOR="\"$(CLASSPATH_SEPARATOR)\"" \
-DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\"" \
-DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"$(db_pathtail)\"" \
@@ -232,6 +234,14 @@ libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar \
$(LIBLTDL) $(libgcj_la_LIBADD)
libgcj_la_LINK = $(LIBLINK)
+## libjvm.so
+libjvm_la_SOURCES = jni-libjvm.cc
+libjvm_la_DEPENDENCIES = libgcj.la libgcj.spec
+## See jv_convert_LDADD.
+libjvm_la_LIBADD = -L$(here)/.libs libgcj.la
+## The mysterious backslash in the grep pattern is consumed by make.
+libjvm_la_LDFLAGS = -rpath $(toolexeclibdir) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
## The .db file. This rule is only used for native builds, so it is
## safe to invoke gcj-dbtool.
@@ -887,6 +897,7 @@ create-headers: $(headers_to_make)
$(libgcj_la_OBJECTS) $(gcj_dbtool_OBJECTS) $(xlib_nat_files): headers.stamp
$(libgij_la_OBJECTS): headers.stamp
+$(libjvm_la_OBJECTS): headers.stamp
## ################################################################
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index ff66c74..5d4c196 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -104,12 +104,14 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bindir)" \
+am__installdirs = "$(DESTDIR)$(dbexecdir)" \
+ "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(dbexecdir)" \
"$(DESTDIR)$(jardir)" "$(DESTDIR)$(pkgconfigdir)" \
"$(DESTDIR)$(toolexecmainlibdir)"
+dbexecLTLIBRARIES_INSTALL = $(INSTALL)
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+LTLIBRARIES = $(dbexec_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
am__dirstamp = $(am__leading_dot)dirstamp
am__objects_1 = gnu/gcj/xlib/lib_gnu_awt_xlib_la-natClip.lo \
gnu/gcj/xlib/lib_gnu_awt_xlib_la-natColormap.lo \
@@ -343,6 +345,8 @@ am_libgcj_la_OBJECTS = prims.lo jni.lo exception.lo stacktrace.lo \
libgcj_la_OBJECTS = $(am_libgcj_la_OBJECTS)
am_libgij_la_OBJECTS = gij.lo
libgij_la_OBJECTS = $(am_libgij_la_OBJECTS)
+am_libjvm_la_OBJECTS = jni-libjvm.lo
+libjvm_la_OBJECTS = $(am_libjvm_la_OBJECTS)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_gcj_dbtool_OBJECTS = gnu/gcj/tools/gcj_dbtool/Main.$(OBJEXT) \
@@ -388,14 +392,14 @@ LTGCJCOMPILE = $(LIBTOOL) --mode=compile $(GCJ) $(AM_GCJFLAGS) \
$(GCJFLAGS)
GCJLD = $(GCJ)
SOURCES = $(lib_gnu_awt_xlib_la_SOURCES) $(libgcj_la_SOURCES) \
- $(libgij_la_SOURCES) $(gcj_dbtool_SOURCES) \
- $(gen_from_JIS_SOURCES) $(gij_SOURCES) $(grmic_SOURCES) \
- $(grmiregistry_SOURCES) $(jv_convert_SOURCES)
+ $(libgij_la_SOURCES) $(libjvm_la_SOURCES) \
+ $(gcj_dbtool_SOURCES) $(gen_from_JIS_SOURCES) $(gij_SOURCES) \
+ $(grmic_SOURCES) $(grmiregistry_SOURCES) $(jv_convert_SOURCES)
DIST_SOURCES = $(lib_gnu_awt_xlib_la_SOURCES) \
$(am__libgcj_la_SOURCES_DIST) $(libgij_la_SOURCES) \
- $(gcj_dbtool_SOURCES) $(am__gen_from_JIS_SOURCES_DIST) \
- $(gij_SOURCES) $(grmic_SOURCES) $(grmiregistry_SOURCES) \
- $(jv_convert_SOURCES)
+ $(libjvm_la_SOURCES) $(gcj_dbtool_SOURCES) \
+ $(am__gen_from_JIS_SOURCES_DIST) $(gij_SOURCES) \
+ $(grmic_SOURCES) $(grmiregistry_SOURCES) $(jv_convert_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
@@ -662,6 +666,7 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) $(foreach o
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
toolexeclib_LTLIBRARIES = libgcj.la libgij.la $(am__append_2)
toolexecmainlib_DATA = libgcj.spec
+dbexec_LTLIBRARIES = libjvm.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgcj.pc
jardir = $(datadir)/java
@@ -701,7 +706,7 @@ AM_CXXFLAGS = \
-DBOOT_CLASS_PATH="\"$(BOOT_CLASS_PATH_DIR)\"" \
-DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \
-DGCJ_ENDORSED_DIRS="\"$(jardir)/gcj-endorsed\"" \
- -DGCJ_VERSIONED_LIBDIR="\"$(libdir)/gcj-$(gcc_version)\"" \
+ -DGCJ_VERSIONED_LIBDIR="\"$(dbexecdir)\"" \
-DPATH_SEPARATOR="\"$(CLASSPATH_SEPARATOR)\"" \
-DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\"" \
-DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"$(db_pathtail)\"" \
@@ -762,6 +767,12 @@ libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar \
$(LIBLTDL) $(libgcj_la_LIBADD)
libgcj_la_LINK = $(LIBLINK)
+libjvm_la_SOURCES = jni-libjvm.cc
+libjvm_la_DEPENDENCIES = libgcj.la libgcj.spec
+libjvm_la_LIBADD = -L$(here)/.libs libgcj.la
+libjvm_la_LDFLAGS = -rpath $(toolexeclibdir) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
+
lib_gnu_awt_xlib_la_SOURCES = $(xlib_nat_source_files)
lib_gnu_awt_xlib_la_LIBADD = gnu/awt/xlib.lo gnu/gcj/xlib.lo
lib_gnu_awt_xlib_la_DEPENDENCIES = libgcj-$(gcc_version).jar \
@@ -7210,6 +7221,33 @@ libgcj-test.spec: $(top_builddir)/config.status $(srcdir)/libgcj-test.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
scripts/jar: $(top_builddir)/config.status $(top_srcdir)/scripts/jar.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+install-dbexecLTLIBRARIES: $(dbexec_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(dbexecdir)" || $(mkdir_p) "$(DESTDIR)$(dbexecdir)"
+ @list='$(dbexec_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(dbexecLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(dbexecdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(dbexecLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(dbexecdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-dbexecLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(dbexec_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(dbexecdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(dbexecdir)/$$p"; \
+ done
+
+clean-dbexecLTLIBRARIES:
+ -test -z "$(dbexec_LTLIBRARIES)" || rm -f $(dbexec_LTLIBRARIES)
+ @list='$(dbexec_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)"
@@ -7572,6 +7610,8 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
$(libgcj_la_LINK) -rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(libgcj_la_OBJECTS) $(libgcj_la_LIBADD) $(LIBS)
libgij.la: $(libgij_la_OBJECTS) $(libgij_la_DEPENDENCIES)
$(CXXLINK) -rpath $(toolexeclibdir) $(libgij_la_LDFLAGS) $(libgij_la_OBJECTS) $(libgij_la_LIBADD) $(LIBS)
+libjvm.la: $(libjvm_la_OBJECTS) $(libjvm_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(dbexecdir) $(libjvm_la_LDFLAGS) $(libjvm_la_OBJECTS) $(libjvm_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
@@ -7842,6 +7882,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gij.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jni-libjvm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jni.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/no-threads.Plo@am__quote@
@@ -8532,7 +8573,7 @@ check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA)
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(dbexecdir)" "$(DESTDIR)$(jardir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(toolexecmainlibdir)"; do \
+ for dir in "$(DESTDIR)$(dbexecdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(dbexecdir)" "$(DESTDIR)$(jardir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(toolexecmainlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
@@ -8611,9 +8652,9 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
-clean-am: clean-binPROGRAMS clean-generic clean-libtool \
- clean-noinstPROGRAMS clean-toolexeclibLTLIBRARIES \
- mostlyclean-am
+clean-am: clean-binPROGRAMS clean-dbexecLTLIBRARIES clean-generic \
+ clean-libtool clean-noinstPROGRAMS \
+ clean-toolexeclibLTLIBRARIES mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -8636,8 +8677,8 @@ install-data-am: install-data-local install-jarDATA \
install-pkgconfigDATA
install-exec-am: install-binPROGRAMS install-binSCRIPTS \
- install-dbexecDATA install-toolexeclibLTLIBRARIES \
- install-toolexecmainlibDATA
+ install-dbexecDATA install-dbexecLTLIBRARIES \
+ install-toolexeclibLTLIBRARIES install-toolexecmainlibDATA
install-info: install-info-recursive
@@ -8666,36 +8707,37 @@ ps: ps-recursive
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
- uninstall-dbexecDATA uninstall-info-am uninstall-jarDATA \
- uninstall-pkgconfigDATA uninstall-toolexeclibLTLIBRARIES \
- uninstall-toolexecmainlibDATA
+ uninstall-dbexecDATA uninstall-dbexecLTLIBRARIES \
+ uninstall-info-am uninstall-jarDATA uninstall-pkgconfigDATA \
+ uninstall-toolexeclibLTLIBRARIES uninstall-toolexecmainlibDATA
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
- check-am clean clean-binPROGRAMS clean-generic clean-libtool \
- clean-noinstPROGRAMS clean-recursive \
- clean-toolexeclibLTLIBRARIES ctags ctags-recursive dist \
- dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \
- distcheck distclean distclean-compile distclean-generic \
- distclean-libtool distclean-local distclean-recursive \
- distclean-tags distcleancheck distdir distuninstallcheck dvi \
- dvi-am html html-am info info-am install install-am \
- install-binPROGRAMS install-binSCRIPTS install-data \
- install-data-am install-data-local install-dbexecDATA \
- install-exec install-exec-am install-info install-info-am \
- install-jarDATA install-man install-pkgconfigDATA \
- install-strip install-toolexeclibLTLIBRARIES \
- install-toolexecmainlibDATA installcheck installcheck-am \
- installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic maintainer-clean-recursive \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool mostlyclean-local mostlyclean-recursive \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
- uninstall-binPROGRAMS uninstall-binSCRIPTS \
- uninstall-dbexecDATA uninstall-info-am uninstall-jarDATA \
- uninstall-pkgconfigDATA uninstall-toolexeclibLTLIBRARIES \
- uninstall-toolexecmainlibDATA
+ check-am clean clean-binPROGRAMS clean-dbexecLTLIBRARIES \
+ clean-generic clean-libtool clean-noinstPROGRAMS \
+ clean-recursive clean-toolexeclibLTLIBRARIES ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-local \
+ distclean-recursive distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-binSCRIPTS \
+ install-data install-data-am install-data-local \
+ install-dbexecDATA install-dbexecLTLIBRARIES install-exec \
+ install-exec-am install-info install-info-am install-jarDATA \
+ install-man install-pkgconfigDATA install-strip \
+ install-toolexeclibLTLIBRARIES install-toolexecmainlibDATA \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-local \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-binSCRIPTS uninstall-dbexecDATA \
+ uninstall-dbexecLTLIBRARIES uninstall-info-am \
+ uninstall-jarDATA uninstall-pkgconfigDATA \
+ uninstall-toolexeclibLTLIBRARIES uninstall-toolexecmainlibDATA
$(db_name): gcj-dbtool$(EXEEXT)
@@ -11273,6 +11315,7 @@ create-headers: $(headers_to_make)
$(libgcj_la_OBJECTS) $(gcj_dbtool_OBJECTS) $(xlib_nat_files): headers.stamp
$(libgij_la_OBJECTS): headers.stamp
+$(libjvm_la_OBJECTS): headers.stamp
# No install-html support yet.
.PHONY: install-html
diff --git a/libjava/jni-libjvm.cc b/libjava/jni-libjvm.cc
new file mode 100644
index 0000000..d0c3036
--- /dev/null
+++ b/libjava/jni-libjvm.cc
@@ -0,0 +1,89 @@
+// jni-libjvm.cc - an implementation of the JNI invocation API.
+
+/* Copyright (C) 2006 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <gcj/cni.h>
+#include <gcj/javaprims.h>
+#include <java-assert.h>
+#include <jvm.h>
+#include <jni.h>
+
+using namespace gcj;
+
+// Forward declarations.
+extern struct JNIInvokeInterface _Jv_JNI_InvokeFunctions;
+extern jint JNICALL _Jv_JNI_AttachCurrentThread (JavaVM *vm,
+ void **penv, void *args);
+extern JavaVM *_Jv_the_vm;
+
+jint JNICALL
+JNI_GetDefaultJavaVMInitArgs (void *args)
+{
+ jint version = * (jint *) args;
+ // Here we only support 1.2 and 1.4.
+ if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4)
+ return JNI_EVERSION;
+
+ JavaVMInitArgs *ia = reinterpret_cast<JavaVMInitArgs *> (args);
+ ia->version = JNI_VERSION_1_4;
+ ia->nOptions = 0;
+ ia->options = NULL;
+ ia->ignoreUnrecognized = true;
+
+ return 0;
+}
+
+jint JNICALL
+JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
+{
+ JvAssert (! _Jv_the_vm);
+
+ jint version = * (jint *) args;
+ // We only support 1.2 and 1.4.
+ if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4)
+ return JNI_EVERSION;
+
+ JvVMInitArgs* vm_args = reinterpret_cast<JvVMInitArgs *> (args);
+
+ jint result = _Jv_CreateJavaVM (vm_args);
+ if (result)
+ return result;
+
+ // FIXME: synchronize
+ JavaVM *nvm = (JavaVM *) _Jv_MallocUnchecked (sizeof (JavaVM));
+ if (nvm == NULL)
+ return JNI_ERR;
+ nvm->functions = &_Jv_JNI_InvokeFunctions;
+
+ jint r =_Jv_JNI_AttachCurrentThread (nvm, penv, NULL);
+ if (r < 0)
+ return r;
+
+ _Jv_the_vm = nvm;
+ *vm = _Jv_the_vm;
+
+ return 0;
+}
+
+jint JNICALL
+JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize buf_len, jsize *n_vms)
+{
+ if (buf_len <= 0)
+ return JNI_ERR;
+
+ // We only support a single VM.
+ if (_Jv_the_vm != NULL)
+ {
+ vm_buffer[0] = _Jv_the_vm;
+ *n_vms = 1;
+ }
+ else
+ *n_vms = 0;
+ return 0;
+}
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 62a96ce..19539c7 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -107,7 +107,7 @@ static java::util::IdentityHashMap *local_ref_table;
static java::util::IdentityHashMap *global_ref_table;
// The only VM.
-static JavaVM *the_vm;
+JavaVM *_Jv_the_vm;
#ifdef ENABLE_JVMPI
// The only JVMPI interface description.
@@ -2408,7 +2408,7 @@ _Jv_JNI_AttachCurrentThread (JavaVM *, jstring name, void **penv,
}
// This is the one actually used by JNI.
-static jint JNICALL
+jint JNICALL
_Jv_JNI_AttachCurrentThread (JavaVM *vm, void **penv, void *args)
{
return _Jv_JNI_AttachCurrentThread (vm, NULL, penv, args, false);
@@ -2424,7 +2424,7 @@ _Jv_JNI_AttachCurrentThreadAsDaemon (JavaVM *vm, void **penv,
static jint JNICALL
_Jv_JNI_DestroyJavaVM (JavaVM *vm)
{
- JvAssert (the_vm && vm == the_vm);
+ JvAssert (_Jv_the_vm && vm == _Jv_the_vm);
union
{
@@ -2496,82 +2496,16 @@ _Jv_JNI_GetEnv (JavaVM *, void **penv, jint version)
return 0;
}
-jint JNICALL
-JNI_GetDefaultJavaVMInitArgs (void *args)
-{
- jint version = * (jint *) args;
- // Here we only support 1.2 and 1.4.
- if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4)
- return JNI_EVERSION;
-
- JavaVMInitArgs *ia = reinterpret_cast<JavaVMInitArgs *> (args);
- ia->version = JNI_VERSION_1_4;
- ia->nOptions = 0;
- ia->options = NULL;
- ia->ignoreUnrecognized = true;
-
- return 0;
-}
-
-jint JNICALL
-JNI_CreateJavaVM (JavaVM **vm, void **penv, void *args)
-{
- JvAssert (! the_vm);
-
- jint version = * (jint *) args;
- // We only support 1.2 and 1.4.
- if (version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4)
- return JNI_EVERSION;
-
- JvVMInitArgs* vm_args = reinterpret_cast<JvVMInitArgs *> (args);
-
- jint result = _Jv_CreateJavaVM (vm_args);
- if (result)
- return result;
-
- // FIXME: synchronize
- JavaVM *nvm = (JavaVM *) _Jv_MallocUnchecked (sizeof (JavaVM));
- if (nvm == NULL)
- return JNI_ERR;
- nvm->functions = &_Jv_JNI_InvokeFunctions;
-
- jint r =_Jv_JNI_AttachCurrentThread (nvm, penv, NULL);
- if (r < 0)
- return r;
-
- the_vm = nvm;
- *vm = the_vm;
-
- return 0;
-}
-
-jint JNICALL
-JNI_GetCreatedJavaVMs (JavaVM **vm_buffer, jsize buf_len, jsize *n_vms)
-{
- if (buf_len <= 0)
- return JNI_ERR;
-
- // We only support a single VM.
- if (the_vm != NULL)
- {
- vm_buffer[0] = the_vm;
- *n_vms = 1;
- }
- else
- *n_vms = 0;
- return 0;
-}
-
JavaVM *
_Jv_GetJavaVM ()
{
// FIXME: synchronize
- if (! the_vm)
+ if (! _Jv_the_vm)
{
JavaVM *nvm = (JavaVM *) _Jv_MallocUnchecked (sizeof (JavaVM));
if (nvm != NULL)
nvm->functions = &_Jv_JNI_InvokeFunctions;
- the_vm = nvm;
+ _Jv_the_vm = nvm;
}
// If this is a Java thread, we want to make sure it has an
@@ -2579,10 +2513,10 @@ _Jv_GetJavaVM ()
if (_Jv_ThreadCurrent () != NULL)
{
void *ignore;
- _Jv_JNI_AttachCurrentThread (the_vm, &ignore, NULL);
+ _Jv_JNI_AttachCurrentThread (_Jv_the_vm, &ignore, NULL);
}
- return the_vm;
+ return _Jv_the_vm;
}
static jint JNICALL