if r != null then
icd.write "Result: {icd.register(r)}"
end
+ if std_slots_nb > 0 then
+ icd.write "StdSlots: {std_slots_nb}"
+ end
+ if tag_slots_nb > 0 then
+ icd.write "TagSlots: {tag_slots_nb}"
+ end
var closdecls = closure_decls
if closdecls != null then
for c in closdecls do
end
class ICodeDumper
+ readable var _dump_locations: Bool
+ readable var _dump_line_numbers: Bool
var _ids: HashMap[Object, String] = new HashMap[Object, String]
var _last_value: Int = 0
+ init(dump_locations: Bool, dump_line_numbers: Bool) do
+ _dump_locations = dump_locations
+ _dump_line_numbers = dump_line_numbers
+ end
+
# Return the name of e
# If e is unknown, a new name is gived
fun register(e: IRegister): String
return s
else
_last_value += 1
- var s = "REG{i}(r{_last_value})"
+ var s: String
+ if e.in_tag_slots then
+ s = "BREG{i}(r{_last_value})"
+ else if e.is_local then
+ s = "LREG{i}(r{_last_value})"
+ else
+ s = "REG{i}(r{_last_value})"
+ end
_ids[e] = s
return s
end
var _last_label: Int = 0
# Return the name of e
# If e is unknown, a new name is gived
- fun lab(e: ISeq): String
+ fun lab(e: IEscapeMark): String
do
if _ids.has_key(e) then
return _ids[e]
end
# Is the label e known? (because we goto to it)
- fun has_lab(e: ISeq): Bool
+ fun has_lab(e: IEscapeMark): Bool
do
return _ids.has_key(e)
end
print s
end
- var _indent_level: Int = 0
+ readable var _indent_level: Int = 0
# Indent the next writes
fun indent do _indent_level += 1
fun dump(icd: ICodeDumper)
do
var result = result
- var s = ""
- var l = location
- if l != null then
- s = " ... {l}"
+ var s_loc = ""
+ var s_line = ""
+ var loc = location
+ if loc != null and icd.dump_locations then
+ s_loc = " ... {loc}"
+ end
+ if icd.dump_line_numbers then
+ s_line = "{icd.line(self)}: "
end
if result == null then
- icd.write "{icd.line(self)}: {dump_intern(icd)}{s}"
+ icd.write "{s_line}{dump_intern(icd)}{s_loc}"
else
- icd.write "{icd.line(self)}: {icd.register(result)} := {dump_intern(icd)}{s}"
+ icd.write "{s_line}{icd.register(result)} := {dump_intern(icd)}{s_loc}"
end
end
for ic in icodes do
ic.dump(icd)
end
- if icd.has_lab(self) then icd.write("{icd.lab(self)}:")
+ var mark = iescape_mark
+ if mark != null and icd.has_lab(mark) then icd.write("{icd.lab(mark)}:")
end
end
end
icd.unindent
icd.write "}"
- if icd.has_lab(self) then icd.write("{icd.lab(self)}:")
+ var mark = iescape_mark
+ if mark != null and icd.has_lab(mark) then icd.write("{icd.lab(mark)}:")
end
end
redef class IEscape
redef fun dump_intern(icd)
do
- return "ESCAPE {icd.lab(seq)}"
+ return "ESCAPE {icd.lab(iescape_mark)}"
end
end
redef class INative
redef fun dump_intern(icd)
do
- if exprs.is_empty then
- return "NATIVE \"{code}\""
- else
- return "NATIVE \"{code}\"({icd.register_all(exprs)})"
- end
+ return "NATIVE \"{method.full_name}\"({icd.register_all(exprs)})"
+ end
+end
+
+redef class IIntValue
+ redef fun dump_intern(icd)
+ do
+ return "INTVALUE {value}"
+ end
+end
+
+redef class IBoolValue
+ redef fun dump_intern(icd)
+ do
+ return "BOOLVALUE {value}"
+ end
+end
+
+redef class IStringValue
+ redef fun dump_intern(icd)
+ do
+ return "STRINGVALUE {value}"
+ end
+end
+
+redef class ICharValue
+ redef fun dump_intern(icd)
+ do
+ return "CHARVALUE {value}"
+ end
+end
+
+redef class IFloatValue
+ redef fun dump_intern(icd)
+ do
+ return "FLOATVALUE {value}"
end
end