re PR libgcj/26861 (VirtualMachineError in interperter.)
PR libgcj/26861: * interpret.cc (run) <insn_getfield>: Removed 0xffff check. <insn_putfield>: Likewise. (NULLCHECK): Define unconditionally. * link.cc (ensure_class_linked): Removed dead code. From-SVN: r113531
This commit is contained in:
parent
b149e89e77
commit
a7285117b4
3 changed files with 20 additions and 24 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-05-04 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
PR libgcj/26861:
|
||||||
|
* interpret.cc (run) <insn_getfield>: Removed 0xffff check.
|
||||||
|
<insn_putfield>: Likewise.
|
||||||
|
(NULLCHECK): Define unconditionally.
|
||||||
|
* link.cc (ensure_class_linked): Removed dead code.
|
||||||
|
|
||||||
2006-05-04 Tom Tromey <tromey@redhat.com>
|
2006-05-04 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* java/lang/Class.h (JV_STATE_LOADING): Added comment.
|
* java/lang/Class.h (JV_STATE_LOADING): Added comment.
|
||||||
|
|
|
@ -25,7 +25,6 @@ details. */
|
||||||
#include <java/lang/StringBuffer.h>
|
#include <java/lang/StringBuffer.h>
|
||||||
#include <java/lang/Class.h>
|
#include <java/lang/Class.h>
|
||||||
#include <java/lang/reflect/Modifier.h>
|
#include <java/lang/reflect/Modifier.h>
|
||||||
#include <java/lang/VirtualMachineError.h>
|
|
||||||
#include <java/lang/InternalError.h>
|
#include <java/lang/InternalError.h>
|
||||||
#include <java/lang/NullPointerException.h>
|
#include <java/lang/NullPointerException.h>
|
||||||
#include <java/lang/ArithmeticException.h>
|
#include <java/lang/ArithmeticException.h>
|
||||||
|
@ -222,12 +221,20 @@ static jint get4(unsigned char* loc) {
|
||||||
|
|
||||||
#define SAVE_PC() frame_desc.pc = pc
|
#define SAVE_PC() frame_desc.pc = pc
|
||||||
|
|
||||||
#ifdef HANDLE_SEGV
|
// We used to define this conditionally, depending on HANDLE_SEGV.
|
||||||
#define NULLCHECK(X) SAVE_PC()
|
// However, that runs into a problem if a chunk in low memory is
|
||||||
#define NULLARRAYCHECK(X) SAVE_PC()
|
// mapped and we try to look at a field near the end of a large
|
||||||
#else
|
// object. See PR 26858 for details. It is, most likely, relatively
|
||||||
|
// inexpensive to simply do this check always.
|
||||||
#define NULLCHECK(X) \
|
#define NULLCHECK(X) \
|
||||||
do { SAVE_PC(); if ((X)==NULL) throw_null_pointer_exception (); } while (0)
|
do { SAVE_PC(); if ((X)==NULL) throw_null_pointer_exception (); } while (0)
|
||||||
|
|
||||||
|
// Note that we can still conditionally define NULLARRAYCHECK, since
|
||||||
|
// we know that all uses of an array will first reference the length
|
||||||
|
// field, which is first -- and thus will trigger a SEGV.
|
||||||
|
#ifdef HANDLE_SEGV
|
||||||
|
#define NULLARRAYCHECK(X) SAVE_PC()
|
||||||
|
#else
|
||||||
#define NULLARRAYCHECK(X) \
|
#define NULLARRAYCHECK(X) \
|
||||||
do { SAVE_PC(); if ((X)==NULL) { throw_null_pointer_exception (); } } while (0)
|
do { SAVE_PC(); if ((X)==NULL) { throw_null_pointer_exception (); } } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -2542,8 +2549,6 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
|
||||||
|
|
||||||
jclass type = field->type;
|
jclass type = field->type;
|
||||||
jint field_offset = field->u.boffset;
|
jint field_offset = field->u.boffset;
|
||||||
if (field_offset > 0xffff)
|
|
||||||
throw new java::lang::VirtualMachineError;
|
|
||||||
|
|
||||||
jobject obj = POPA();
|
jobject obj = POPA();
|
||||||
NULLCHECK(obj);
|
NULLCHECK(obj);
|
||||||
|
@ -2746,8 +2751,6 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
|
||||||
(JvNewStringLatin1 ("field is static"));
|
(JvNewStringLatin1 ("field is static"));
|
||||||
|
|
||||||
jint field_offset = field->u.boffset;
|
jint field_offset = field->u.boffset;
|
||||||
if (field_offset > 0xffff)
|
|
||||||
throw new java::lang::VirtualMachineError;
|
|
||||||
|
|
||||||
void *newinsn = NULL;
|
void *newinsn = NULL;
|
||||||
if (type->isPrimitive ())
|
if (type->isPrimitive ())
|
||||||
|
|
|
@ -1629,21 +1629,6 @@ _Jv_Linker::ensure_class_linked (jclass klass)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // Should be redundant now
|
|
||||||
// If superclass looks like a constant pool entry,
|
|
||||||
// resolve it now.
|
|
||||||
if ((uaddr) klass->superclass < (uaddr) pool->size)
|
|
||||||
klass->superclass = pool->data[(uaddr) klass->superclass].clazz;
|
|
||||||
|
|
||||||
// Likewise for interfaces.
|
|
||||||
for (int i = 0; i < klass->interface_count; i++)
|
|
||||||
{
|
|
||||||
if ((uaddr) klass->interfaces[i] < (uaddr) pool->size)
|
|
||||||
klass->interfaces[i]
|
|
||||||
= pool->data[(uaddr) klass->interfaces[i]].clazz;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Resolve the remaining constant pool entries.
|
// Resolve the remaining constant pool entries.
|
||||||
for (int index = 1; index < pool->size; ++index)
|
for (int index = 1; index < pool->size; ++index)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue