"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sljit/sljitNativePPC_common.c" between
pcre-8.43.tar.bz2 and pcre-8.44.tar.bz2

About: The PCRE library implements Perl compatible regular expression pattern matching.

sljitNativePPC_common.c  (pcre-8.43.tar.bz2):sljitNativePPC_common.c  (pcre-8.44.tar.bz2)
skipping to change at line 234 skipping to change at line 234
#define SUBFE (HI(31) | LO(136)) #define SUBFE (HI(31) | LO(136))
#define SUBFIC (HI(8)) #define SUBFIC (HI(8))
#define XOR (HI(31) | LO(316)) #define XOR (HI(31) | LO(316))
#define XORI (HI(26)) #define XORI (HI(26))
#define XORIS (HI(27)) #define XORIS (HI(27))
#define SIMM_MAX (0x7fff) #define SIMM_MAX (0x7fff)
#define SIMM_MIN (-0x8000) #define SIMM_MIN (-0x8000)
#define UIMM_MAX (0xffff) #define UIMM_MAX (0xffff)
#define RLDI(dst, src, sh, mb, type) \
(HI(30) | S(src) | A(dst) | ((type) << 2) | (((sh) & 0x1f) << 11) | (((sh
) & 0x20) >> 4) | (((mb) & 0x1f) << 6) | ((mb) & 0x20))
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_sw addr, void* func) SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_sw addr, void* func)
{ {
sljit_sw* ptrs; sljit_sw* ptrs;
if (func_ptr) if (func_ptr)
*func_ptr = (void*)context; *func_ptr = (void*)context;
ptrs = (sljit_sw*)func; ptrs = (sljit_sw*)func;
context->addr = addr ? addr : ptrs[0]; context->addr = addr ? addr : ptrs[0];
context->r2 = ptrs[1]; context->r2 = ptrs[1];
context->r11 = ptrs[2]; context->r11 = ptrs[2];
skipping to change at line 327 skipping to change at line 330
if (target_addr <= 0x7fffffffffffl) { if (target_addr <= 0x7fffffffffffl) {
jump->flags |= PATCH_ABS48; jump->flags |= PATCH_ABS48;
return 1; return 1;
} }
#endif #endif
return 0; return 0;
} }
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_la
bel, sljit_uw max_label)
{
if (max_label < 0x100000000l) {
put_label->flags = 0;
return 1;
}
if (max_label < 0x1000000000000l) {
put_label->flags = 1;
return 3;
}
put_label->flags = 2;
return 4;
}
static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label)
{
sljit_uw addr = put_label->label->addr;
sljit_ins *inst = (sljit_ins *)put_label->addr;
sljit_s32 reg = *inst;
if (put_label->flags == 0) {
SLJIT_ASSERT(addr < 0x100000000l);
inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 16);
}
else {
if (put_label->flags == 1) {
SLJIT_ASSERT(addr < 0x1000000000000l);
inst[0] = ORI | S(TMP_ZERO) | A(reg) | IMM(addr >> 32);
}
else {
inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 48);
inst[1] = ORI | S(reg) | A(reg) | IMM((addr >> 32) & 0xff
ff);
inst ++;
}
inst[1] = RLDI(reg, reg, 32, 31, 1);
inst[2] = ORIS | S(reg) | A(reg) | IMM((addr >> 16) & 0xffff);
inst += 2;
}
inst[1] = ORI | S(reg) | A(reg) | IMM(addr & 0xffff);
}
#endif
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil er) SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil er)
{ {
struct sljit_memory_fragment *buf; struct sljit_memory_fragment *buf;
sljit_ins *code; sljit_ins *code;
sljit_ins *code_ptr; sljit_ins *code_ptr;
sljit_ins *buf_ptr; sljit_ins *buf_ptr;
sljit_ins *buf_end; sljit_ins *buf_end;
sljit_uw word_count; sljit_uw word_count;
sljit_uw next_addr;
sljit_sw executable_offset; sljit_sw executable_offset;
sljit_uw addr; sljit_uw addr;
struct sljit_label *label; struct sljit_label *label;
struct sljit_jump *jump; struct sljit_jump *jump;
struct sljit_const *const_; struct sljit_const *const_;
struct sljit_put_label *put_label;
CHECK_ERROR_PTR(); CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler)); CHECK_PTR(check_sljit_generate_code(compiler));
reverse_buf(compiler); reverse_buf(compiler);
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
compiler->size += (compiler->size & 0x1) + (sizeof(struct sljit_function_ context) / sizeof(sljit_ins)); compiler->size += (compiler->size & 0x1) + (sizeof(struct sljit_function_ context) / sizeof(sljit_ins));
#else #else
compiler->size += (sizeof(struct sljit_function_context) / sizeof(sljit_i ns)); compiler->size += (sizeof(struct sljit_function_context) / sizeof(sljit_i ns));
#endif #endif
#endif #endif
code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins)); code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins));
PTR_FAIL_WITH_EXEC_IF(code); PTR_FAIL_WITH_EXEC_IF(code);
buf = compiler->buf; buf = compiler->buf;
code_ptr = code; code_ptr = code;
word_count = 0; word_count = 0;
next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code); executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels; label = compiler->labels;
jump = compiler->jumps; jump = compiler->jumps;
const_ = compiler->consts; const_ = compiler->consts;
put_label = compiler->put_labels;
do { do {
buf_ptr = (sljit_ins*)buf->memory; buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2); buf_end = buf_ptr + (buf->used_size >> 2);
do { do {
*code_ptr = *buf_ptr++; *code_ptr = *buf_ptr++;
SLJIT_ASSERT(!label || label->size >= word_count); if (next_addr == word_count) {
SLJIT_ASSERT(!jump || jump->addr >= word_count); SLJIT_ASSERT(!label || label->size >= word_count)
SLJIT_ASSERT(!const_ || const_->addr >= word_count); ;
/* These structures are ordered by their address. */ SLJIT_ASSERT(!jump || jump->addr >= word_count);
if (label && label->size == word_count) { SLJIT_ASSERT(!const_ || const_->addr >= word_coun
/* Just recording the address. */ t);
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(cod SLJIT_ASSERT(!put_label || put_label->addr >= wor
e_ptr, executable_offset); d_count);
label->size = code_ptr - code;
label = label->next; /* These structures are ordered by their address.
} */
if (jump && jump->addr == word_count) { if (label && label->size == word_count) {
/* Just recording the address. */
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OF
FSET(code_ptr, executable_offset);
label->size = code_ptr - code;
label = label->next;
}
if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
jump->addr = (sljit_uw)(code_ptr - 3); jump->addr = (sljit_uw)(code_ptr - 3);
#else #else
jump->addr = (sljit_uw)(code_ptr - 6); jump->addr = (sljit_uw)(code_ptr - 6);
#endif #endif
if (detect_jump_type(jump, code_ptr, code, execut able_offset)) { if (detect_jump_type(jump, code_ptr, code , executable_offset)) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
code_ptr[-3] = code_ptr[0]; code_ptr[-3] = code_ptr[0];
code_ptr -= 3;
#else
if (jump->flags & PATCH_ABS32) {
code_ptr -= 3; code_ptr -= 3;
code_ptr[-1] = code_ptr[2]; #else
code_ptr[0] = code_ptr[3]; if (jump->flags & PATCH_ABS32) {
} code_ptr -= 3;
else if (jump->flags & PATCH_ABS48) { code_ptr[-1] = code_ptr[2
code_ptr--; ];
code_ptr[-1] = code_ptr[0]; code_ptr[0] = code_ptr[3]
code_ptr[0] = code_ptr[1]; ;
/* rldicr rX,rX,32,31 -> rX,rX,16 }
,47 */ else if (jump->flags & PATCH_ABS4
SLJIT_ASSERT((code_ptr[-3] & 0xfc 8) {
00ffff) == 0x780007c6); code_ptr--;
code_ptr[-3] ^= 0x8422; code_ptr[-1] = code_ptr[0
/* oris -> ori */ ];
code_ptr[-2] ^= 0x4000000; code_ptr[0] = code_ptr[1]
} ;
else { /* rldicr rX,rX,32,31 ->
code_ptr[-6] = code_ptr[0]; rX,rX,16,47 */
code_ptr -= 6; SLJIT_ASSERT((code_ptr[-3
] & 0xfc00ffff) == 0x780007c6);
code_ptr[-3] ^= 0x8422;
/* oris -> ori */
code_ptr[-2] ^= 0x4000000
;
}
else {
code_ptr[-6] = code_ptr[0
];
code_ptr -= 6;
}
#endif
if (jump->flags & REMOVE_COND) {
code_ptr[0] = BCx | (2 <<
2) | ((code_ptr[0] ^ (8 << 21)) & 0x03ff0001);
code_ptr++;
jump->addr += sizeof(slji
t_ins);
code_ptr[0] = Bx;
jump->flags -= IS_COND;
}
} }
jump = jump->next;
}
if (const_ && const_->addr == word_count) {
const_->addr = (sljit_uw)code_ptr;
const_ = const_->next;
}
if (put_label && put_label->addr == word_count) {
SLJIT_ASSERT(put_label->label);
put_label->addr = (sljit_uw)code_ptr;
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
code_ptr += put_label_get_length(put_labe
l, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label-
>size));
word_count += 4;
#endif #endif
if (jump->flags & REMOVE_COND) { put_label = put_label->next;
code_ptr[0] = BCx | (2 << 2) | ((
code_ptr[0] ^ (8 << 21)) & 0x03ff0001);
code_ptr++;
jump->addr += sizeof(sljit_ins);
code_ptr[0] = Bx;
jump->flags -= IS_COND;
}
} }
jump = jump->next; next_addr = compute_next_addr(label, jump, const_
} , put_label);
if (const_ && const_->addr == word_count) {
const_->addr = (sljit_uw)code_ptr;
const_ = const_->next;
} }
code_ptr ++; code_ptr ++;
word_count ++; word_count ++;
} while (buf_ptr < buf_end); } while (buf_ptr < buf_end);
buf = buf->next; buf = buf->next;
} while (buf); } while (buf);
if (label && label->size == word_count) { if (label && label->size == word_count) {
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executabl e_offset); label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executabl e_offset);
label->size = code_ptr - code; label->size = code_ptr - code;
label = label->next; label = label->next;
} }
SLJIT_ASSERT(!label); SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump); SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_); SLJIT_ASSERT(!const_);
SLJIT_ASSERT(!put_label);
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size - (sizeof(struct sljit_function_context) / sizeof(sljit_ins))); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size - (sizeof(struct sljit_function_context) / sizeof(sljit_ins)));
#else #else
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
#endif #endif
jump = compiler->jumps; jump = compiler->jumps;
while (jump) { while (jump) {
do { do {
addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target; addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target;
skipping to change at line 506 skipping to change at line 578
} }
buf_ptr[0] = (buf_ptr[0] & 0xffff0000) | ((addr >> 48) & 0xffff); buf_ptr[0] = (buf_ptr[0] & 0xffff0000) | ((addr >> 48) & 0xffff);
buf_ptr[1] = (buf_ptr[1] & 0xffff0000) | ((addr >> 32) & 0xffff); buf_ptr[1] = (buf_ptr[1] & 0xffff0000) | ((addr >> 32) & 0xffff);
buf_ptr[3] = (buf_ptr[3] & 0xffff0000) | ((addr >> 16) & 0xffff); buf_ptr[3] = (buf_ptr[3] & 0xffff0000) | ((addr >> 16) & 0xffff);
buf_ptr[4] = (buf_ptr[4] & 0xffff0000) | (addr & 0xffff); buf_ptr[4] = (buf_ptr[4] & 0xffff0000) | (addr & 0xffff);
#endif #endif
} while (0); } while (0);
jump = jump->next; jump = jump->next;
} }
put_label = compiler->put_labels;
while (put_label) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
addr = put_label->label->addr;
buf_ptr = (sljit_ins *)put_label->addr;
SLJIT_ASSERT((buf_ptr[0] & 0xfc1f0000) == ADDIS && (buf_ptr[1] &
0xfc000000) == ORI);
buf_ptr[0] |= (addr >> 16) & 0xffff;
buf_ptr[1] |= addr & 0xffff;
#else
put_label_set(put_label);
#endif
put_label = put_label->next;
}
compiler->error = SLJIT_ERR_COMPILED; compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset; compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins);
code = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset); code = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset);
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
if (((sljit_sw)code_ptr) & 0x4) if (((sljit_sw)code_ptr) & 0x4)
code_ptr++; code_ptr++;
skipping to change at line 2264 skipping to change at line 2351
return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, f reg) | A(mem & REG_MASK) | B(OFFS_REG(mem))); return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, f reg) | A(mem & REG_MASK) | B(OFFS_REG(mem)));
} }
inst = updated_data_transfer_insts[mem_flags]; inst = updated_data_transfer_insts[mem_flags];
return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, freg) | A (mem & REG_MASK) | IMM(memw)); return push_inst(compiler, INST_CODE_AND_DST(inst, DOUBLE_DATA, freg) | A (mem & REG_MASK) | IMM(memw));
} }
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi ler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi ler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{ {
struct sljit_const *const_; struct sljit_const *const_;
sljit_s32 reg; sljit_s32 dst_r;
CHECK_ERROR_PTR(); CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
ADJUST_LOCAL_OFFSET(dst, dstw); ADJUST_LOCAL_OFFSET(dst, dstw);
const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_c onst)); const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_c onst));
PTR_FAIL_IF(!const_); PTR_FAIL_IF(!const_);
set_const(const_, compiler); set_const(const_, compiler);
reg = FAST_IS_REG(dst) ? dst : TMP_REG2; dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
PTR_FAIL_IF(emit_const(compiler, dst_r, init_value));
PTR_FAIL_IF(emit_const(compiler, reg, init_value));
if (dst & SLJIT_MEM) if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM P_REG1, 0, TMP_REG2, 0)); PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM P_REG1, 0, TMP_REG2, 0));
return const_; return const_;
} }
SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct slj
it_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
{
struct sljit_put_label *put_label;
sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
ADJUST_LOCAL_OFFSET(dst, dstw);
put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct
sljit_put_label));
PTR_FAIL_IF(!put_label);
set_put_label(put_label, compiler, 0);
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
PTR_FAIL_IF(emit_const(compiler, dst_r, 0));
#else
PTR_FAIL_IF(push_inst(compiler, dst_r));
compiler->size += 4;
#endif
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TM
P_REG1, 0, TMP_REG2, 0));
return put_label;
}
 End of changes. 21 change blocks. 
54 lines changed or deleted 160 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)