memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 3739 2005-11-22 23:05:51Z twisti $
+ $Id: codegen.inc 3745 2005-11-22 23:43:53Z twisti $
*/
mte = NEW(methodtree_element);
- mte->startpc = (functionptr) asm_calljavafunction;
- mte->endpc = (functionptr) ((ptrint) asm_calljavafunction2 - 1);
+ mte->startpc = (u1 *) (ptrint) asm_calljavafunction;
+ mte->endpc = (u1 *) ((ptrint) asm_calljavafunction2 - 1);
avl_insert(methodtree, mte);
mte = NEW(methodtree_element);
- mte->startpc = (functionptr) asm_calljavafunction2;
- mte->endpc = (functionptr) ((ptrint) asm_call_jit_compiler - 1);
+ mte->startpc = (u1 *) (ptrint) asm_calljavafunction2;
+ mte->endpc = (u1 *) ((ptrint) asm_call_jit_compiler - 1);
avl_insert(methodtree, mte);
#endif /* !defined(ENABLE_INTRP) */
#if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__)
/* On some architectures the patcher stub call instruction might
- be longer than the actual instruction generated. On this
- architectures we store the last patcher call position and after
- the basic block code generation is completed, we check the range
- and maybe generate some nop's. */
+ be longer than the actual instruction generated. On this
+ architectures we store the last patcher call position and after
+ the basic block code generation is completed, we check the
+ range and maybe generate some nop's. */
cd->lastmcodeptr = ((u1 *) branchptr) + PATCHER_CALL_SIZE;
#endif
*******************************************************************************/
-void codegen_insertmethod(functionptr startpc, functionptr endpc)
+void codegen_insertmethod(u1 *startpc, u1 *endpc)
{
methodtree_element *mte;
mte = NEW(methodtree_element);
mte->startpc = startpc;
- mte->endpc = endpc;
+ mte->endpc = endpc;
if (avl_insert(methodtree, mte)) {
#if defined(USE_THREADS)
*******************************************************************************/
-functionptr codegen_findmethod(functionptr pc)
+u1 *codegen_findmethod(u1 *pc)
{
methodtree_element mtepc;
methodtree_element *mte;
static void codegen_finish(methodinfo *m, codegendata *cd, s4 mcodelen)
{
- jumpref *jr;
- functionptr epoint;
- s4 extralen;
- s4 alignedlen;
+ jumpref *jr;
+ u1 *epoint;
+ s4 extralen;
+ s4 alignedlen;
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
extralen = sizeof(threadcritnode) * cd->threadcritcount;
/* allocate new memory */
m->mcodelength = mcodelen + cd->dseglen;
- m->mcode = (functionptr) (ptrint) CNEW(u1, alignedlen + extralen);
+ m->mcode = CNEW(u1, alignedlen + extralen);
/* copy data and code to their new location */
- MCOPY((void *) (ptrint) m->mcode, cd->dsegtop - cd->dseglen, u1,
- cd->dseglen);
- MCOPY((void *) ((ptrint) m->mcode + cd->dseglen), cd->mcodebase, u1,
- mcodelen);
+ MCOPY((void *) m->mcode, cd->dsegtop - cd->dseglen, u1, cd->dseglen);
+ MCOPY((void *) (m->mcode + cd->dseglen), cd->mcodebase, u1, mcodelen);
- m->entrypoint = epoint = (functionptr) ((ptrint) m->mcode + cd->dseglen);
+ m->entrypoint = epoint = (m->mcode + cd->dseglen);
/* jump table resolving */
#if defined(__I386__) || defined(__X86_64__) || defined(ENABLE_INTRP) || defined(DISABLE_GC)
/* add method into methodtree to find the entrypoint */
- codegen_insertmethod(m->entrypoint,
- (functionptr) ((ptrint) m->entrypoint + mcodelen));
+ codegen_insertmethod(m->entrypoint, m->entrypoint + mcodelen);
#endif
#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__)
dr = cd->datareferences;
while (dr != NULL) {
- *((functionptr *) ((ptrint) epoint + (ptrint) dr->pos -
- SIZEOF_VOID_P)) = epoint;
+ *((u1 **) (epoint + (ptrint) dr->pos - SIZEOF_VOID_P)) = epoint;
dr = dr->next;
}
}
*******************************************************************************/
-functionptr codegen_createnativestub(functionptr f, methodinfo *m)
+u1 *codegen_createnativestub(functionptr f, methodinfo *m)
{
codegendata *cd;
registerdata *rd;
*******************************************************************************/
-void removecompilerstub(functionptr stub)
+void removecompilerstub(u1 *stub)
{
/* pass size 1 to keep the intern function happy */
- CFREE((void *) (ptrint) stub, 1);
+ CFREE((void *) stub, 1);
}
*******************************************************************************/
-void removenativestub(functionptr stub)
+void removenativestub(u1 *stub)
{
/* pass size 1 to keep the intern function happy */
- CFREE((void *) (ptrint) stub, 1);
+ CFREE((void *) stub, 1);
}
Changes: Christian Ullrich
- $Id: codegen.inc.h 3740 2005-11-22 23:06:26Z twisti $
+ $Id: codegen.inc.h 3745 2005-11-22 23:43:53Z twisti $
*/
typedef struct _methodtree_element methodtree_element;
struct _methodtree_element {
- functionptr startpc;
- functionptr endpc;
+ u1 *startpc;
+ u1 *endpc;
};
#endif
bool codegen(methodinfo *m, codegendata *cd, registerdata *rd);
void codegen_free(methodinfo *m, codegendata *cd);
void codegen_close(void);
-void codegen_insertmethod(functionptr startpc, functionptr endpc);
+void codegen_insertmethod(u1 *startpc, u1 *endpc);
-functionptr codegen_findmethod(functionptr pc);
+u1 *codegen_findmethod(u1 *pc);
#if defined(__I386__) || defined(__X86_64__)
void codegen_addreference(codegendata *cd, struct basicblock *target, void *branchptr);
void dseg_display(methodinfo *m, codegendata *cd);
-functionptr codegen_createnativestub(functionptr f, methodinfo *m);
+u1 *codegen_createnativestub(functionptr f, methodinfo *m);
void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end);
void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra);
void codegen_finish_native_call(u1 *datasp);
-functionptr createcompilerstub(methodinfo *m);
-functionptr createnativestub(functionptr f, methodinfo *m, codegendata *cd,
- registerdata *rd, methoddesc *md);
+u1 *createcompilerstub(methodinfo *m);
+u1 *createnativestub(functionptr f, methodinfo *m, codegendata *cd,
+ registerdata *rd, methoddesc *md);
-void removecompilerstub(functionptr stub);
-void removenativestub(functionptr stub);
+void removecompilerstub(u1 *stub);
+void removenativestub(u1 *stub);
/* machine dependent find method function */
u1 *md_codegen_findmethod(u1 *ra);