[svn:parrot] r41348 - branches/kill_jit/src

darbelo at svn.parrot.org darbelo at svn.parrot.org
Sat Sep 19 00:59:43 UTC 2009


Author: darbelo
Date: Sat Sep 19 00:59:42 2009
New Revision: 41348
URL: https://trac.parrot.org/parrot/changeset/41348

Log:
Remove more dead JIT code.

Modified:
   branches/kill_jit/src/frame_builder.c
   branches/kill_jit/src/frame_builder.h

Modified: branches/kill_jit/src/frame_builder.c
==============================================================================
--- branches/kill_jit/src/frame_builder.c	Sat Sep 19 00:32:02 2009	(r41347)
+++ branches/kill_jit/src/frame_builder.c	Sat Sep 19 00:59:42 2009	(r41348)
@@ -1175,172 +1175,6 @@
 
 int control_word = 0x27f;
 
-void
-Parrot_jit_begin(Parrot_jit_info_t *jit_info,
-                 PARROT_INTERP)
-{
-    /* the generated code gets called as:
-     * (jit_code)(interp, pc)
-     * jumping to pc is the same code as used in Parrot_jit_cpcf_op()
-     */
-
-    /* Maintain the stack frame pointer for the sake of gdb */
-    jit_emit_stack_frame_enter(jit_info->native_ptr);
-    emitm_fldcw(interp, jit_info->native_ptr, &control_word);
-    /* stack:
-     *  12   pc
-     *   8   interpreter
-     *   4   retaddr
-     *   0   ebp <----- ebp
-     *  -4   ebx .. preserved regs
-     *  -8   esi ..
-     * -12   edi ..
-     * -16   interpreter
-     */
-
-    /* Save all callee-saved registers (cdecl)
-     */
-    emitm_pushl_r(jit_info->native_ptr, emit_EBX);
-    emitm_pushl_r(jit_info->native_ptr, emit_ESI);
-    emitm_pushl_r(jit_info->native_ptr, emit_EDI);
-
-    /* Cheat on op function calls by writing the interpreter arg on the stack
-     * just once. If an op function ever modifies the interpreter argument on
-     * the stack this will stop working !!! */
-
-    /* get the interpreter from stack:  mov 8(%ebp), %eax */
-    emitm_movl_m_r(interp, jit_info->native_ptr, emit_EAX, emit_EBP, emit_None, 1, 8);
-    emitm_pushl_r(jit_info->native_ptr, emit_EAX);
-
-    /* get the pc from stack:  mov 12(%ebp), %eax */
-    emitm_movl_m_r(interp, jit_info->native_ptr, emit_EAX, emit_EBP, emit_None, 1, 12);
-
-    /* jump to restart pos or first op */
-    Parrot_emit_jump_to_eax(jit_info, interp);
-}
-
-/*
- * create a JITted version of a PIR sub, where everything
- * resided in registers
- *
- * The sub is called as
- *
- *   opcode_t * func(Interp *i, INTVAL *sig_bits, void **args);
- *
- *   args[0] ...    NULL / return value address
- *   args[1..n] ... addresses of n arguments
- *   args[n + 1] .. opcode_t* next - usually just returned
- */
-
-void
-Parrot_jit_begin_sub_regs(Parrot_jit_info_t *jit_info,
-                 PARROT_INTERP)
-{
-    jit_emit_stack_frame_enter(jit_info->native_ptr);
-    /* stack:
-     *  16   args
-     *  12   sig_bits
-     *   8   interpreter
-     *   4   retaddr
-     *   0   ebp <----- ebp
-     * [ -4   ebx .. preserved regs ]
-     * [ -8   edi .. preserved regs ]
-     */
-    /*
-     * check register usage of the subroutine
-     * how many we have to preserve
-     */
-    jit_save_regs(jit_info, interp);
-    /* when it's a recursive sub, we fetch params to registers
-     * and all a inner helper sub, which run with registers only
-     */
-    if (jit_info->flags & JIT_CODE_RECURSIVE) {
-        char * L1;
-        PMC *sig_result;
-        opcode_t *result;
-
-        jit_get_params_pc(jit_info, interp);
-        /* remember fixup position - call sub */
-        L1 = NATIVECODE;
-        emitm_calll(NATIVECODE, 0);
-        /* check type of return value */
-        result      = Parrot_pcc_get_results(interp, CURRENT_CONTEXT(interp));
-        sig_result  = Parrot_pcc_get_pmc_constant(interp, CURRENT_CONTEXT(interp), result[1]);
-        if (!VTABLE_elements(interp, sig_result))
-            goto no_result;
-        /* fetch args to %edx */
-        emitm_movl_m_r(interp, NATIVECODE, emit_EDX, emit_EBP, emit_None, 1, 16);
-        emitm_movl_m_r(interp, NATIVECODE, emit_ECX, emit_EDX, emit_None, 1, 0);
-        if (VTABLE_get_integer_keyed_int(interp, sig_result, 0) ==
-                PARROT_ARG_FLOATVAL) {
-            jit_emit_fst_mb_n(interp, jit_info->native_ptr, emit_ECX, 0);
-        }
-        else {
-            emitm_movl_r_m(interp, NATIVECODE, emit_EAX, emit_ECX, 0, 1, 0);
-        }
-no_result:
-        /* return 0 - no branch */
-        jit_emit_bxor_rr_i(interp, NATIVECODE, emit_EAX, emit_EAX);
-        /* restore pushed callee saved */
-        jit_restore_regs(jit_info, interp);
-        jit_emit_stack_frame_leave(NATIVECODE);
-        emitm_ret(NATIVECODE);
-        /* align the inner sub */
-#if SUB_ALIGN
-        while ((long)jit_info->native_ptr & ((1<<SUB_ALIGN) - 1)) {
-            jit_emit_noop(jit_info->native_ptr);
-        }
-#endif
-        /* fixup call statement */
-        L1[1] = NATIVECODE - L1 - 5;
-    }
-    /* TODO be sure we got a label here in map_branch */
-}
-
-void
-Parrot_jit_begin_sub(Parrot_jit_info_t *jit_info,
-                 PARROT_INTERP)
-{
-}
-
-void
-jit_mov_mr_n_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int base_reg, INTVAL offs, int src_reg)
-{
-    emitm_fld(jit_info->native_ptr, src_reg);
-    jit_emit_fstore_mb_n(interp, jit_info->native_ptr, base_reg, offs);
-}
-
-void
-jit_mov_mr_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int base_reg, INTVAL offs, int src_reg)
-{
-    emitm_movl_r_m(interp, jit_info->native_ptr,
-            src_reg, base_reg, emit_None, 1, offs);
-}
-
-void
-jit_mov_rm_n_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int dst_reg, int base_reg, INTVAL offs)
-{
-    jit_emit_fload_mb_n(interp, jit_info->native_ptr, base_reg,  offs);
-    emitm_fstp(jit_info->native_ptr, (dst_reg+1));
-}
-
-void
-jit_mov_rm_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int dst_reg, int base_reg, INTVAL offs)
-{
-    emitm_movl_m_r(interp, jit_info->native_ptr,
-            dst_reg, base_reg, emit_None, 1, offs);
-}
-
-void
-Parrot_jit_emit_finit(Parrot_jit_info_t *jit_info)
-{
-    jit_emit_finit(jit_info->native_ptr);
-}
-
 extern int jit_op_count(void);
 
 void
