[svn:parrot] r41364 - trunk/src

darbelo at svn.parrot.org darbelo at svn.parrot.org
Sat Sep 19 12:56:49 UTC 2009


Author: darbelo
Date: Sat Sep 19 12:56:47 2009
New Revision: 41364
URL: https://trac.parrot.org/parrot/changeset/41364

Log:
Remove useless functions and #defines from the frame builder.

Modified:
   trunk/src/frame_builder.c
   trunk/src/frame_builder.h

Modified: trunk/src/frame_builder.c
==============================================================================
--- trunk/src/frame_builder.c	Sat Sep 19 10:28:05 2009	(r41363)
+++ trunk/src/frame_builder.c	Sat Sep 19 12:56:47 2009	(r41364)
@@ -343,115 +343,6 @@
 
 #  define NATIVECODE jit_info->native_ptr
 
-/*
- * preserve registers around a functioncall
- *
- * all used register around a call (skip >= 0 := return result
- *
- * TODO factor out common code
- *      use jit_emit_mov_RM_{in} functions (load/store base indexed)
- *      and a macro to retrieve sp
- */
-int
-jit_save_regs_call(Parrot_jit_info_t *jit_info, PARROT_INTERP, int skip)
-{
-    int i, used_i, used_n;
-    const jit_arch_regs *reg_info;
-
-    used_i = Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_INT);
-    used_n = Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_NUM);
-    jit_emit_sub_ri_i(interp, jit_info->native_ptr, emit_ESP,
-            (used_i * sizeof (INTVAL) + used_n * sizeof (FLOATVAL)));
-    reg_info = &jit_info->arch_info->regs[jit_info->code_type];
-    for (i = 0; i < used_i; ++i) {
-        /* XXX need 2 skip vars */
-        if (reg_info->map_I[i] == skip)
-            continue;
-        emitm_movl_r_m(interp, NATIVECODE, reg_info->map_I[i], emit_ESP,
-                            emit_None, 1,
-                            (used_n * sizeof (FLOATVAL) +
-                             i      * sizeof (INTVAL)));
-    }
-    for (i = 0; i < used_n; ++i) {
-        if (reg_info->map_F[i] == skip)
-            continue;
-        emitm_fld(NATIVECODE, reg_info->map_F[i]);
-        jit_emit_fstore_mb_n(interp, NATIVECODE, emit_ESP, (i * sizeof (FLOATVAL)));
-    }
-    return used_n;
-}
-
-void
-jit_restore_regs_call(Parrot_jit_info_t *jit_info, PARROT_INTERP,
-        int skip)
-{
-
-    int i, used_i, used_n;
-    const jit_arch_regs *reg_info;
-
-    used_i = Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_INT);
-    used_n = Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_NUM);
-    reg_info = &jit_info->arch_info->regs[jit_info->code_type];
-
-    for (i = 0; i < used_i; ++i) {
-        if (reg_info->map_I[i] == skip)
-            continue;
-        emitm_movl_m_r(interp, NATIVECODE, reg_info->map_I[i], emit_ESP,
-                            emit_None, 1,
-                            (used_n * sizeof (FLOATVAL) +
-                             i      * sizeof (INTVAL)));
-    }
-    for (i = 0; i < used_n; ++i) {
-        if (reg_info->map_F[i] == skip)
-            continue;
-        jit_emit_fload_mb_n(interp, NATIVECODE, emit_ESP, (i * sizeof (FLOATVAL)));
-        emitm_fstp(NATIVECODE, (1+reg_info->map_F[i]));
-    }
-
-    jit_emit_add_ri_i(interp, jit_info->native_ptr, emit_ESP,
-            (used_i * sizeof (INTVAL) + used_n * sizeof (FLOATVAL)));
-}
-
-/*
- * params are put rigth to left on the stack
- * parrot registers are counted left to right
- * so this function returns for a given register type
- * the needed register number
- * TODO handel overflow params
- */
-
-int
-count_regs(PARROT_INTERP, char *sig, char *sig_start)
-{
-    const char *typs[] = {
-        "Ilisc",         /* I */
-        "StbB",          /* S */
-        "pP234",         /* P */
-        "Nfd"            /* N */
-    };
-    int first_reg = 0;
-    int i, found;
-
-    /* char at sig is the type to look at */
-    for (found = -1, i = 0; i < 4; i++) {
-        if (strchr(typs[i], *sig)) {
-            found = i;
-            break;
-        }
-    }
-
-    if (found == -1)
-        Parrot_ex_throw_from_c_args(interp, NULL, 1,
-            "Parrot_jit_build_call_func: sig char not found\n");
-
-    for (--sig; sig > sig_start; --sig) {
-        if (strchr(typs[found], *sig)) {
-            ++first_reg;
-        }
-    }
-    return first_reg;
-}
-
 size_t
 calc_signature_needs(const char *sig, int *strings)
 {

Modified: trunk/src/frame_builder.h
==============================================================================
--- trunk/src/frame_builder.h	Sat Sep 19 10:28:05 2009	(r41363)
+++ trunk/src/frame_builder.h	Sat Sep 19 12:56:47 2009	(r41364)
@@ -1575,12 +1575,6 @@
 
 enum { JIT_X86BRANCH, JIT_X86JUMP, JIT_X86CALL };
 
-void jit_emit_jcc(Parrot_jit_info_t *jit_info, int code, opcode_t disp);
-
-void emit_jump(Parrot_jit_info_t *jit_info, opcode_t disp);
-
-void Parrot_emit_jump_to_eax(Parrot_jit_info_t *jit_info, PARROT_INTERP);
-
 #  define jit_emit_stack_frame_enter(pc) do { \
     emitm_pushl_r((pc), emit_EBP); \
     jit_emit_mov_rr_i((pc), emit_EBP, emit_ESP); \
@@ -1602,72 +1596,6 @@
 
 void jit_get_params_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP);
 
