(utf8_init): Initialize utf_java_lang_ClassCastException.
* src/vm/utf8.h (utf_java_lang_ClassCastException): Added.
* src/vm/class.c (class_java_lang_ClassCastException): Added.
* src/vm/class.h (class_java_lang_ClassCastException): Likewise.
* src/vm/exceptions.c (exceptions_init): Initialize
class_java_lang_ClassCastException.
(new_classcastexception): Renamed to
exceptions_new_classcastexception, pass the failing class name to the
exception.
* src/vm/exceptions.h (exceptionptr): Use thread object directly.
(new_classcastexception): Renamed to
exceptions_new_classcastexception.
* src/vm/jit/stacktrace.c (stacktrace_inline_classcastexception):
Changed signature.
* src/vm/jit/stacktrace.h (stacktrace_inline_classcastexception):
Likewise.
* src/vm/jit/codegen-common.c (codegen_add_classcastexception_ref):
Likewise.
* src/vm/jit/codegen-common.h (codegen_add_classcastexception_ref):
Likewise.
* src/vm/jit/powerpc/codegen.c (codegen): Pass register number to
codegen_add_classcastexception_ref.
Christian Thalinger
Edwin Steiner
- $Id: class.c 5053 2006-06-28 19:11:20Z twisti $
+ $Id: class.c 5088 2006-07-08 20:16:05Z twisti $
*/
classinfo *class_java_lang_OutOfMemoryError;
classinfo *class_java_lang_Exception;
+classinfo *class_java_lang_ClassCastException;
classinfo *class_java_lang_ClassNotFoundException;
classinfo *class_java_lang_IllegalArgumentException;
classinfo *class_java_lang_IllegalMonitorStateException;
Changes:
- $Id: class.h 5053 2006-06-28 19:11:20Z twisti $
+ $Id: class.h 5088 2006-07-08 20:16:05Z twisti $
*/
extern classinfo *class_java_lang_OutOfMemoryError;
extern classinfo *class_java_lang_Exception;
+extern classinfo *class_java_lang_ClassCastException;
extern classinfo *class_java_lang_ClassNotFoundException;
extern classinfo *class_java_lang_IllegalArgumentException;
extern classinfo *class_java_lang_IllegalMonitorStateException;
Changes: Edwin Steiner
- $Id: exceptions.c 5067 2006-07-03 10:18:56Z twisti $
+ $Id: exceptions.c 5088 2006-07-08 20:16:05Z twisti $
*/
!link_class(class_java_lang_Exception))
return false;
+ /* java/lang/ClassCastException */
+
+ if (!(class_java_lang_ClassCastException =
+ load_class_bootstrap(utf_java_lang_ClassCastException)) ||
+ !link_class(class_java_lang_ClassCastException))
+ return false;
+
/* java/lang/ClassNotFoundException */
if (!(class_java_lang_ClassNotFoundException =
}
-/* new_classcastexception ******************************************************
+/* exceptions_new_classcastexception *******************************************
- generates a java.lang.ClassCastException for the jit compiler
+ Generates a java.lang.ClassCastException for the JIT compiler.
*******************************************************************************/
-java_objectheader *new_classcastexception(void)
+java_objectheader *exceptions_new_classcastexception(java_objectheader *o)
{
java_objectheader *e;
+ utf *classname;
+ java_lang_String *s;
- e = new_exception(string_java_lang_ClassCastException);
+ classname = o->vftbl->class->name;
- if (!e)
+ s = javastring_new(classname);
+
+ e = native_new_and_init_string(class_java_lang_ClassCastException, s);
+
+ if (e == NULL)
return *exceptionptr;
return e;
Changes: Edwin Steiner
- $Id: exceptions.h 5067 2006-07-03 10:18:56Z twisti $
+ $Id: exceptions.h 5088 2006-07-08 20:16:05Z twisti $
*/
#if defined(ENABLE_THREADS)
-#define exceptionptr builtin_get_exceptionptrptr()
+#define exceptionptr &(THREADOBJECT->_exceptionptr)
#else
#define exceptionptr &_no_threads_exceptionptr
#endif
void exceptions_throw_arrayindexoutofboundsexception(void);
java_objectheader *new_arraystoreexception(void);
-java_objectheader *new_classcastexception(void);
+java_objectheader *exceptions_new_classcastexception(java_objectheader *o);
java_objectheader *new_illegalargumentexception(void);
void exceptions_throw_illegalargumentexception(void);
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen-common.c 5071 2006-07-03 13:49:14Z twisti $
+ $Id: codegen-common.c 5088 2006-07-08 20:16:05Z twisti $
*/
*******************************************************************************/
-void codegen_add_classcastexception_ref(codegendata *cd)
+void codegen_add_classcastexception_ref(codegendata *cd, s4 reg)
{
- codegen_add_exception_ref(cd, -1, STACKTRACE_inline_classcastexception);
+ codegen_add_exception_ref(cd, reg, STACKTRACE_inline_classcastexception);
}
Changes: Christian Ullrich
Edwin Steiner
- $Id: codegen-common.h 5071 2006-07-03 13:49:14Z twisti $
+ $Id: codegen-common.h 5088 2006-07-08 20:16:05Z twisti $
*/
void codegen_add_arithmeticexception_ref(codegendata *cd);
void codegen_add_arrayindexoutofboundsexception_ref(codegendata *cd, s4 reg);
void codegen_add_arraystoreexception_ref(codegendata *cd);
-void codegen_add_classcastexception_ref(codegendata *cd);
+void codegen_add_classcastexception_ref(codegendata *cd, s4 reg);
void codegen_add_nullpointerexception_ref(codegendata *cd);
void codegen_add_fillinstacktrace_ref(codegendata *cd);
Christian Ullrich
Edwin Steiner
- $Id: codegen.c 5079 2006-07-06 11:36:01Z twisti $
+ $Id: codegen.c 5088 2006-07-08 20:16:05Z twisti $
*/
replacementpoint++;
}
+#if 0
/* generate basicblock profiling code */
- if (JITDATA_HAS_FLAG_INSTRUMENT(jd) && 0) {
+ if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) {
/* count frequency */
disp = dseg_addaddress(cd, code->bbfrequency);
/* if (bptr->type == BBTYPE_EXH) */
/* PROFILE_CYCLE_START; */
}
+#endif
/* copy interface registers to their destination */
/* interface checkcast code */
- if (!super || (super->flags & ACC_INTERFACE)) {
- if (super) {
+ if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
+ if (super != NULL) {
M_TST(s1);
M_BEQ(s2);
-
- } else {
+ }
+ else {
codegen_addpatchref(cd,
PATCHER_checkcast_instanceof_interface,
(constant_classref *) iptr->target,
M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, interfacetablelength));
M_LDATST(REG_ITMP3, REG_ITMP3, -superindex);
M_BLE(0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
M_ALD(REG_ITMP3, REG_ITMP2,
OFFSET(vftbl_t, interfacetable[0]) -
superindex * sizeof(methodptr*));
M_TST(REG_ITMP3);
M_BEQ(0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
- if (!super)
+ if (super == NULL)
M_BR(s3);
}
/* class checkcast code */
- if (!super || !(super->flags & ACC_INTERFACE)) {
+ if ((super == NULL) || !(super->flags & ACC_INTERFACE)) {
disp = dseg_addaddress(cd, supervftbl);
- if (super) {
+ if (super != NULL) {
M_TST(s1);
M_BEQ(s3);
-
- } else {
+ }
+ else {
codegen_addpatchref(cd, PATCHER_checkcast_class,
(constant_classref *) iptr->target,
disp);
}
M_CMPU(REG_ITMP3, REG_ITMP2);
M_BGT(0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
}
d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
-
- } else {
+ }
+ else {
/* array type cast-check */
s1 = emit_load_s1(jd, iptr, src, rd->argintregs[0]);
M_JSR;
M_TST(REG_RESULT);
M_BEQ(0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
MCODECHECK(100);
- /* Check if the exception is an
- ArrayIndexOutOfBoundsException. If so, move index register
- into REG_ITMP1. */
+ /* Move the value register to a temporary register, if
+ there is the need for it. */
if (eref->reg != -1)
M_MOV(eref->reg, REG_ITMP1);
if (savedmcodeptr != NULL) {
disp = ((u4 *) savedmcodeptr) - (((u4 *) cd->mcodeptr) + 1);
M_BR(disp);
-
- } else {
+ }
+ else {
savedmcodeptr = cd->mcodeptr;
if (code->isleafmethod) {
Changes: Christian Thalinger
Edwin Steiner
- $Id: stacktrace.c 5085 2006-07-08 14:20:59Z twisti $
+ $Id: stacktrace.c 5088 2006-07-08 20:16:05Z twisti $
*/
*******************************************************************************/
java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc)
+ u1 *xpc,
+ java_objectheader *o)
{
stackframeinfo sfi;
- java_objectheader *o;
+ java_objectheader *e;
/* create stackframeinfo */
/* create exception */
- o = new_classcastexception();
+ e = exceptions_new_classcastexception(o);
/* remove stackframeinfo */
stacktrace_remove_stackframeinfo(&sfi);
- return o;
+ return e;
}
Changes:
- $Id: stacktrace.h 4921 2006-05-15 14:24:36Z twisti $
+ $Id: stacktrace.h 5088 2006-07-08 20:16:05Z twisti $
*/
(functionptr) stacktrace_inline_arraystoreexception
java_objectheader *stacktrace_inline_classcastexception(u1 *pv, u1 *sp, u1 *ra,
- u1 *xpc);
+ u1 *xpc,
+ java_objectheader *o);
#define STACKTRACE_inline_classcastexception \
(functionptr) stacktrace_inline_classcastexception
Christian Thalinger
Edwin Steiner
- $Id: utf8.c 5053 2006-06-28 19:11:20Z twisti $
+ $Id: utf8.c 5088 2006-07-08 20:16:05Z twisti $
*/
utf *utf_java_lang_OutOfMemoryError;
utf *utf_java_lang_Exception;
+utf *utf_java_lang_ClassCastException;
utf *utf_java_lang_ClassNotFoundException;
utf *utf_java_lang_IllegalArgumentException;
utf *utf_java_lang_IllegalMonitorStateException;
utf_java_lang_Exception = utf_new_char(string_java_lang_Exception);
+ utf_java_lang_ClassCastException =
+ utf_new_char(string_java_lang_ClassCastException);
+
utf_java_lang_ClassNotFoundException =
utf_new_char(string_java_lang_ClassNotFoundException);
Changes: Edwin Steiner
- $Id: utf8.h 5053 2006-06-28 19:11:20Z twisti $
+ $Id: utf8.h 5088 2006-07-08 20:16:05Z twisti $
*/
extern utf *utf_java_lang_OutOfMemoryError;
extern utf *utf_java_lang_Exception;
+extern utf *utf_java_lang_ClassCastException;
extern utf *utf_java_lang_ClassNotFoundException;
extern utf *utf_java_lang_IllegalArgumentException;
extern utf *utf_java_lang_IllegalMonitorStateException;