pike.git / src / code / amd64.c

version» Context lines:

pike.git/src/code/amd64.c:1629: Inside #if 0
   mov_mem_reg( REG_R10,24, REG_R9 );    /* load done. */    mov_reg_mem(REG_R8, REG_R10,0);    mov_reg_mem(REG_R9, REG_R10,8);    mov_reg_mem(REG_RAX, REG_R10,sizeof(struct svalue));    mov_reg_mem(REG_RCX, REG_R10,8+sizeof(struct svalue));    /* save done. */   #endif    return;    +  case F_SIZEOF: +  { +  LABELS(); +  ins_debug_instr_prologue(b, 0, 0); +  amd64_load_sp_reg(); +  add_reg_imm_reg( sp_reg, -sizeof(struct svalue), REG_RBX); +  mov_sval_type( REG_RBX, REG_RAX ); +  /* type in RAX, svalue in ARG1 */ +  cmp_reg32_imm( REG_RAX, PIKE_T_ARRAY ); jne( &label_A ); +  /* It's an array */ +  mov_mem_reg( REG_RBX, OFFSETOF(svalue, u.array ), ARG1_REG); +  /* load size -> RAX*/ +  mov_mem32_reg( ARG1_REG,OFFSETOF(array, size), REG_RAX ); +  jmp( &label_C ); +  +  LABEL_A; +  cmp_reg32_imm( REG_RAX, PIKE_T_STRING ); jne( &label_B ); +  /* It's a string */ +  mov_mem_reg( REG_RBX, OFFSETOF(svalue, u.string ), ARG1_REG); +  /* load size ->RAX*/ +  mov_mem32_reg( ARG1_REG,OFFSETOF(pike_string, len ), REG_RAX ); +  jmp( &label_C ); +  LABEL_B; +  /* It's something else, svalue in RBX. */ +  mov_reg_reg( REG_RBX, ARG1_REG ); +  amd64_call_c_function( pike_sizeof ); +  LABEL_C;/* all done, res in RAX */ +  /* free value, store result */ +  push( REG_RAX ); +  amd64_free_svalue( REG_RBX, 0 ); +  pop( REG_RAX ); +  mov_reg_mem(REG_RAX, REG_RBX, OFFSETOF(svalue, u.integer)); +  mov_imm_mem(PIKE_T_INT, REG_RBX, OFFSETOF(svalue, type)); +  } +  return; +     case F_POP_VALUE:    {    ins_debug_instr_prologue(b, 0, 0);    amd64_load_sp_reg();    amd64_add_sp( -1 );    amd64_free_svalue( sp_reg, 0 );    }    return;    case F_CATCH:    {
pike.git/src/code/amd64.c:2042:    maybe_update_pc();    switch(a) {    case F_THIS_OBJECT:    if( b == 0 )    {    amd64_push_this_object();    return;    }    break; /* Fallback to C-version. */    +  +  case F_RETURN_LOCAL: +  /* FIXME: The C version has a trick: +  if locals+b < expendibles, pop to there +  and return. +  +  This saves a push, and the poping has to be done anyway. +  */ +  ins_f_byte_with_arg( F_LOCAL, b ); +  ins_f_byte( F_DUMB_RETURN ); +  return; +     case F_ADD_NEG_INT:    b = -b;       case F_ADD_INT:    {    LABELS();    amd64_load_sp_reg();    mov_mem16_reg( sp_reg, -sizeof(struct svalue), REG_RAX );    cmp_reg32_imm( REG_RAX,PIKE_T_INT );    jne( &label_A );
pike.git/src/code/amd64.c:2244:       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), REG_RCX);    add_reg_imm(REG_RCX, b*sizeof(struct svalue));    amd64_push_svaluep(REG_RCX);    return;    +  case F_CLEAR_2_LOCAL:    case F_CLEAR_LOCAL:    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_load_fp_reg();    mov_mem_reg(fp_reg, OFFSETOF(pike_frame, locals), REG_RBX);    add_reg_imm(REG_RBX, b*sizeof(struct svalue));    amd64_free_svalue(REG_RBX, 0); -  +  mov_imm_mem(PIKE_T_INT, REG_RBX, OFFSETOF(svalue, type));    mov_imm_mem(0, REG_RBX, OFFSETOF(svalue, u.integer)); -  mov_imm_mem32(PIKE_T_INT, REG_RBX, OFFSETOF(svalue, type)); +  if( a == F_CLEAR_2_LOCAL ) +  { +  add_reg_imm( REG_RBX, sizeof(struct svalue ) ); +  amd64_free_svalue(REG_RBX, 0); +  mov_imm_mem(PIKE_T_INT, REG_RBX, OFFSETOF(svalue, type)); +  mov_imm_mem(0, REG_RBX, OFFSETOF(svalue, u.integer)); +  }    return;       case F_INC_LOCAL_AND_POP:    {    LABELS();    ins_debug_instr_prologue(a-F_OFFSET, b, 0);    amd64_load_fp_reg();    mov_mem_reg(fp_reg, OFFSETOF(pike_frame, locals), REG_RCX);    add_reg_imm(REG_RCX, b*sizeof(struct svalue));    mov_sval_type(REG_RCX, REG_RAX);
pike.git/src/code/amd64.c:2322:    case F_DEC_LOCAL:    ins_f_byte_with_arg(F_DEC_LOCAL_AND_POP, b);    ins_f_byte_with_arg(F_LOCAL, b);    return;       case F_POST_DEC_LOCAL:    ins_f_byte_with_arg(F_LOCAL, b);    ins_f_byte_with_arg(F_DEC_LOCAL_AND_POP, b);    return;    + #if 0 +  /* +  These really have to be done inline: +  +  reg = (sp- *--mark_sp)>>16 +  ltosval_and_free(-(args+2)) -> pike_sp-args +  call_builtin(reg) +  -- stack now lvalue, result, so now.. +  ins_f_byte( F_ASSIGN or F_ASSIGN_AND_POP ) +  */ +  case F_LTOSVAL_CALL_BUILTIN_AND_ASSIGN_POP: +  case F_LTOSVAL_CALL_BUILTIN_AND_ASSIGN: +  +  return; + #endif +     case F_CALL_BUILTIN_AND_POP:    ins_f_byte_with_arg( F_CALL_BUILTIN, b );    ins_f_byte( F_POP_VALUE );    return;       case F_MARK_CALL_BUILTIN_AND_RETURN:    ins_f_byte_with_arg( F_MARK_CALL_BUILTIN, b );    ins_f_byte( F_DUMB_RETURN );    return;