Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: cacao.c 7236 2007-01-22 17:25:03Z twisti $
+ $Id: cacao.c 7698 2007-04-13 10:12:04Z twisti $
*/
lt_dlhandle libjvm_handle;
lt_ptr libjvm_vm_createjvm;
lt_ptr libjvm_vm_run;
+ const char *lterror;
bool (*vm_createjvm)(JavaVM **, void **, void *);
void (*vm_run)(JavaVM *, JavaVMInitArgs *);
If not found, try the absolute path. */
if (!(libjvm_handle = lt_dlopenext("libjvm"))) {
+ /* save the error message */
+
+ lterror = strdup(lt_dlerror());
+
if (!(libjvm_handle = lt_dlopenext(path))) {
+ /* print the first error message too */
+
+ fprintf(stderr, "main: lt_dlopenext failed: %s\n", lterror);
+
+ /* and now the current one */
+
fprintf(stderr, "main: lt_dlopenext failed: %s\n", lt_dlerror());
abort();
}
+
+ /* free the error string */
+
+ free((void *) lterror);
}
if (!(libjvm_vm_createjvm = lt_dlsym(libjvm_handle, "vm_createjvm"))) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-/* #define USEBUILTINTABLE */
-
#define SUPPORT_DIVISION 0
#define SUPPORT_LONG 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Michael Starzinger
- Christian Thalinger
-
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#ifndef _ARCH_H
#define _ARCH_H
+#include "config.h"
+
+
/* define architecture features ***********************************************/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 0
#define SUPPORT_LONG 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 1
#define SUPPORT_LONG 1
#include "config.h"
-/*#define USE_FAKE_ATOMIC_INSTRUCTIONS 0 */
-
/* define architecture features ***********************************************/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 0
#define SUPPORT_LONG 0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#if SIZEOF_VOID_P == 8
#define SUPPORT_DIVISION 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7692 2007-04-12 14:47:24Z twisti $
+ $Id: codegen.c 7700 2007-04-13 11:48:48Z twisti $
*/
case ICMD_LDIV: /* ..., val1, val2 ==> ..., val1 / val2 */
case ICMD_LREM: /* ..., val1, val2 ==> ..., val1 % val2 */
- bte = iptr->sx.s23.s3.bte;
- md = bte->md;
+ s1 = emit_load_s1(jd, iptr, REG_A0_A1_PACKED);
+ s2 = emit_load_s2(jd, iptr, REG_A2_A3_PACKED);
- s2 = emit_load_s2(jd, iptr, REG_ITMP12_PACKED);
+ /* XXX TODO: only do this if arithmetic check is really done! */
M_OR(GET_HIGH_REG(s2), GET_LOW_REG(s2), REG_ITMP3);
emit_arithmetic_check(cd, iptr, REG_ITMP3);
- s3 = PACK_REGS(rd->argintregs[GET_LOW_REG(md->params[1].regoff)],
- rd->argintregs[GET_HIGH_REG(md->params[1].regoff)]);
- M_LNGMOVE(s2, s3);
-
- s1 = emit_load_s1(jd, iptr, REG_ITMP12_PACKED);
- s3 = PACK_REGS(rd->argintregs[GET_LOW_REG(md->params[0].regoff)],
- rd->argintregs[GET_HIGH_REG(md->params[0].regoff)]);
- M_LNGMOVE(s1, s3);
+ M_LNGMOVE(s1, REG_A0_A1_PACKED);
+ M_LNGMOVE(s2, REG_A2_A3_PACKED);
+ bte = iptr->sx.s23.s3.bte;
disp = dseg_add_functionptr(cd, bte->fp);
M_ALD(REG_ITMP3, REG_PV, disp);
M_JSR(REG_RA, REG_ITMP3);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 7351 2007-02-13 21:32:36Z twisti $
+ $Id: md-abi.c 7699 2007-04-13 10:42:05Z twisti $
*/
case TYPE_LNG:
if (i < INT_ARG_CNT) {
pd->inmemory = false;
- pd->regoff = reguse;
+ pd->regoff = reguse;
reguse++;
md->argintreguse = reguse;
- } else {
+ }
+ else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize;
stacksize++;
}
break;
case TYPE_DBL:
if (i < FLT_ARG_CNT) {
pd->inmemory = false;
- pd->regoff = reguse;
+ pd->regoff = reguse;
reguse++;
md->argfltreguse = reguse;
- } else {
+ }
+ else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize;
stacksize++;
}
break;
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
# if WORDS_BIGENDIAN == 1
- pd->regoff = PACK_REGS(reguse + 1, reguse);
+ pd->regoff = PACK_REGS(reguse + 1, reguse);
# else
- pd->regoff = PACK_REGS(reguse, reguse + 1);
+ pd->regoff = PACK_REGS(reguse, reguse + 1);
# endif
reguse += 2;
md->argintreguse = reguse;
}
else {
pd->inmemory = true;
- pd->regoff = ALIGN_2_WORD(stacksize);
+ pd->regoff = ALIGN_2_WORD(stacksize);
}
stacksize += 2;
}
if (i < INT_ARG_CNT) {
pd->inmemory = false;
- pd->regoff = reguse;
+ pd->regoff = reguse;
reguse++;
md->argintreguse = reguse;
- } else {
+ }
+ else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize;
}
stacksize++;
break;
if (i < INT_ARG_CNT) {
pd->inmemory = false;
#if WORDS_BIGENDIAN == 1
- pd->regoff = PACK_REGS(reguse + 1, reguse);
+ pd->regoff = PACK_REGS(reguse + 1, reguse);
#else
- pd->regoff = PACK_REGS(reguse, reguse + 1);
+ pd->regoff = PACK_REGS(reguse, reguse + 1);
#endif
reguse += 2;
md->argintreguse = reguse;
- } else {
+ }
+ else {
pd->inmemory = true;
- pd->regoff = stacksize;
+ pd->regoff = stacksize;
}
stacksize += 2;
break;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 1
#define SUPPORT_LONG 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7688 2007-04-12 09:05:12Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#include "config.h"
-/*#define USE_FAKE_ATOMIC_INSTRUCTIONS 0 */
-
/* define architecture features ***********************************************/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 1
#define SUPPORT_LONG 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7693 2007-04-12 14:56:49Z michi $
+ $Id: codegen.c 7694 2007-04-12 15:35:13Z tbfg $
*/
s2 = emit_load_s2(jd, iptr, REG_ITMP2);
d = codegen_reg_of_dst(jd, iptr, REG_ITMP2);
M_SUB(s1, s2, d);
+ M_EXTSW(d, d);
emit_store_dst(jd, iptr, d);
break;
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
s2 = emit_load_s2(jd, iptr, REG_ITMP2);
d = codegen_reg_of_dst(jd, iptr, REG_ITMP2);
- M_SRA(s1, s2, d);
+ M_AND_IMM(s2, 0x3f, REG_ITMP2);
+ M_SRA(s1, REG_ITMP2, d);
emit_store_dst(jd, iptr, d);
break;
case ICMD_LUSHRCONST:
/* sx.val.i = constant */
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
d = codegen_reg_of_dst(jd, iptr, REG_ITMP2);
+#if 0
+ /* fast division, result in REG_ITMP3) */
+ M_SRA_IMM(s1, iptr->sx.val.i, REG_ITMP3);
+ M_ADDZE(REG_ITMP3, REG_ITMP3);
+
+ M_SUB(s1, REG_ITMP3, d);
+ M_EXTSW(d, d);
+ emit_store_dst(jd, iptr, d);
+ break;
+#else
+
M_MOV(s1, REG_ITMP2);
M_CMPI(s1, 0);
M_BGE(1 + 2*(iptr->sx.val.i >= 32768));
M_EXTSW(d, d);
emit_store_dst(jd, iptr, d);
break;
+#endif
case ICMD_IOR: /* ..., val1, val2 ==> ..., val1 | val2 */
case ICMD_LOR:
/* generate patcher stub call code */
- {
- patchref *pref;
- u4 mcode;
- u1 *savedmcodeptr;
- u1 *tmpmcodeptr;
-
- for (pref = cd->patchrefs; pref != NULL; pref = pref->next) {
- /* Get machine code which is patched back in later. The
- call is 1 instruction word long. */
-
- tmpmcodeptr = cd->mcodebase + pref->branchpos;
-
- mcode = *((u4 *) tmpmcodeptr);
-
- /* Patch in the call to call the following code (done at
- compile time). */
-
- savedmcodeptr = cd->mcodeptr; /* save current mcodeptr */
- cd->mcodeptr = tmpmcodeptr; /* set mcodeptr to patch position */
-
- disp = ((u4 *) savedmcodeptr) - (((u4 *) tmpmcodeptr) + 1);
- M_BL(disp);
-
- cd->mcodeptr = savedmcodeptr; /* restore the current mcodeptr */
-
- /* create stack frame - keep stack 16-byte aligned */
-
- M_AADD_IMM(REG_SP, -8 * 8, REG_SP);
-
- /* move return address onto stack */
-
- M_MFLR(REG_ZERO);
- M_AST(REG_ZERO, REG_SP, 5 * 8);
-
- /* move pointer to java_objectheader onto stack */
-
-#if defined(ENABLE_THREADS)
- /* order reversed because of data segment layout */
-
- (void) dseg_add_unique_address(cd, NULL); /* flcword */
- (void) dseg_add_unique_address(cd, lock_get_initial_lock_word()); /* monitorPtr */
- disp = dseg_add_unique_address(cd, NULL); /* vftbl */
-
- M_LDA(REG_ITMP3, REG_PV, disp);
- M_AST(REG_ITMP3, REG_SP, 4 * 8);
-#else
- /* do nothing */
-#endif
-
- /* move machine code onto stack */
-
- disp = dseg_add_unique_s4(cd, mcode);
- M_ILD(REG_ITMP3, REG_PV, disp);
- M_IST(REG_ITMP3, REG_SP, 3 * 8);
-
- /* move class/method/field reference onto stack */
-
- disp = dseg_add_unique_address(cd, pref->ref);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_AST(REG_ITMP3, REG_SP, 2 * 8);
-
- /* move data segment displacement onto stack */
-
- disp = dseg_add_unique_s4(cd, pref->disp);
- M_ILD(REG_ITMP3, REG_PV, disp);
- M_IST(REG_ITMP3, REG_SP, 1 * 8);
-
- /* move patcher function pointer onto stack */
+ emit_patcher_stubs(jd);
- disp = dseg_add_functionptr(cd, pref->patcher);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_AST(REG_ITMP3, REG_SP, 0 * 8);
+ codegen_finish(jd);
- disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_MTCTR(REG_ITMP3);
- M_RTS;
- }
- }
+ return code->entrypoint;
}
cd->mcodeptr = savedmcodeptr; /* restore the current mcodeptr */
/* create stack frame - keep stack 16-byte aligned */
-
M_AADD_IMM(REG_SP, -8 * 8, REG_SP);
/* calculate return address and move it onto the stack */
-
M_LDA(REG_ITMP3, REG_PV, pref->branchpos);
M_AST_INTERN(REG_ITMP3, REG_SP, 5 * 8);
#endif
/* move machine code onto stack */
-
disp = dseg_add_s4(cd, mcode);
M_ILD(REG_ITMP3, REG_PV, disp);
M_IST_INTERN(REG_ITMP3, REG_SP, 3 * 8);
/* move class/method/field reference onto stack */
-
disp = dseg_add_address(cd, pref->ref);
M_ALD(REG_ITMP3, REG_PV, disp);
M_AST_INTERN(REG_ITMP3, REG_SP, 2 * 8);
/* move data segment displacement onto stack */
-
disp = dseg_add_s4(cd, pref->disp);
M_ILD(REG_ITMP3, REG_PV, disp);
M_IST_INTERN(REG_ITMP3, REG_SP, 1 * 8);
- M_NOP;
/* move patcher function pointer onto stack */
-
disp = dseg_add_functionptr(cd, pref->patcher);
M_ALD(REG_ITMP3, REG_PV, disp);
M_AST_INTERN(REG_ITMP3, REG_SP, 0 * 8);
-#if 0
- disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_MTCTR(REG_ITMP3);
- M_RTS;
-#else
if (targetdisp == 0) {
targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
(((u4 *) cd->mcodeptr) + 1);
M_BR(disp);
}
-#endif
}
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: patcher.c 7601 2007-03-28 23:02:50Z michi $
+ $Id: patcher.c 7694 2007-04-12 15:35:13Z tbfg $
*/
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- /* calculate and set the new return address */
-
- ra = ra - 1 * 4;
- *((ptrint *) (sp + 5 * 8)) = (ptrint) ra;
-
/* resolve native function */
if (!(f = native_resolve_function(m)))
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7688 2007-04-12 09:05:12Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-#define USEBUILTINTABLE
-
#define SUPPORT_DIVISION 1
#define SUPPORT_LONG 1
#define U8_AVAILABLE 1
-/* #define USEBUILTINTABLE */
-
#define SUPPORT_DIVISION 0
#define SUPPORT_LONG 1
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: stack.c 7667 2007-04-05 00:16:05Z michi $
+ $Id: stack.c 7695 2007-04-12 19:49:34Z twisti $
*/
/* automatically replace some ICMDs with builtins */
-#if defined(USEBUILTINTABLE)
bte = builtintable_get_automatic(opcode);
- if (bte && bte->opcode == opcode) {
- iptr->opc = ICMD_BUILTIN;
+ if ((bte != NULL) && (bte->opcode == opcode)) {
+ iptr->opc = ICMD_BUILTIN;
iptr->flags.bits &= INS_FLAG_ID_MASK;
- iptr->sx.s23.s3.bte = bte;
+ iptr->sx.s23.s3.bte = bte;
/* iptr->line is already set */
- jd->isleafmethod = false;
+ jd->isleafmethod = false;
goto icmd_BUILTIN;
}
-#endif /* defined(USEBUILTINTABLE) */
/* main opcode switch *************************************/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7601 2007-03-28 23:02:50Z michi $
+ $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
*/
#define U8_AVAILABLE 1
-/* #define USEBUILTINTABLE */
-
#define SUPPORT_DIVISION 1
#define SUPPORT_LONG 1