Eliminate use of C++ static constructors.

* interpret.cc: Remove static Utf8Consts. Use namespace gcj.
	* jni.cc: Likewise.
	* resolve.cc: Likewise.
	* defineclass.cc: Likewise.
	(_Jv_ClassReader::handleClassBegin): Synchronize call to
	_Jv_RegisterClass.
	* include/jvm.h (void_signature, clinit_name, init_name, finit_name):
	Declare in namespace gcj.
	* java/lang/Class.h (Class): Remove initialization for primitive
	types.
	(friend void _Jv_InitPrimClass): This is in prims.cc.
	* prims.cc (_Jv_InitPrimClass): Do primitive type initialization
	here instead.
	(void_signature, clinit_name, init_name, finit_name): Define in
	namespace gcj.
	(_Jv_CreateJavaVM): Call _Jv_InitThreads, _Jv_InitGC, and
	_Jv_InitializeSyncMutex from here. Initialize Utf8 constants.
	Initialize primitive types.
	* java/lang/natClassLoader.cc (_Jv_RegisterClasses): Don't call
	initialization routines. Don't synchronize.
	* java/lang/natRuntime.cc (_load): Synchronize on java.lang.Class
	across dlopen call.

From-SVN: r46282
This commit is contained in:
Bryce McKinlay 2001-10-16 08:35:17 +00:00 committed by Bryce McKinlay
parent 6fd617e3e1
commit 107abb2f61
10 changed files with 131 additions and 61 deletions

View file

@ -138,8 +138,15 @@ java::lang::Runtime::_load (jstring path, jboolean do_search)
#endif
jsize total = JvGetStringUTFRegion (path, 0, path->length(), &buf[offset]);
buf[offset + total] = '\0';
lt_dlhandle h;
// FIXME: make sure path is absolute.
lt_dlhandle h = do_search ? lt_dlopenext (buf) : lt_dlopen (buf);
{
// Synchronize on java.lang.Class. This is to protect the class chain from
// concurrent modification by class registration calls which may be run
// during the dlopen().
JvSynchronize sync (&java::lang::Class::class$);
h = do_search ? lt_dlopenext (buf) : lt_dlopen (buf);
}
if (h == NULL)
{
const char *msg = lt_dlerror ();