Esempio n. 1
0
void test_swl_swr(void)
{
  s32 i;

  DO_OP(swl, le);
  DO_OP(swl, be);
  DO_OP(swr, le);
  DO_OP(swr, be);

  for (i = 0; i < 5; i++)
  {
    do_rl_op("swr_swl_be", swr_swl_be, 4 + i, data_be[i]);
    do_rl_op("swr_swl_le", swr_swl_le, 4 + i, data_le[i]);
  }
  printf("\n");
}
Esempio n. 2
0
void test_lwl_lwr(void)
{
  s32 i;

  DO_OP(lwl, le);
  DO_OP(lwl, be);
  DO_OP(lwr, le);
  DO_OP(lwr, be);

  for (i = 0; i < 5; i++)
  {
    do_rl_op("lwr_lwl_be", lwr_lwl_be, 4 + i, data_be[i], reg_be);
    do_rl_op("lwr_lwl_le", lwr_lwl_le, 4 + i, data_le[i], reg_le);
  }
  printf("\n");
}
Esempio n. 3
0
opcode_t *
runops_profile_core(struct Parrot_Interp *interpreter, opcode_t *pc)
{
    opcode_t cur_op, old_op;
    RunProfile *profile = interpreter->profile;

    old_op = profile->cur_op;
    /*
     * if we are reentering the runloop:
     * - remember old op and calc time till now
     */
    if (old_op) {
        profile->data[old_op].time +=
            Parrot_floatval_time() - profile->starttime;
    }

    while (pc) {/* && pc >= code_start && pc < code_end) */
        interpreter->cur_pc = pc;
        profile->cur_op = cur_op = *pc + PARROT_PROF_EXTRA;
        profile->data[cur_op].numcalls++;
        profile->starttime = Parrot_floatval_time();

        DO_OP(pc, interpreter);

        /* profile->cur_op may be different, if exception was thrown */
        profile->data[profile->cur_op].time +=
            Parrot_floatval_time() - profile->starttime;
    }
    if (old_op) {
        /* old opcode continues */
        profile->starttime = Parrot_floatval_time();
        profile->cur_op = old_op;
    }
    return pc;
}
Esempio n. 4
0
opcode_t *
runops_fast_core(struct Parrot_Interp *interpreter, opcode_t *pc)
{
    while (pc) {
        DO_OP(pc, interpreter);
    }
    return pc;
}
Esempio n. 5
0
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static opcode_t *
runops_fast_core(PARROT_INTERP, ARGIN(Parrot_runcore_t *runcore), ARGIN(opcode_t *pc))
{
    ASSERT_ARGS(runops_fast_core)

    /* disable pc */
    Parrot_pcc_set_pc(interp, CURRENT_CONTEXT(interp), NULL);

    while (pc) {
        /* TODO
         * Decide do we need check here.
         * Fast-core cause segfaults even on test suite
        if (pc < code_start || pc >= code_end)
            Parrot_ex_throw_from_c_args(interp, NULL, 1,
                "attempt to access code outside of current code segment");
        */
        DO_OP(pc, interp);
    }

    return pc;
}
Esempio n. 6
0
opcode_t *
runops_slow_core(struct Parrot_Interp *interpreter, opcode_t *pc)
{
#ifdef USE_TRACE_INTERP
    Interp * trace_i;
    struct Parrot_Context *trace_ctx;
#endif
    opcode_t *opc, *ostart, *oend;
    static size_t dod, gc;

#ifdef code_start
#  undef code_start
#endif
#ifdef code_end
#  undef code_end
#endif

#define  code_start interpreter->code->byte_code
#define  code_end   (interpreter->code->byte_code + \
        interpreter->code->cur_cs->base.size)


#ifdef USE_TRACE_INTERP
    if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
        trace_i = make_interpreter(interpreter, NO_FLAGS);
        Parrot_init(trace_i);
        /* remeber old context */
        trace_ctx = mem_sys_allocate(sizeof(struct Parrot_Context));
        mem_sys_memcopy(trace_ctx, &trace_i->ctx,
                sizeof(struct Parrot_Context));
        /* copy in current */
        mem_sys_memcopy(&trace_i->ctx, &interpreter->ctx,
                sizeof(struct Parrot_Context));
        trace_i->code = interpreter->code;
        Interp_flags_SET(trace_i, PARROT_EXTERN_CODE_FLAG);
    }
#endif

    dod = interpreter->dod_runs;
    gc = interpreter->collect_runs;
    while (pc) {/* && pc >= code_start && pc < code_end) {*/
        interpreter->cur_pc = pc;
        opc = pc;
        ostart = code_start;
        oend = code_end;

        DO_OP(pc, interpreter);

        if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
#ifdef USE_TRACE_INTERP
            mem_sys_memcopy(&trace_i->ctx, &interpreter->ctx,
                    sizeof(struct Parrot_Context));
            trace_op(trace_i, ostart, oend, opc);
#else
            trace_op(interpreter, ostart, oend, opc);
#endif
            if (dod != interpreter->dod_runs) {
                dod = interpreter->dod_runs;
                PIO_printf(interpreter, "       DOD\n");
            }
            if (gc != interpreter->collect_runs) {
                gc = interpreter->collect_runs;
                PIO_printf(interpreter, "       GC\n");
            }
        }
    }
#ifdef USE_TRACE_INTERP
    if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
        /* restore trace context */
        mem_sys_memcopy(&trace_i->ctx, trace_ctx,
                sizeof(struct Parrot_Context));
        mem_sys_free(trace_ctx);
    }
#endif

    /*    if (pc && (pc < code_start || pc >= code_end)) {
        internal_exception(INTERP_ERROR,
       "Error: Control left bounds of byte-code block (now at location %d)!\n",
       (int)(pc - code_start));
       }*/
#undef code_start
#undef code_end
    return pc;
}