[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-390-gdd201e7

Benoit Sonntag sonntag at icps.u-strasbg.fr
Tue Aug 11 03:55:26 UTC 2009


The following commit has been merged in the master branch:
commit dd201e733a6a7ebf28dffe2e66f2c06b6c4a68f2
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date:   Tue Aug 11 05:55:22 2009 +0200

    UNSTABLE ;-)

diff --git a/src2/aliaser_local.li b/src2/aliaser_local.li
index 3eb05f0..8c417c6 100644
--- a/src2/aliaser_local.li
+++ b/src2/aliaser_local.li
@@ -20,7 +20,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 Section Header
   
-  + name      := LOCAL_USE;
+  + name      := ALIASER_LOCAL;
 
   - copyright := "2003-2009 Sonntag Benoit";
 
@@ -33,53 +33,52 @@ Section Inherit
   
 Section Private
   
-  - free:FAST_ARRAY[LOCAL_USE] := FAST_ARRAY[LOCAL_USE].create_with_capacity 128;
-  
-  - list:FAST_ARRAY[LOCAL_USE] := FAST_ARRAY[LOCAL_USE].create_with_capacity 128;
-  
-  + local:LOCAL;
-  
-  + level:INTEGER;
-  
-  - is_free:BOOLEAN <-
-  (
+  - free:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 128;
     
-  );
+Section Public
   
-  - set_local loc:LOCAL <-
+  - reset <-
   (
-    local := loc;
-    level := current_list_level;
+    free.clear;
   );
   
