[SCM] Lisaac compiler branch, living-external, updated. lisaac-0.12-548-gf6e3b14

Mildred Ki'Lya silkensedai at online.fr
Thu Oct 8 17:06:25 UTC 2009


The following commit has been merged in the living-external branch:
commit e9a661bc32ce6ff1c4b048fc371b61a4d2e390b8
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Thu Oct 8 16:34:59 2009 +0200

    Make External Slots always alive

diff --git a/src/profil_slot.li b/src/profil_slot.li
index 38a591e..da68bac 100644
--- a/src/profil_slot.li
+++ b/src/profil_slot.li
@@ -94,8 +94,7 @@ Section Public
     + result:FAST_ARRAY(WRITE);
     + tm:ITM_TYPE_MULTI;
     + ts:ITM_TYPE_MONO;
-    
-    PROFIL_LIST.add Self;
+    + call_list:FAST_ARRAY(EXPR);
     
     (s.id_section.is_external).if {
       name := s.name;
@@ -163,8 +162,24 @@ Section Public
       };
     };           
     //
-    result := write_argument call_lst;
-    //        
+    call_list := call_lst;
+    (call_list = NULL).if {
+      // Mildred: Is it really necesary to create arguments ?
+      //          It seems to work with call_list = NULL
+      call_list := FAST_ARRAY(EXPR).create_with_capacity (s.argument_count);
+      s.argument_list.foreach { arg:ITM_ARGUMENT;
+        arg.lower.to (arg.upper) do { i:INTEGER;
+          + ty:TYPE_FULL;
+          ty := arg.item i.to_run_for Self;
+          //call_list.add_last (ty.default_value position);
+          call_list.add_last (PROTOTYPE_CST.create position type ty);
+        };
+      };
+    };
+    result := write_argument call_list;
+
+    PROFIL_LIST.add Self;
+    
     slot_code.create_code is_first;       
     //
     result
@@ -173,6 +188,19 @@ Section Public
   //
   // Execute.
   //
+
+  - execute inline_lev:INTEGER <-
+  (
+    parent_profil.execute inline_lev;
+
+    // Mildred: TODO: Ugly hack
+    // Remove first item from argument_list so the Self parameter won't be
+    // generated for External and Interrupt slots. FIND A BETTER WAY
+    // If done in the make slot, crash (Call on NULL)
+    slot_code.id_section.is_external_or_interrupt.if {
+      argument_list.put NULL to 0;
+    };
+  );
   
   - remove_inline <-
   (
diff --git a/src/type/prototype.li b/src/type/prototype.li
index b92cbf8..3bd3e1e 100644
--- a/src/type/prototype.li
+++ b/src/type/prototype.li
@@ -237,6 +237,12 @@ Section Public
     + buf:STRING;
 
     //
+    // Make External slots alive
+    //
+
+    TYPE.load_external_slots;
+
+    //
     // Creation list execution.
     //    
     list_current := LIST.create position;
diff --git a/src/type/type.li b/src/type/type.li
index 3344fe9..72f6979 100644
--- a/src/type/type.li
+++ b/src/type/type.li
@@ -946,8 +946,36 @@ Section Public
     result
   );
   
+
+Section PROTOTYPE
+
+  - load_external_slots <-
+  (
+    set_external_slots_alive <-
+    (
+      ? { Self != TYPE };
+      (prototype != NULL).if {
+        prototype.slot_list.foreach_pair { (name:STRING_CONSTANT, itm:ITM_SLOT);
+          itm.id_section.is_external_or_interrupt.if {
+            + slot:SLOT_CODE;
+            slot ?= get_slot name;
+            (slot != NULL).if {
+              slot.set_alive (default.to_strict);
+            };
+          };
+        };
+      };
+    );
+
+    dico_type.foreach_value { typ:TYPE;
+      typ.set_external_slots_alive;
+    };
+  );
+
 Section TYPE
 
+  - set_external_slots_alive;
+
   - load_prototype n:STRING_CONSTANT generic_count gen_count:INTEGER :PROTOTYPE <-
   ( + j,idx_path,idx_name,idx_name_old,idx_path_old:INTEGER;
     + entry:POINTER; 
@@ -1115,6 +1143,8 @@ Section TYPE
     .when (ALIAS_STR.prototype_integer_64) or (ALIAS_STR.prototype_uinteger_64) then {
       size := 3; // 64 bits
     };
+
+    set_external_slots_alive;
   );
   
   - dico_name_to_prototype:HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT) := 
diff --git a/src/variable/slot_code.li b/src/variable/slot_code.li
index 056887f..6cdce20 100644
--- a/src/variable/slot_code.li
+++ b/src/variable/slot_code.li
@@ -37,6 +37,29 @@ Section Public
   - common_slot:SLOT <- parent_slot;
 
   + index:INTEGER;
+
+  - set_alive type_self:TYPE_FULL <-
+  [
+    -? { id_section.is_external_or_interrupt };
+    // if not in Section External or Section Interrupt, PROFIL_SLOT.force_alive
+    // won't be true and the slot might not stay alive forever
+  ]
+  ( + profil_slot :PROFIL_SLOT;
+
+    // If there is already a profile, the peofile will stay alive because
+    // PROFIL_SLOT.force_alive is already true.
+
+    (profil.count <= 0).if {
+      profil_slot := PROFIL_SLOT.clone;
+      profil.add_last profil_slot;
+      profil_slot.make Self with (type_self, NULL) verify TRUE;
+      PROFIL_LIST.set_immortal profil_slot;
+    } else {
+      profil.foreach { p:PROFIL_SLOT;
+        PROFIL_LIST.set_immortal p;
+      };
+    };
+  );
   
   //
   // Static and Dynamic profil.

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list