@@ -1417,30 +1251,6 @@
     Parrot_emit_jump_to_eax(jit_info, interp);
 }
 
-void
-Parrot_jit_restart_op(Parrot_jit_info_t *jit_info,
-                   PARROT_INTERP)
-{
-    char *jmp_ptr, *sav_ptr;
-
-    Parrot_jit_normal_op(jit_info, interp);
-    /* test eax, if zero (e.g after trace), return from JIT */
-    jit_emit_test_r_i(jit_info->native_ptr, emit_EAX);
-    /* remember PC */
-    jmp_ptr = jit_info->native_ptr;
-    /* emit jump past exit code, dummy offset
-     * this assumes exit code is not longer then a short jump (126 bytes) */
-    emitm_jxs(jit_info->native_ptr, emitm_jnz, 0);
-    jit_emit_end(jit_info->native_ptr);
-    /* fixup above jump */
-    sav_ptr = jit_info->native_ptr;
-    jit_info->native_ptr = jmp_ptr;
-    emitm_jxs(jit_info->native_ptr, emitm_jnz, (long)(sav_ptr - jmp_ptr) - 2);
-    /* restore PC */
-    jit_info->native_ptr = sav_ptr;
-    Parrot_emit_jump_to_eax(jit_info, interp);
-}
-
 /*
  * params are put rigth to left on the stack
  * parrot registers are counted left to right

Modified: branches/kill_jit/src/frame_builder.h
==============================================================================
--- branches/kill_jit/src/frame_builder.h	Sat Sep 19 00:32:02 2009	(r41347)
+++ branches/kill_jit/src/frame_builder.h	Sat Sep 19 00:59:42 2009	(r41348)
@@ -2049,37 +2049,6 @@
 
 void Parrot_jit_begin(Parrot_jit_info_t *jit_info, PARROT_INTERP);
 
-/*
- * create a JITted version of a PIR sub, where everything
- * resided in registers
- *
- * The sub is called as
- *
- *   opcode_t * func(Interp *i, INTVAL *sig_bits, void **args);
- *
- *   args[0] ...    NULL / return value address
- *   args[1..n] ... addresses of n arguments
- *   args[n + 1] .. opcode_t* next - usually just returned
- */
-
-void Parrot_jit_begin_sub_regs(Parrot_jit_info_t *jit_info, PARROT_INTERP);
-
-void Parrot_jit_begin_sub(Parrot_jit_info_t *jit_info, PARROT_INTERP);
-
-void jit_mov_mr_n_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int base_reg, INTVAL offs, int src_reg);
-
-void jit_mov_mr_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int base_reg, INTVAL offs, int src_reg);
-
-void jit_mov_rm_n_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int dst_reg, int base_reg, INTVAL offs);
-
-void jit_mov_rm_offs(PARROT_INTERP, Parrot_jit_info_t *jit_info,
-        int dst_reg, int base_reg, INTVAL offs);
-
-void Parrot_jit_emit_finit(Parrot_jit_info_t *jit_info);
-
 void Parrot_jit_normal_op(Parrot_jit_info_t *jit_info, PARROT_INTERP);
 
 void Parrot_jit_cpcf_op(Parrot_jit_info_t *jit_info, PARROT_INTERP);


More information about the parrot-commits mailing list