X-Git-Url: http://nitlanguage.org diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 085a36d..e07f125 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -252,7 +252,7 @@ class SeparateCompiler do # Collect all bas box class # FIXME: this is not completely fine with a separate compilation scheme - for classname in ["Int", "Bool", "Char", "Float", "NativeString", "Pointer"] do + for classname in ["Int", "Bool", "Byte", "Char", "Float", "NativeString", "Pointer"] do var classes = self.mainmodule.model.get_mclasses_by_name(classname) if classes == null then continue assert classes.length == 1 else print classes.join(", ") @@ -625,6 +625,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 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}" @@ -768,7 +769,8 @@ class SeparateCompiler end v.add_decl("\},") else - v.add_decl("0, \{\}, /*DEAD TYPE*/") + # Use -1 to indicate dead type, the info is used by --hardening + v.add_decl("-1, \{\}, /*DEAD TYPE*/") end v.add_decl("\};") end @@ -1036,7 +1038,7 @@ class SeparateCompiler v.add("if({t} == NULL) \{") v.add_abort("type null") v.add("\}") - v.add("if({t}->table_size == 0) \{") + v.add("if({t}->table_size < 0) \{") v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);") v.add_abort("type dead") v.add("\}") @@ -1192,7 +1194,7 @@ class SeparateCompilerVisitor if mtype.name == "Int" then return self.new_expr("(long)({value})>>2", mtype) else if mtype.name == "Char" then - return self.new_expr("(char)((long)({value})>>2)", mtype) + return self.new_expr("(uint32_t)((long)({value})>>2)", mtype) else if mtype.name == "Bool" then return self.new_expr("(short int)((long)({value})>>2)", mtype) else