"Fossies" - the Fresh Open Source Software Archive  

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

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

sljitNativeARM_32.c  (pcre-8.43.tar.bz2):sljitNativeARM_32.c  (pcre-8.44.tar.bz2)
skipping to change at line 586 skipping to change at line 586
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_uw *code; sljit_uw *code;
sljit_uw *code_ptr; sljit_uw *code_ptr;
sljit_uw *buf_ptr; sljit_uw *buf_ptr;
sljit_uw *buf_end; sljit_uw *buf_end;
sljit_uw size; sljit_uw size;
sljit_uw word_count; sljit_uw word_count;
sljit_uw next_addr;
sljit_sw executable_offset; sljit_sw executable_offset;
sljit_sw jump_addr; sljit_sw addr;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
sljit_uw cpool_size; sljit_uw cpool_size;
sljit_uw cpool_skip_alignment; sljit_uw cpool_skip_alignment;
sljit_uw cpool_current_index; sljit_uw cpool_current_index;
sljit_uw *cpool_start_address; sljit_uw *cpool_start_address;
sljit_uw *last_pc_patch; sljit_uw *last_pc_patch;
struct future_patch *first_patch; struct future_patch *first_patch;
#endif #endif
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);
/* Second code generation pass. */ /* Second code generation pass. */
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
size = compiler->size + (compiler->patches << 1); size = compiler->size + (compiler->patches << 1);
if (compiler->cpool_fill > 0) if (compiler->cpool_fill > 0)
size += compiler->cpool_fill + CONST_POOL_ALIGNMENT - 1; size += compiler->cpool_fill + CONST_POOL_ALIGNMENT - 1;
skipping to change at line 628 skipping to change at line 630
cpool_size = 0; cpool_size = 0;
cpool_skip_alignment = 0; cpool_skip_alignment = 0;
cpool_current_index = 0; cpool_current_index = 0;
cpool_start_address = NULL; cpool_start_address = NULL;
first_patch = NULL; first_patch = NULL;
last_pc_patch = code; last_pc_patch = code;
#endif #endif
code_ptr = code; code_ptr = code;
word_count = 0; word_count = 0;
next_addr = 1;
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;
if (label && label->size == 0) { if (label && label->size == 0) {
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code, executable_of fset); label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code, executable_of fset);
label = label->next; label = label->next;
} }
do { do {
buf_ptr = (sljit_uw*)buf->memory; buf_ptr = (sljit_uw*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2); buf_end = buf_ptr + (buf->used_size >> 2);
do { do {
skipping to change at line 665 skipping to change at line 669
} }
buf_ptr++; buf_ptr++;
if (++cpool_current_index >= cpool_size) { if (++cpool_current_index >= cpool_size) {
SLJIT_ASSERT(!first_patch); SLJIT_ASSERT(!first_patch);
cpool_size = 0; cpool_size = 0;
if (label && label->size == word_ count) { if (label && label->size == word_ count) {
/* Points after the curre nt instruction. */ /* Points after the curre nt instruction. */
label->addr = (sljit_uw)S LJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); label->addr = (sljit_uw)S LJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
label->size = code_ptr - code; label->size = code_ptr - code;
label = label->next; label = label->next;
next_addr = compute_next_
addr(label, jump, const_, put_label);
} }
} }
} }
} }
else if ((*buf_ptr & 0xff000000) != PUSH_POOL) { else if ((*buf_ptr & 0xff000000) != PUSH_POOL) {
#endif #endif
*code_ptr = *buf_ptr++; *code_ptr = *buf_ptr++;
if (next_addr == word_count) {
SLJIT_ASSERT(!label || label->size >= wor
d_count);
SLJIT_ASSERT(!jump || jump->addr >= word_
count);
SLJIT_ASSERT(!const_ || const_->addr >= w
ord_count);
SLJIT_ASSERT(!put_label || put_label->add
r >= word_count);
/* These structures are ordered by their address. */ /* These structures are ordered by their address. */
SLJIT_ASSERT(!label || label->size >= word_count) if (jump && jump->addr == word_count) {
;
SLJIT_ASSERT(!jump || jump->addr >= word_count);
SLJIT_ASSERT(!const_ || const_->addr >= word_coun
t);
if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
if (detect_jump_type(jump, code_ptr, code if (detect_jump_type(jump, code_p
, executable_offset)) tr, code, executable_offset))
code_ptr--; code_ptr--;
jump->addr = (sljit_uw)code_ptr; jump->addr = (sljit_uw)code_ptr;
#else #else
jump->addr = (sljit_uw)(code_ptr - 2); jump->addr = (sljit_uw)(code_ptr
if (detect_jump_type(jump, code_ptr, code - 2);
, executable_offset)) if (detect_jump_type(jump, code_p
code_ptr -= 2; tr, code, executable_offset))
code_ptr -= 2;
#endif #endif
jump = jump->next; jump = jump->next;
} }
if (label && label->size == word_count) { if (label && label->size == word_count) {
/* code_ptr can be affected above. */ /* code_ptr can be affected above
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OF . */
FSET(code_ptr + 1, executable_offset); label->addr = (sljit_uw)SLJIT_ADD
label->size = (code_ptr + 1) - code; _EXEC_OFFSET(code_ptr + 1, executable_offset);
label = label->next; label->size = (code_ptr + 1) - co
} de;
if (const_ && const_->addr == word_count) { label = label->next;
}
if (const_ && const_->addr == word_count)
{
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
const_->addr = (sljit_uw)code_ptr; const_->addr = (sljit_uw)code_ptr ;
#else #else
const_->addr = (sljit_uw)(code_ptr - 1); const_->addr = (sljit_uw)(code_pt r - 1);
#endif #endif
const_ = const_->next; const_ = const_->next;
}
if (put_label && put_label->addr == word_
count) {
SLJIT_ASSERT(put_label->label);
put_label->addr = (sljit_uw)code_
ptr;
put_label = put_label->next;
}
next_addr = compute_next_addr(label, jump
, const_, put_label);
} }
code_ptr++; code_ptr++;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
} }
else { else {
/* Fortunately, no need to shift. */ /* Fortunately, no need to shift. */
cpool_size = *buf_ptr++ & ~PUSH_POOL; cpool_size = *buf_ptr++ & ~PUSH_POOL;
SLJIT_ASSERT(cpool_size > 0); SLJIT_ASSERT(cpool_size > 0);
cpool_start_address = ALIGN_INSTRUCTION(code_ptr + 1); cpool_start_address = ALIGN_INSTRUCTION(code_ptr + 1);
cpool_current_index = patch_pc_relative_loads(las t_pc_patch, code_ptr, cpool_start_address, cpool_size); cpool_current_index = patch_pc_relative_loads(las t_pc_patch, code_ptr, cpool_start_address, cpool_size);
skipping to change at line 728 skipping to change at line 744
last_pc_patch = code_ptr; last_pc_patch = code_ptr;
} }
#endif #endif
} while (buf_ptr < buf_end); } while (buf_ptr < buf_end);
buf = buf->next; buf = buf->next;
} while (buf); } while (buf);
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_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
SLJIT_ASSERT(cpool_size == 0); SLJIT_ASSERT(cpool_size == 0);
if (compiler->cpool_fill > 0) { if (compiler->cpool_fill > 0) {
cpool_start_address = ALIGN_INSTRUCTION(code_ptr); cpool_start_address = ALIGN_INSTRUCTION(code_ptr);
cpool_current_index = patch_pc_relative_loads(last_pc_patch, code _ptr, cpool_start_address, compiler->cpool_fill); cpool_current_index = patch_pc_relative_loads(last_pc_patch, code _ptr, cpool_start_address, compiler->cpool_fill);
if (cpool_current_index > 0) if (cpool_current_index > 0)
code_ptr = cpool_start_address + cpool_current_index; code_ptr = cpool_start_address + cpool_current_index;
buf_ptr = compiler->cpool; buf_ptr = compiler->cpool;
skipping to change at line 758 skipping to change at line 775
} }
SLJIT_ASSERT(!first_patch); SLJIT_ASSERT(!first_patch);
} }
#endif #endif
jump = compiler->jumps; jump = compiler->jumps;
while (jump) { while (jump) {
buf_ptr = (sljit_uw *)jump->addr; buf_ptr = (sljit_uw *)jump->addr;
if (jump->flags & PATCH_B) { if (jump->flags & PATCH_B) {
jump_addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, executable_offset); addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, execu table_offset);
if (!(jump->flags & JUMP_ADDR)) { if (!(jump->flags & JUMP_ADDR)) {
SLJIT_ASSERT(jump->flags & JUMP_LABEL); SLJIT_ASSERT(jump->flags & JUMP_LABEL);
SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - jum SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - add
p_addr) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - jump_addr) >= -0x02000 r) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - addr) >= -0x02000000);
000); *buf_ptr |= (((sljit_sw)jump->u.label->addr - add
*buf_ptr |= (((sljit_sw)jump->u.label->addr - jum r) >> 2) & 0x00ffffff;
p_addr) >> 2) & 0x00ffffff;
} }
else { else {
SLJIT_ASSERT(((sljit_sw)jump->u.target - jump_add SLJIT_ASSERT(((sljit_sw)jump->u.target - addr) <=
r) <= 0x01ffffff && ((sljit_sw)jump->u.target - jump_addr) >= -0x02000000); 0x01ffffff && ((sljit_sw)jump->u.target - addr) >= -0x02000000);
*buf_ptr |= (((sljit_sw)jump->u.target - jump_add *buf_ptr |= (((sljit_sw)jump->u.target - addr) >>
r) >> 2) & 0x00ffffff; 2) & 0x00ffffff;
} }
} }
else if (jump->flags & SLJIT_REWRITABLE_JUMP) { else if (jump->flags & SLJIT_REWRITABLE_JUMP) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
jump->addr = (sljit_uw)code_ptr; jump->addr = (sljit_uw)code_ptr;
code_ptr[0] = (sljit_uw)buf_ptr; code_ptr[0] = (sljit_uw)buf_ptr;
code_ptr[1] = *buf_ptr; code_ptr[1] = *buf_ptr;
inline_set_jump_addr((sljit_uw)code_ptr, executable_offse t, (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target, 0); inline_set_jump_addr((sljit_uw)code_ptr, executable_offse t, (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target, 0);
code_ptr += 2; code_ptr += 2;
#else #else
skipping to change at line 816 skipping to change at line 833
else else
buf_ptr += 1; buf_ptr += 1;
/* Set the value again (can be a simple constant). */ /* Set the value again (can be a simple constant). */
inline_set_const((sljit_uw)code_ptr, executable_offset, *buf_ptr, 0); inline_set_const((sljit_uw)code_ptr, executable_offset, *buf_ptr, 0);
code_ptr += 2; code_ptr += 2;
const_ = const_->next; const_ = const_->next;
} }
#endif #endif
put_label = compiler->put_labels;
while (put_label) {
addr = put_label->label->addr;
buf_ptr = (sljit_uw*)put_label->addr;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
SLJIT_ASSERT((buf_ptr[0] & 0xffff0000) == 0xe59f0000);
buf_ptr[((buf_ptr[0] & 0xfff) >> 2) + 2] = addr;
#else
SLJIT_ASSERT((buf_ptr[-1] & 0xfff00000) == MOVW && (buf_ptr[0] &
0xfff00000) == MOVT);
buf_ptr[-1] |= ((addr << 4) & 0xf0000) | (addr & 0xfff);
buf_ptr[0] |= ((addr >> 12) & 0xf0000) | ((addr >> 16) & 0xfff);
#endif
put_label = put_label->next;
}
SLJIT_ASSERT(code_ptr - code <= (sljit_s32)size); SLJIT_ASSERT(code_ptr - code <= (sljit_s32)size);
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_uw); compiler->executable_size = (code_ptr - code) * sizeof(sljit_uw);
code = (sljit_uw *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset); code = (sljit_uw *)SLJIT_ADD_EXEC_OFFSET(code, executable_offset);
code_ptr = (sljit_uw *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset) ; code_ptr = (sljit_uw *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset) ;
SLJIT_CACHE_FLUSH(code, code_ptr); SLJIT_CACHE_FLUSH(code, code_ptr);
skipping to change at line 2641 skipping to change at line 2674
inst |= (1 << 23); inst |= (1 << 23);
else else
memw = -memw; memw = -memw;
return push_inst(compiler, inst | TYPE2_TRANSFER_IMM(memw)); return push_inst(compiler, inst | TYPE2_TRANSFER_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);
dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WO
RD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), init_value));
compiler->patches++;
#else
PTR_FAIL_IF(emit_imm(compiler, dst_r, init_value));
#endif
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);
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw,
TMP_REG1));
return const_;
}
reg = SLOW_IS_REG(dst) ? dst : TMP_REG2; 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);
dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WO RD_SIZE | LOAD_DATA, 1, reg, TMP_PC, 0), init_value)); PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WO RD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), 0));
compiler->patches++; compiler->patches++;
#else #else
PTR_FAIL_IF(emit_imm(compiler, reg, init_value)); PTR_FAIL_IF(emit_imm(compiler, dst_r, 0));
#endif #endif
set_const(const_, compiler);
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);
if (dst & SLJIT_MEM) if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1));
return const_; return put_label;
} }
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta rget, sljit_sw executable_offset) SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta rget, sljit_sw executable_offset)
{ {
inline_set_jump_addr(addr, executable_offset, new_target, 1); inline_set_jump_addr(addr, executable_offset, new_target, 1);
} }
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta nt, sljit_sw executable_offset) SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta nt, sljit_sw executable_offset)
{ {
inline_set_const(addr, executable_offset, new_constant, 1); inline_set_const(addr, executable_offset, new_constant, 1);
 End of changes. 27 change blocks. 
44 lines changed or deleted 118 lines changed or added

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