pike.git / src / code / amd64.c

version» Context lines:

pike.git/src/code/amd64.c:989:    mov_reg_reg(ARG1_REG, Pike_interpreter_reg);    amd64_flush_code_generator_state();       if( PIKE_PC - orig_ppc != ENTRY_PROLOGUE_SIZE ) /* sanity check */    Pike_fatal("ENTRY_PROLOGUE_SIZE incorrectly set, should be 0x%x\n",    PIKE_PC-orig_ppc );   }      void amd64_flush_code_generator_state(void)   { -  sp_reg = -1; -  fp_reg = -1; +  amd64_prev_stored_pc = -1;    ret_for_func = 0; -  +  fp_reg = -1; +  sp_reg = -1;    mark_sp_reg = -1;    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)) {    mov_reg_mem(PIKE_SP_REG, Pike_interpreter_reg,    OFFSETOF(Pike_interpreter_struct, stack_pointer));    dirty_regs &= ~(1 << PIKE_SP_REG);    }
pike.git/src/code/amd64.c:1054:   }         static void mov_sval_type(enum amd64_reg src, enum amd64_reg dst )   {    mov_mem8_reg( src, OFFSETOF(svalue, tu.t.type), dst);   /* and_reg32_imm( dst, 0x1f );*/   }       + #if 0   static void svalue_is_referenced(enum amd64_reg in, struct label *not )   {    /* bit 4 set, and no higher bit set (all with 8bit values). */    /* aka: type & 248 == 8. Incidentally, 248 is equal to -8 in signed 8bit*/    and_reg_imm(in,-8);    /* jz(not) -- saves one comparison in most cases, adds code size, more jumps. */    cmp_reg_imm(in,MIN_REF_TYPE);    jne( not );   }      static void mem_svalue_is_referenced(enum amd64_reg in, struct label *not )   {    /* bit 4 set, and no higher bit set. */    if( in == P_REG_RAX ) Pike_error("RAX not supported here.\n");    mov_sval_type(in,P_REG_RAX);    svalue_is_referenced(P_REG_RAX, not );   } -  + #endif    -  +    static void update_arg1(INT32 value)   {    mov_imm_reg(value, ARG1_REG);    /* FIXME: Alloc stack space on NT. */   }      static void update_arg2(INT32 value)   {    mov_imm_reg(value, ARG2_REG);    /* FIXME: Alloc stack space on NT. */
pike.git/src/code/amd64.c:2603:    add_reg_imm_reg(sp_reg, -sizeof(struct svalue), ARG1_REG);    amd64_ref_svalue(ARG1_REG, 0);    return;       case F_ASSIGN_LOCAL_AND_POP:    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_assign_local(b);    amd64_add_sp(-1);    return;    +     case F_ASSIGN_PRIVATE_GLOBAL_AND_POP:    case F_ASSIGN_PRIVATE_GLOBAL:    {    LABELS();    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_get_storage( P_REG_RBX, b );    /* do not assign if this object is destructed. */    mov_mem_reg( fp_reg, OFFSETOF(pike_frame,current_object), ARG1_REG );    mov_mem_reg( ARG1_REG, OFFSETOF(object,prog), P_REG_RAX );    test_reg(P_REG_RAX);
pike.git/src/code/amd64.c:2734:    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_load_fp_reg();    amd64_load_sp_reg();    mov_mem_reg(fp_reg, OFFSETOF(pike_frame, context), ARG3_REG);    mov_mem_reg(fp_reg, OFFSETOF(pike_frame, current_object),    ARG2_REG);    mov_reg_reg(sp_reg, ARG1_REG);    mov_mem16_reg(ARG3_REG, OFFSETOF(inherit, identifier_level),    ARG3_REG);    add_reg_imm(ARG3_REG, b); -  flush_dirty_regs(); /* In case an error is thrown. */ -  call_imm(low_object_index_no_free); -  /* NB: We know that low_object_index_no_free() doesn't -  * mess with the stack pointer. */ +  amd64_call_c_function(low_object_index_no_free);    amd64_add_sp(1);    return;       case F_LOCAL:    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_load_fp_reg();    amd64_load_sp_reg();    mov_mem_reg(fp_reg, OFFSETOF(pike_frame, locals), P_REG_RCX);    add_reg_imm(P_REG_RCX, b*sizeof(struct svalue));    amd64_push_svaluep(P_REG_RCX);
pike.git/src/code/amd64.c:3138:    LABEL_B;    /* something else. */    update_arg1(b);    update_arg2(c);    amd64_call_c_opcode(instrs[a-F_OFFSET].address,    instrs[a-F_OFFSET].flags);    LABEL_C;    /* done */    }    return; +  case F_PRIVATE_IF_DIRECT_GLOBAL: +  { +  LABELS(); +  amd64_load_sp_reg(); +  ins_debug_instr_prologue(a-F_OFFSET, b, c); +  /* do not assign if this object is destructed. */ +  mov_mem_reg( fp_reg, OFFSETOF(pike_frame,current_object), ARG2_REG ); +  mov_mem_reg( fp_reg, OFFSETOF(pike_frame,context), ARG3_REG ); +  /* if ctx->prog != arg1->prog */ +  mov_mem_reg( ARG3_REG, OFFSETOF(inherit,prog), P_REG_R8 ); +  mov_mem_reg( ARG2_REG, OFFSETOF(object,prog), P_REG_RAX ); +  cmp_reg_reg(P_REG_R8,P_REG_RAX); +  je(&label_A); +  mov_reg_reg(sp_reg, ARG1_REG); +  mov_mem16_reg(ARG3_REG, OFFSETOF(inherit, identifier_level), +  ARG3_REG); +  add_reg_imm(ARG3_REG, c); +  amd64_call_c_function(low_object_index_no_free); +  amd64_add_sp(1); +  jmp(&label_B); +  +  LABEL_A; +  mov_mem_reg(ARG2_REG, OFFSETOF(object,storage), P_REG_RBX ); +  add_reg_mem(P_REG_RBX, ARG3_REG, OFFSETOF(inherit,storage_offset)); +  add_reg_imm(P_REG_RBX, b ); +  amd64_push_svaluep( P_REG_RBX ); +  LABEL_B; +  return; +  } +  +  case F_ASSIGN_PRIVATE_IF_DIRECT_GLOBAL: +  { +  LABELS(); +  amd64_load_sp_reg(); +  ins_debug_instr_prologue(a-F_OFFSET, b, c); +  /* do not assign if this object is destructed. */ +  mov_mem_reg( fp_reg, OFFSETOF(pike_frame,current_object), ARG1_REG ); +  mov_mem_reg( fp_reg, OFFSETOF(pike_frame,context), ARG2_REG ); +  /* if ctx->prog != arg1->prog */ +  mov_mem_reg( ARG1_REG, OFFSETOF(object,prog), P_REG_RAX ); +  mov_mem_reg( ARG2_REG, OFFSETOF(inherit,prog), P_REG_R8 ); +  cmp_reg_reg(P_REG_R8,P_REG_RAX); +  je(&label_A); +  +  /* arg1 = object */ +  /* arg2 = c + identifier_level */ +  /* arg3 = Pike_sp-1 */ +  mov_mem16_reg( ARG2_REG, OFFSETOF(inherit,identifier_level), ARG2_REG); +  add_reg_imm( ARG2_REG, c ); +  add_reg_imm_reg( sp_reg, -1*sizeof(struct svalue), ARG3_REG ); +  amd64_call_c_function(object_low_set_index); +  jmp(&label_B); +  LABEL_A; +  mov_mem_reg(ARG1_REG, OFFSETOF(object,storage), P_REG_RBX ); +  add_reg_mem(P_REG_RBX, ARG2_REG, OFFSETOF(inherit,storage_offset)); +  add_reg_imm(P_REG_RBX, b ); +  amd64_free_svalue( P_REG_RBX, 0 ); +  amd64_assign_svalue_no_free( P_REG_RBX, sp_reg, -sizeof(struct svalue)); +  amd64_ref_svalue(P_REG_RBX,0); +  LABEL_B; +  } +  return;    case F_ASSIGN_PRIVATE_TYPED_GLOBAL_AND_POP:    case F_ASSIGN_PRIVATE_TYPED_GLOBAL:    {    LABELS();    amd64_load_sp_reg();       ins_debug_instr_prologue(a-F_OFFSET, b, 0);       amd64_get_storage( P_REG_RBX, b );