X-Git-Url: http://nitlanguage.org diff --git a/src/compiling/compiling_icode.nit b/src/compiling/compiling_icode.nit index aaa49f0..6287845 100644 --- a/src/compiling/compiling_icode.nit +++ b/src/compiling/compiling_icode.nit @@ -15,7 +15,7 @@ # limitations under the License. # Generate C code from intermediate code representation -package compiling_icode +module compiling_icode import icode private import analysis @@ -267,7 +267,9 @@ redef class IRoutine else p = cparams.join(", ") end - if human_name != null then v.add_decl("static const char * const LOCATE_{cname} = \"{human_name}\";") + if human_name != null then + v.add_instr("static const char LOCATE_{cname}[] = \"{human_name}\";") + end v.add_decl("{r} {cname}({p});") v.add_decl("typedef {r} (*{cname}_t)({p});") v.add_instr("{r} {cname}({p})\{") @@ -295,6 +297,7 @@ redef class IRoutine v.add_instr("fra.me.meth = LOCATE_{v.basecname};") v.add_instr("fra.me.has_broke = 0;") v.add_instr("fra.me.REG_size = {std_slots_nb};") + v.add_instr("fra.me.nitni_local_ref_head = NULL;") # Declare/initialize local variables for i in [0..std_slots_nb[ do @@ -868,6 +871,14 @@ redef class INative else if n == once "copy_to".to_symbol then s = "(void)memcpy(UNBOX_NativeString({regs[1]})+UNTAG_Int({regs[4]}), UNBOX_NativeString({regs[0]})+UNTAG_Int({regs[3]}), UNTAG_Int({regs[2]}));" end + else if c == once "Sys".to_symbol then + if n == once "force_garbage_collection".to_symbol then + s = "Nit_gc_force_garbage_collection()" + else if n == once "native_argc".to_symbol then + s = "TAG_Int(glob_argc)" + else if n == once "native_argv".to_symbol then + s = "BOX_NativeString(glob_argv[UNTAG_Int({regs[1]})])" + end else if n == once "object_id".to_symbol then s = "TAG_Int((bigint)((obj_t){regs[0]})[1].object_id)" else if n == once "sys".to_symbol then @@ -919,7 +930,7 @@ redef class IBoolValue v.add_location(location) var w = new_result(v) w.add("TAG_Bool(") - if value then w.add("true") else w.add("false") + if value then w.add("1") else w.add("0") w.add(")") end end