public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Load runtime from Version class. Date: Fri, 30 May 2008 02:48:00 -0000 [thread overview] Message-ID: <20080530024833.29938.qmail@sourceware.org> (raw) The branch, master has been updated via 7b9112dfabcff8ee1eb5903f148300239ff0339b (commit) from eb225d30fd0625138f7940c96ef69dc7904b6ecb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 7b9112dfabcff8ee1eb5903f148300239ff0339b Author: Andrew Cagney <cagney@redhat.com> Date: Thu May 29 22:42:44 2008 -0400 Load runtime from Version class. frysk-common/ChangeLog 2008-05-29 Andrew Cagney <cagney@redhat.com> * Makefile.rules (Runner): Add frysk-sys directory; let JAVA interpreter be overridden. * TestRunner.java-in: Don't load libraries from here. frysk-sys/frysk/config/ChangeLog 2008-05-29 Andrew Cagney <cagney@redhat.com> * Runtime.java (nativeCall): New. * jni/Runtime.cxx: New. * cni/Runtime.cxx: New. * FryskVersion.java: Load runtime environment. ----------------------------------------------------------------------- Summary of changes: frysk-common/ChangeLog | 6 +++++ frysk-common/Makefile.rules | 6 +++- frysk-common/TestRunner.java-in | 6 ----- frysk-sys/frysk/config/ChangeLog | 7 +++++ frysk-sys/frysk/config/FryskVersion.java | 3 ++ frysk-sys/frysk/config/Runtime.java | 37 ++++++++++++++++++----------- frysk-sys/frysk/config/cni/Runtime.cxx | 4 +++ frysk-sys/frysk/config/jni/Runtime.cxx | 4 +++ 8 files changed, 51 insertions(+), 22 deletions(-) First 500 lines of diff: diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog index d28e1f7..6be00bc 100644 --- a/frysk-common/ChangeLog +++ b/frysk-common/ChangeLog @@ -1,3 +1,9 @@ +2008-05-29 Andrew Cagney <cagney@redhat.com> + + * Makefile.rules (Runner): Add frysk-sys directory; let JAVA + interpreter be overridden. + * TestRunner.java-in: Don't load libraries from here. + 2008-05-27 Andrew Cagney <cagney@redhat.com> * Makefile.gen.sh (noinst_DATA): Add TestRunner.jar. diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules index b6ab03e..568866d 100644 --- a/frysk-common/Makefile.rules +++ b/frysk-common/Makefile.rules @@ -388,6 +388,7 @@ $(GEN_SOURCENAME)/JUnitTests.java: files-java.list mv -f $@.tmp $@ \f frysk_imports = $$(cd ../frysk-imports && pwd) +frysk_sys = $$(cd ../frysk-sys && pwd) Runner: rm -f $@ echo "#!/bin/sh" >> $@.tmp @@ -401,7 +402,7 @@ Runner: echo "libunwind-x86_64.so \\" >> $@.tmp echo "\"" >> $@.tmp echo "# hack to hopefully find the right libstdc++.so" >> $@.tmp - echo "export LD_LIBRARY_PATH=.\\" >> $@.tmp + echo "export LD_LIBRARY_PATH=$(frysk_sys)\\" >> $@.tmp echo ":$(frysk_imports)/elfutils/libdw\\" >> $@.tmp echo ":$(frysk_imports)/elfutils/libelf\\" >> $@.tmp echo ":$(frysk_imports)/elfutils/backends\\" >> $@.tmp @@ -413,7 +414,8 @@ Runner: echo ":/usr/lib" >> $@.tmp echo "export CLASSPATH=\\" >> $@.tmp echo "$(CLASSPATH):$(GEN_DIRNAME).jar:TestRunner.jar" >> $@.tmp - echo "gij \"\$$@\"" >> $@.tmp + echo "JAVA=$${JAVA:-gij}" >> $@.tmp + echo "\$${JAVA} \"\$$@\"" >> $@.tmp chmod a+x $@.tmp mv $@.tmp $@ diff --git a/frysk-common/TestRunner.java-in b/frysk-common/TestRunner.java-in index b93c9fa..b3f9eeb 100755 --- a/frysk-common/TestRunner.java-in +++ b/frysk-common/TestRunner.java-in @@ -43,7 +43,6 @@ import frysk.junit.Runner; import @GEN_PACKAGENAME@.JUnitTests; import frysk.config.Prefix; import frysk.config.PrefixFactory; -import frysk.config.Runtime; /** * Run the JUnit tests from within the build tree. @@ -63,9 +62,4 @@ public class TestRunner { int status = testRunner.runTestCases(JUnitTests.get()); System.exit (status); } - static { - // Needs to be done before main, and hence before any - // libraries main needs to load. - Runtime.load(); - } } diff --git a/frysk-sys/frysk/config/ChangeLog b/frysk-sys/frysk/config/ChangeLog index f5a775a..899d178 100644 --- a/frysk-sys/frysk/config/ChangeLog +++ b/frysk-sys/frysk/config/ChangeLog @@ -1,3 +1,10 @@ +2008-05-29 Andrew Cagney <cagney@redhat.com> + + * Runtime.java (nativeCall): New. + * jni/Runtime.cxx: New. + * cni/Runtime.cxx: New. + * FryskVersion.java: Load runtime environment. + 2008-05-27 Andrew Cagney <cagney@redhat.com> * Runtime.java: New. diff --git a/frysk-sys/frysk/config/FryskVersion.java b/frysk-sys/frysk/config/FryskVersion.java index 7f6e12e..6bdfe9d 100644 --- a/frysk-sys/frysk/config/FryskVersion.java +++ b/frysk-sys/frysk/config/FryskVersion.java @@ -44,6 +44,9 @@ package frysk.config; */ public class FryskVersion { + static { + // Needs to be done before initializing V. + Runtime.load(); } private static native String version(); private static final String v = version(); /** diff --git a/frysk-sys/frysk/config/Runtime.java b/frysk-sys/frysk/config/Runtime.java index a5549db..77fe1ff 100644 --- a/frysk-sys/frysk/config/Runtime.java +++ b/frysk-sys/frysk/config/Runtime.java @@ -54,27 +54,42 @@ public class Runtime { public static final Runtime COMPILER_NATIVE_INTERFACE = new Runtime("CNI"); public static final Runtime JAVA_NATIVE_INTERFACE = new Runtime("JNI"); + public static Runtime get() { + return runtime(); + } + private static native Runtime runtime(); - private static boolean tryBindings() { + private static boolean tryNativeCall() { // Try calling a binding, if it works cool. If it fails, // check that it failed on the expected symbol and if that is // wrong abort. try { - runtime(); + nativeCall(); return true; } catch (UnsatisfiedLinkError e) { - if (!e.getMessage().equals("runtime")) { - System.err.println("Problem loading runtime bindings, unexpected error: " + e.toString()); - System.exit(1); + String m = e.getMessage(); + if (m.equals("nativeCall")) { + // Error from GIJ. + return false; + } + if (m.equals("frysk.config.Runtime.nativeCall()V")) { + // Error from IcedTea/OpenJDK. + return false; } - return false; + throw new RuntimeException("Problem loading runtime bindings, unexpected error", e); } } + private static native void nativeCall(); + private static boolean loaded = false; public static void load() { + if (loaded) { + return; + } + loaded = true; // Just try a call, perhaps things have already been loaded so // things will just work. - if (tryBindings()) { + if (tryNativeCall()) { return; } // No such luck, try explicitly loading frysk's JNI runtime. @@ -85,16 +100,10 @@ public class Runtime { + e.getMessage()); System.exit(1); } - if (tryBindings()) { + if (tryNativeCall()) { return; } System.err.println("Problem loading runtime bindings."); System.exit(1); } - - public static Runtime get() { - return runtime(); - } - - private static native Runtime runtime(); } diff --git a/frysk-sys/frysk/config/cni/Runtime.cxx b/frysk-sys/frysk/config/cni/Runtime.cxx index 29150ec..c7b1182 100644 --- a/frysk-sys/frysk/config/cni/Runtime.cxx +++ b/frysk-sys/frysk/config/cni/Runtime.cxx @@ -47,3 +47,7 @@ Runtime* Runtime::runtime() { return COMPILER_NATIVE_INTERFACE; } + +void +Runtime::nativeCall() { +} diff --git a/frysk-sys/frysk/config/jni/Runtime.cxx b/frysk-sys/frysk/config/jni/Runtime.cxx index 9dc8e27..77306c9 100644 --- a/frysk-sys/frysk/config/jni/Runtime.cxx +++ b/frysk-sys/frysk/config/jni/Runtime.cxx @@ -45,3 +45,7 @@ Runtime Runtime::runtime(jnixx::env env) { return GetCOMPILER_NATIVE_INTERFACE(env); } + +void +Runtime::nativeCall(jnixx::env env) { +} hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-05-30 2:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080530024833.29938.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).