-Section Public
-  
-  - write loc:LOCAL :STRING_CONSTANT <-
-  // True, if alias found.
-  [ -? {loc.my_alias = NULL}; ]
+  - write wr:WRITE_LOCAL :STRING_CONSTANT <-
   ( + tab:FAST_ARRAY(LOCAL);    
     + t:TYPE_FULL;
+    + loc,loc2:LOCAL;
+    + j:INTEGER;
     
-
-    (v.my_alias = NULL).if {
-      (ALIASER_LOCAL.new_alias v).if_false {              
-        t := v.type;
-        tab := var_size.item (v.type.size);
-        tab.add_last v;
+    loc  := wr.local;
+    loc2 := loc.my_alias;
+    (loc2 = NULL).if {
+      j := free.lower;
+      {(j <= free.upper) && {free.item j.type != loc.type}}.while_do {
+        j := j + 1;
       };
+      (j > free.upper).if {        
+        t := loc.type;
+        tab := var_size.item (loc.type.size);
+        tab.add_last loc;
+        loc2 := loc;        
+      } else {
+        loc2 := free.item j;
+        free.remove j;
+      };
+      loc.set_list_level current_list_level;
+      loc.set_my_alias loc2;
     };
-    v.my_alias.intern_name
+    loc2.intern_name
+  );
+
+  - read rd:READ_LOCAL :STRING_CONSTANT <-
+  ( + loc,loc2:LOCAL;
     
-    + elt:LOCAL_USE;
-    (free.is_empty).if {
-      elt := clone;
-    } else {
-      elt := free.last;
-      free.remove_last;
+    loc := rd.local;
+    loc.unread rd;
+    loc2 := loc.my_alias;
+    ((loc.ensure_count = 0) && {current_list_level <= loc.list_level}).if {
+      free.add_last loc2;
     };
-    elt.set_local loc;
-    list.add_last elt;
-  )
-  [ -? {loc.my_alias != NULL}; ];
-
-  - read loc:LOCAL :STRING_CONSTANT <-
+    loc2.intern_name
+  );
+  
\ No newline at end of file
diff --git a/src2/any.li b/src2/any.li
index 9df0bbc..ed4ae2d 100644
--- a/src2/any.li
+++ b/src2/any.li
@@ -146,7 +146,9 @@ Section Public
   - context_main:LOCAL;
   
   - list_current:LIST;
-    
+  
+  - current_list_level:INTEGER;
+  
   - stack_local:FAST_ARRAY(LOCAL)  := FAST_ARRAY(LOCAL).create_with_capacity 64;  
   
   - profil_slot:PROFIL_SLOT; // Principal slot.
diff --git a/src2/code_life/list.li b/src2/code_life/list.li
index 4d9fcb8..4a7ea9d 100644
--- a/src2/code_life/list.li
+++ b/src2/code_life/list.li
@@ -257,8 +257,12 @@ Section Public
     buffer.append "{\n";
     indent.append "  ";
     
+    current_list_level := current_list_level + 1;
+    
     genere_body buffer;
     
+    current_list_level := current_list_level - 1;
+    
     indent.remove_last 2;    
     buffer.append indent;
     buffer.add_last '}';
@@ -271,6 +275,8 @@ Section Public
     pos_local := buffer.count+1;
     stack_local.clear;
     
+    current_list_level := 0;
+    
     genere_body buffer;
     
     // Local.    
diff --git a/src2/code_life/push.li b/src2/code_life/push.li
index 0fc6ee3..fa0c469 100644
--- a/src2/code_life/push.li
+++ b/src2/code_life/push.li
@@ -122,10 +122,13 @@ Section Public
     
   - genere buffer:STRING <-
   ( + id:UINTEGER_32;
-    add_var_size context;
+    //+ idf:STRING_CONSTANT;
+    not_yet_implemented;    
     (is_first).if {      
+      //idf := ALIASER_LOCAL.write context;
       buffer.append "push_first(&";
     } else {
+      //idf := ALIASER_LOCAL.read context;
       buffer.append "push(&";
     };
     buffer.append (context.intern_name);
diff --git a/src2/code_life/read_local.li b/src2/code_life/read_local.li
index c394792..bfba3e8 100644
--- a/src2/code_life/read_local.li
+++ b/src2/code_life/read_local.li
@@ -82,19 +82,21 @@ Section Public
   //
     
   - genere buffer:STRING <-
-  ( + tb:PROFIL_BLOCK;
+  ( //+ tb:PROFIL_BLOCK;
     + idf:STRING_CONSTANT;
     
-    idf := ALIASER_LOCAL.read local;
+    idf := ALIASER_LOCAL.read Self;
     (variable.ensure_count = -1).if {
       buffer.add_last '*';
     };
     buffer.append idf;
     //
+    /*
     tb ?= local.type.raw;    
     (tb != NULL).if {
       add_var_size local;
     };
+    */
   );
   
 
diff --git a/src2/code_life/write_local.li b/src2/code_life/write_local.li
index 184c58e..7818690 100644
--- a/src2/code_life/write_local.li
+++ b/src2/code_life/write_local.li
@@ -105,7 +105,7 @@ Section Public
   - genere buffer:STRING <-
   ( + idf:STRING_CONSTANT;
     
-    idf := ALIASER_LOCAL.write local;        
+    idf := ALIASER_LOCAL.write Self;        
     (quiet_generation).if_false {
       (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
         buffer.add_last '*';
@@ -124,7 +124,7 @@ Section Public
   - genere_first_result buffer:STRING <-
   ( + idf:STRING_CONSTANT;
     
-    idf := ALIASER_LOCAL.write local;        
+    idf := ALIASER_LOCAL.write Self;        
     (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
       buffer.add_last '*';
     };
@@ -136,7 +136,7 @@ Section Public
   - genere_argument_result buffer:STRING <-
   ( + idf:STRING_CONSTANT;
     
-    idf := ALIASER_LOCAL.write local;
+    idf := ALIASER_LOCAL.write Self;
     buffer.add_last '&';
     buffer.append idf; 
   );
diff --git a/src2/variable/local.li b/src2/variable/local.li
index ef2dd3d..886fd74 100644
--- a/src2/variable/local.li
+++ b/src2/variable/local.li
@@ -81,6 +81,13 @@ Section Public
   (
     my_alias := new_loc;
   );
+  
+  + list_level:INTEGER;
+  
+  - set_list_level lev:INTEGER <-
+  (
+    list_level := lev;
+  );
     
   - write p:POSITION with r:EXPR value val:EXPR :WRITE <-
   ( + result:WRITE;

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list