pike.git / src / code / amd64.c

version» Context lines:

pike.git/src/code/amd64.c:1763: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if( PIKE_T_INT != 0 )    Pike_fatal("assumption failed: pike_t_int == 0\n");    if( sizeof(struct svalue) != 16 )    Pike_fatal("assumption failed: sizeof svalue != 16\n");    if( OFFSETOF(svalue,tu.t.type) != 0 )    Pike_fatal("assumption failed: offsetof(svalue.tu.t.type) != 0\n");    if( OFFSETOF(svalue,u.integer) != 8 )    Pike_fatal("assumption failed: offsetof(svalue.u.integer) != 8\n");   #endif -  instrs[F_CATCH - F_OFFSET].address = inter_return_opcode_F_CATCH; +    }      static void amd64_return_from_function()   {    if( ret_for_func )    {    jmp_rel_imm( ret_for_func );    }    else    {
pike.git/src/code/amd64.c:2419:    {    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:    { -  /* Special argument for the F_CATCH instruction. */ -  addr = inter_return_opcode_F_CATCH; +  INT32 base_addr = 0; +  +  LABELS();    mov_rip_imm_reg(0, ARG1_REG); /* Address for the POINTER. */ -  rel_addr = PIKE_PC; +  base_addr = PIKE_PC; +  +  amd64_call_c_function (setup_catch_context); +  mov_reg_reg(P_REG_RAX, P_REG_RBX); +  +  /* Pass a pointer to Pike_interpreter.catch_ctx.recovery.recovery to +  LOW_SET_JMP. */ +  mov_mem_reg (Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, catch_ctx), +  ARG1_REG); +  add_reg_imm_reg (ARG1_REG, +  OFFSETOF(catch_context, recovery) + +  OFFSETOF(JMP_BUF, recovery), +  ARG1_REG); +  +  /* Copy the pointer to Pike_interpreter.catching_eval_jmpbuf +  too, for compliance with F_CATCH conventions. +  FIXME: Just ignore catching_eval_jmpbuf in OPCODE_INLINE_CATCH mode? */ +  mov_reg_mem (ARG1_REG, +  Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, catching_eval_jmpbuf)); +  +  /* Now, call the actual setjmp function. */ +  amd64_call_c_function (LOW_SETJMP_FUNC); +  +  test_reg (P_REG_RAX); +  jnz (&label_A); +  +  jmp (&label_B); +  +  LABEL_A; // Got exception +  +  amd64_call_c_function (handle_caught_exception); +  mov_reg_reg(P_REG_RAX, P_REG_RBX); +  +  /* Restore catching_eval_jmpbuf from catch_ctx->recovery. +  FIXME: Just ignore catching_eval_jmpbuf in OPCODE_INLINE_CATCH mode? */ +  mov_mem_reg (Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, catch_ctx), +  P_REG_RAX); +  +  test_reg (P_REG_RAX); +  jz (&label_B); /* Pike_interpreter.catch_ctx == 0 */ +  +  add_reg_imm_reg (P_REG_RAX, +  OFFSETOF(catch_context, recovery), +  P_REG_RAX); +  +  mov_mem_reg (Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, recoveries), +  P_REG_RCX); +  +  cmp_reg_reg(P_REG_RAX, P_REG_RCX); +  jne (&label_B); /* Pike_interpreter.recoveries != +  Pike_interpreter.catch_ctx->recovery */ +  add_reg_imm_reg (P_REG_RAX, +  OFFSETOF(JMP_BUF, recovery), +  P_REG_RAX); +  mov_reg_mem (P_REG_RAX, +  Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, catching_eval_jmpbuf)); +  jmp (&label_C); +  LABEL_B; +  /* Zero Pike_interpreter.catching_eval_jmpbuf. */ +  mov_imm_mem(0, +  Pike_interpreter_reg, +  OFFSETOF(Pike_interpreter_struct, catching_eval_jmpbuf)); +  +  LABEL_C; +  /* RBX now contains either the address returned from +  setup_catch_context, or the one from +  handle_caught_exception. */ +  jmp_reg(P_REG_RBX); +  +  upd_pointer(base_addr - 4, PIKE_PC - base_addr);    } -  break; +  return;       /* sp-1 = undefinedp(sp-1) */    case F_UNDEFINEDP:    {    LABELS();    ins_debug_instr_prologue(b, 0, 0);    amd64_load_sp_reg();       mov_mem32_reg( sp_reg, SVAL(-1).type, P_REG_RAX );    cmp_reg32_imm( P_REG_RAX, 1<<16 | PIKE_T_INT );
pike.git/src/code/amd64.c:2693:    * orig_addr + JUMP_EPILOGUE_SIZE. */    cmp_reg_reg( P_REG_RAX, P_REG_RCX );    je( &label_B );    jmp_reg(P_REG_RAX);    LABEL_B;    return;    }    }    if (flags & I_JUMP) {    jmp_reg(P_REG_RAX); -  -  if (b + F_OFFSET == F_CATCH) { -  upd_pointer(rel_addr - 4, PIKE_PC - rel_addr); +     }   } - } +       int amd64_ins_f_jump(unsigned int op, int backward_jump)   {    int flags;    void *addr;    int off = op - F_OFFSET;    int ret = -1;    LABELS();      #ifdef PIKE_DEBUG