aboutsummaryrefslogtreecommitdiff
path: root/libjava/interpret.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-05-04 17:35:05 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-05-04 17:35:05 +0000
commita7285117b4d52ba2ee8adc9f2c123ee08c48937c (patch)
tree0f72903bf321b4c5bf8b857d5a52da113dcd0e60 /libjava/interpret.cc
parentb149e89e77531944d9575190084dee9816391bc2 (diff)
downloadgcc-a7285117b4d52ba2ee8adc9f2c123ee08c48937c.zip
gcc-a7285117b4d52ba2ee8adc9f2c123ee08c48937c.tar.gz
gcc-a7285117b4d52ba2ee8adc9f2c123ee08c48937c.tar.bz2
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
Diffstat (limited to 'libjava/interpret.cc')
-rw-r--r--libjava/interpret.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index 9a2059d..7912158 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -25,7 +25,6 @@ details. */
#include <java/lang/StringBuffer.h>
#include <java/lang/Class.h>
#include <java/lang/reflect/Modifier.h>
-#include <java/lang/VirtualMachineError.h>
#include <java/lang/InternalError.h>
#include <java/lang/NullPointerException.h>
#include <java/lang/ArithmeticException.h>
@@ -222,12 +221,20 @@ static jint get4(unsigned char* loc) {
#define SAVE_PC() frame_desc.pc = pc
+// We used to define this conditionally, depending on HANDLE_SEGV.
+// However, that runs into a problem if a chunk in low memory is
+// mapped and we try to look at a field near the end of a large
+// object. See PR 26858 for details. It is, most likely, relatively
+// inexpensive to simply do this check always.
+#define NULLCHECK(X) \
+ 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 NULLCHECK(X) SAVE_PC()
#define NULLARRAYCHECK(X) SAVE_PC()
#else
-#define NULLCHECK(X) \
- do { SAVE_PC(); if ((X)==NULL) throw_null_pointer_exception (); } while (0)
#define NULLARRAYCHECK(X) \
do { SAVE_PC(); if ((X)==NULL) { throw_null_pointer_exception (); } } while (0)
#endif
@@ -2542,8 +2549,6 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
jclass type = field->type;
jint field_offset = field->u.boffset;
- if (field_offset > 0xffff)
- throw new java::lang::VirtualMachineError;
jobject obj = POPA();
NULLCHECK(obj);
@@ -2746,8 +2751,6 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
(JvNewStringLatin1 ("field is static"));
jint field_offset = field->u.boffset;
- if (field_offset > 0xffff)
- throw new java::lang::VirtualMachineError;
void *newinsn = NULL;
if (type->isPrimitive ())