Joseph Wenninger
Christian Thalinger
- $Id: parse.c 2514 2005-05-23 10:23:09Z twisti $
+ $Id: parse.c 2541 2005-05-31 16:02:14Z twisti $
*/
OP(ICMD_CHECKASIZE);
i = code_get_u2(p + 1, inline_env->method);
{
- classinfo *component;
constant_classref *compr;
constant_classref *cr;
classinfo *c;
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
compr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
if (!(cr = class_get_classref_multiarray_of(1, compr)))
BUILTIN2T(PATCHER_builtin_newarray, TYPE_ADR, cr, currentline);
}
s_count++;
-#else
- cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
-
- if (!resolve_classref(inline_env->method,
- cr,resolveEager,true,&component))
- return NULL;
-
- c = class_array_of(component,true);
- if (!c)
- return NULL;
- LOADCONST_A_BUILTIN(c->vftbl);
- s_count++;
- BUILTIN2(BUILTIN_newarray, TYPE_ADR, currentline);
-#endif
}
OP(ICMD_CHECKEXCEPTION);
break;
inline_env->method->isleafmethod = false;
i = code_get_u2(p + 1, inline_env->method);
{
- classinfo *component;
+ constant_classref *cr;
classinfo *c;
- constant_classref *cr;
- vftbl_t *arrayvftbl;
s4 v = code_get_u1(p + 3, inline_env->method);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &c))
(voidptr) (ptrint) PATCHER_builtin_multianewarray,
currentline);
}
-#else
-/* vftbl *arrayvftbl = */
-/* ((classinfo *) class_getconstant(class, i, CONSTANT_Class))->vftbl; */
-/* OP2A(opcode, v, arrayvftbl,currentline); */
-
-
- cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
-
- if (!resolve_classref_or_classinfo(inline_env->method,
- CLASSREF_OR_CLASSINFO(cr),resolveEager,true,&component))
- return NULL;
-
- arrayvftbl = component->vftbl;
- OP2A(opcode, v, arrayvftbl, currentline);
-
-/* classinfo *arrayclass = */
-/* (classinfo *) class_getconstant(class, i, CONSTANT_Class); */
-/* OP2A(opcode, v, arrayclass, currentline); */
-#endif
}
break;
case JAVA_GETSTATIC:
case JAVA_PUTSTATIC:
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
case JAVA_GETFIELD:
case JAVA_PUTFIELD:
-#endif
i = code_get_u2(p + 1, inline_env->method);
{
constant_FMIref *fr;
unresolved_field *uf;
fieldinfo *fi;
- classinfo *c;
fr = class_getconstant(inline_env->method->class, i, CONSTANT_Fieldref);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
OP2A_NOINC(opcode, fr->parseddesc.fd->type, fr, currentline);
if (!(uf = create_unresolved_field(inline_env->method->class,
iptr->val.a = fi;
}
PINC;
-#if defined(__MIPS__)
+#if defined(__MIPS__) || defined(__POWERPC__)
if (!fi || !fi->class->initialized)
inline_env->method->isleafmethod = false;
-#endif
-#else
- {
- classinfo *frclass;
- if (!resolve_classref(inline_env->method,fr->classref,resolveEager,true,&frclass))
- return NULL;
-
- fi = class_resolvefield(frclass,
- fr->name,
- fr->descriptor,
- inline_env->method->class,
- true);
-
- if (!fi)
- return NULL;
-
- OP2A(opcode, fi->type, fi, currentline);
- if (!fi->class->initialized) {
- inline_env->method->isleafmethod = false;
- }
- }
#endif
}
break;
-#if !defined(__X86_64__) && !defined(__I386__) && !defined(__ALPHA__) && !defined(__MIPS__)
- case JAVA_PUTFIELD:
- case JAVA_GETFIELD:
- i = code_get_u2(p + 1,inline_env->method);
- {
- constant_FMIref *fr;
- fieldinfo *fi;
- classinfo *frclass;
-
- fr = class_getconstant(inline_env->method->class, i, CONSTANT_Fieldref);
- if (!resolve_classref(inline_env->method,fr->classref,resolveEager,true,&frclass))
- return NULL;
-
- fi = class_resolvefield(frclass,
- fr->name,
- fr->descriptor,
- inline_env->method->class,
- true);
-
- if (!fi)
- return NULL;
-
- OP2A(opcode, fi->type, fi, currentline);
- }
- break;
-#endif
-
/* method invocation *****/
case JAVA_INVOKESTATIC:
i = code_get_u2(p + 1, inline_env->method);
{
- constant_FMIref *mr;
- methodinfo *mi;
+ constant_FMIref *mr;
unresolved_method *um;
- classinfo *mrclass;
+ methodinfo *mi;
inline_env->method->isleafmethod = false;
mr = class_getconstant(inline_env->method->class, i, CONSTANT_Methodref);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
OP2A_NOINC(opcode, mr->parseddesc.md->paramcount, mr, currentline);
um = create_unresolved_method(inline_env->method->class,
iptr->val.a = mi;
}
PINC;
-#else
- if (!resolve_classref(inline_env->method,mr->classref,resolveEager,true,&mrclass))
- return NULL;
-
- mi = class_resolveclassmethod(mrclass,
- mr->name,
- mr->descriptor,
- inline_env->method->class,
- true);
-
- if (!mi)
- return NULL;
-
-if (DEBUG4==true) {
- method_display_w_class(mi);
- printf("\tINVOKE STAT\n");
- fflush(stdout);}
-
- if (!(mi->flags & ACC_STATIC)) {
- *exceptionptr =
- new_exception(string_java_lang_IncompatibleClassChangeError);
- return NULL;
- }
-
- method_descriptor2types(mi);
- OP2A(opcode, mi->paramcount, mi, currentline);
-#endif
}
break;
case JAVA_INVOKEVIRTUAL:
i = code_get_u2(p + 1, inline_env->method);
{
- constant_FMIref *mr;
- methodinfo *mi;
+ constant_FMIref *mr;
unresolved_method *um;
- classinfo *mrclass;
+ methodinfo *mi;
inline_env->method->isleafmethod = false;
mr = class_getconstant(inline_env->method->class, i, CONSTANT_Methodref);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
OP2A_NOINC(opcode, mr->parseddesc.md->paramcount + 1, mr, currentline);
um = create_unresolved_method(inline_env->method->class,
iptr->val.a = mi;
}
PINC;
-#else
- if (!resolve_classref(inline_env->method,mr->classref,resolveEager,true,&mrclass))
- return NULL;
-
- mi = class_resolveclassmethod(mrclass,
- mr->name,
- mr->descriptor,
- inline_env->method->class,
- true);
-
- if (!mi)
- return NULL;
-
-if (DEBUG4==true) {
- method_display_w_class(mi);
- printf("\tINVOKE SPEC/VIRT\n");
- fflush(stdout);}
-
- if (mi->flags & ACC_STATIC) {
- *exceptionptr =
- new_exception(string_java_lang_IncompatibleClassChangeError);
- return NULL;
- }
-
- method_descriptor2types(mi);
- OP2A(opcode, mi->paramcount, mi, currentline);
-#endif
}
break;
case JAVA_INVOKEINTERFACE:
i = code_get_u2(p + 1,inline_env->method);
{
- constant_FMIref *mr;
- methodinfo *mi;
- classinfo *mrclass;
+ constant_FMIref *mr;
unresolved_method *um;
+ methodinfo *mi;
inline_env->method->isleafmethod = false;
mr = class_getconstant(inline_env->method->class, i, CONSTANT_InterfaceMethodref);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
OP2A_NOINC(opcode, mr->parseddesc.md->paramcount + 1, mr, currentline);
um = create_unresolved_method(inline_env->method->class,
iptr->val.a = mi;
}
PINC;
-#else
- if (!resolve_classref(inline_env->method,mr->classref,resolveEager,true,&mrclass))
- return NULL;
-
- mi = class_resolveinterfacemethod(mrclass,
- mr->name,
- mr->descriptor,
- inline_env->method->class,
- true);
- if (!mi)
- return NULL;
-
- if (mi->flags & ACC_STATIC) {
- *exceptionptr =
- new_exception(string_java_lang_IncompatibleClassChangeError);
- return NULL;
- }
-
-if (DEBUG4==true) {
- method_display_w_class(mi);
- printf("\tINVOKE INTERFACE\n");
- fflush(stdout);}
-
- method_descriptor2types(mi);
- OP2A(opcode, mi->paramcount, mi, currentline);
-#endif
}
break;
case JAVA_NEW:
{
constant_classref *cr;
- classinfo *cls;
+ classinfo *c;
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
i = code_get_u2(p + 1, inline_env->method);
cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
- if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &cls))
+ if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &c))
return NULL;
/* <clinit> can throw an exception over native code */
- if (cls && cls->initialized) {
- LOADCONST_A_BUILTIN(cls);
+ if (c && c->initialized) {
+ LOADCONST_A_BUILTIN(c);
BUILTIN1T(BUILTIN_new, TYPE_ADR, NULL, currentline);
} else {
s_count++;
OP(ICMD_CHECKEXCEPTION);
-#else
- i = code_get_u2(p + 1,inline_env->method);
- cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
- if (!resolve_classref(inline_env->method,cr,resolveEager,true,&cls))
- return NULL;
- LOADCONST_A_BUILTIN(cls);
- s_count++;
- BUILTIN1(BUILTIN_new, TYPE_ADR, currentline);
- OP(ICMD_CHECKEXCEPTION);
-#endif
}
break;
i = code_get_u2(p + 1, inline_env->method);
{
constant_classref *cr;
- classinfo *cls;
+ classinfo *c;
cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
- if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &cls))
+ if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &c))
return NULL;
if (cr->name->text[0] == '[') {
/* array type cast-check */
- if (cls) {
- LOADCONST_A_BUILTIN(cls->vftbl);
+ if (c) {
+ LOADCONST_A_BUILTIN(c->vftbl);
BUILTIN2T(BUILTIN_arraycheckcast, TYPE_ADR, NULL, currentline);
} else {
} else {
/* object type cast-check */
- OP2AT(opcode, 1, cls, cr, currentline);
+ OP2AT(opcode, 1, c, cr, currentline);
}
-#if defined(__MIPS__)
- if (!cls)
+#if defined(__MIPS__) || defined(__POWERPC__)
+ if (!c)
inline_env->method->isleafmethod = false;
-#endif
-#else
- if (!resolve_classref(inline_env->method,
- cr,resolveEager,true,&cls))
- return NULL;
-
- if (cls->vftbl->arraydesc) {
- /* array type cast-check */
- LOADCONST_A_BUILTIN(cls->vftbl);
- s_count++;
- BUILTIN2(BUILTIN_arraycheckcast, TYPE_ADR,currentline);
-
- } else { /* object type cast-check */
- /*
- + LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
- + s_count++;
- + BUILTIN2(BUILTIN_checkcast, TYPE_ADR,currentline);
- + */
- OP2A(opcode, 1, cls, currentline);
- }
#endif
}
break;
i = code_get_u2(p + 1,inline_env->method);
{
constant_classref *cr;
- classinfo *cls;
+ classinfo *c;
cr = (constant_classref *) class_getconstant(inline_env->method->class, i, CONSTANT_Class);
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
- if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &cls))
+ if (!resolve_classref(inline_env->method, cr, resolveLazy, true, &c))
return NULL;
if (cr->name->text[0] == '[') {
/* array type cast-check */
- if (cls) {
- LOADCONST_A_BUILTIN(cls->vftbl);
+ if (c) {
+ LOADCONST_A_BUILTIN(c->vftbl);
BUILTIN2T(BUILTIN_arrayinstanceof, TYPE_INT, NULL, currentline);
} else {
} else {
/* object type cast-check */
- OP2AT(opcode, 1, cls, cr, currentline);
+ OP2AT(opcode, 1, c, cr, currentline);
}
-#if defined(__MIPS__)
- if (!cls)
+#if defined(__MIPS__) || defined(__POWERPC__)
+ if (!c)
inline_env->method->isleafmethod = false;
-#endif
-#else
- if (!resolve_classref(inline_env->method,
- cr,resolveEager,true,&cls))
- return NULL;
-
- if (cls->vftbl->arraydesc) {
- /* array type cast-check */
- LOADCONST_A_BUILTIN(cls->vftbl);
- s_count++;
- BUILTIN2(BUILTIN_arrayinstanceof, TYPE_INT, currentline);
- }
- else { /* object type cast-check */
- /*
- LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
- s_count++;
- BUILTIN2(BUILTIN_instanceof, TYPE_INT,currentline);
- + */
- OP2A(opcode, 1, cls, currentline);
- }
#endif
}
break;
Changes: Edwin Steiner
Christian Thalinger
- $Id: stack.c 2496 2005-05-23 08:06:06Z twisti $
+ $Id: stack.c 2541 2005-05-31 16:02:14Z twisti $
*/
#include "disass.h"
#include "types.h"
+#include "md-abi.h"
#include "codegen.h"
+
#include "mm/memory.h"
#include "native/native.h"
#include "toolbox/logging.h"
case ICMD_INVOKESTATIC:
COUNT(count_pcmd_met);
{
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
unresolved_method *um = iptr->target;
/* if (lm->flags & ACC_STATIC) */
/* {COUNT(count_check_null);} */
call_argcount = iptr->op1;
call_returntype = um->methodref->parseddesc.md->returntype.type;
-#else
- methodinfo *lm = iptr->val.a;
- if (lm->flags & ACC_STATIC)
- {COUNT(count_check_null);}
- call_argcount = iptr->op1;
- call_returntype = lm->returntype;
-#endif
_callhandling:
i = call_argcount;
case ICMD_GETFIELD:
case ICMD_PUTFIELD:
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
if (iptr->val.a)
printf(" %d, ", ((fieldinfo *) iptr->val.a)->offset);
else
printf(" (type ");
utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
printf(")");
-#else
- printf(" %d,", ((fieldinfo *) iptr->val.a)->offset);
- printf(" ");
- utf_display_classname(((fieldinfo *) iptr->val.a)->class->name);
- printf(".");
- utf_display(((fieldinfo *) iptr->val.a)->name);
- printf(" (type ");
- utf_display(((fieldinfo *) iptr->val.a)->descriptor);
- printf(")");
-#endif
break;
case ICMD_PUTSTATIC:
case ICMD_GETSTATIC:
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
if (iptr->val.a)
printf(" ");
else
printf(" (type ");
utf_display(((unresolved_field *) iptr->target)->fieldref->descriptor);
printf(")");
-#else
- printf(" ");
- utf_display_classname(((fieldinfo *) iptr->val.a)->class->name);
- printf(".");
- utf_display(((fieldinfo *) iptr->val.a)->name);
- printf(" (type ");
- utf_display(((fieldinfo *) iptr->val.a)->descriptor);
- printf(")");
-#endif
break;
case ICMD_PUTSTATICCONST:
break;
case ICMD_MULTIANEWARRAY:
- {
- vftbl_t *vft;
+ if (iptr->target) {
+ printf(" (NOT RESOLVED) %d ",iptr->op1);
+ utf_display(((constant_classref *) iptr->val.a)->name);
+ } else {
printf(" %d ",iptr->op1);
- vft = (vftbl_t *)iptr->val.a;
- if (vft)
- utf_display_classname(vft->class->name);
- else
- printf("<null>");
+ utf_display_classname(((vftbl_t *) iptr->val.a)->class->name);
}
break;
case ICMD_CHECKCAST:
case ICMD_INSTANCEOF:
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
if (iptr->op1) {
classinfo *c = iptr->val.a;
if (c) {
utf_display_classname(((constant_classref *) iptr->target)->name);
}
break;
-#endif
- if (iptr->op1) {
- classinfo *c = iptr->val.a;
- if (c->flags & ACC_INTERFACE)
- printf(" (INTERFACE) ");
- else
- printf(" (CLASS,%3d) ", c->vftbl->diffval);
- utf_display_classname(c->name);
- }
- break;
case ICMD_INLINE_START:
printf("\t\t\t%s.%s%s depth=%i",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text, iptr->op1);
case ICMD_INVOKESPECIAL:
case ICMD_INVOKESTATIC:
case ICMD_INVOKEINTERFACE:
-#if defined(__X86_64__) || defined(__I386__) || defined(__ALPHA__) || defined(__MIPS__)
if (!iptr->val.a)
printf(" (NOT RESOLVED) ");
else
printf(".");
utf_display(((unresolved_method *) iptr->target)->methodref->name);
utf_display(((unresolved_method *) iptr->target)->methodref->descriptor);
-#else
- printf(" ");
- utf_display_classname(((methodinfo *) iptr->val.a)->class->name);
- printf(".");
- utf_display(((methodinfo *) iptr->val.a)->name);
- utf_display(((methodinfo *) iptr->val.a)->descriptor);
-#endif
break;
case ICMD_IFEQ: