Makefile.in: Rebuilt.

* Makefile.in: Rebuilt.
	* Makefile.am (CLEANFILES): Don't mention $(class_files).
	(clean-local): New target
	* java/lang/natRuntime.cc: Include <ltdl.h> if required.
	(load, loadLibrary): Now native.
	(init): New method.
	* java/lang/Runtime.java (load, loadLibrary): Now native.
	(init): New native method.
	(Runtime): Use init.
	* prims.cc: Include <ltdl.h> if required.
	(JvRunMain): Call LTDL_SET_PRELOADED_SYMBOLS.

From-SVN: r26785
This commit is contained in:
Tom Tromey 1999-05-05 14:19:24 +00:00 committed by Tom Tromey
parent 8b04083bec
commit 9096b279c2
6 changed files with 94 additions and 16 deletions

View File

@ -1,3 +1,18 @@
1999-05-05 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (CLEANFILES): Don't mention $(class_files).
(clean-local): New target
* java/lang/natRuntime.cc: Include <ltdl.h> if required.
(load, loadLibrary): Now native.
(init): New method.
* java/lang/Runtime.java (load, loadLibrary): Now native.
(init): New native method.
(Runtime): Use init.
* prims.cc: Include <ltdl.h> if required.
(JvRunMain): Call LTDL_SET_PRELOADED_SYMBOLS.
1999-05-05 Gilles Zunino <Gilles.Zunino@hei.fr> 1999-05-05 Gilles Zunino <Gilles.Zunino@hei.fr>
* configure.in: Switch from irix threads to posix threads * configure.in: Switch from irix threads to posix threads

View File

@ -120,7 +120,11 @@ libgcj.zip: $(java_source_files)
$(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/' $(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/'
MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files)
CLEANFILES = libgcj.zip $(class_files) CLEANFILES = libgcj.zip
clean-local:
## We just remove every .class file that was created.
find . -name '*.class' -print | xargs rm -f
SUFFIXES = .class .java .h SUFFIXES = .class .java .h

View File

@ -163,7 +163,7 @@ libgcj_la_LIBADD = $(javao_files) $(nat_files) $(c_files) $(GCOBJS) \
libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) -release $(VERSION) libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) -release $(VERSION)
MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files)
CLEANFILES = libgcj.zip $(class_files) CLEANFILES = libgcj.zip
SUFFIXES = .class .java .h SUFFIXES = .class .java .h
@ -1196,7 +1196,8 @@ mostlyclean: mostlyclean-recursive
clean-am: clean-hdr clean-toolexeclibLTLIBRARIES clean-compile \ clean-am: clean-hdr clean-toolexeclibLTLIBRARIES clean-compile \
clean-libtool clean-binPROGRAMS clean-noinstPROGRAMS \ clean-libtool clean-binPROGRAMS clean-noinstPROGRAMS \
clean-tags clean-depend clean-generic mostlyclean-am clean-tags clean-depend clean-generic mostlyclean-am \
clean-local
clean: clean-recursive clean: clean-recursive
@ -1258,6 +1259,9 @@ libgcj.zip: $(java_source_files)
-@rm -f libgcj.zip -@rm -f libgcj.zip
$(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/' $(ZIP) -r libgcj java gnu -n .class -i '*.class' -i '*/'
clean-local:
find . -name '*.class' -print | xargs rm -f
.class.lo: .class.lo:
$(GCJCOMPILE) -o $@ $< $(GCJCOMPILE) -o $@ $<

View File

@ -94,18 +94,8 @@ public class Runtime
s.checkLink(lib); s.checkLink(lib);
} }
public synchronized void load (String pathname) public native void load (String pathname);
{ public native void loadLibrary (String libname);
checkLink (pathname);
// FIXME.
throw new UnsatisfiedLinkError ("Runtime.load not implemented");
}
public synchronized void loadLibrary (String libname)
{
checkLink (libname);
// FIXME.
throw new UnsatisfiedLinkError ("Runtime.loadLibrary not implemented");
}
public native void runFinalization (); public native void runFinalization ();
@ -122,10 +112,13 @@ public class Runtime
public native void traceInstructions (boolean on); public native void traceInstructions (boolean on);
public native void traceMethodCalls (boolean on); public native void traceMethodCalls (boolean on);
// A helper for the constructor.
private final native void init ();
// The sole constructor. // The sole constructor.
private Runtime () private Runtime ()
{ {
finalize_on_exit = false; init ();
} }
// Private data. // Private data.

View File

@ -15,6 +15,12 @@ details. */
#include <cni.h> #include <cni.h>
#include <jvm.h> #include <jvm.h>
#include <java/lang/Runtime.h> #include <java/lang/Runtime.h>
#include <java/lang/UnknownError.h>
#include <java/lang/UnsatisfiedLinkError.h>
#ifdef USE_LTDL
#include <ltdl.h>
#endif
void void
java::lang::Runtime::exit (jint status) java::lang::Runtime::exit (jint status)
@ -43,6 +49,55 @@ java::lang::Runtime::gc (void)
_Jv_RunGC (); _Jv_RunGC ();
} }
void
java::lang::Runtime::load (jstring path)
{
JvSynchronize sync (this);
checkLink (path);
using namespace java::lang;
#ifdef USE_LTDL
// FIXME: make sure path is absolute.
lt_dlhandle h = lt_dlopen (FIXME);
if (h == NULL)
{
const char *msg = lt_dlerror ();
_Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
}
#else
_Jv_Throw (new UnknownError
(JvNewStringLatin1 ("Runtime.load not implemented")));
#endif /* USE_LTDL */
}
void
java::lang::Runtime::loadLibrary (jstring lib)
{
JvSynchronize sync (this);
checkLink (lib);
using namespace java::lang;
#ifdef USE_LTDL
// FIXME: make sure path is absolute.
lt_dlhandle h = lt_dlopenext (FIXME);
if (h == NULL)
{
const char *msg = lt_dlerror ();
_Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
}
#else
_Jv_Throw (new UnknownError
(JvNewStringLatin1 ("Runtime.loadLibrary not implemented")));
#endif /* USE_LTDL */
}
void
java::lang::Runtime::init (void)
{
finalize_on_exit = false;
#ifdef USE_LTDL
lt_dlinit ();
#endif
}
void void
java::lang::Runtime::runFinalization (void) java::lang::Runtime::runFinalization (void)
{ {

View File

@ -39,6 +39,9 @@ details. */
#include <java/lang/reflect/Modifier.h> #include <java/lang/reflect/Modifier.h>
#include <java/io/PrintStream.h> #include <java/io/PrintStream.h>
#ifdef USE_LTDL
#include <ltdl.h>
#endif
#define ObjectClass _CL_Q34java4lang6Object #define ObjectClass _CL_Q34java4lang6Object
extern java::lang::Class ObjectClass; extern java::lang::Class ObjectClass;
@ -571,6 +574,10 @@ JvRunMain (jclass klass, int argc, const char **argv)
no_memory = new java::lang::OutOfMemoryError; no_memory = new java::lang::OutOfMemoryError;
#ifdef USE_LTDL
LTDL_SET_PRELOADED_SYMBOLS ();
#endif
arg_vec = JvConvertArgv (argc - 1, argv + 1); arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23); main_group = new java::lang::ThreadGroup (23);
main_thread = new java::lang::FirstThread (main_group, klass, arg_vec); main_thread = new java::lang::FirstThread (main_group, klass, arg_vec);