"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "sljit/sljitNativeARM_64.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_64.c  (pcre-8.43.tar.bz2):sljitNativeARM_64.c  (pcre-8.44.tar.bz2)
skipping to change at line 164 skipping to change at line 164
static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm) static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm)
{ {
sljit_s32 dst = inst[0] & 0x1f; sljit_s32 dst = inst[0] & 0x1f;
SLJIT_ASSERT((inst[0] & 0xffe00000) == MOVZ && (inst[1] & 0xffe00000) == (MOVK | (1 << 21))); SLJIT_ASSERT((inst[0] & 0xffe00000) == MOVZ && (inst[1] & 0xffe00000) == (MOVK | (1 << 21)));
inst[0] = MOVZ | dst | ((new_imm & 0xffff) << 5); inst[0] = MOVZ | dst | ((new_imm & 0xffff) << 5);
inst[1] = MOVK | dst | (((new_imm >> 16) & 0xffff) << 5) | (1 << 21); inst[1] = MOVK | dst | (((new_imm >> 16) & 0xffff) << 5) | (1 << 21);
inst[2] = MOVK | dst | (((new_imm >> 32) & 0xffff) << 5) | (2 << 21); inst[2] = MOVK | dst | (((new_imm >> 32) & 0xffff) << 5) | (2 << 21);
inst[3] = MOVK | dst | ((new_imm >> 48) << 5) | (3 << 21); inst[3] = MOVK | dst | ((new_imm >> 48) << 5) | (3 << 21);
} }
static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in s *code_ptr, sljit_ins *code, sljit_sw executable_offset) static SLJIT_INLINE sljit_sw detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code, sljit_sw executable_offset)
{ {
sljit_sw diff; sljit_sw diff;
sljit_uw target_addr; sljit_uw target_addr;
if (jump->flags & SLJIT_REWRITABLE_JUMP) { if (jump->flags & SLJIT_REWRITABLE_JUMP) {
jump->flags |= PATCH_ABS64; jump->flags |= PATCH_ABS64;
return 0; return 0;
} }
if (jump->flags & JUMP_ADDR) if (jump->flags & JUMP_ADDR)
skipping to change at line 199 skipping to change at line 199
return 5; return 5;
} }
diff -= sizeof(sljit_ins); diff -= sizeof(sljit_ins);
} }
if (diff <= 0x7ffffff && diff >= -0x8000000) { if (diff <= 0x7ffffff && diff >= -0x8000000) {
jump->flags |= PATCH_B; jump->flags |= PATCH_B;
return 4; return 4;
} }
if (target_addr <= 0xffffffffl) { if (target_addr < 0x100000000l) {
if (jump->flags & IS_COND) if (jump->flags & IS_COND)
code_ptr[-5] -= (2 << 5); code_ptr[-5] -= (2 << 5);
code_ptr[-2] = code_ptr[0]; code_ptr[-2] = code_ptr[0];
return 2; return 2;
} }
if (target_addr <= 0xffffffffffffl) { if (target_addr < 0x1000000000000l) {
if (jump->flags & IS_COND) if (jump->flags & IS_COND)
code_ptr[-5] -= (1 << 5); code_ptr[-5] -= (1 << 5);
jump->flags |= PATCH_ABS48; jump->flags |= PATCH_ABS48;
code_ptr[-1] = code_ptr[0]; code_ptr[-1] = code_ptr[0];
return 1; return 1;
} }
jump->flags |= PATCH_ABS64; jump->flags |= PATCH_ABS64;
return 0; return 0;
} }
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 2;
}
if (max_label < 0x1000000000000l) {
put_label->flags = 1;
return 1;
}
put_label->flags = 2;
return 0;
}
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;
sljit_s32 dst; sljit_s32 dst;
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);
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++;
/* These structures are ordered by their address. */ if (next_addr == word_count) {
SLJIT_ASSERT(!label || label->size >= word_count); SLJIT_ASSERT(!label || label->size >= word_count)
SLJIT_ASSERT(!jump || jump->addr >= word_count); ;
SLJIT_ASSERT(!const_ || const_->addr >= word_count); SLJIT_ASSERT(!jump || jump->addr >= word_count);
if (label && label->size == word_count) { SLJIT_ASSERT(!const_ || const_->addr >= word_coun
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(cod t);
e_ptr, executable_offset); SLJIT_ASSERT(!put_label || put_label->addr >= wor
label->size = code_ptr - code; d_count);
label = label->next;
} /* These structures are ordered by their address.
if (jump && jump->addr == word_count) { */
jump->addr = (sljit_uw)(code_ptr - 4); if (label && label->size == word_count) {
code_ptr -= detect_jump_type(jump, code_p label->addr = (sljit_uw)SLJIT_ADD_EXEC_OF
tr, code, executable_offset); FSET(code_ptr, executable_offset);
jump = jump->next; label->size = code_ptr - code;
} label = label->next;
if (const_ && const_->addr == word_count) { }
const_->addr = (sljit_uw)code_ptr; if (jump && jump->addr == word_count) {
const_ = const_->next; jump->addr = (sljit_uw)(code_ptr
- 4);
code_ptr -= detect_jump_type(jump
, code_ptr, code, executable_offset);
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 - 3
);
code_ptr -= put_label_get_length(put_labe
l, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label-
>size));
put_label = put_label->next;
}
next_addr = compute_next_addr(label, jump, const_
, put_label);
} }
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);
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
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;
buf_ptr = (sljit_ins *)jump->addr; buf_ptr = (sljit_ins *)jump->addr;
if (jump->flags & PATCH_B) { if (jump->flags & PATCH_B) {
addr = (sljit_sw)(addr - (sljit_uw)SLJIT_ADD_EXEC _OFFSET(buf_ptr, executable_offset)) >> 2; addr = (sljit_sw)(addr - (sljit_uw)SLJIT_ADD_EXEC _OFFSET(buf_ptr, executable_offset)) >> 2;
skipping to change at line 326 skipping to change at line 358
buf_ptr[0] = MOVZ | dst | ((addr & 0xffff) << 5); buf_ptr[0] = MOVZ | dst | ((addr & 0xffff) << 5);
buf_ptr[1] = MOVK | dst | (((addr >> 16) & 0xffff) << 5) | (1 << 21); buf_ptr[1] = MOVK | dst | (((addr >> 16) & 0xffff) << 5) | (1 << 21);
if (jump->flags & (PATCH_ABS48 | PATCH_ABS64)) if (jump->flags & (PATCH_ABS48 | PATCH_ABS64))
buf_ptr[2] = MOVK | dst | (((addr >> 32) & 0xffff ) << 5) | (2 << 21); buf_ptr[2] = MOVK | dst | (((addr >> 32) & 0xffff ) << 5) | (2 << 21);
if (jump->flags & PATCH_ABS64) if (jump->flags & PATCH_ABS64)
buf_ptr[3] = MOVK | dst | (((addr >> 48) & 0xffff ) << 5) | (3 << 21); buf_ptr[3] = MOVK | dst | (((addr >> 48) & 0xffff ) << 5) | (3 << 21);
} while (0); } while (0);
jump = jump->next; jump = jump->next;
} }
put_label = compiler->put_labels;
while (put_label) {
addr = put_label->label->addr;
buf_ptr = (sljit_ins *)put_label->addr;
buf_ptr[0] |= (addr & 0xffff) << 5;
buf_ptr[1] |= ((addr >> 16) & 0xffff) << 5;
if (put_label->flags >= 1)
buf_ptr[2] |= ((addr >> 32) & 0xffff) << 5;
if (put_label->flags >= 2)
buf_ptr[3] |= ((addr >> 48) & 0xffff) << 5;
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);
code_ptr = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset ); code_ptr = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset );
SLJIT_CACHE_FLUSH(code, code_ptr); SLJIT_CACHE_FLUSH(code, code_ptr);
return code; return code;
} }
skipping to change at line 1949 skipping to change at line 1998
set_const(const_, compiler); set_const(const_, compiler);
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1; dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, init_value)); PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM) if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2)); PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2));
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);
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, 0));
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, 1);
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst,
dstw, TMP_REG2));
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)
{ {
sljit_ins* inst = (sljit_ins*)addr; sljit_ins* inst = (sljit_ins*)addr;
modify_imm64_const(inst, new_target); modify_imm64_const(inst, new_target);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
SLJIT_CACHE_FLUSH(inst, inst + 4); SLJIT_CACHE_FLUSH(inst, inst + 4);
} }
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)
{ {
 End of changes. 12 change blocks. 
22 lines changed or deleted 106 lines changed or added

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