mirror of git://gcc.gnu.org/git/gcc.git
interpret.cc (ARRAYBOUNDSCHECK): New macro.
2002-01-08 Chris Sears <cbsears_sf@yahoo.com> * interpret.cc (ARRAYBOUNDSCHECK): New macro. (continue1) [insn_iaload, insn_laload, insn_faload, insn_daload, insn_aaload, insn_baload, insn_caload, insn_saload, insn_iastore, insn_lastore, insn_fastore, insn_dastore, insn_aastore, insn_bastore, insn_castore, insn_sastore]: Use it. (continue1) [insn_arraylength]: Check for null array. From-SVN: r48652
This commit is contained in:
parent
0d24f4d131
commit
00cc944db9
|
@ -1,3 +1,12 @@
|
||||||
|
2002-01-08 Chris Sears <cbsears_sf@yahoo.com>
|
||||||
|
|
||||||
|
* interpret.cc (ARRAYBOUNDSCHECK): New macro.
|
||||||
|
(continue1) [insn_iaload, insn_laload, insn_faload, insn_daload,
|
||||||
|
insn_aaload, insn_baload, insn_caload, insn_saload, insn_iastore,
|
||||||
|
insn_lastore, insn_fastore, insn_dastore, insn_aastore,
|
||||||
|
insn_bastore, insn_castore, insn_sastore]: Use it.
|
||||||
|
(continue1) [insn_arraylength]: Check for null array.
|
||||||
|
|
||||||
2002-01-06 Andreas Tobler <a.tobler@schweiz.ch>
|
2002-01-06 Andreas Tobler <a.tobler@schweiz.ch>
|
||||||
|
|
||||||
* configure, include/config.h.in: Rebuilt.
|
* configure, include/config.h.in: Rebuilt.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// interpret.cc - Code for the interpreter
|
// interpret.cc - Code for the interpreter
|
||||||
|
|
||||||
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
|
/* Copyright (C) 1999, 2000, 2001 , 2002 Free Software Foundation
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
|
@ -187,6 +187,13 @@ static jint get4(unsigned char* loc) {
|
||||||
do { if ((X)==NULL) throw_null_pointer_exception (); } while (0)
|
do { if ((X)==NULL) throw_null_pointer_exception (); } while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ARRAYBOUNDSCHECK(array, index) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (((unsigned) index) >= (unsigned) (array->length)) \
|
||||||
|
_Jv_ThrowBadArrayIndex (index); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
// this method starts the actual running of the method. It is inlined
|
// this method starts the actual running of the method. It is inlined
|
||||||
// in three different variants in the static methods run_normal,
|
// in three different variants in the static methods run_normal,
|
||||||
|
@ -958,10 +965,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jintArray arr = (jintArray) POPA();
|
jintArray arr = (jintArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHI( elements(arr)[index] );
|
PUSHI( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -972,10 +976,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jlongArray arr = (jlongArray) POPA();
|
jlongArray arr = (jlongArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHL( elements(arr)[index] );
|
PUSHL( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -986,10 +987,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jfloatArray arr = (jfloatArray) POPA();
|
jfloatArray arr = (jfloatArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHF( elements(arr)[index] );
|
PUSHF( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1000,10 +998,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jdoubleArray arr = (jdoubleArray) POPA();
|
jdoubleArray arr = (jdoubleArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHD( elements(arr)[index] );
|
PUSHD( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1014,10 +1009,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jobjectArray arr = (jobjectArray) POPA();
|
jobjectArray arr = (jobjectArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHA( elements(arr)[index] );
|
PUSHA( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1028,10 +1020,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jbyteArray arr = (jbyteArray) POPA();
|
jbyteArray arr = (jbyteArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHI( elements(arr)[index] );
|
PUSHI( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1042,10 +1031,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jcharArray arr = (jcharArray) POPA();
|
jcharArray arr = (jcharArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHI( elements(arr)[index] );
|
PUSHI( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1056,10 +1042,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jshortArray arr = (jshortArray) POPA();
|
jshortArray arr = (jshortArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
PUSHI( elements(arr)[index] );
|
PUSHI( elements(arr)[index] );
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1171,10 +1154,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jintArray arr = (jintArray) POPA();
|
jintArray arr = (jintArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1186,10 +1166,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jlongArray arr = (jlongArray) POPA();
|
jlongArray arr = (jlongArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1201,10 +1178,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jfloatArray arr = (jfloatArray) POPA();
|
jfloatArray arr = (jfloatArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1216,10 +1190,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jdoubleArray arr = (jdoubleArray) POPA();
|
jdoubleArray arr = (jdoubleArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1231,10 +1202,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jobjectArray arr = (jobjectArray) POPA();
|
jobjectArray arr = (jobjectArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
_Jv_CheckArrayStore (arr, value);
|
_Jv_CheckArrayStore (arr, value);
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
|
@ -1247,10 +1215,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jbyteArray arr = (jbyteArray) POPA();
|
jbyteArray arr = (jbyteArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1262,10 +1227,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jcharArray arr = (jcharArray) POPA();
|
jcharArray arr = (jcharArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -1277,10 +1239,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
jint index = POPI();
|
jint index = POPI();
|
||||||
jshortArray arr = (jshortArray) POPA();
|
jshortArray arr = (jshortArray) POPA();
|
||||||
NULLCHECK (arr);
|
NULLCHECK (arr);
|
||||||
if (index < 0 || index >= arr->length)
|
ARRAYBOUNDSCHECK (arr, index);
|
||||||
{
|
|
||||||
_Jv_ThrowBadArrayIndex (index);
|
|
||||||
}
|
|
||||||
elements(arr)[index] = value;
|
elements(arr)[index] = value;
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
@ -2229,6 +2188,7 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv)
|
||||||
SAVE_PC;
|
SAVE_PC;
|
||||||
{
|
{
|
||||||
__JArray *arr = (__JArray*)POPA();
|
__JArray *arr = (__JArray*)POPA();
|
||||||
|
NULLCHECK (arr);
|
||||||
PUSHI (arr->length);
|
PUSHI (arr->length);
|
||||||
}
|
}
|
||||||
NEXT_INSN;
|
NEXT_INSN;
|
||||||
|
|
Loading…
Reference in New Issue