end
redef class MMSrcLocalClass
- # The table element of the attribute position (for accessor simulation)
- readable attr _base_attr_pos: TableEltBaseAttrPos
-
# The table element of the subtype check
readable attr _class_color_pos: TableEltClassColorPos
clt.add(new TableEltSuperPos(p))
end
end
- if tc.attr_sim and not intro_attributes.is_empty then
- _base_attr_pos = new TableEltBaseAttrPos(self)
- clt.add(_base_attr_pos)
- else
- module_table.append(ilt)
- end
+ module_table.append(ilt)
module_table.append(clt)
end
end
if cte.length > 0 then
ctab.add(cte)
end
- if not cctx.attr_sim and ite.length > 0 then
+ if ite.length > 0 then
itab.add(ite)
end
end
cc.instance_table = scc.instance_table.to_a
append_to_table(ga, cc.instance_table, cc.instance_layout)
end
-
- if cctx.attr_sim then
- cc.instance_table = build_tables(ga, c, itab)
- for sc in c.cshe.greaters_and_self do
- var scc = ga.compiled_classes[sc.global]
- append_to_table(cc, cc.instance_table, scc.instance_layout)
- end
- end
end
return ga
if p.local_class == c then
if pg.intro == p then
if p isa MMAttribute then
- if v.tc.attr_sim then
- var bc = pg.local_class
- assert bc isa MMSrcLocalClass
- var s = bc.base_attr_pos.symbol
- v.add_decl("#define {pg.attr_access}(recv) ATTRS(recv, {s}, {pg.pos_of})")
- else
- v.add_decl("#define {pg.attr_access}(recv) ATTR(recv, {pg.color_id})")
- end
+ v.add_decl("#define {pg.attr_access}(recv) ATTR(recv, {pg.color_id})")
else if p isa MMMethod then
v.add_decl("#define {pg.meth_call}(recv) (({p.cname}_t)CALL((recv), {pg.color_id}))")
end
init(c) do super
end
-class TableEltBaseAttrPos
-special LocalTableElt
- attr _local_class: MMSrcLocalClass
- redef meth symbol do return "COLOR_{_local_class.module}_{_local_class.name}_BASEATTR"
- redef meth value(ga)
- do
- return "{ga.color(self)} /* BaseAttrPos of {_local_class} */"
- end
-
- redef meth compile_to_c(v, c)
- do
- var ga = v.global_analysis
- var cc = ga.compiled_classes[c.global]
- return "{cc.color(_local_class.instance_layout.first)} /* {ga.color(self)}: Base attribut offset of {_local_class.module}::{_local_class} in {c} */"
- end
-
- init(c: MMSrcLocalClass)
- do
- _local_class = c
- end
-end
-
class TableEltComposite
special TableElt
attr _table: Array[LocalTableElt]
readable attr _opt_output: OptionString = new OptionString("Output file", "-o", "--output")
readable attr _opt_boost: OptionBool = new OptionBool("Optimize compilation", "-O", "--boost")
readable attr _opt_no_cc: OptionBool = new OptionBool("Do not invoke C compiler", "--no_cc")
- readable attr _opt_attr_sim: OptionBool = new OptionBool("Use attribute simulation", "--attr-sim")
readable attr _opt_global: OptionBool = new OptionBool("Use global compilation", "--global")
readable attr _opt_clibdir: OptionString = new OptionString("NIT C library directory", "--clibdir")
readable attr _opt_bindir: OptionString = new OptionString("NIT tools directory", "--bindir")
init
do
super
- option_context.add_option(opt_output, opt_boost, opt_no_cc, opt_attr_sim, opt_global, opt_clibdir, opt_bindir, opt_compdir, opt_extension_prefix)
+ option_context.add_option(opt_output, opt_boost, opt_no_cc, opt_global, opt_clibdir, opt_bindir, opt_compdir, opt_extension_prefix)
end
redef meth process_options
no_cc = opt_no_cc.value
ext_prefix = opt_extension_prefix.value
if ext_prefix == null then ext_prefix = ""
- attr_sim = opt_attr_sim.value
global = opt_global.value
compdir = opt_compdir.value
if compdir == null then