-/*
- * preserve registers
- * a) all callee saved on function entry
- */
-
-void jit_save_regs(Parrot_jit_info_t *jit_info, PARROT_INTERP);
-
-/* restore saved regs, see above */
-
-void jit_restore_regs(Parrot_jit_info_t *jit_info, PARROT_INTERP);
-
-/*
- * preserve registers around a functioncall
- *
- * all used register around a call (skip >= 0 := return result
- *
- * TODO factor out common code
- *      use jit_emit_mov_RM_{in} functions (load/store base indexed)
- *      and a macro to retrieve sp
- */
-
-int jit_save_regs_call(Parrot_jit_info_t *jit_info, PARROT_INTERP, int skip);
-
-void jit_restore_regs_call(Parrot_jit_info_t *jit_info, PARROT_INTERP,
-    int skip);
-
-void jit_set_returns_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
-    int recursive);
-
-void jit_set_args_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
-    int recursive);
-
-/*
- * if jit_emit_noop is defined, it does align a jump target
- * to 1 << JUMP_ALIGN
- * It may emit exactly one byte, or some desired padding.
- * The instructions must perform like a noop.
- *
- * Alignment effects seem to be rather processor specific and
- * it's not quite clear if the branch src or target should be
- * aligned. Turned off for now.
- *
- * s. also info gcc /align-jump
- *
- * noop; mov %esi, %esi; lea 0(%esi), %esi
- * TODO
- * 7 bytes: 8d b4 26 00 00 00 00    lea    0x0(%esi),%esi
- * 6 bytes: 8d b6 00 00 00 00       lea    0x0(%esi),%esi
- * 5 bytes: 90 8d 74 26 00          nop,   lea    0x0(%esi),%esi
- * 4 bytes: 8d 74 26 00             lea    0x0(%esi),%esi
- *
- */
-
-#  define jit_emit_noop(pc) do { \
-     switch (((unsigned long) (pc)) & 3) { \
-       case 1: *(pc)++ = (char) 0x8d; *(pc)++ = (char) 0x76; *(pc)++ = (char) 0x00; break; \
-       case 2: *(pc)++ = (char) 0x89; *(pc)++ = (char) 0xf6; break; \
-       case 3: *(pc)++ = (char) 0x90; break; \
-     } \
-   } while (0)
-
-#  define JUMP_ALIGN 0
-#  define SUB_ALIGN 0
-
-int count_regs(PARROT_INTERP, char *sig, char *sig_start);
-
 size_t calc_signature_needs(const char *sig, int *strings);
 
 void * Parrot_jit_build_call_func(PARROT_INTERP, PMC *pmc_nci,


More information about the parrot-commits mailing list