# Collect types to colorize
var live_types = runtime_type_analysis.live_types
var live_cast_types = runtime_type_analysis.live_cast_types
- var mtypes = new HashSet[MType]
- mtypes.add_all(live_types)
- for c in self.box_kinds.keys do
- mtypes.add(c.mclass_type)
- end
# Compute colors
- var poset = poset_from_mtypes(mtypes, live_cast_types)
+ var poset = poset_from_mtypes(live_types, live_cast_types)
var colorer = new POSetColorer[MType]
colorer.colorize(poset)
type_ids = colorer.ids
type_tables = build_type_tables(poset)
# VT and FT are stored with other unresolved types in the big resolution_tables
- self.compile_resolution_tables(mtypes)
+ self.compute_resolution_tables(live_types)
return poset
end
return tables
end
- protected fun compile_resolution_tables(mtypes: Set[MType]) do
- # resolution_tables is used to perform a type resolution at runtime in O(1)
-
+ # resolution_tables is used to perform a type resolution at runtime in O(1)
+ private fun compute_resolution_tables(mtypes: Set[MType]) do
# During the visit of the body of classes, live_unresolved_types are collected
# and associated to
# Collect all live_unresolved_types (visited in the body of classes)
var res = self.new_var(mtype)
if compiler.runtime_type_analysis != null and not compiler.runtime_type_analysis.live_types.has(valtype) then
self.add("/*no autobox from {value.mtype} to {mtype}: {value.mtype} is not live! */")
- self.add("PRINT_ERROR(\"Dead code executed!\\n\"); show_backtrace(1);")
+ self.add("PRINT_ERROR(\"Dead code executed!\\n\"); fatal_exit(1);")
return res
end
self.require_declaration("BOX_{valtype.c_name}")
# Bad things will appen!
var res = self.new_var(mtype)
self.add("/* {res} left unintialized (cannot convert {value.mtype} to {mtype}) */")
- self.add("PRINT_ERROR(\"Cast error: Cannot cast %s to %s.\\n\", \"{value.mtype}\", \"{mtype}\"); show_backtrace(1);")
+ self.add("PRINT_ERROR(\"Cast error: Cannot cast %s to %s.\\n\", \"{value.mtype}\", \"{mtype}\"); fatal_exit(1);")
return res
end
end
var res = self.new_var(mtype)
if compiler.runtime_type_analysis != null and not compiler.runtime_type_analysis.live_types.has(value.mtype.as(MClassType)) then
self.add("/*no boxing of {value.mtype}: {value.mtype} is not live! */")
- self.add("PRINT_ERROR(\"Dead code executed!\\n\"); show_backtrace(1);")
+ self.add("PRINT_ERROR(\"Dead code executed!\\n\"); fatal_exit(1);")
return res
end
self.require_declaration("BOX_{valtype.c_name}")
self.add("count_type_test_resolved_{tag}++;")
end
else
- self.add("PRINT_ERROR(\"NOT YET IMPLEMENTED: type_test(%s, {mtype}).\\n\", \"{value.inspect}\"); show_backtrace(1);")
+ self.add("PRINT_ERROR(\"NOT YET IMPLEMENTED: type_test(%s, {mtype}).\\n\", \"{value.inspect}\"); fatal_exit(1);")
end
# check color is in table