mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-13 05:43:45 +08:00
natClassLoader.cc (_Jv_PrepareCompiledClass): Only initialize String fields for interpreted classes.
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Only initialize String fields for interpreted classes. Fixes bug reported by Hans Boehm. From-SVN: r35150
This commit is contained in:
parent
373d3b1863
commit
5e5c1371d3
@ -1,5 +1,9 @@
|
|||||||
2000-07-20 Tom Tromey <tromey@cygnus.com>
|
2000-07-20 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
|
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Only
|
||||||
|
initialize String fields for interpreted classes. Fixes bug
|
||||||
|
reported by Hans Boehm.
|
||||||
|
|
||||||
* java/io/File.java (getParentFile): New method, from Classpath
|
* java/io/File.java (getParentFile): New method, from Classpath
|
||||||
via Oskar Liljeblad.
|
via Oskar Liljeblad.
|
||||||
|
|
||||||
|
@ -165,9 +165,7 @@ java::lang::ClassLoader::linkClass0 (java::lang::Class *klass)
|
|||||||
|
|
||||||
#ifdef INTERPRETER
|
#ifdef INTERPRETER
|
||||||
if (_Jv_IsInterpretedClass (klass))
|
if (_Jv_IsInterpretedClass (klass))
|
||||||
{
|
_Jv_PrepareClass (klass);
|
||||||
_Jv_PrepareClass (klass);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_Jv_PrepareCompiledClass (klass);
|
_Jv_PrepareCompiledClass (klass);
|
||||||
@ -230,7 +228,7 @@ java::lang::ClassLoader::findLoadedClass (jstring name)
|
|||||||
lives in resolve.cc which is entirely conditionally compiled.
|
lives in resolve.cc which is entirely conditionally compiled.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_Jv_PrepareCompiledClass(jclass klass)
|
_Jv_PrepareCompiledClass (jclass klass)
|
||||||
{
|
{
|
||||||
if (klass->state >= JV_STATE_LINKED)
|
if (klass->state >= JV_STATE_LINKED)
|
||||||
return;
|
return;
|
||||||
@ -270,23 +268,33 @@ _Jv_PrepareCompiledClass(jclass klass)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jfieldID f = JvGetFirstStaticField (klass);
|
#ifdef INTERPRETER
|
||||||
for (int n = JvNumStaticFields (klass); n > 0; --n)
|
// FIXME: although the comment up top says that this function is
|
||||||
|
// only called for compiled classes, it is actually called for every
|
||||||
|
// class.
|
||||||
|
if (! _Jv_IsInterpretedClass (klass))
|
||||||
{
|
{
|
||||||
int mod = f->getModifiers ();
|
#endif /* INTERPRETER */
|
||||||
// Maybe the compiler should mark these with
|
jfieldID f = JvGetFirstStaticField (klass);
|
||||||
// _Jv_FIELD_CONSTANT_VALUE? For now we just know that this
|
for (int n = JvNumStaticFields (klass); n > 0; --n)
|
||||||
// only happens for constant strings.
|
|
||||||
if (f->getClass () == &StringClass
|
|
||||||
&& java::lang::reflect::Modifier::isStatic (mod)
|
|
||||||
&& java::lang::reflect::Modifier::isFinal (mod))
|
|
||||||
{
|
{
|
||||||
jstring *strp = (jstring *) f->u.addr;
|
int mod = f->getModifiers ();
|
||||||
if (*strp)
|
// Maybe the compiler should mark these with
|
||||||
*strp = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) *strp);
|
// _Jv_FIELD_CONSTANT_VALUE? For now we just know that this
|
||||||
|
// only happens for constant strings.
|
||||||
|
if (f->getClass () == &StringClass
|
||||||
|
&& java::lang::reflect::Modifier::isStatic (mod)
|
||||||
|
&& java::lang::reflect::Modifier::isFinal (mod))
|
||||||
|
{
|
||||||
|
jstring *strp = (jstring *) f->u.addr;
|
||||||
|
if (*strp)
|
||||||
|
*strp = _Jv_NewStringUtf8Const ((_Jv_Utf8Const *) *strp);
|
||||||
|
}
|
||||||
|
f = f->getNextField ();
|
||||||
}
|
}
|
||||||
f = f->getNextField ();
|
#ifdef INTERPRETER
|
||||||
}
|
}
|
||||||
|
#endif /* INTERPRETER */
|
||||||
|
|
||||||
klass->notifyAll ();
|
klass->notifyAll ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user