Class: CodeTools::Generator
- Inherits:
-
Object
- Object
- CodeTools::Generator
show all
- Includes:
- GeneratorMethods
- Defined in:
- lib/rubinius/code/compiler/generator.rb
Defined Under Namespace
Classes: BasicBlock, Label
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#accumulate_stack(size) ⇒ Object
-
#add_generator(generator) ⇒ Object
-
#add_literal(literal) ⇒ Object
-
#cast_array ⇒ Object
instructions that can cause stack unwinding.
-
#cast_for_multi_block_arg ⇒ Object
-
#cast_for_single_block_arg ⇒ Object
-
#cast_for_splat_block_arg ⇒ Object
-
#cast_multi_value ⇒ Object
-
#check_frozen ⇒ Object
-
#close ⇒ Object
-
#create_block(literal) ⇒ Object
-
#definition_line(line) ⇒ Object
-
#encode ⇒ Object
-
#ensure_return ⇒ Object
-
#execute(node) ⇒ Object
(also: #run)
-
#find_const(literal) ⇒ Object
-
#find_literal(literal) ⇒ Object
-
#initialize ⇒ Generator
constructor
A new instance of Generator.
-
#invoke_primitive(literal, count) ⇒ Object
-
#ip_to_line(ip) ⇒ Object
-
#last_match(mode, which) ⇒ Object
-
#line ⇒ Object
-
#max_stack_size ⇒ Object
-
#new_basic_block ⇒ Object
-
#new_label ⇒ Object
-
#new_register ⇒ Object
-
#new_stack_local ⇒ Object
-
#object_to_s(literal) ⇒ Object
-
#package(klass) ⇒ Object
-
#passed_arg(index) ⇒ Object
-
#passed_blockarg(count) ⇒ Object
-
#pop_modifiers ⇒ Object
-
#pop_state ⇒ Object
-
#push_arg(idx) ⇒ Object
Minor meta operations that can be used to detect the number of method arguments needed.
-
#push_block_arg ⇒ Object
-
#push_const(literal) ⇒ Object
-
#push_float(float) ⇒ Object
-
#push_generator(generator) ⇒ Object
-
#push_ivar(literal) ⇒ Object
-
#push_literal(literal) ⇒ Object
-
#push_local(index) ⇒ Object
-
#push_local_depth(depth, index) ⇒ Object
-
#push_modifiers ⇒ Object
-
#push_proc ⇒ Object
-
#push_state(scope) ⇒ Object
-
#r_load_literal(reg, literal) ⇒ Object
-
#raise_break ⇒ Object
-
#raise_exc ⇒ Object
-
#raise_return ⇒ Object
-
#reraise ⇒ Object
-
#ret ⇒ Object
-
#send(meth, count, priv = false) ⇒ Object
-
#send_method(literal) ⇒ Object
-
#send_primitive(name) ⇒ Object
-
#send_stack(literal, count) ⇒ Object
-
#send_stack_with_block(literal, count) ⇒ Object
-
#send_stack_with_splat(literal, count) ⇒ Object
-
#send_super(meth, args, splat = false) ⇒ Object
-
#send_super_stack_with_block(literal, count) ⇒ Object
-
#send_super_stack_with_splat(literal, count) ⇒ Object
-
#send_vcall(literal) ⇒ Object
-
#send_with_block(meth, count, priv = false) ⇒ Object
-
#send_with_splat(meth, args, priv = false, concat = false) ⇒ Object
-
#set_arg(idx) ⇒ Object
-
#set_ivar(literal) ⇒ Object
-
#set_line(line) ⇒ Object
-
#set_local(index) ⇒ Object
-
#set_local_depth(depth, index) ⇒ Object
-
#state ⇒ Object
Commands (these don’t generate data in the stream).
-
#string_build(count) ⇒ Object
-
#string_dup ⇒ Object
-
#unwind ⇒ Object
-
#use_detected ⇒ Object
-
#yield_splat(count) ⇒ Object
-
#yield_stack(count) ⇒ Object
-
#zsuper(literal) ⇒ Object
#a_equal, #a_function, #a_greater, #a_greater_equal, #a_instance, #a_kind, #a_less, #a_less_equal, #a_method, #a_not_equal, #a_receiver_method, #a_type, #add_scope, #allow_private, #b_if, #b_if_int, #b_if_serial, #call, #call_0, #call_send, #check_interrupts, #check_serial, #check_serial_private, #clear_exception, #dup, #dup_many, #e_cache_function, #e_cache_function_p, #e_cache_method, #e_cache_method_p, #e_cache_value, #e_cache_value_p, #e_check_signature, #e_invoke_function, #e_invoke_method, #e_resolve_function, #e_resolve_method, #e_resolve_path_constant, #e_resolve_receiver_method, #e_resolve_scope_constant, #e_signature, #emit_push_literal, #goto, #goto_future, #goto_if_equal, #goto_if_false, #goto_if_nil, #goto_if_not_equal, #goto_if_not_nil, #goto_if_not_undefined, #goto_if_true, #goto_if_undefined, #goto_past, #instance_of, #kind_of, #m_bytes, #m_counter, #m_debug, #m_log, #m_sum, #m_time_stamp, #m_timer_start, #m_timer_stop, #m_value, #make_array, #move_down, #n_iadd, #n_iadd_o, #n_idiv, #n_idiv_o, #n_ieq, #n_ige, #n_igt, #n_ile, #n_ilt, #n_imul, #n_imul_o, #n_ine, #n_ipopcnt, #n_isub, #n_isub_o, #noop, #p_any, #p_call, #p_char, #p_char_set, #p_choice, #p_commit, #p_commit_back, #p_commit_partial, #p_end, #p_fail, #p_fail_twice, #p_init, #p_jump, #p_return, #p_span, #p_test_any, #p_test_char, #p_test_char_set, #pop, #pop_many, #pop_unwind, #push_block, #push_cpath_top, #push_current_exception, #push_exception_state, #push_false, #push_file, #push_has_block, #push_int, #push_memo, #push_mirror, #push_my_field, #push_my_offset, #push_nil, #push_rubinius, #push_scope, #push_self, #push_stack_local, #push_tagged_nil, #push_true, #push_type, #push_undef, #push_variables, #r_copy, #r_load_0, #r_load_1, #r_load_false, #r_load_int, #r_load_local, #r_load_local_depth, #r_load_nil, #r_load_stack, #r_load_true, #r_store_int, #r_store_local, #r_store_local_depth, #r_store_stack, #restore_exception_state, #rotate, #set_call_flags, #set_const, #set_const_at, #set_stack_local, #setup_unwind, #shift_array, #store_my_field, #string_append, #swap, #yield_debugger
Constructor Details
Returns a new instance of Generator.
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
# File 'lib/rubinius/code/compiler/generator.rb', line 245
def initialize
@stream = []
@literals_map = Hash.new { |h,k| h[k] = add_literal(k) }
@literals = []
@ip = 0
@modstack = []
@break = nil
@redo = nil
@next = nil
@retry = nil
@last_line = nil
@file = nil
@lines = []
@primitive = nil
@instruction = nil
@for_block = nil
@for_module_body = nil
@required_args = 0
@post_args = 0
@total_args = 0
@arity = 0
@detected_args = 0
@detected_locals = 0
@splat_index = nil
@local_names = nil
@block_index = nil
@keywords = nil
@kwrest_index = nil
@local_count = 0
@registers = 0
@state = []
@generators = []
@stack_locals = 0
@enter_block = new_basic_block
@current_block = @enter_block
@max_stack = 0
end
|
Instance Attribute Details
#arity ⇒ Object
Returns the value of attribute arity.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def arity
@arity
end
|
#block_index ⇒ Object
Returns the value of attribute block_index.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def block_index
@block_index
end
|
#break ⇒ Object
Returns the value of attribute break.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def break
@break
end
|
#current_block ⇒ Object
Returns the value of attribute current_block.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def current_block
@current_block
end
|
#detected_args ⇒ Object
Returns the value of attribute detected_args.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def detected_args
@detected_args
end
|
#detected_locals ⇒ Object
Returns the value of attribute detected_locals.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def detected_locals
@detected_locals
end
|
#file ⇒ Object
Returns the value of attribute file.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def file
@file
end
|
#for_block ⇒ Object
Returns the value of attribute for_block.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def for_block
@for_block
end
|
#for_module_body ⇒ Object
Returns the value of attribute for_module_body.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def for_module_body
@for_module_body
end
|
#ip ⇒ Object
Returns the value of attribute ip.
289
290
291
|
# File 'lib/rubinius/code/compiler/generator.rb', line 289
def ip
@ip
end
|
#iseq ⇒ Object
Returns the value of attribute iseq.
289
290
291
|
# File 'lib/rubinius/code/compiler/generator.rb', line 289
def iseq
@iseq
end
|
#keywords ⇒ Object
Returns the value of attribute keywords.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def keywords
@keywords
end
|
#kwrest_index ⇒ Object
Returns the value of attribute kwrest_index.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def kwrest_index
@kwrest_index
end
|
#literals ⇒ Object
Returns the value of attribute literals.
289
290
291
|
# File 'lib/rubinius/code/compiler/generator.rb', line 289
def literals
@literals
end
|
#local_count ⇒ Object
Returns the value of attribute local_count.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def local_count
@local_count
end
|
#local_names ⇒ Object
Returns the value of attribute local_names.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def local_names
@local_names
end
|
#name ⇒ Object
Returns the value of attribute name.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def name
@name
end
|
#next ⇒ Object
Returns the value of attribute next.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def next
@next
end
|
#post_args ⇒ Object
Returns the value of attribute post_args.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def post_args
@post_args
end
|
#primitive ⇒ Object
Returns the value of attribute primitive.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def primitive
@primitive
end
|
#redo ⇒ Object
Returns the value of attribute redo.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def redo
@redo
end
|
#registers ⇒ Object
Returns the value of attribute registers.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def registers
@registers
end
|
#required_args ⇒ Object
Returns the value of attribute required_args.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def required_args
@required_args
end
|
#retry ⇒ Object
Returns the value of attribute retry.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def retry
@retry
end
|
#splat_index ⇒ Object
Returns the value of attribute splat_index.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def splat_index
@splat_index
end
|
#stream ⇒ Object
Returns the value of attribute stream.
289
290
291
|
# File 'lib/rubinius/code/compiler/generator.rb', line 289
def stream
@stream
end
|
#total_args ⇒ Object
Returns the value of attribute total_args.
290
291
292
|
# File 'lib/rubinius/code/compiler/generator.rb', line 290
def total_args
@total_args
end
|
Instance Method Details
#accumulate_stack(size) ⇒ Object
467
468
469
|
# File 'lib/rubinius/code/compiler/generator.rb', line 467
def accumulate_stack(size)
@max_stack = size if size > @max_stack
end
|
#add_generator(generator) ⇒ Object
490
491
492
493
494
|
# File 'lib/rubinius/code/compiler/generator.rb', line 490
def add_generator(generator)
index = add_literal generator
@generators << index
index
end
|
#add_literal(literal) ⇒ Object
500
501
502
503
504
|
# File 'lib/rubinius/code/compiler/generator.rb', line 500
def add_literal(literal)
index = @literals.size
@literals << literal
index
end
|
#cast_array ⇒ Object
instructions that can cause stack unwinding
600
601
602
603
|
# File 'lib/rubinius/code/compiler/generator.rb', line 600
def cast_array
super
unwind
end
|
#cast_for_multi_block_arg ⇒ Object
605
606
607
608
|
# File 'lib/rubinius/code/compiler/generator.rb', line 605
def cast_for_multi_block_arg
super
unwind
end
|
#cast_for_single_block_arg ⇒ Object
610
611
612
613
|
# File 'lib/rubinius/code/compiler/generator.rb', line 610
def cast_for_single_block_arg
super
unwind
end
|
#cast_for_splat_block_arg ⇒ Object
615
616
617
618
|
# File 'lib/rubinius/code/compiler/generator.rb', line 615
def cast_for_splat_block_arg
super
unwind
end
|
#cast_multi_value ⇒ Object
620
621
622
623
|
# File 'lib/rubinius/code/compiler/generator.rb', line 620
def cast_multi_value
super
unwind
end
|
#check_frozen ⇒ Object
625
626
627
628
|
# File 'lib/rubinius/code/compiler/generator.rb', line 625
def check_frozen
super
unwind
end
|
#close ⇒ Object
440
441
442
443
444
445
446
447
|
# File 'lib/rubinius/code/compiler/generator.rb', line 440
def close
if @lines.empty?
msg = "closing a method definition with no line info: #{file}:#{line}"
raise Exception, msg
end
@lines << @ip
end
|
#create_block(literal) ⇒ Object
630
631
632
633
|
# File 'lib/rubinius/code/compiler/generator.rb', line 630
def create_block(literal)
super
unwind
end
|
#definition_line(line) ⇒ Object
393
394
395
396
397
398
399
400
401
402
|
# File 'lib/rubinius/code/compiler/generator.rb', line 393
def definition_line(line)
unless @stream.empty?
raise Exception, "only use #definition_line first"
end
@lines << -1
@lines << line
@last_line = line
end
|
#encode ⇒ Object
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
# File 'lib/rubinius/code/compiler/generator.rb', line 304
def encode
@iseq = Rubinius::InstructionSequence.new @stream.to_tuple
begin
@enter_block.validate_stack
rescue Exception => e
if $DEBUG
puts "Error computing stack for #{@name}: #{e.message} (#{e.class})"
end
raise e
end
@generators.each { |x| @literals[x].encode }
end
|
#ensure_return ⇒ Object
635
636
637
638
|
# File 'lib/rubinius/code/compiler/generator.rb', line 635
def ensure_return
super
unwind
end
|
#execute(node) ⇒ Object
Also known as:
run
296
297
298
|
# File 'lib/rubinius/code/compiler/generator.rb', line 296
def execute(node)
node.bytecode self
end
|
#find_const(literal) ⇒ Object
640
641
642
643
|
# File 'lib/rubinius/code/compiler/generator.rb', line 640
def find_const(literal)
super
unwind
end
|
#find_literal(literal) ⇒ Object
496
497
498
|
# File 'lib/rubinius/code/compiler/generator.rb', line 496
def find_literal(literal)
@literals_map[literal]
end
|
#invoke_primitive(literal, count) ⇒ Object
645
646
647
648
|
# File 'lib/rubinius/code/compiler/generator.rb', line 645
def invoke_primitive(literal, count)
super
unwind
end
|
#ip_to_line(ip) ⇒ Object
427
428
429
430
431
432
433
434
435
436
437
438
|
# File 'lib/rubinius/code/compiler/generator.rb', line 427
def ip_to_line(ip)
total = @lines.size - 2
i = 0
while i < total
if ip >= @lines[i] and ip <= @lines[i+2]
return @lines[i+1]
end
i += 2
end
end
|
#last_match(mode, which) ⇒ Object
546
547
548
549
550
|
# File 'lib/rubinius/code/compiler/generator.rb', line 546
def last_match(mode, which)
push_int Integer(mode)
push_int Integer(which)
invoke_primitive :regexp_last_match_result, 2
end
|
#line ⇒ Object
423
424
425
|
# File 'lib/rubinius/code/compiler/generator.rb', line 423
def line
@last_line
end
|
#max_stack_size ⇒ Object
471
472
473
474
475
|
# File 'lib/rubinius/code/compiler/generator.rb', line 471
def max_stack_size
size = @max_stack + @local_count + @stack_locals
size += 1 if @for_block
size
end
|
#new_basic_block ⇒ Object
463
464
465
|
# File 'lib/rubinius/code/compiler/generator.rb', line 463
def new_basic_block
BasicBlock.new self
end
|
#new_label ⇒ Object
453
454
455
|
# File 'lib/rubinius/code/compiler/generator.rb', line 453
def new_label
Label.new(self)
end
|
#new_register ⇒ Object
457
458
459
|
# File 'lib/rubinius/code/compiler/generator.rb', line 457
def new_register
(@registers += 1) - 1
end
|
#new_stack_local ⇒ Object
477
478
479
480
481
|
# File 'lib/rubinius/code/compiler/generator.rb', line 477
def new_stack_local
idx = @stack_locals
@stack_locals += 1
return idx
end
|
#object_to_s(literal) ⇒ Object
650
651
652
653
|
# File 'lib/rubinius/code/compiler/generator.rb', line 650
def object_to_s(literal)
super
unwind
end
|
#package(klass) ⇒ Object
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
# File 'lib/rubinius/code/compiler/generator.rb', line 320
def package(klass)
@generators.each { |x| @literals[x] = @literals[x].package klass }
code = klass.new
code.iseq = @iseq
code.literals = @literals.to_tuple
code.lines = @lines.to_tuple
code.required_args = @required_args
code.post_args = @post_args
code.total_args = @total_args
code.splat = @splat_index
code.arity = @arity
code.local_count = @local_count
code.local_names = @local_names.to_tuple if @local_names
code.keywords = @keywords.to_tuple if @keywords
code.registers = @registers
code.add_metadata :block_index, @block_index if @block_index
code.add_metadata :kwrest_index, @kwrest_index if @kwrest_index
code.stack_size = max_stack_size
code.file = @file
code.name = @name
code.primitive = @primitive
if @for_block
code.add_metadata :for_block, true
end
if @for_module_body
code.add_metadata :for_module_body, true
end
code
end
|
#passed_arg(index) ⇒ Object
655
656
657
658
|
# File 'lib/rubinius/code/compiler/generator.rb', line 655
def passed_arg(index)
super
unwind
end
|
#passed_blockarg(count) ⇒ Object
660
661
662
663
|
# File 'lib/rubinius/code/compiler/generator.rb', line 660
def passed_blockarg(count)
super
unwind
end
|
#pop_modifiers ⇒ Object
389
390
391
|
# File 'lib/rubinius/code/compiler/generator.rb', line 389
def pop_modifiers
@break, @redo, @next, @retry = @modstack.pop
end
|
#pop_state ⇒ Object
381
382
383
|
# File 'lib/rubinius/code/compiler/generator.rb', line 381
def pop_state
@state.pop
end
|
#push_arg(idx) ⇒ Object
Minor meta operations that can be used to detect the number of method arguments needed
520
521
522
523
|
# File 'lib/rubinius/code/compiler/generator.rb', line 520
def push_arg(idx)
push_local(idx)
@detected_args = @detected_locals
end
|
#push_block_arg ⇒ Object
665
666
667
668
|
# File 'lib/rubinius/code/compiler/generator.rb', line 665
def push_block_arg
super
unwind
end
|
#push_const(literal) ⇒ Object
670
671
672
673
|
# File 'lib/rubinius/code/compiler/generator.rb', line 670
def push_const(literal)
super
unwind
end
|
#push_float(float) ⇒ Object
506
507
508
|
# File 'lib/rubinius/code/compiler/generator.rb', line 506
def push_float(float)
emit_push_literal add_literal(float)
end
|
#push_generator(generator) ⇒ Object
483
484
485
486
487
488
|
# File 'lib/rubinius/code/compiler/generator.rb', line 483
def push_generator(generator)
index = @literals.size
push_literal generator
@generators << index
index
end
|
#push_ivar(literal) ⇒ Object
675
676
677
678
|
# File 'lib/rubinius/code/compiler/generator.rb', line 675
def push_ivar(literal)
super
unwind
end
|
#push_literal(literal) ⇒ Object
510
511
512
|
# File 'lib/rubinius/code/compiler/generator.rb', line 510
def push_literal(literal)
super find_literal(literal)
end
|
#push_local(index) ⇒ Object
525
526
527
528
529
530
531
|
# File 'lib/rubinius/code/compiler/generator.rb', line 525
def push_local(index)
if @detected_locals <= index
@detected_locals = index + 1
end
super
end
|
#push_local_depth(depth, index) ⇒ Object
680
681
682
683
|
# File 'lib/rubinius/code/compiler/generator.rb', line 680
def push_local_depth(depth, index)
super
unwind
end
|
#push_modifiers ⇒ Object
385
386
387
|
# File 'lib/rubinius/code/compiler/generator.rb', line 385
def push_modifiers
@modstack << [@break, @redo, @next, @retry]
end
|
#push_proc ⇒ Object
685
686
687
688
|
# File 'lib/rubinius/code/compiler/generator.rb', line 685
def push_proc
super
unwind
end
|
#push_state(scope) ⇒ Object
377
378
379
|
# File 'lib/rubinius/code/compiler/generator.rb', line 377
def push_state(scope)
@state << AST::State.new(scope)
end
|
#r_load_literal(reg, literal) ⇒ Object
514
515
516
|
# File 'lib/rubinius/code/compiler/generator.rb', line 514
def r_load_literal(reg, literal)
super reg, find_literal(literal)
end
|
#raise_break ⇒ Object
690
691
692
693
|
# File 'lib/rubinius/code/compiler/generator.rb', line 690
def raise_break
super
unwind
end
|
#raise_exc ⇒ Object
695
696
697
698
|
# File 'lib/rubinius/code/compiler/generator.rb', line 695
def raise_exc
super
unwind
end
|
#raise_return ⇒ Object
700
701
702
703
|
# File 'lib/rubinius/code/compiler/generator.rb', line 700
def raise_return
super
unwind
end
|
#reraise ⇒ Object
705
706
707
708
|
# File 'lib/rubinius/code/compiler/generator.rb', line 705
def reraise
super
unwind
end
|
#ret ⇒ Object
594
595
596
|
# File 'lib/rubinius/code/compiler/generator.rb', line 594
def ret
super 0
end
|
#send(meth, count, priv = false) ⇒ Object
552
553
554
555
556
557
558
559
560
561
562
563
564
|
# File 'lib/rubinius/code/compiler/generator.rb', line 552
def send(meth, count, priv=false)
allow_private if priv
unless count.kind_of? Fixnum
raise CompileError, "count must be a number"
end
if count == 0
send_method meth
else
send_stack meth, count
end
end
|
#send_method(literal) ⇒ Object
710
711
712
713
|
# File 'lib/rubinius/code/compiler/generator.rb', line 710
def send_method(literal)
super
unwind
end
|
#send_primitive(name) ⇒ Object
449
450
451
|
# File 'lib/rubinius/code/compiler/generator.rb', line 449
def send_primitive(name)
@primitive = name
end
|
#send_stack(literal, count) ⇒ Object
715
716
717
718
|
# File 'lib/rubinius/code/compiler/generator.rb', line 715
def send_stack(literal, count)
super
unwind
end
|
#send_stack_with_block(literal, count) ⇒ Object
720
721
722
723
|
# File 'lib/rubinius/code/compiler/generator.rb', line 720
def send_stack_with_block(literal, count)
super
unwind
end
|
#send_stack_with_splat(literal, count) ⇒ Object
725
726
727
728
|
# File 'lib/rubinius/code/compiler/generator.rb', line 725
def send_stack_with_splat(literal, count)
super
unwind
end
|
#send_super(meth, args, splat = false) ⇒ Object
586
587
588
589
590
591
592
|
# File 'lib/rubinius/code/compiler/generator.rb', line 586
def send_super(meth, args, splat=false)
if splat
send_super_stack_with_splat meth, args
else
send_super_stack_with_block meth, args
end
end
|
#send_super_stack_with_block(literal, count) ⇒ Object
730
731
732
733
|
# File 'lib/rubinius/code/compiler/generator.rb', line 730
def send_super_stack_with_block(literal, count)
super
unwind
end
|
#send_super_stack_with_splat(literal, count) ⇒ Object
735
736
737
738
|
# File 'lib/rubinius/code/compiler/generator.rb', line 735
def send_super_stack_with_splat(literal, count)
super
unwind
end
|
#send_vcall(literal) ⇒ Object
740
741
742
743
|
# File 'lib/rubinius/code/compiler/generator.rb', line 740
def send_vcall(literal)
super
unwind
end
|
#send_with_block(meth, count, priv = false) ⇒ Object
566
567
568
569
570
571
572
573
574
|
# File 'lib/rubinius/code/compiler/generator.rb', line 566
def send_with_block(meth, count, priv=false)
allow_private if priv
unless count.kind_of? Fixnum
raise CompileError, "count must be a number"
end
send_stack_with_block meth, count
end
|
#send_with_splat(meth, args, priv = false, concat = false) ⇒ Object
576
577
578
579
580
581
582
583
584
|
# File 'lib/rubinius/code/compiler/generator.rb', line 576
def send_with_splat(meth, args, priv=false, concat=false)
val = 0
val |= Rubinius::InstructionSet::CALL_FLAG_CONCAT if concat
set_call_flags val unless val == 0
allow_private if priv
send_stack_with_splat meth, args
end
|
#set_arg(idx) ⇒ Object
533
534
535
536
|
# File 'lib/rubinius/code/compiler/generator.rb', line 533
def set_arg(idx)
set_local(idx)
@detected_args = @detected_locals
end
|
#set_ivar(literal) ⇒ Object
745
746
747
748
|
# File 'lib/rubinius/code/compiler/generator.rb', line 745
def set_ivar(literal)
super
unwind
end
|
#set_line(line) ⇒ Object
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
# File 'lib/rubinius/code/compiler/generator.rb', line 404
def set_line(line)
raise Exception, "source code line cannot be nil" unless line
if !@last_line
@lines << @ip
@lines << line
@last_line = line
elsif line != @last_line
if @lines[-2] == @ip
@lines[-1] = line
else
@lines << @ip
@lines << line
end
@last_line = line
end
end
|
#set_local(index) ⇒ Object
538
539
540
541
542
543
544
|
# File 'lib/rubinius/code/compiler/generator.rb', line 538
def set_local(index)
if @detected_locals <= index
@detected_locals = index + 1
end
super
end
|
#set_local_depth(depth, index) ⇒ Object
750
751
752
753
|
# File 'lib/rubinius/code/compiler/generator.rb', line 750
def set_local_depth(depth, index)
super
unwind
end
|
#state ⇒ Object
Commands (these don’t generate data in the stream)
373
374
375
|
# File 'lib/rubinius/code/compiler/generator.rb', line 373
def state
@state.last
end
|
#string_build(count) ⇒ Object
755
756
757
758
|
# File 'lib/rubinius/code/compiler/generator.rb', line 755
def string_build(count)
super
unwind
end
|
#string_dup ⇒ Object
760
761
762
763
|
# File 'lib/rubinius/code/compiler/generator.rb', line 760
def string_dup
super
unwind
end
|
#unwind ⇒ Object
765
766
767
|
# File 'lib/rubinius/code/compiler/generator.rb', line 765
def unwind
super 0
end
|
#use_detected ⇒ Object
357
358
359
360
361
362
363
364
365
366
367
368
369
|
# File 'lib/rubinius/code/compiler/generator.rb', line 357
def use_detected
if @required_args < @detected_args
@required_args = @detected_args
end
if @total_args < @detected_args
@total_args = @detected_args
end
if @local_count < @detected_locals
@local_count = @detected_locals
end
end
|
#yield_splat(count) ⇒ Object
769
770
771
772
|
# File 'lib/rubinius/code/compiler/generator.rb', line 769
def yield_splat(count)
super
unwind
end
|
#yield_stack(count) ⇒ Object
774
775
776
777
|
# File 'lib/rubinius/code/compiler/generator.rb', line 774
def yield_stack(count)
super
unwind
end
|
#zsuper(literal) ⇒ Object
779
780
781
782
|
# File 'lib/rubinius/code/compiler/generator.rb', line 779
def zsuper(literal)
super
unwind
end
|