[前][次][番号順一覧][スレッド一覧][生データ]

yarv-dev:1036

From: sheepman <sheepman sheepman.sakura.ne.jp>
Date: Mon, 17 Jul 2006 11:50:29 +0900
Subject: [yarv-dev:1036] open> InstructionSequence#eval dumps core

こんにちは、sheepman です。
僕の手元では、InstructionSequence#eval を呼ぶと core を
吐くので調べ見ました。

$ cat t.rb
iseq = YARVCore::InstructionSequence.compile(<<__EOS__)
if 1 < 2
  puts "hello"
end
__EOS__
iseq.eval

$ ruby-2.0 t.rb
ruby 2.0.0 (Base: Ruby 1.9.0 2006-04-08) [i686-linux]
YARVCore 0.4.1 Rev: 519 (2006-07-12) [opts: [direct threaded code] [inline method cache] ]
-- stack frame ------------
0000 (0x402b0008): 00000004
0001 (0x402b000c): 00000005
0002 (0x402b0010): 40296248
0003 (0x402b0014): 00000004
0004 (0x402b0018): 00000001
0005 (0x402b001c): 40296248
0006 (0x402b0020): 00000004
0007 (0x402b0024): 00000001 <- lfp <- dfp
-- control frame ----------
c:0004 p:---- s:0008 b:0008 l:000007 d:000007 CFUNC  :eval
c:0003 p:0027 s:0005 b:0005 l:000004 d:000004 TOP    t.rb:6
c:0002 p:---- s:0002 b:0002 l:000001 d:000001 FINISH
c:0001 p:---- s:0000 b:-001 l:000000 d:000000 ------
---------------------------
DBG> : "t.rb:6:in `<main>'"
[BUG] Segmentation fault
ruby 2.0.0 (2006-04-08) [i686-linux]

zsh: abort      ruby-2.0 t.rb

以下のパッチを当てると直りました。VALUE を仮定している yarv_th_eval に
yarv_iseq_t* を与えているのが原因だと思います。

$ svn diff iseq.c
Index: iseq.c
===================================================================
--- iseq.c      (revision 522)
+++ iseq.c      (working copy)
@@ -427,8 +427,7 @@
 static VALUE
 iseq_eval(VALUE self)
 {
-    yarv_iseq_t *iseq = iseq_check(self);
-    return yarv_th_eval(GET_THREAD(), iseq);
+    return yarv_th_eval(GET_THREAD(), self);
 }

 static VALUE

-- 
sheepman / TAMURA Takashi
sheepman sheepman.sakura.ne.jp 

--
ML: yarv-dev quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

->    1036 2006-07-17 11:50 [sheepman sheepman.sa] open> InstructionSequence#eval dumps core
      1037 2006-07-18 16:51 ┗[ko1 atdot.net       ] fixed> Re: open> InstructionSequence#eval dumps core