pike.git / src / code / amd64.c

version» Context lines:

pike.git/src/code/amd64.c:595:    mark_sp_reg = 0;    dirty_regs = 0;    amd64_prev_stored_pc = -1;   }      static void flush_dirty_regs(void)   {    /* NB: PIKE_FP_REG is currently never dirty. */    if (dirty_regs & (1 << PIKE_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }    if (dirty_regs & (1 << PIKE_MARK_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_MARK_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, mark_stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, mark_stack_pointer));    dirty_regs &= ~(1 << PIKE_MARK_SP_REG);    }   }      static enum amd64_reg alloc_reg (int avoid_regs)   {    enum amd64_reg reg;    int used_regs = (avoid_regs | REG_RESERVED) & REG_BITMASK;       avoid_regs |= REG_RESERVED;
pike.git/src/code/amd64.c:657:    return reg;   }      /* NB: We load Pike_fp et al into registers that    * are persistent across function calls.    */   void amd64_load_fp_reg(void)   {    if (!fp_reg) {    AMD64_MOVE_RELADDR_TO_REG(Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, frame_pointer), +  OFFSETOF(Pike_interpreter_struct, frame_pointer),    PIKE_FP_REG);    fp_reg = PIKE_FP_REG;    }   }      void amd64_load_sp_reg(void)   {    if (!sp_reg) {    AMD64_MOVE_RELADDR_TO_REG(Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer), +  OFFSETOF(Pike_interpreter_struct, stack_pointer),    PIKE_SP_REG);    sp_reg = PIKE_SP_REG;    }   }      void amd64_load_mark_sp_reg(void)   {    if (!mark_sp_reg) {    AMD64_MOVE_RELADDR_TO_REG(Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, mark_stack_pointer), +  OFFSETOF(Pike_interpreter_struct, mark_stack_pointer),    PIKE_MARK_SP_REG);    mark_sp_reg = PIKE_MARK_SP_REG;    }   }            static void update_arg1(INT32 value)   {    AMD64_LOAD_IMM32(ARG1_REG, value);
pike.git/src/code/amd64.c:717:    AMD64_CMP_REG_IMM32(REG_RAX, MAX_REF_TYPE);    AMD64_JG(0);    skip = PIKE_PC;    AMD64_ADD_VAL_TO_RELADDR(1, OFFSETOF(pike_string, refs), REG_RCX);    Pike_compiler->new_program->program[skip-1] = ((INT32)PIKE_PC) - skip;    AMD64_ADD_IMM32(sp_reg, sizeof(struct svalue));    dirty_regs |= 1 << sp_reg;    /* FIXME: Deferred writing of Pike_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }   }      static void amd64_push_int(INT64 value, int subtype)   {    amd64_load_sp_reg();    AMD64_LOAD_IMM32(REG_RAX, (subtype<<16) + PIKE_T_INT);    AMD64_MOVE_REG_TO_RELADDR(REG_RAX, sp_reg, OFFSETOF(svalue, type));    AMD64_LOAD_IMM(REG_RAX, value);    AMD64_MOVE_REG_TO_RELADDR(REG_RAX, sp_reg, OFFSETOF(svalue, u.integer));    AMD64_ADD_IMM32(sp_reg, sizeof(struct svalue));    dirty_regs |= 1 << sp_reg;    /* FIXME: Deferred writing of Pike_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }   }      static void amd64_mark(int offset)   {    amd64_load_sp_reg();    amd64_load_mark_sp_reg();    if (offset) {    AMD64_ADD_REG_IMM32(sp_reg, -offset * sizeof(struct svalue), REG_RAX);    AMD64_MOVE_REG_TO_RELADDR(REG_RAX, mark_sp_reg, 0x00);    } else {    AMD64_MOVE_REG_TO_RELADDR(sp_reg, mark_sp_reg, 0x00);    }    AMD64_ADD_IMM32(mark_sp_reg, sizeof(struct svalue *));    dirty_regs |= 1 << mark_sp_reg;    /* FIXME: Deferred writing of Pike_mark_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_MARK_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_MARK_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, mark_stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, mark_stack_pointer));    dirty_regs &= ~(1 << PIKE_MARK_SP_REG);    }   }      static void amd64_pop_mark(void)   {    amd64_load_mark_sp_reg();    AMD64_ADD_IMM32(mark_sp_reg, -(int)sizeof(struct svalue *));    dirty_regs |= 1 << mark_sp_reg;    /* FIXME: Deferred writing of Pike_mark_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_MARK_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_MARK_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, mark_stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, mark_stack_pointer));    dirty_regs &= ~(1 << PIKE_MARK_SP_REG);    }   }      static void amd64_push_string(int strno, int subtype)   {    amd64_load_fp_reg();    amd64_load_sp_reg();    AMD64_MOVE_RELADDR_TO_REG(fp_reg, OFFSETOF(pike_frame, context), REG_RAX);    AMD64_LOAD_IMM32(REG_RCX, (subtype<<16) | PIKE_T_STRING);
pike.git/src/code/amd64.c:792:    AMD64_MOVE_RELADDR_TO_REG(REG_RAX, strno * sizeof(struct pike_string *),    REG_RAX);    AMD64_MOVE_REG_TO_RELADDR(REG_RAX, sp_reg,    (INT32)OFFSETOF(svalue, u.string) -    (INT32)sizeof(struct svalue));    AMD64_ADD_VAL_TO_RELADDR(1, OFFSETOF(pike_string, refs), REG_RAX);    dirty_regs |= 1 << sp_reg;    /* FIXME: Deferred writing of Pike_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }   }      static void amd64_push_local_function(int fun)   {    amd64_load_fp_reg();    amd64_load_sp_reg();    AMD64_MOVE_RELADDR_TO_REG(fp_reg, OFFSETOF(pike_frame, context), REG_RAX);    AMD64_MOVE_RELADDR_TO_REG(fp_reg, OFFSETOF(pike_frame, current_object),
pike.git/src/code/amd64.c:817:    AMD64_ADD_IMM32(REG_RAX, fun);    AMD64_ADD_VAL_TO_RELADDR(1, (INT32)OFFSETOF(object, refs), REG_RCX);    AMD64_SHL_IMM8(REG_RAX, 16);    AMD64_ADD_IMM32(REG_RAX, PIKE_T_FUNCTION);    AMD64_MOVE_REG_TO_RELADDR(REG_RAX, sp_reg, OFFSETOF(svalue, type));    AMD64_ADD_IMM32(sp_reg, sizeof(struct svalue));    dirty_regs |= 1 << sp_reg;    /* FIXME: Deferred writing of Pike_sp doen't seem to work reliably yet. */    if (dirty_regs & (1 << PIKE_SP_REG)) {    AMD64_MOVE_REG_TO_RELADDR(PIKE_SP_REG, Pike_interpreter_reg, -  OFFSETOF(Pike_interpreter, stack_pointer)); +  OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }   }      static void amd64_call_c_function(void *addr)   {    CALL_ABSOLUTE(addr);    next_reg = REG_RAX;    CLEAR_REGS();   }