0
- attr_accessor :argc, :
nlocals, :stacksize, :flags, :consts, :bytecode,
0
+ attr_accessor :argc, :
, :stacksize, :flags, :consts, :bytecode,
0
:filename, :lineno, :name, :symbols, :stacknow, :varsyms, :jumps, :labels, :lines
0
- def initialize(fname, type = nil, name = "<module>", lineno = 0)
0
- @argc, @nlocals, @stacksize, @flags, @filename, @lineno, @name, @stack, @nopop, @type =
0
- 0, 0, 1, CO_NOFREE, fname, lineno, name, [], 0, type
0
+ def initialize(fname, type = nil, name = "<module>", lineno = 0, argc = 0)
0
+ @argc, @stacksize, @flags, @filename, @lineno, @name, @stack, @nopop, @type =
0
+ argc, 1, CO_NOFREE, fname, lineno, name, [], 0, type
0
@flags |= CO_NEWLOCALS if [:class, :method].include?(type)
0
def pop_top; bc 0x01; dump_stack end
0
+ def binary_add; infix 0x17 end
0
+ def binary_subscr; infix 0x19 end
0
+ def inplace_add; infix 0x37 end
0
+ def print_item; dump_stack; bc 0x47 end
0
+ def print_newline; dump_stack; bc 0x48 end
0
def load_locals; bc 0x52 end
0
def ret_val; bc 0x53 end
0
def build_class; bc 0x59 end
0
mark_jump n, bc(0x6f, n, 0x0)
0
- stack_push
Object.new, bc(0x7c, n, 0x0)
0
+ stack_push
n, bc(0x7c, n, 0x0)
0
+ def getdynamic id, lvl
0
+ load_name @varsyms[id - 1]
0
def import(mod, inner = nil)
0
args = @stack[-op_argc, op_argc].map { |o,_| o }
0
idx = @bytecode.index { |x| x.object_id == recbytes.object_id }
0
bytes = @bytecode.slice! idx..-1
0
+ blk = Pyasm.new(@filename, :block, "<block>", @lines.last[0])
0
+ blk.load_iseq blockiseq
0
bytes = @bytecode.slice! idx..-1
0
bytes.shift unless receiver
0
- asm = Pyasm.new(@filename, type, id.to_s, @lines.last[0]
])
0
+ asm = Pyasm.new(@filename, type, id.to_s, @lines.last[0]
, iseq[5][:arg_size])
0
asm.load_name(:__name__)
0
asm.store_name(:__module__)
0
@varsyms += iseq[8].reverse
0
- iseq
.last.each do |inst|
0
+ iseq
[11].each do |inst|
0
- f << [@argc, @
nlocals, @stacksize, @flags].pack("LLLL")
0
+ f << [@argc, @
varsyms.length, @stacksize, @flags].pack("LLLL")
0
bytes = @bytecode.flatten
Comments
No one has commented yet.