rta: store real types in live_cast_type
[nit.git] / src / separate_compiler.nit
index 666dfd4..981c0d8 100644 (file)
@@ -18,6 +18,8 @@ module separate_compiler
 import abstract_compiler
 import layout_builders
 import rapid_type_analysis
+import collect_super_sends
+import compiler_ffi
 
 # Add separate compiler specific options
 redef class ToolContext
@@ -270,7 +272,12 @@ class SeparateCompiler
                end
 
                # lookup super calls and add it to the list of mmethods to build layout with
-               var super_calls = runtime_type_analysis.live_super_sends
+               var super_calls
+               if runtime_type_analysis != null then
+                       super_calls = runtime_type_analysis.live_super_sends
+               else
+                       super_calls = modelbuilder.collect_super_sends
+               end
                for mmethoddef in super_calls do
                        var mclass = mmethoddef.mclassdef.mclass
                        mmethods[mclass].add(mmethoddef)
@@ -888,6 +895,17 @@ class SeparateCompiler
                end
                print "\t{total}\t{holes}"
        end
+
+       redef fun compile_nitni_structs
+       do
+               self.header.add_decl("struct nitni_instance \{struct instance *value;\};")
+       end
+       
+       redef fun finalize_ffi_for_module(nmodule)
+       do
+               self.mainmodule = nmodule.mmodule.as(not null)
+               super
+       end
 end
 
 # A visitor on the AST of property definition that generate the C code of a separate compilation process.
@@ -930,6 +948,8 @@ class SeparateCompilerVisitor
                        end
                        self.add("{res} = BOX_{valtype.c_name}({value}); /* autobox from {value.mtype} to {mtype} */")
                        return res
+               else if value.mtype.cname_blind == "void*" and mtype.cname_blind == "void*" then
+                       return value
                else
                        # Bad things will appen!
                        var res = self.new_var(mtype)