Branch: Tag:

2015-09-07

2015-09-07 17:12:00 by Per Hedbor <ph@opera.com>

[amd64] Fixed compilation of F_CONSTANT in decoded programs.

Note that the code used for decode_value decoded programs is
significantly slower than the one that is generated for programs
compiled from pike code.

This is sort of unfortunate since most modules are dumped.

3770:    return;       case F_CONSTANT: +  { +  struct svalue *cval = &Pike_compiler->new_program->constants[b].sval;    ins_debug_instr_prologue(a-F_OFFSET, b, 0); -  +  if( TYPEOF(*cval) == PIKE_T_INT && +  SUBTYPEOF(*cval) == NUMBER_UNDEFINED) +  {    amd64_load_fp_reg();    amd64_load_sp_reg(); - #if 0 +  /* We end up here in programs decoded from decode_value. +  constants are not restored until after the program +  code is generated. +  +  (there is no way to differentiate a 'real' undefined here) +  */    mov_mem_reg( fp_reg, OFFSETOF(pike_frame,context), P_REG_RCX );    mov_mem_reg( P_REG_RCX, OFFSETOF(inherit,prog), P_REG_RCX );    mov_mem_reg( P_REG_RCX, OFFSETOF(program,constants), P_REG_RCX );    add_reg_imm( P_REG_RCX, b*sizeof(struct program_constant) +    OFFSETOF(program_constant,sval) );    amd64_push_svaluep( P_REG_RCX ); -  /* ~14 instructions total */ - #else +  /* ~14 instructions total, 3-4 deref */ +  } +  else    { -  struct svalue *cval = &Pike_compiler->new_program->constants[b].sval; +  amd64_load_sp_reg();    mov_imm_mem(cval->tu.type_subtype, sp_reg, SVAL(0).type);    if( TYPEOF(*cval) >= MIN_REF_TYPE )    {
3796:    mov_imm_mem(cval->u.integer, sp_reg, SVAL(0).value);    }    amd64_add_sp(1); +  /* 2 or 4 instructions total, 0-1 deref */    } -  /* 2 or 4 instructions total */ - #endif +  }    return;       case F_GLOBAL_LVALUE: