icode: add IStaticCall
[nit.git] / src / compiling / compiling_global.nit
index 2a686f2..20e74c3 100644 (file)
@@ -463,6 +463,7 @@ redef class MMModule
                        else
                                var mainm = sys.select_method(name)
                                v.add_instr("G_sys = NEW_Sys();")
+                               v.add_instr("register_static_object(&G_sys);")
                                v.add_instr("{mainm.cname}(G_sys);")
                        end
                end
@@ -997,9 +998,9 @@ redef class MMLocalClass
                                icb.stmt(inew)
                                var iargs = [iself]
                                iargs.add_all(iparams)
-                               icb.stmt(new INative("{p.cname}(@@@{", @@@"*iparams.length}, init_table)", iargs))
-                               icb.stmt(new INative("CHECKNEW_{name}(@@@)", [iself]))
 
+                               icb.stmt(new IStaticCall(p, iargs))
+                               icb.stmt(new INative("CHECKNEW_{name}(@@@)", [iself]))
                                var cname = "NEW_{self}_{p.global.intro.cname}"
                                var new_args = iroutine.compile_signature_to_c(v, cname, "new {self} {p.full_name}", null, null)
                                var ctx_old = v.ctx