Issue #578 has been updated by bowen113 (bowen wenqi).


rocky (Rocky Bernstein) wrote:
> =begin
>  Another possiblility would be to add an instruction-sequence method (iseq) into Proc. Off of the instruction sequence, one could use the methods like disasm or to_a.
>  
>  The actual additional code (put in the right place) for this seems pretty small:
>  
>  VALUE
>  proc_iseq(VALUE self)
>  {
>      rb_proc_t *proc;
>      rb_iseq_t *iseq;
>      VALUE rb_iseq;
>      GetProcPtr(self, proc);
>      iseq = proc->block.iseq;
>      if (!iseq) return Qnil;
>      rb_iseq = iseq_alloc_shared(rb_cISeq);
>      RDATA(rb_iseq)->data = iseq;
>      return rb_iseq;
>  }
http://www.breitling2u.com/breitling-chronomat-evolution-watches-17_109.html
http://www.breitling2u.com/
http://www.breitling2u.com/breitling-super-ocean-watches-17_117.html
>  
>   rb_define_method(rb_cProc, "iseq", proc_iseq, 0);
>  
>  Warning: the above may have flaws in it.
> =end


----------------------------------------
Feature #578: add method to disassemble Proc objects
https://bugs.ruby-lang.org/issues/578#change-31454

Author: rogerdpack (Roger Pack)
Status: Closed
Priority: Low
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 1.9.2


=begin
 Currently 
 RubyVM::InstructionSequence.disassemble
 works only for methods.
 
 I wasn't sure how to patch 
 RubyVM::InstructionSequence.disassemble
 to work with proc objects AND methods, so added a new method
 RubyVM::InstructionSequence.disassemble_proc
 which works for proc objects, in the accompanying patch.
 Either way would work.
 
 Hope this can be included before the feature freeze, if possible :)
 -=R
=end



-- 
http://bugs.ruby-lang.org/