зеркало из https://github.com/github/ruby.git
revert r62655 for r63763
r63655 was tightly coupled to handle_frames and some assumptions seems to have been broken by r63763. To partially resolve Bug#14892, this reverts the optimization for now. I want to make MJIT CI happy first and then I'll probably retry r63655 by partially reverting r63763 for sp changes. The skipped test is not fixed yet. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
96f1c66377
Коммит
7a0a585444
44
insns.def
44
insns.def
|
@ -989,9 +989,9 @@ opt_plus
|
||||||
val = vm_opt_plus(recv, obj);
|
val = vm_opt_plus(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1008,9 +1008,9 @@ opt_minus
|
||||||
val = vm_opt_minus(recv, obj);
|
val = vm_opt_minus(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1027,9 +1027,9 @@ opt_mult
|
||||||
val = vm_opt_mult(recv, obj);
|
val = vm_opt_mult(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1046,9 +1046,9 @@ opt_div
|
||||||
val = vm_opt_div(recv, obj);
|
val = vm_opt_div(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1065,9 +1065,9 @@ opt_mod
|
||||||
val = vm_opt_mod(recv, obj);
|
val = vm_opt_mod(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1084,9 +1084,9 @@ opt_eq
|
||||||
val = opt_eq_func(recv, obj, ci, cc);
|
val = opt_eq_func(recv, obj, ci, cc);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1103,9 +1103,9 @@ opt_neq
|
||||||
val = vm_opt_neq(ci, cc, ci_eq, cc_eq, recv, obj);
|
val = vm_opt_neq(ci, cc, ci_eq, cc_eq, recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1122,9 +1122,9 @@ opt_lt
|
||||||
val = vm_opt_lt(recv, obj);
|
val = vm_opt_lt(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1141,9 +1141,9 @@ opt_le
|
||||||
val = vm_opt_le(recv, obj);
|
val = vm_opt_le(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1160,9 +1160,9 @@ opt_gt
|
||||||
val = vm_opt_gt(recv, obj);
|
val = vm_opt_gt(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1179,9 +1179,9 @@ opt_ge
|
||||||
val = vm_opt_ge(recv, obj);
|
val = vm_opt_ge(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1198,9 +1198,9 @@ opt_ltlt
|
||||||
val = vm_opt_ltlt(recv, obj);
|
val = vm_opt_ltlt(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1217,9 +1217,9 @@ opt_aref
|
||||||
val = vm_opt_aref(recv, obj);
|
val = vm_opt_aref(recv, obj);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1236,10 +1236,10 @@ opt_aset
|
||||||
val = vm_opt_aset(recv, obj, set);
|
val = vm_opt_aset(recv, obj, set);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(obj);
|
PUSH(obj);
|
||||||
PUSH(set);
|
PUSH(set);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1259,10 +1259,10 @@ opt_aset_with
|
||||||
val = tmp;
|
val = tmp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(rb_str_resurrect(key));
|
PUSH(rb_str_resurrect(key));
|
||||||
PUSH(val);
|
PUSH(val);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1279,9 +1279,9 @@ opt_aref_with
|
||||||
val = vm_opt_aref_with(recv, key);
|
val = vm_opt_aref_with(recv, key);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
PUSH(rb_str_resurrect(key));
|
PUSH(rb_str_resurrect(key));
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1298,8 +1298,8 @@ opt_length
|
||||||
val = vm_opt_length(recv, BOP_LENGTH);
|
val = vm_opt_length(recv, BOP_LENGTH);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1316,8 +1316,8 @@ opt_size
|
||||||
val = vm_opt_length(recv, BOP_SIZE);
|
val = vm_opt_length(recv, BOP_SIZE);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1334,8 +1334,8 @@ opt_empty_p
|
||||||
val = vm_opt_empty_p(recv);
|
val = vm_opt_empty_p(recv);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1352,8 +1352,8 @@ opt_succ
|
||||||
val = vm_opt_succ(recv);
|
val = vm_opt_succ(recv);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1370,8 +1370,8 @@ opt_not
|
||||||
val = vm_opt_not(ci, cc, recv);
|
val = vm_opt_not(ci, cc, recv);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(recv);
|
PUSH(recv);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
@ -1398,9 +1398,9 @@ opt_regexpmatch2
|
||||||
val = vm_opt_regexpmatch2(obj2, obj1);
|
val = vm_opt_regexpmatch2(obj2, obj1);
|
||||||
|
|
||||||
if (val == Qundef) {
|
if (val == Qundef) {
|
||||||
#ifndef MJIT_HEADER
|
|
||||||
PUSH(obj2);
|
PUSH(obj2);
|
||||||
PUSH(obj1);
|
PUSH(obj1);
|
||||||
|
#ifndef MJIT_HEADER
|
||||||
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
ADD_PC(-WIDTH_OF_opt_send_without_block);
|
||||||
#endif
|
#endif
|
||||||
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
DISPATCH_ORIGINAL_INSN(opt_send_without_block);
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
struct compile_status {
|
struct compile_status {
|
||||||
int success; /* has TRUE if compilation has had no issue */
|
int success; /* has TRUE if compilation has had no issue */
|
||||||
int *stack_size_for_pos; /* stack_size_for_pos[pos] has stack size for the position (otherwise -1) */
|
int *stack_size_for_pos; /* stack_size_for_pos[pos] has stack size for the position (otherwise -1) */
|
||||||
/* If TRUE, JIT-ed code will use local variables to store pushed values instead of
|
|
||||||
using VM's stack and moving stack pointer. */
|
|
||||||
int local_stack_p;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Storage to keep data which is consistent in each conditional branch.
|
/* Storage to keep data which is consistent in each conditional branch.
|
||||||
|
@ -175,13 +172,7 @@ compile_insns(FILE *f, const struct rb_iseq_constant_body *body, unsigned int st
|
||||||
static void
|
static void
|
||||||
compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct compile_status *status)
|
compile_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body, struct compile_status *status)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
fprintf(f, "\ncancel:\n");
|
fprintf(f, "\ncancel:\n");
|
||||||
if (status->local_stack_p) {
|
|
||||||
for (i = 0; i < body->stack_max; i++) {
|
|
||||||
fprintf(f, " *((VALUE *)reg_cfp->bp + %d) = stack[%d];\n", i + 1, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(f, " return Qundef;\n");
|
fprintf(f, " return Qundef;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +182,6 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func
|
||||||
{
|
{
|
||||||
struct compile_status status;
|
struct compile_status status;
|
||||||
status.success = TRUE;
|
status.success = TRUE;
|
||||||
status.local_stack_p = !body->catch_except_p;
|
|
||||||
status.stack_size_for_pos = ALLOC_N(int, body->iseq_size);
|
status.stack_size_for_pos = ALLOC_N(int, body->iseq_size);
|
||||||
memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size);
|
memset(status.stack_size_for_pos, NOT_COMPILED_STACK_SIZE, sizeof(int) * body->iseq_size);
|
||||||
|
|
||||||
|
@ -205,12 +195,7 @@ mjit_compile(FILE *f, const struct rb_iseq_constant_body *body, const char *func
|
||||||
fprintf(f, "__declspec(dllexport)\n");
|
fprintf(f, "__declspec(dllexport)\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(f, "VALUE\n%s(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)\n{\n", funcname);
|
fprintf(f, "VALUE\n%s(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp)\n{\n", funcname);
|
||||||
if (status.local_stack_p) {
|
fprintf(f, " VALUE *stack = reg_cfp->sp;\n");
|
||||||
fprintf(f, " VALUE stack[%d];\n", body->stack_max);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(f, " VALUE *stack = reg_cfp->sp;\n");
|
|
||||||
}
|
|
||||||
fprintf(f, " static const VALUE *const original_body_iseq = (VALUE *)0x%"PRIxVALUE";\n",
|
fprintf(f, " static const VALUE *const original_body_iseq = (VALUE *)0x%"PRIxVALUE";\n",
|
||||||
(VALUE)body->iseq_encoded);
|
(VALUE)body->iseq_encoded);
|
||||||
|
|
||||||
|
|
|
@ -675,6 +675,24 @@ class TestJIT < Test::Unit::TestCase
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_stack_pointer_with_assignment
|
||||||
|
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "nil\nnil\n", success_count: 1)
|
||||||
|
begin;
|
||||||
|
2.times do
|
||||||
|
a, b = nil
|
||||||
|
p a
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_stack_pointer_with_regexpmatch
|
||||||
|
skip
|
||||||
|
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "nil\nnil\n", success_count: 1)
|
||||||
|
begin;
|
||||||
|
1000.times { break if /a/ =~ "ab" && !$~[0] }
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# The shortest way to test one proc
|
# The shortest way to test one proc
|
||||||
|
|
|
@ -20,11 +20,6 @@
|
||||||
MAYBE_UNUSED(<%= ope.fetch(:decl) %>) = (<%= ope.fetch(:type) %>)operands[<%= i %>];
|
MAYBE_UNUSED(<%= ope.fetch(:decl) %>) = (<%= ope.fetch(:type) %>)operands[<%= i %>];
|
||||||
% end
|
% end
|
||||||
%
|
%
|
||||||
% # JIT: Declare stack_size to be used in some macro of _mjit_compile_insn_body.erb
|
|
||||||
if (status->local_stack_p) {
|
|
||||||
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
|
||||||
}
|
|
||||||
%
|
|
||||||
% # JIT: Declare variables for operands, popped values and return values
|
% # JIT: Declare variables for operands, popped values and return values
|
||||||
% insn.declarations.each do |decl|
|
% insn.declarations.each do |decl|
|
||||||
fprintf(f, " <%= decl %>;\n");
|
fprintf(f, " <%= decl %>;\n");
|
||||||
|
|
|
@ -69,9 +69,6 @@
|
||||||
% end
|
% end
|
||||||
% when /\A\s+DISPATCH_ORIGINAL_INSN\([^)]+\);\s+\z/
|
% when /\A\s+DISPATCH_ORIGINAL_INSN\([^)]+\);\s+\z/
|
||||||
% # For `opt_xxx`'s fallbacks.
|
% # For `opt_xxx`'s fallbacks.
|
||||||
if (status->local_stack_p) {
|
|
||||||
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1);
|
|
||||||
}
|
|
||||||
if (!body->catch_except_p) {
|
if (!body->catch_except_p) {
|
||||||
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
fprintf(f, " reg_cfp->pc = original_body_iseq + %d;\n", pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,15 +12,4 @@
|
||||||
}
|
}
|
||||||
%
|
%
|
||||||
% # JIT: move sp to use or preserve stack variables
|
% # JIT: move sp to use or preserve stack variables
|
||||||
if (status->local_stack_p) {
|
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */
|
||||||
% # JIT-only behavior (pushing JIT's local variables to VM's stack):
|
|
||||||
rb_snum_t i, push_size;
|
|
||||||
push_size = -<%= insn.call_attribute('sp_inc') %> + <%= insn.rets.size %> - <%= insn.pops.size %>;
|
|
||||||
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %ld + 1;\n", push_size); /* POPN(INSN_ATTR(popn)); */
|
|
||||||
for (i = 0; i < push_size; i++) { /* TODO: use memcpy? */
|
|
||||||
fprintf(f, " *(reg_cfp->sp + %ld) = stack[%ld];\n", i - push_size, (rb_snum_t)b->stack_size - push_size + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fprintf(f, " reg_cfp->sp = (VALUE *)reg_cfp->bp + %d;\n", b->stack_size + 1 - <%= insn.pops.size %>); /* POPN(INSN_ATTR(popn)); */
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,10 +24,6 @@
|
||||||
int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
|
int param_size = iseq->body->param.size; /* TODO: check calling->argc for argument_arity_error */
|
||||||
|
|
||||||
fprintf(f, "{\n");
|
fprintf(f, "{\n");
|
||||||
% # JIT: Declare stack_size to be used in some macro of _mjit_compile_insn_body.erb
|
|
||||||
if (status->local_stack_p) {
|
|
||||||
fprintf(f, " MAYBE_UNUSED(unsigned int) stack_size = %u;\n", b->stack_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
% # JIT: Invalidate call cache if it requires vm_search_method. This allows to inline some of following things.
|
% # JIT: Invalidate call cache if it requires vm_search_method. This allows to inline some of following things.
|
||||||
<%= render 'mjit_compile_send_guard' -%>
|
<%= render 'mjit_compile_send_guard' -%>
|
||||||
|
|
|
@ -31,13 +31,13 @@
|
||||||
% # reg_cfp: the second argument of _mjitXXX
|
% # reg_cfp: the second argument of _mjitXXX
|
||||||
% # GET_CFP(): refers to `reg_cfp`
|
% # GET_CFP(): refers to `reg_cfp`
|
||||||
% # GET_EP(): refers to `reg_cfp->ep`
|
% # GET_EP(): refers to `reg_cfp->ep`
|
||||||
% # GET_SP(): refers to `reg_cfp->sp`, or `(stack + stack_size)` if local_stack_p
|
% # GET_SP(): refers to `reg_cfp->sp`
|
||||||
% # GET_SELF(): refers to `reg_cfp->self`
|
% # GET_SELF(): refers to `reg_cfp->self`
|
||||||
% # GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)`
|
% # GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)`
|
||||||
% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup
|
% # EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup
|
||||||
% # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()`
|
% # CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()`
|
||||||
% # TOPN(): refers to `reg_cfp->sp`, or `*(stack + (stack_size - num - 1))` if local_stack_p
|
% # TOPN(): refers to `reg_cfp->sp`
|
||||||
% # STACK_ADDR_FROM_TOP(): refers to `reg_cfp->sp`, or `stack + (stack_size - num)` if local_stack_p
|
% # STACK_ADDR_FROM_TOP(): refers to `reg_cfp->sp`
|
||||||
% # DISPATCH_ORIGINAL_INSN(): expanded in _mjit_compile_insn.erb
|
% # DISPATCH_ORIGINAL_INSN(): expanded in _mjit_compile_insn.erb
|
||||||
% # THROW_EXCEPTION(): specially defined for JIT
|
% # THROW_EXCEPTION(): specially defined for JIT
|
||||||
% # RESTORE_REGS(): specially defined for `leave`
|
% # RESTORE_REGS(): specially defined for `leave`
|
||||||
|
|
Загрузка…
Ссылка в новой задаче