[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-400-gd135667

Benoit Sonntag sonntag at icps.u-strasbg.fr
Tue Aug 18 00:57:21 UTC 2009


The following commit has been merged in the master branch:
commit d13566763676cd86e42daa9ac10bd4f936b4b4f4
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date:   Tue Aug 18 02:57:14 2009 +0200

    bootstrap ready

diff --git a/example/compile.sh b/example/compile.sh
index 3510f7b..9cd11f6 100755
--- a/example/compile.sh
+++ b/example/compile.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-for i in `find -name "*.li"` ; do cat $i | grep -q "main" && echo Compile $i && lisaac $i -O -q ; done
+for i in `find -name "*.li"` ; do cat $i | grep -q "main" && echo Compile $i && ../src2/lisaac $i ; done
diff --git a/lib2_os/unix/file_system/directory_unix.li~ b/lib2_os/unix/file_system/directory_unix.li~
old mode 100755
new mode 100644
index cacd50b..585c332
--- a/lib2_os/unix/file_system/directory_unix.li~
+++ b/lib2_os/unix/file_system/directory_unix.li~
@@ -52,14 +52,14 @@ Section Public
   //
       
   - open:BOOLEAN <-
-  ( + p,n:NATIVE_ARRAY[CHARACTER];
+  ( + p,n:NATIVE_ARRAY(CHARACTER);
     + dir,dirent:POINTER;
     + new_entry:ENTRY;
     + result:BOOLEAN;
     + i:INTEGER;
     
     (list = NULL).if {
-      list := LINKED_LIST[ENTRY].create;
+      list := LINKED_LIST(ENTRY).create;
     } else {
       list.clear;
     };
@@ -71,7 +71,7 @@ Section Public
 
 	dirent := `readdir(@dir)`:POINTER;
 	(dirent != NULL).if {
-	  n := `((struct dirent *)@dirent)->d_name`:NATIVE_ARRAY[CHARACTER];	
+	  n := `((struct dirent *)@dirent)->d_name`:NATIVE_ARRAY(CHARACTER);	
 	  string_tmp.clear;
 	  i := 0;
 	  {n.item i = '\0'}.until_do { 
@@ -101,7 +101,7 @@ Section Public
 Section DIRECTORY
   
   - physical_get_entry new_path:ABSTRACT_STRING :ENTRY <-
-  ( + pe:NATIVE_ARRAY[CHARACTER];
+  ( + pe:NATIVE_ARRAY(CHARACTER);
     + result:ENTRY;
         
     pe := new_path.to_external;
@@ -123,13 +123,13 @@ Section DIRECTORY
   );
   
   - physical_make_directory new_path:ABSTRACT_STRING :BOOLEAN <-
-  ( + pa:NATIVE_ARRAY[CHARACTER];
+  ( + pa:NATIVE_ARRAY(CHARACTER);
     pa := new_path.to_external;
     `mkdir(@pa,S_IRWXU)`:(INTEGER) = 0
   );
 
   - physical_make_file new_path:ABSTRACT_STRING :BOOLEAN <-
-  ( + pa:NATIVE_ARRAY[CHARACTER];
+  ( + pa:NATIVE_ARRAY(CHARACTER);
     + stream:POINTER;
     + result:BOOLEAN;
     
@@ -142,13 +142,13 @@ Section DIRECTORY
   );
 
   - physical_remove p:ABSTRACT_STRING :BOOLEAN <-
-  ( + pa:NATIVE_ARRAY[CHARACTER];
+  ( + pa:NATIVE_ARRAY(CHARACTER);
     pa := p.to_external;
     `remove(@pa)`:(INTEGER) = 0
   );
       
   - physical_move old_path:ABSTRACT_STRING to new_path:ABSTRACT_STRING :BOOLEAN <-
-  ( + old_p,new_p:NATIVE_ARRAY[CHARACTER];
+  ( + old_p,new_p:NATIVE_ARRAY(CHARACTER);
     old_p := old_path.to_external;
     new_p := new_path.to_external;
     `rename(@old_p, at new_p)`:(INTEGER) = 0
diff --git a/src2/aliaser_local.li b/src2/aliaser_local.li
index 256d2be..b7ba8f6 100644
--- a/src2/aliaser_local.li
+++ b/src2/aliaser_local.li
@@ -31,13 +31,21 @@ Section Inherit
 
   - parent_any:ANY := ANY;
   
-Section Private
-  
-  - free:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 128;
+Section ALIASER_LOCAL,LIST
   
   - free_context:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 64;
   
   - top_context:INTEGER;
+  
+  - var_size:FAST_ARRAY(FAST_ARRAY(LOCAL)) :=
+  ( + result:FAST_ARRAY(FAST_ARRAY(LOCAL));
+    
+    result := FAST_ARRAY(FAST_ARRAY(LOCAL)).create_with_capacity 4;
+    0.to 3 do { j:INTEGER;
+      result.add_last (FAST_ARRAY(LOCAL).create_with_capacity 32);
+    };
+    result
+  );
     
 Section Public
   
@@ -45,45 +53,35 @@ Section Public
   
   - reset <-
   (
-    free.clear;
+    (var_size.lower).to (var_size.upper) do { i:INTEGER;
+      var_size.item i.clear;
+    };
     free_context.clear;
     top_context := -1;
     current_list_level := 0;
   );
   
   - write wr:WRITE_LOCAL :STRING_CONSTANT <-
-  ( + tab:FAST_ARRAY(LOCAL);    
-    + t:TYPE_FULL;
-    + loc,loc2:LOCAL;
-    + j:INTEGER;
+  ( + loc,loc2:LOCAL;
     + result:STRING_CONSTANT;
     
     loc  := wr.local;
     (is_on).if {      
       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);
-          j := tab.lower;    
-          {(j <= tab.upper) && {tab.item j.type != t}}.while_do {
-            j := j + 1;
-          };
-          (j > tab.upper).if {
-            tab.add_last loc;
-          } else {          
-            tab.add loc to j;	
-          };
-          loc2 := loc;        
+        loc2 := search_alias loc;
+        (loc2 = loc).if {
+          add_var_size loc;
         } else {
-          loc2 := free.item j;
-          free.remove j;          
+          /*
+          loc.intern_name.print; "->".print;
+          loc2.intern_name.print; '='.print;
+          loc.ensure_count.print;
+          '\n'.print;
+          */
+          loc2.set_ensure_count (loc.ensure_count);
         };
-        loc.set_list_level current_list_level;
+        loc2.set_list_level current_list_level;        
         loc.set_my_alias loc2;
       };
       result := loc2.intern_name;
@@ -104,9 +102,14 @@ Section Public
     ((loc2 = NULL) || {! is_on}).if {
       result := loc.intern_name;
     } else {                  
-      ((loc.ensure_count = 0) && {current_list_level <= loc.list_level}).if {
-        free.add_last loc2;        
-      };
+      /*
+      "----> READ ".print;
+      loc.intern_name.print; "->".print;
+      loc2.intern_name.print; '='.print;
+      loc.ensure_count.print;
+      '\n'.print;
+      */
+      loc2.set_ensure_count (loc.ensure_count);      
       result := loc2.intern_name;
     };
     result
@@ -174,3 +177,42 @@ Section ALIASER_LOCAL, READ_LOCAL
       };
     };
   );
+  
+Section Private
+  
+  - search_alias v:LOCAL :LOCAL <-
+  ( + tab:FAST_ARRAY(LOCAL);
+    + j:INTEGER;
+    + t:TYPE_FULL;
+    + result:LOCAL;
+    + is_void:BOOLEAN;
+        
+    t := v.type;
+    is_void := (! t.is_expanded) && {! t.is_strict} && {! t.raw.is_block};
+    tab := var_size.item (v.type.size);
+    j := tab.lower;    
+    {
+      (j <= tab.upper) && 
+      {
+        (
+          (tab.item j.type != t) &&  
+          {
+            (! is_void) ||
+            {tab.item j.type.is_expanded} ||
+            {tab.item j.type.is_strict} ||
+            {tab.item j.type.raw.is_block}
+          }
+        ) || 
+        {tab.item j.ensure_count != 0} ||
+        {tab.item j.list_level < current_list_level}
+      }
+    }.while_do {
+      j := j + 1;
+    };
+    (j > tab.upper).if {
+      result := v;
+    } else {
+      result := tab.item j;
+    };
+    result
+  );
diff --git a/src2/any.li b/src2/any.li
index ed4ae2d..eb7ab0d 100644
--- a/src2/any.li
+++ b/src2/any.li
@@ -167,17 +167,7 @@ Section Public
   //
   // Output Buffer and service.
   //
-  
-  - var_size:FAST_ARRAY(FAST_ARRAY(LOCAL)) :=
-  ( + result:FAST_ARRAY(FAST_ARRAY(LOCAL));
-    
-    result := FAST_ARRAY(FAST_ARRAY(LOCAL)).create_with_capacity 4;
-    0.to 3 do { j:INTEGER;
-      result.add_last (FAST_ARRAY(LOCAL).create_with_capacity 32);
-    };
-    result
-  );
-    
+      
   - output_decl:STRING := STRING.create 60000;
   - output_glob:STRING := STRING.create 10000;
   - output_code:STRING := STRING.create 4000000;
diff --git a/src2/code_life/list.li b/src2/code_life/list.li
index 8276a1f..fee4f98 100644
--- a/src2/code_life/list.li
+++ b/src2/code_life/list.li
@@ -281,10 +281,10 @@ Section Public
     
     // Local.    
     string_tmp.clear;        
-    add_local (var_size.item 3) in string_tmp; // 64 bits
-    add_local (var_size.item 2) in string_tmp; // 32 bits
-    add_local (var_size.item 1) in string_tmp; // 16 bits
-    add_local (var_size.item 0) in string_tmp; //  8 bits
+    add_local (ALIASER_LOCAL.var_size.item 3) in string_tmp; // 64 bits
+    add_local (ALIASER_LOCAL.var_size.item 2) in string_tmp; // 32 bits
+    add_local (ALIASER_LOCAL.var_size.item 1) in string_tmp; // 16 bits
+    add_local (ALIASER_LOCAL.var_size.item 0) in string_tmp; //  8 bits
     buffer.insert_string string_tmp to pos_local;          
   );
   
@@ -334,14 +334,18 @@ Section Private
   ( + loc:LOCAL;
     + t:TYPE_FULL;
     + cur:INTEGER;
-    + i:INTEGER;
+    //+ i:INTEGER;
     
     (! tab.is_empty).if {
       (tab.lower).to (tab.upper) do { j:INTEGER;
 	loc := tab.item j;	
         loc.is_result.if_false {
-          local_counter := local_counter + 1;
-          
+          (loc.type.raw = TYPE_CONTEXT).if {
+            context_counter := context_counter + 1;
+          } else {
+            local_counter := local_counter + 1;
+          };
+          /*
           (
             (loc.ensure_count != 0) && 
             {profil_current != NULL} && 
@@ -363,7 +367,7 @@ Section Private
               
             };
           };
-          
+          */
           (((buf.count + loc.intern_name.count - cur) > 70) || {t != loc.type}).if {
             // New line
             (t != NULL).if {
@@ -381,11 +385,12 @@ Section Private
           buf.append (loc.intern_name);
         };
       };
-      buf.append ";\n";
-      tab.clear;
+      buf.append ";\n";     
     };
   );
   
 Section LISAAC
 
-  - local_counter:INTEGER;
\ No newline at end of file
+  - local_counter:INTEGER;
+  
+  - context_counter:INTEGER;
\ No newline at end of file
diff --git a/src2/code_life/switch.li b/src2/code_life/switch.li
index 3f375b6..0eed109 100644
--- a/src2/code_life/switch.li
+++ b/src2/code_life/switch.li
@@ -225,6 +225,10 @@ Section Public
 	list.first .set_code (list.second.code);
 	list.second.set_code lst;
       };
+      /*
+      seq_or_and := seq_or_and + 1;
+      seq_inline := seq_inline + 1;
+      */
       expr := expr.execute_link;      
       
       CALL_SLOT.reset_count_no_recursive;
@@ -248,6 +252,8 @@ Section Public
   // Genere.
   //
   
+  - bug_count:INTEGER;
+  
   - genere buffer:STRING <-
   ( + lst:LIST;
     + first_case:INTEGER;
@@ -255,8 +261,7 @@ Section Public
     + typ_id:TYPE_ID;
     + wrt:WRITE;
     + is_genered:BOOLEAN;
-    + rd:READ;
-    
+        
     (
       (list.first.id = TYPE_NULL) && 
       {debug_level_option = 0} && 
@@ -310,16 +315,17 @@ Section Public
     };
     (first_case <= list.upper).if {
       polymorphic_counter := polymorphic_counter + 1;            
+      /*
+      (is_genered).if {
+        buffer.append "printf(\"";
+        bug_count.append_in buffer;
+        buffer.append "\\n\");\n";
+        bug_count := bug_count + 1;
+      };
+      */
       buffer.append "switch (";      
       (is_genered).if {
-        //expr := expr.my_copy;
-         rd ?= expr;
-        (rd = NULL).if {
-          crash_with_message "SWITCH.genere ";
-        } else {
-          rd.variable.set_ensure_count (rd.variable.ensure_count + 1);
-        };
-        
+        expr := expr.my_copy;        
       };
       list.item first_case.id.put_access_id expr in buffer;
       buffer.append ") {\n";
diff --git a/src2/lip/lip_call.li b/src2/lip/lip_call.li
index a7bb0b3..12c52a3 100644
--- a/src2/lip/lip_call.li
+++ b/src2/lip/lip_call.li
@@ -170,7 +170,7 @@ Section Public
     
     entry := FILE_SYSTEM.get_entry path;         
     ((entry != NULL) && {entry.is_directory} && {entry.open}).if {
-      dir ?= entry;
+      dir ?= entry;           
       (dir.lower).to (dir.upper) do { j:INTEGER;
         entry := dir.item j;
         (entry.name.has_suffix ".li").if {
diff --git a/src2/lisaac.li b/src2/lisaac.li
index ce48016..c13f566 100644
--- a/src2/lisaac.li
+++ b/src2/lisaac.li
@@ -782,9 +782,12 @@ Section Public
 	STD_ERROR.put_integer (POSITION.nb_warning);
 	STD_ERROR.put_string " warning(s).\n";
       };
-      STD_ERROR.put_string " Local counter : ";
+      STD_ERROR.put_string " Local   counter : ";
       STD_ERROR.put_integer (LIST.local_counter);
       STD_ERROR.put_string "\n";
+      STD_ERROR.put_string " Context counter : ";
+      STD_ERROR.put_integer (LIST.context_counter);
+      STD_ERROR.put_string "\n";
     };
     
     (is_statistic).if {            

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list