X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fcodegen-common.cpp;h=9920715b1c8d52b982c87f1cebc4db25c39afada;hb=09e7483afddb297f5c67f12864076184d5226c4a;hp=76ec50c82438087d40a97895ed14fcc7443d1b92;hpb=907182a09a41ea1f4460a34c5feebb192e5d3035;p=cacao.git diff --git a/src/vm/jit/codegen-common.cpp b/src/vm/jit/codegen-common.cpp index 76ec50c82..9920715b1 100644 --- a/src/vm/jit/codegen-common.cpp +++ b/src/vm/jit/codegen-common.cpp @@ -1887,6 +1887,32 @@ nowperformreturn: } #endif + // Emit the fast-path if available. + if (bte->emit_fastpath != NULL) { + void (*emit_fastpath)(jitdata* jd, instruction* iptr, int d); + emit_fastpath = (void (*)(jitdata* jd, instruction* iptr, int d)) bte->emit_fastpath; + + assert(md->returntype.type == TYPE_VOID); + d = REG_ITMP1; + + // Actually call the fast-path emitter. + emit_fastpath(jd, iptr, d); + + // If fast-path succeeded, jump to the end of the builtin + // invocation. + // XXX Actually the slow-path block below should be moved + // out of the instruction stream and the jump below should be + // inverted. +#if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER + os::abort("codegen_emit: Implement jump over slow-path for this configuration."); +#elif SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER + M_TEST(d); + emit_label_bne(cd, BRANCH_LABEL_10); +#else +# error Unable to generate code for this configuration! +#endif + } + goto gen_method; case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ... */ @@ -2066,6 +2092,12 @@ if (!md->params[s3].inmemory) { break; } + // If we are emitting a fast-path block, this is the label for + // successful fast-path execution. + if ((iptr->opc == ICMD_BUILTIN) && (bte->emit_fastpath != NULL)) { + emit_label(cd, BRANCH_LABEL_10); + } + break; case ICMD_TABLESWITCH: /* ..., index ==> ... */