pike.git / src / code / ppc32.c

version» Context lines:

pike.git/src/code/ppc32.c:166:      void ppc32_push_constant(INT32 arg)   {    INT32 offs;    struct svalue *sval = &Pike_compiler->new_program->constants[arg].sval;       /*    * Note: The constants table may contain UNDEFINED in case of being    * called through decode_value() in PORTABLE_BYTECODE mode.    */ -  if(!REFCOUNTED_TYPE(TYPEOF(*sval)) && !sval->subtype) { +  if(!REFCOUNTED_TYPE(TYPEOF(*sval)) && !SUBTYPEOF(*sval)) {    int e;    INT32 last=0;       LOAD_SP_REG();       for(e=0;e<(int)sizeof(struct svalue);e+=4)    {    if(e==0 || *(INT32 *)(((char *)sval)+e) != last)    SET_REG(0, last = *(INT32 *)(((char *)sval)+e));    /* stw r0,e(pike_sp) */
pike.git/src/code/ppc32.c:376:    LOAD_FP_REG();    /* lwz r3,catch_ctx(pike_interpreter) */    LWZ(PPC_REG_ARG1, PPC_REG_PIKE_INTERP,    OFFSETOF(Pike_interpreter_struct, catch_ctx));    /* lwz r4,recovery.previous(r3) */    LWZ(PPC_REG_ARG2, PPC_REG_ARG1,    OFFSETOF(catch_context, recovery.previous));    /* stw r4,recoveries(pike_interpreter) */    STW(PPC_REG_ARG2, PPC_REG_PIKE_INTERP,    OFFSETOF(Pike_interpreter_struct, recoveries)); -  /* lwz r4,save_expendible(r3) */ -  LWZ(PPC_REG_ARG2, PPC_REG_ARG1, -  OFFSETOF(catch_context, save_expendible)); -  /* stw r4,expendible(pike_fp) */ -  STW(PPC_REG_ARG2, PPC_REG_PIKE_FP, -  OFFSETOF(pike_frame, expendible)); +     /* lwz r4,prev(r3) */    LWZ(PPC_REG_ARG2, PPC_REG_ARG1,    OFFSETOF(catch_context, prev));    /* stw r4,catch_ctx(pike_interpreter) */    STW(PPC_REG_ARG2, PPC_REG_PIKE_INTERP,    OFFSETOF(Pike_interpreter_struct, catch_ctx));       FLUSH_CODE_GENERATOR_STATE();    ADD_CALL(really_free_catch_context);   }
pike.git/src/code/ppc32.c:406:    static unsigned int last_num_linenumbers=~0;    if(last_prog_id != Pike_compiler->new_program->id ||    last_num_linenumbers != Pike_compiler->new_program->num_linenumbers)    {    last_prog_id=Pike_compiler->new_program->id;    last_num_linenumbers = Pike_compiler->new_program->num_linenumbers;    UPDATE_PC();    }   }    + #ifdef OPCODE_INLINE_RETURN + void ppc32_ins_entry(void) + { +  /* stwu r1, -32(r1) */ +  STWU(1, 1, -32); +  /* mflr r0 */ +  MFSPR(0, PPC_SPREG_LR); +  /* stw r0, 36(r1) */ +  STW(0, 1, 36); + } + #endif /* OPCODE_INLINE_RETURN */ +    void ins_f_byte(unsigned int b)   {    void *addr; -  +  INT32 rel_addr;       b-=F_OFFSET;   #ifdef PIKE_DEBUG    if(b>255)    Pike_error("Instruction too big %d\n",b);   #endif    maybe_update_pc();    addr = instrs[b].address;      #ifdef PIKE_DEBUG
pike.git/src/code/ppc32.c:458:    case F_ADD - F_OFFSET:    SET_REG(PPC_REG_ARG1, 2);    addr = (void *)f_add;    break;       case F_EXIT_CATCH - F_OFFSET:    ppc32_push_int(0, 1);    case F_ESCAPE_CATCH - F_OFFSET:    ppc32_escape_catch();    return; +  + #ifdef OPCODE_INLINE_RETURN +  case F_CATCH - F_OFFSET: +  /* Special argument for the F_CATCH instruction. */ +  addr = inter_return_opcode_F_CATCH; +  /* bl .+4 */ +  BL(4); +  /* mflr r3 */ +  MFSPR(PPC_REG_ARG1, PPC_SPREG_LR); +  rel_addr = PIKE_PC; +  /* addi r3, r3, offs */ +  ADDI(PPC_REG_ARG1, PPC_REG_ARG1, 4); +  break; + #endif    }       FLUSH_CODE_GENERATOR_STATE();    ADD_CALL(addr); -  + #ifdef OPCODE_INLINE_RETURN +  if (instrs[b].flags & I_RETURN) { +  /* cmpwi r3,-1 */ +  CMPI(0, PPC_REG_RET, -1); +  /* bne .+20 */ +  BC(4, 2, 5); +  /* lwz r0, 36(r1) */ +  LWZ(0, 1, 36); +  /* addi r1, r1, 32 */ +  ADDI(1, 1, 32); +  /* mtlr r0 */ +  MTSPR(0, PPC_SPREG_LR); +  /* blr */ +  BCLR(20, 0); +  +  if ((b + F_OFFSET) == F_RETURN_IF_TRUE) { +  /* Kludge. We must check if the ret addr is +  * orig_addr + JUMP_EPILOGUE_SIZE. */ +  +  /* mflr r0 */ +  MFSPR(0, PPC_SPREG_LR); +  /* subf r0, r0, r3 */ +  SUBF(0, 0, PPC_REG_RET); +  /* cmplwi r0, JUMP_EPILOGUE_SIZE */ +  CMPLI(0, 0, JUMP_EPILOGUE_SIZE*4); +  /* beq .+12 */ +  BC(12, 2, 3); +  } +  } + #endif   #ifdef OPCODE_RETURN_JUMPADDR    if (instrs[b].flags & I_JUMP) {    /* This is the code that JUMP_EPILOGUE_SIZE compensates for. */    /* mtlr r3 */    MTSPR(PPC_REG_RET, PPC_SPREG_LR);    /* blr */    BCLR(20, 0); -  +  + #ifdef OPCODE_INLINE_RETURN +  if (b == F_CATCH - F_OFFSET) { +  Pike_compiler->new_program->program[rel_addr] += (PIKE_PC - rel_addr)*4;    }   #endif    } -  + #endif + }      void ins_f_byte_with_arg(unsigned int a, INT32 b)   {    maybe_update_pc();      #ifdef PIKE_DEBUG    if (d_flag < 3)   #endif    switch(a)    {
pike.git/src/code/ppc32.c:596:    CMPLI(0, PPC_REG_RET, 0);    /* beq .+8 */    BC(12, 2, 2);    pos_ = PIKE_PC;    }    if(backward_jump) {    ADD_CALL(branch_check_threads_etc);    if(pos_)    Pike_compiler->new_program->program[pos_-1] += 4*(PIKE_PC-pos_);    } -  ret=DO_NOT_WARN( (INT32) PIKE_PC ); +  ret=(INT32) PIKE_PC;    /* b . */    B(0);    return ret;   }      INT32 ppc32_ins_f_jump_with_arg(unsigned int a, unsigned INT32 b, int backward_jump)   {    if(a == F_COND_RECUR) return -1;    SET_REG(PPC_REG_ARG1, b);    return ppc32_ins_f_jump(a, backward_jump);
pike.git/src/code/ppc32.c:673:    __asm__("icbi 0,%0" : : "r" (a));    __asm__("dcbst 0,%0" : : "r" (a));    a += 4;    }    __asm__("sync");    __asm__("isync");   #endif /* _POWER */   }      #if 0 - #define addstr(s, l) low_my_binary_strcat((s), (l), buf) + #define addstr(s, l) buffer_memcpy(buf, (s), (l))   #define adddata2(s,l) addstr((char *)(s),(l) * sizeof((s)[0]));    - void ppc32_encode_program(struct program *p, struct dynamic_buffer_s *buf) + void ppc32_encode_program(struct program *p, struct byte_buffer *buf)   {    size_t prev = 0, rel;    /* De-relocate the program... */    for (rel = 0; rel < p->num_relocations; rel++)    {    size_t off = p->relocations[rel];    INT32 opcode;   #ifdef PIKE_DEBUG    if (off < prev) {    Pike_fatal("Relocations in bad order!\n");