signal(sig, (void*) catch_NullPointerException);
sigemptyset(&nsig);
sigaddset(&nsig, sig);
- sigprocmask(SIG_UNBLOCK, &nsig, 0);
+ sigprocmask(SIG_UNBLOCK, &nsig, NULL);
asm_signal_exception(proto_java_lang_NullPointerException, sigctx);
}
}
}
+
/*************************** function gen_mcode ********************************
generates machine code
if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
M_AND(s1, iptr->val.i, d, 1);
}
+ else if (iptr->val.i == 0xffff) {
+ M_ZAPNOT(s1, 0x03, d, 1);
+ }
+ else if (iptr->val.i == 0xffffff) {
+ M_ZAPNOT(s1, 0x07, d, 1);
+ }
+ else {
+ ICONST(REG_ITMP2, iptr->val.i);
+ M_AND(s1, REG_ITMP2, d, 0);
+ }
+ store_reg_to_var_int(iptr->dst, d);
+ break;
+ case ICMD_IREMPOW2:
+ var_to_reg_int(s1, src, REG_ITMP1);
+ d = reg_of_var(iptr->dst, REG_ITMP3);
+ if ((iptr->val.i >= 0) && (iptr->val.i <= 255)) {
+ M_AND(s1, iptr->val.i, d, 1);
+ M_BGEZ(s1, 3);
+ M_ISUB(REG_ZERO, s1, d, 0);
+ M_AND(d, iptr->val.i, d, 1);
+ }
+ else if (iptr->val.i == 0xffff) {
+ M_ZAPNOT(s1, 0x03, d, 1);
+ M_BGEZ(s1, 3);
+ M_ISUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x03, d, 1);
+ }
+ else if (iptr->val.i == 0xffffff) {
+ M_ZAPNOT(s1, 0x07, d, 1);
+ M_BGEZ(s1, 3);
+ M_ISUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x07, d, 1);
+ }
else {
ICONST(REG_ITMP2, iptr->val.i);
M_AND(s1, REG_ITMP2, d, 0);
+ M_BGEZ(s1, 3);
+ M_ISUB(REG_ZERO, s1, d, 0);
+ M_AND(d, REG_ITMP2, d, 0);
}
+ M_ISUB(REG_ZERO, d, d, 0);
+ store_reg_to_var_int(iptr->dst, d);
+ break;
+ case ICMD_IREM0X10001:
+ var_to_reg_int(s1, src, REG_ITMP1);
+ d = reg_of_var(iptr->dst, REG_ITMP3);
+ M_ZAPNOT(s1, 0x03, REG_ITMP2, 1);
+ M_SRA(s1, 16, d, 1);
+ M_CMPLT(REG_ITMP2, d, REG_ITMP1, 0);
+ M_ISUB(REG_ITMP2, d, d, 0);
+ M_IADD(d, REG_ITMP1, d, 0);
+ M_BGEZ(s1, 10);
+ M_ISUB(REG_ZERO, s1, REG_ITMP1, 0);
+ M_ZAPNOT(REG_ITMP1, 0x03, REG_ITMP2, 1);
+ M_SRA(REG_ITMP1, 16, d, 1);
+ M_CMPLT(REG_ITMP2, d, REG_ITMP1, 0);
+ M_ISUB(REG_ITMP2, d, d, 0);
+ M_IADD(d, REG_ITMP1, d, 0);
+ M_ISUB(REG_ZERO, d, d, 0);
+ M_SLL(s1, 33, REG_ITMP2, 1);
+ M_CMPEQ(REG_ITMP2, REG_ZERO, REG_ITMP2, 0);
+ M_ISUB(d, REG_ITMP2, d, 0);
store_reg_to_var_int(iptr->dst, d);
break;
case ICMD_LANDCONST:
if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
M_AND(s1, iptr->val.l, d, 1);
}
+ else if (iptr->val.l == 0xffffL) {
+ M_ZAPNOT(s1, 0x03, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffL) {
+ M_ZAPNOT(s1, 0x07, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffL) {
+ M_ZAPNOT(s1, 0x0f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffL) {
+ M_ZAPNOT(s1, 0x1f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffffL) {
+ M_ZAPNOT(s1, 0x3f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffffffL) {
+ M_ZAPNOT(s1, 0x7f, d, 1);
+ }
+ else {
+ LCONST(REG_ITMP2, iptr->val.l);
+ M_AND(s1, REG_ITMP2, d, 0);
+ }
+ store_reg_to_var_int(iptr->dst, d);
+ break;
+ case ICMD_LREMPOW2:
+ var_to_reg_int(s1, src, REG_ITMP1);
+ d = reg_of_var(iptr->dst, REG_ITMP3);
+ if ((iptr->val.l >= 0) && (iptr->val.l <= 255)) {
+ M_AND(s1, iptr->val.l, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_AND(d, iptr->val.l, d, 1);
+ }
+ else if (iptr->val.l == 0xffffL) {
+ M_ZAPNOT(s1, 0x03, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x03, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffL) {
+ M_ZAPNOT(s1, 0x07, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x07, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffL) {
+ M_ZAPNOT(s1, 0x0f, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x0f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffL) {
+ M_ZAPNOT(s1, 0x1f, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x1f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffffL) {
+ M_ZAPNOT(s1, 0x3f, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x3f, d, 1);
+ }
+ else if (iptr->val.l == 0xffffffffffffffL) {
+ M_ZAPNOT(s1, 0x7f, d, 1);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_ZAPNOT(d, 0x7f, d, 1);
+ }
else {
LCONST(REG_ITMP2, iptr->val.l);
M_AND(s1, REG_ITMP2, d, 0);
+ M_BGEZ(s1, 3);
+ M_LSUB(REG_ZERO, s1, d, 0);
+ M_AND(d, REG_ITMP2, d, 0);
}
+ M_LSUB(REG_ZERO, d, d, 0);
+ store_reg_to_var_int(iptr->dst, d);
+ break;
+ case ICMD_LREM0X10001:
+ var_to_reg_int(s1, src, REG_ITMP1);
+ d = reg_of_var(iptr->dst, REG_ITMP3);
+ M_ZAPNOT(s1, 0x03, REG_ITMP2, 1);
+ M_SRA(s1, 16, d, 1);
+ M_CMPLT(REG_ITMP2, d, REG_ITMP1, 0);
+ M_LSUB(REG_ITMP2, d, d, 0);
+ M_LADD(d, REG_ITMP1, d, 0);
+ M_LDA(REG_ITMP2, REG_ZERO, -1);
+ M_SRL(REG_ITMP2, 33, REG_ITMP2, 1);
+ M_CMPULT(s1, REG_ITMP2, REG_ITMP2, 0);
+ M_BNEZ(REG_ITMP2, 11);
+ M_LDA(d, REG_ZERO, -257);
+ M_ZAPNOT(d, 0xcd, d, 1);
+ M_LSUB(REG_ZERO, s1, REG_ITMP2, 0);
+ M_CMOVGE(s1, s1, REG_ITMP2, 0);
+ M_UMULH(REG_ITMP2, d, REG_ITMP2, 0);
+ M_SRL(REG_ITMP2, 16, REG_ITMP2, 1);
+ M_LSUB(REG_ZERO, REG_ITMP2, d, 0);
+ M_CMOVGE(s1, REG_ITMP2, d, 0);
+ M_SLL(d, 16, REG_ITMP2, 1);
+ M_LADD(d, REG_ITMP2, d, 0);
+ M_LSUB(s1, d, d, 0);
store_reg_to_var_int(iptr->dst, d);
break;
}
} /* for basic block */
+ bptr -> mpc = (int)((u1*) mcodeptr - mcodebase);
+
{
s4 *xcodeptr = NULL;
+/* -*- mode: c; tab-width: 4; c-basic-offset: 4 -*- */
/****************************** ncomp/nstack.c *********************************
Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
case ICMD_IMUL:
iptr[0].opc = ICMD_IMULCONST;
goto icmd_iconst_tail;
+ case ICMD_IREM:
+ if (iptr[0].val.i == 0x10001) {
+ iptr[0].opc = ICMD_IREM0X10001;
+ goto icmd_iconst_tail;
+ }
+ if ((iptr[0].val.i == 0x00000002) ||
+ (iptr[0].val.i == 0x00000004) ||
+ (iptr[0].val.i == 0x00000008) ||
+ (iptr[0].val.i == 0x00000010) ||
+ (iptr[0].val.i == 0x00000020) ||
+ (iptr[0].val.i == 0x00000040) ||
+ (iptr[0].val.i == 0x00000080) ||
+ (iptr[0].val.i == 0x00000100) ||
+ (iptr[0].val.i == 0x00000200) ||
+ (iptr[0].val.i == 0x00000400) ||
+ (iptr[0].val.i == 0x00000800) ||
+ (iptr[0].val.i == 0x00001000) ||
+ (iptr[0].val.i == 0x00002000) ||
+ (iptr[0].val.i == 0x00004000) ||
+ (iptr[0].val.i == 0x00008000) ||
+ (iptr[0].val.i == 0x00010000) ||
+ (iptr[0].val.i == 0x00020000) ||
+ (iptr[0].val.i == 0x00040000) ||
+ (iptr[0].val.i == 0x00080000) ||
+ (iptr[0].val.i == 0x00100000) ||
+ (iptr[0].val.i == 0x00200000) ||
+ (iptr[0].val.i == 0x00400000) ||
+ (iptr[0].val.i == 0x00800000) ||
+ (iptr[0].val.i == 0x01000000) ||
+ (iptr[0].val.i == 0x02000000) ||
+ (iptr[0].val.i == 0x04000000) ||
+ (iptr[0].val.i == 0x08000000) ||
+ (iptr[0].val.i == 0x10000000) ||
+ (iptr[0].val.i == 0x20000000) ||
+ (iptr[0].val.i == 0x40000000) ||
+ (iptr[0].val.i == 0x80000000)) {
+ iptr[0].opc = ICMD_IREMPOW2;
+ iptr[0].val.i -= 1;
+ goto icmd_iconst_tail;
+ }
+ CONST(TYPE_INT);
+ break;
case ICMD_IAND:
iptr[0].opc = ICMD_IANDCONST;
goto icmd_iconst_tail;
case ICMD_LMUL:
iptr[0].opc = ICMD_LMULCONST;
goto icmd_lconst_tail;
+ case ICMD_LREM:
+ if (iptr[0].val.l == 0x10001) {
+ iptr[0].opc = ICMD_LREM0X10001;
+ goto icmd_lconst_tail;
+ }
+ if ((iptr[0].val.l == 0x00000002) ||
+ (iptr[0].val.l == 0x00000004) ||
+ (iptr[0].val.l == 0x00000008) ||
+ (iptr[0].val.l == 0x00000010) ||
+ (iptr[0].val.l == 0x00000020) ||
+ (iptr[0].val.l == 0x00000040) ||
+ (iptr[0].val.l == 0x00000080) ||
+ (iptr[0].val.l == 0x00000100) ||
+ (iptr[0].val.l == 0x00000200) ||
+ (iptr[0].val.l == 0x00000400) ||
+ (iptr[0].val.l == 0x00000800) ||
+ (iptr[0].val.l == 0x00001000) ||
+ (iptr[0].val.l == 0x00002000) ||
+ (iptr[0].val.l == 0x00004000) ||
+ (iptr[0].val.l == 0x00008000) ||
+ (iptr[0].val.l == 0x00010000) ||
+ (iptr[0].val.l == 0x00020000) ||
+ (iptr[0].val.l == 0x00040000) ||
+ (iptr[0].val.l == 0x00080000) ||
+ (iptr[0].val.l == 0x00100000) ||
+ (iptr[0].val.l == 0x00200000) ||
+ (iptr[0].val.l == 0x00400000) ||
+ (iptr[0].val.l == 0x00800000) ||
+ (iptr[0].val.l == 0x01000000) ||
+ (iptr[0].val.l == 0x02000000) ||
+ (iptr[0].val.l == 0x04000000) ||
+ (iptr[0].val.l == 0x08000000) ||
+ (iptr[0].val.l == 0x10000000) ||
+ (iptr[0].val.l == 0x20000000) ||
+ (iptr[0].val.l == 0x40000000) ||
+ (iptr[0].val.l == 0x80000000)) {
+ iptr[0].opc = ICMD_LREMPOW2;
+ iptr[0].val.l -= 1;
+ goto icmd_lconst_tail;
+ }
+ CONST(TYPE_LNG);
+ break;
case ICMD_LAND:
iptr[0].opc = ICMD_LANDCONST;
goto icmd_lconst_tail;
/* pop 2 push 1 */
+ case ICMD_IREM:
+ if (!(SUPPORT_DIVISION)) {
+ iptr[0].opc = ICMD_BUILTIN2;
+ iptr[0].op1 = TYPE_INT;
+ iptr[0].val.a = (functionptr) new_builtin_irem;
+ isleafmethod = false;
+ goto builtin2;
+ }
+
+ case ICMD_LREM:
+ if (!(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_MULDIV)) {
+ iptr[0].opc = ICMD_BUILTIN2;
+ iptr[0].op1 = TYPE_LNG;
+ iptr[0].val.a = (functionptr) new_builtin_lrem;
+ isleafmethod = false;
+ goto builtin2;
+ }
+
case ICMD_IADD:
case ICMD_ISUB:
case ICMD_IMUL:
case ICMD_IDIV:
- case ICMD_IREM:
case ICMD_ISHL:
case ICMD_ISHR:
case ICMD_LSUB:
case ICMD_LMUL:
case ICMD_LDIV:
- case ICMD_LREM:
case ICMD_LOR:
case ICMD_LAND:
}
OP1_0ANY;
case ICMD_BUILTIN2:
+builtin2:
if (! (curstack->flags & SAVEDVAR)) {
curstack->varkind = ARGVAR;
curstack->varnum = 1;
}
}
printf("\n");
+
+ if (showdisassemble) {
+ s4ptr = (s4 *) (method->mcode + dseglen);
+ for (i = 0; i < block[0].mpc; i += 4, s4ptr++) {
+ disasscmd (*s4ptr, i);
+ }
+ printf("\n");
+ }
+
for (b = 0; b < block_count; b++) {
deadcode = block[b].flags <= BBREACHED;
printf("[");
case ICMD_IADDCONST:
case ICMD_ISUBCONST:
case ICMD_IMULCONST:
+ case ICMD_IREMPOW2:
+ case ICMD_IREM0X10001:
case ICMD_IANDCONST:
case ICMD_IORCONST:
case ICMD_IXORCONST:
case ICMD_LADDCONST:
case ICMD_LSUBCONST:
case ICMD_LMULCONST:
+ case ICMD_LREMPOW2:
case ICMD_LANDCONST:
case ICMD_LORCONST:
case ICMD_LXORCONST:
}
printf("\n");
}
+
+ if (showdisassemble) {
+ printf("\n");
+ i = block[b].mpc;
+ s4ptr = (s4 *) (method->mcode + dseglen + i);
+ for (; i < block[b + 1].mpc; i += 4, s4ptr++) {
+ disasscmd (*s4ptr, i);
+ }
+ printf("\n");
+ }
}
}