import icode
private class InlineMethodVisitor
-special ICodeVisitor
+ super ICodeVisitor
var _pass: Int = 0
var _icb: ICodeBuilder
- var _current_inlining: Array[IRoutine]
-
redef fun visit_icode(ic)
do
if ic isa ICall then
var m = ic.property
var ir = m.iroutine
if ir != null and ic.is_inlinable then
- if _current_inlining.has(ir) then
+ var icb = _icb
+ if icb.iroutine == ir then
# We cannot inline ir
# So, at least transform the call to a static one
current_icode.delete
current_icode.insert_before(icall)
current_icode.delete
else
- var icb = _icb
- _current_inlining.push(ir)
var seq = new ISeq
var old_seq = icb.seq
icb.seq = seq
current_icode.delete
icb.seq = old_seq
visit_icode(seq)
- _current_inlining.pop
end
end
end
init(m: MMModule, r: IRoutine)
do
- _current_inlining = [r]
_icb = new ICodeBuilder(m, r)
end
end
var mn = m.name
var cn = m.local_class.name
return (m.is_intern and cn != once ("Object".to_symbol)) or
+ (cn == (once ("Int".to_symbol)) and (mn == (once ("enumerate_to".to_symbol)) or mn == (once ("enumerate_before".to_symbol)))) or
(cn == (once ("Array".to_symbol)) and (mn == (once ("length".to_symbol)) or mn == (once ("[]".to_symbol)) or mn == (once ("iterate".to_symbol)))) or
(cn == (once ("AbstractArrayRead".to_symbol)) and (mn == (once ("length".to_symbol)) or mn == (once ("[]".to_symbol)))) or
(m.global.intro.local_class.name == (once ("Inline__".to_symbol)))