X-Git-Url: http://nitlanguage.org diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 00f3f00..e13c735 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -26,20 +26,20 @@ redef class ToolContext # --no-inline-intern var opt_no_inline_intern = new OptionBool("Do not inline call to intern methods", "--no-inline-intern") # --no-union-attribute - var opt_no_union_attribute = new OptionBool("Put primitive attibutes in a box instead of an union", "--no-union-attribute") + var opt_no_union_attribute = new OptionBool("Put primitive attributes in a box instead of an union", "--no-union-attribute") # --no-shortcut-equate var opt_no_shortcut_equate = new OptionBool("Always call == in a polymorphic way", "--no-shortcut-equal") # --no-tag-primitives var opt_no_tag_primitives = new OptionBool("Use only boxes for primitive types", "--no-tag-primitives") # --colors-are-symbols - var opt_colors_are_symbols = new OptionBool("Store colors as symbols (link-boost)", "--colors-are-symbols") + var opt_colors_are_symbols = new OptionBool("Store colors as symbols instead of static data (link-boost)", "--colors-are-symbols") # --trampoline-call var opt_trampoline_call = new OptionBool("Use an indirection when calling", "--trampoline-call") # --guard-call var opt_guard_call = new OptionBool("Guard VFT calls with a direct call", "--guard-call") # --substitute-monomorph - var opt_substitute_monomorph = new OptionBool("Replace monomorph trampoline with direct call (link-boost)", "--substitute-monomorph") + var opt_substitute_monomorph = new OptionBool("Replace monomorphic trampolines with direct calls (link-boost)", "--substitute-monomorph") # --link-boost var opt_link_boost = new OptionBool("Enable all link-boost optimizations", "--link-boost") @@ -48,9 +48,9 @@ redef class ToolContext # --inline-some-methods var opt_inline_some_methods = new OptionBool("Allow the separate compiler to inline some methods (semi-global)", "--inline-some-methods") # --direct-call-monomorph - var opt_direct_call_monomorph = new OptionBool("Allow the separate compiler to direct call monomorph sites (semi-global)", "--direct-call-monomorph") + var opt_direct_call_monomorph = new OptionBool("Allow the separate compiler to direct call monomorphic sites (semi-global)", "--direct-call-monomorph") # --direct-call-monomorph0 - var opt_direct_call_monomorph0 = new OptionBool("Allow the separate compiler to direct call monomorph sites (semi-global)", "--direct-call-monomorph0") + var opt_direct_call_monomorph0 = new OptionBool("Allow the separate compiler to direct call monomorphic sites (semi-global)", "--direct-call-monomorph0") # --skip-dead-methods var opt_skip_dead_methods = new OptionBool("Do not compile dead methods (semi-global)", "--skip-dead-methods") # --semi-global @@ -60,7 +60,7 @@ redef class ToolContext # --tables-metrics var opt_tables_metrics = new OptionBool("Enable static size measuring of tables used for vft, typing and resolution", "--tables-metrics") # --type-poset - var opt_type_poset = new OptionBool("Build a poset of types to create more condensed tables.", "--type-poset") + var opt_type_poset = new OptionBool("Build a poset of types to create more condensed tables", "--type-poset") redef init do @@ -626,7 +626,7 @@ class SeparateCompiler for cd in mmodule.mclassdefs do for pd in cd.mpropdefs do if not pd isa MMethodDef then continue - if pd.msignature == null then continue # Skip broken method + if pd.mproperty.is_broken or pd.is_broken or pd.msignature == null then continue # Skip broken method var rta = runtime_type_analysis if modelbuilder.toolcontext.opt_skip_dead_methods.value and rta != null and not rta.live_methoddefs.has(pd) then continue #print "compile {pd} @ {cd} @ {mmodule}" @@ -814,6 +814,8 @@ class SeparateCompiler # In a true separate compiler (a with dynamic loading) you cannot do this unfortnally fun compile_class_to_c(mclass: MClass) do + if mclass.is_broken then return + var mtype = mclass.intro.bound_mtype var c_name = mclass.c_name @@ -843,6 +845,9 @@ class SeparateCompiler if rta != null and not rta.live_methoddefs.has(mpropdef) then v.add_decl("NULL, /* DEAD {mclass.intro_mmodule}:{mclass}:{mpropdef} */") continue + else if mpropdef.is_broken or mpropdef.msignature == null or mpropdef.mproperty.is_broken then + v.add_decl("NULL, /* DEAD (BROKEN) {mclass.intro_mmodule}:{mclass}:{mpropdef} */") + continue end var rf = mpropdef.virtual_runtime_function v.require_declaration(rf.c_name) @@ -1048,7 +1053,7 @@ class SeparateCompiler v.add_abort("type null") v.add("\}") v.add("if({t}->table_size < 0) \{") - v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);") + v.add("PRINT_ERROR(\"Instantiation of a dead type: %s\\n\", {t}->name);") v.add_abort("type dead") v.add("\}") end @@ -1169,8 +1174,9 @@ class SeparateCompilerVisitor args.first = self.autobox(args.first, m.mclassdef.mclass.mclass_type) end for i in [0..msignature.arity[ do - var t = msignature.mparameters[i].mtype - if i == msignature.vararg_rank then + var mp = msignature.mparameters[i] + var t = mp.mtype + if mp.is_vararg then t = args[i+1].mtype end args[i+1] = self.autobox(args[i+1], t) @@ -1184,8 +1190,9 @@ class SeparateCompilerVisitor args.first = self.unbox_extern(args.first, m.mclassdef.mclass.mclass_type) end for i in [0..msignature.arity[ do - var t = msignature.mparameters[i].mtype - if i == msignature.vararg_rank then + var mp = msignature.mparameters[i] + var t = mp.mtype + if mp.is_vararg then t = args[i+1].mtype end if m.is_extern then args[i+1] = self.unbox_extern(args[i+1], t) @@ -2241,8 +2248,9 @@ class SeparateRuntimeFunction var sig = new FlatBuffer sig.append("({called_recv.ctype} self") for i in [0..called_signature.arity[ do - var mtype = called_signature.mparameters[i].mtype - if i == called_signature.vararg_rank then + var mp = called_signature.mparameters[i] + var mtype = mp.mtype + if mp.is_vararg then mtype = mmethoddef.mclassdef.mmodule.array_type(mtype) end sig.append(", {mtype.ctype} p{i}") @@ -2277,8 +2285,9 @@ class SeparateRuntimeFunction comment.append("({selfvar}: {selfvar.mtype}") arguments.add(selfvar) for i in [0..msignature.arity[ do - var mtype = msignature.mparameters[i].mtype - if i == msignature.vararg_rank then + var mp = msignature.mparameters[i] + var mtype = mp.mtype + if mp.is_vararg then mtype = v.mmodule.array_type(mtype) end comment.append(", {mtype}")