Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
sisshiki1969 committed Nov 8, 2023
1 parent 755f7c0 commit 75659d0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 97 deletions.
23 changes: 9 additions & 14 deletions a.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
# 実位置引数の数が仮位置引数より1個少ない
# 実引数に1個以上のキーワード引数がある
# calleeの仮引数にキーワード引数がない

def f(a, b)
"a:#{a} b:#{b}"
class Foo
def foo(x)
x * 100
end
end

10.times do
puts f("a", x:100, y:200)
end
#def f
# yield 1,2,3,x:100,y:200
#end
#
#f do |a,b,*c| puts "a:#{a} b:#{b} c:#{c}" end
x = [[0,1,2,3]] * 20
x << Foo.new.method(:foo)
x.each do |a|
puts a[2]
end
75 changes: 0 additions & 75 deletions log

This file was deleted.

4 changes: 2 additions & 2 deletions monoruby/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const LBP_OUTER: i64 = 0 + LFP_OFFSET;
/// Meta 8bytes
const LBP_META: i64 = 8 + LFP_OFFSET;
/// Meta::Regnum 2bytes
const LBP_META_REGNUM: i64 = LBP_META - 4;
const LBP_META_REGNUM: i64 = LBP_META - META_REGNUM as i64;
/// Meta::FuncId 4bytes
const LBP_META_FUNCID: i64 = LBP_META;
const LBP_META_FUNCID: i64 = LBP_META + META_FUNCID as i64;
const LBP_BLOCK: i64 = 16 + LFP_OFFSET;
const LBP_SELF: i64 = 24 + LFP_OFFSET;
pub const LBP_ARG0: i64 = LBP_SELF + 8;
Expand Down
7 changes: 3 additions & 4 deletions monoruby/src/executor/compiler/jitgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,20 +1562,19 @@ impl Codegen {
let wb = ctx.get_write_back();
self.gen_write_back(&wb);
}
let fetch = self.vm_fetch;
monoasm!( &mut self.jit,
movq r13, (pc.get_u64());
);
#[cfg(any(feature = "log-jit", feature = "profile"))]
monoasm!( &mut self.jit,
movq r8, rdi; // the Value which caused this deopt.
movq rcx, rdi; // the Value which caused this deopt.
movq rdi, rbx;
movq rsi, r12;
movq rdx, [r14 - (LBP_META)];
movq rcx, r13;
movq rdx, r13;
movq rax, (crate::globals::log_deoptimize);
call rax;
);
let fetch = self.vm_fetch;
monoasm!( &mut self.jit,
jmp fetch;
);
Expand Down
4 changes: 2 additions & 2 deletions monoruby/src/globals/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,14 @@ impl Globals {

#[cfg(any(feature = "log-jit", feature = "profile"))]
pub(crate) extern "C" fn log_deoptimize(
_vm: &mut Executor,
vm: &mut Executor,
globals: &mut Globals,
func_id: FuncId,
pc: BcPc,
#[cfg(feature = "log-jit")] v: Option<Value>,
) {
use crate::jitgen::trace_ir::TraceIr;

let func_id = vm.cfp().lfp().meta().func_id();
let bc_begin = globals[func_id].as_ruby_func().get_top_pc();
let index = pc - bc_begin;

Expand Down

0 comments on commit 75659d0

Please sign in to comment.