Class: CastOff::Compiler::SimpleIR::CallIR
- Inherits:
-
IR
- Object
- IR
- CastOff::Compiler::SimpleIR::CallIR
show all
- Includes:
- Instruction
- Defined in:
- lib/cast_off/compile/ir/call_ir.rb
Constant Summary
Constants included
from Instruction
Instruction::BlockSeparator, Instruction::BranchInstruction, Instruction::IgnoreInstruction, Instruction::JumpOrReturnInstruction, Instruction::SupportInstruction, Instruction::TypeInfoUser, Instruction::VM_CALL_ARGS_BLOCKARG_BIT, Instruction::VM_CALL_ARGS_SPLAT_BIT, Instruction::VM_CALL_FCALL_BIT, Instruction::VM_CALL_OPT_SEND_BIT, Instruction::VM_CALL_SUPER_BIT, Instruction::VM_CALL_TAILCALL_BIT, Instruction::VM_CALL_TAILRECURSION_BIT, Instruction::VM_CALL_VCALL_BIT
Instance Attribute Summary collapse
Attributes inherited from IR
#alias, #insn
Instance Method Summary
collapse
Methods included from Util
#bug, #dlog, #todo, #vlog
Methods inherited from IR
#add_sampling_variable, #alive, #alive?, #dispatch_method?, #generate_guard, #get_definition, #get_definition_str, #get_usage, #get_variable, #inlining_target?, #reset, #sampling_variable, #set_info, #standard_guard_target, #vanish, #vanish?
Constructor Details
#initialize(param, argc, return_value, insn, cfg) ⇒ CallIR
Returns a new instance of CallIR.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 11
def initialize(param, argc, return_value, insn, cfg)
super(insn, cfg)
@argc = argc
bug() unless return_value.is_a?(TmpVariable)
@return_value = return_value
bug() unless param.is_a?(Array)
bug() unless param.size == @argc
@param = param
@sampling_return_value = false
@values = [@return_value]
@variables = []
@variables_without_result = []
@variables << @return_value
@result_variable = @return_value
@source = @insn.source
@source = @source.empty? ? nil : @source
@source_line = @insn.line.to_s
end
|
Instance Attribute Details
#argc ⇒ Object
Returns the value of attribute argc.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def argc
@argc
end
|
#result_variable ⇒ Object
Returns the value of attribute result_variable.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def result_variable
@result_variable
end
|
#return_value ⇒ Object
Returns the value of attribute return_value.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def return_value
@return_value
end
|
#values ⇒ Object
Returns the value of attribute values.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def values
@values
end
|
#variables ⇒ Object
Returns the value of attribute variables.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def variables
@variables
end
|
#variables_without_result ⇒ Object
Returns the value of attribute variables_without_result.
9
10
11
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 9
def variables_without_result
@variables_without_result
end
|
Instance Method Details
#can_not_unbox ⇒ Object
44
45
46
47
48
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 44
def can_not_unbox()
params = param_variables()
params.each{|p| p.box()}
@return_value.box()
end
|
#harmless?(recv_p) ⇒ Boolean
89
90
91
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 89
def harmless?(recv_p)
bug("#{self}, #{self.class}")
end
|
#mark(defs) ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 101
def mark(defs)
param = param_irs()
if should_be_alive?
if !alive?
alive()
param.each{|p| p.alive()}
true
else
false
end
else
alive? ? param.inject(false){|change, p| p.alive() || change} : false
end
end
|
#param_irs ⇒ Object
63
64
65
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 63
def param_irs()
@param.dup()
end
|
#param_variables ⇒ Object
67
68
69
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 67
def param_variables()
@param.map{|p| p.param_value}
end
|
#propergate_boxed_value(defs) ⇒ Object
39
40
41
42
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 39
def propergate_boxed_value(defs)
false
end
|
#propergate_exact_class(defs) ⇒ Object
51
52
53
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 51
def propergate_exact_class(defs)
false
end
|
#propergate_guard_usage ⇒ Object
30
31
32
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 30
def propergate_guard_usage()
bug()
end
|
#sampling_return_value ⇒ Object
55
56
57
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 55
def sampling_return_value()
@sampling_return_value = true
end
|
#sampling_return_value? ⇒ Boolean
59
60
61
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 59
def sampling_return_value?
@sampling_return_value
end
|
#should_be_alive? ⇒ Boolean
97
98
99
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 97
def should_be_alive?
bug()
end
|
#side_effect? ⇒ Boolean
93
94
95
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 93
def side_effect?
bug()
end
|
#to_c(params) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 71
def to_c(params)
param = []
ret = []
@argc.times do
bug() if params.empty?
param.unshift(params.pop)
end
s = sampling_variable()
ret << s if s
bug() unless param_variables() == param
bug() unless @param.size() == @argc
ret.join("\n")
end
|
#type_propergation ⇒ Object
85
86
87
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 85
def type_propergation()
bug()
end
|
#unboxing_prelude ⇒ Object
35
36
37
|
# File 'lib/cast_off/compile/ir/call_ir.rb', line 35
def unboxing_prelude()
can_not_unbox()
end
|