-rw-r--r-- | lib/jit_aarch64.c | 20 | ||||
-rw-r--r-- | lib/jit_alpha.c | 20 | ||||
-rw-r--r-- | lib/jit_arm.c | 20 | ||||
-rw-r--r-- | lib/jit_hppa.c | 21 | ||||
-rw-r--r-- | lib/jit_ia64.c | 24 | ||||
-rw-r--r-- | lib/jit_mips.c | 20 | ||||
-rw-r--r-- | lib/jit_ppc.c | 25 | ||||
-rw-r--r-- | lib/jit_s390x.c | 20 | ||||
-rw-r--r-- | lib/jit_sparc.c | 20 | ||||
-rw-r--r-- | lib/jit_x86.c | 20 | ||||
-rw-r--r-- | lib/lightning.c | 5 |
diff --git a/lib/jit_aarch64.c b/lib/jit_aarch64.c index ca522a5..94c52b7 100644 --- a/lib/jit_aarch64.c +++ b/lib/jit_aarch64.c @@ -1070,15 +1070,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_alpha.c b/lib/jit_alpha.c index cb91370..84b055c 100644 --- a/lib/jit_alpha.c +++ b/lib/jit_alpha.c @@ -1097,15 +1097,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_arm.c b/lib/jit_arm.c index 62d8e8a..bdafcdd 100644 --- a/lib/jit_arm.c +++ b/lib/jit_arm.c @@ -1385,15 +1385,19 @@ _emit_code(jit_state_t *_jit) flush_consts(); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); flush_consts(); break; case jit_code_callr: diff --git a/lib/jit_hppa.c b/lib/jit_hppa.c index 192da93..289542f 100644 --- a/lib/jit_hppa.c +++ b/lib/jit_hppa.c @@ -1059,16 +1059,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - /* no support for jump outside jit */ - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_ia64.c b/lib/jit_ia64.c index 6abf1a7..ee2ebcd 100644 --- a/lib/jit_ia64.c +++ b/lib/jit_ia64.c @@ -1214,17 +1214,21 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - if (_jit->pc.uc == _jit->code.ptr + 16) - _jitc->jump = 1; - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + if (_jit->pc.uc == _jit->code.ptr + 16) + _jitc->jump = 1; + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_mips.c b/lib/jit_mips.c index 88f128c..3eec489 100644 --- a/lib/jit_mips.c +++ b/lib/jit_mips.c @@ -1343,15 +1343,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c index 501b223..758f52a 100644 --- a/lib/jit_ppc.c +++ b/lib/jit_ppc.c @@ -1236,20 +1236,23 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: + if (node->flag & jit_flag_node) { #if __powerpc__ - if (_jit->pc.uc == _jit->code.ptr + sizeof(void*) * 3) - _jitc->jump = 1; + if (_jit->pc.uc == _jit->code.ptr + sizeof(void*) * 3) + _jitc->jump = 1; #endif - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - /* no support for jump outside jit */ - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi(_jit->pc.w); - patch(word, node); + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_s390x.c b/lib/jit_s390x.c index 184780b..99802a5 100644 --- a/lib/jit_s390x.c +++ b/lib/jit_s390x.c @@ -1052,15 +1052,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_sparc.c b/lib/jit_sparc.c index f1f4bff..81a9f5c 100644 --- a/lib/jit_sparc.c +++ b/lib/jit_sparc.c @@ -1055,15 +1055,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi_p(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi_p(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/jit_x86.c b/lib/jit_x86.c index dc386be..747741d 100644 --- a/lib/jit_x86.c +++ b/lib/jit_x86.c @@ -1668,15 +1668,19 @@ _emit_code(jit_state_t *_jit) jmpr(rn(node->u.w)); break; case jit_code_jmpi: - temp = node->u.n; - assert(temp->code == jit_code_label || - temp->code == jit_code_epilog); - if (temp->flag & jit_flag_patch) - jmpi(temp->u.w); - else { - word = jmpi(_jit->pc.w); - patch(word, node); + if (node->flag & jit_flag_node) { + temp = node->u.n; + assert(temp->code == jit_code_label || + temp->code == jit_code_epilog); + if (temp->flag & jit_flag_patch) + jmpi(temp->u.w); + else { + word = jmpi(_jit->pc.w); + patch(word, node); + } } + else + jmpi(node->u.w); break; case jit_code_callr: callr(rn(node->u.w)); diff --git a/lib/lightning.c b/lib/lightning.c index 1516bd4..8642cf8 100644 --- a/lib/lightning.c +++ b/lib/lightning.c @@ -2295,6 +2295,8 @@ _shortcut_jump(jit_state_t *_jit, jit_node_t *prev, jit_node_t *node) for (next = jump->next; next; next = next->next) { switch (next->code) { case jit_code_jmpi: + if (!(next->flag & jit_flag_node)) + return (0); if (jump->link == node) jump->link = node->link; else { @@ -2500,7 +2502,8 @@ _reverse_jump(jit_state_t *_jit, jit_node_t *prev, jit_node_t *node) return (0); /* =><cond_jump L0> <jump L1> <label L0> */ local_next = node->next; - if (local_next->code != jit_code_jmpi) + if (local_next->code != jit_code_jmpi || + !(local_next->flag & jit_flag_node)) return (0); /* <cond_jump L0> =><jump L1> <label L0> */ |