[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-399-g1e8a97a

Benoit Sonntag sonntag at icps.u-strasbg.fr
Mon Aug 17 05:10:30 UTC 2009


The following commit has been merged in the master branch:
commit 002d2261300e859a128da7f494b19c1831c26fe9
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date:   Mon Aug 17 07:09:29 2009 +0200

    4 bugs OFF cp lisaac lisaac_goodcp lisaac lisaac_good

diff --git a/make.lip b/make.lip
index f19301d..9f0efc2 100644
--- a/make.lip
+++ b/make.lip
@@ -32,7 +32,7 @@ Section Private
   + input_file:STRING;  // is input file name value without extension (auto-loading, if possible).
     
   // Debug information.
-  + debug_level:INTEGER := 15;
+  + debug_level:INTEGER := 0; //15;
   + debug_with_code:BOOLEAN := TRUE; 
   + is_all_warning:BOOLEAN;
     
diff --git a/src2/aliaser_local.li b/src2/aliaser_local.li
index 33b144e..256d2be 100644
--- a/src2/aliaser_local.li
+++ b/src2/aliaser_local.li
@@ -36,6 +36,8 @@ Section Private
   - free:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 128;
   
   - free_context:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 64;
+  
+  - top_context:INTEGER;
     
 Section Public
   
@@ -45,6 +47,7 @@ Section Public
   (
     free.clear;
     free_context.clear;
+    top_context := -1;
     current_list_level := 0;
   );
   
@@ -78,11 +81,7 @@ Section Public
           loc2 := loc;        
         } else {
           loc2 := free.item j;
-          free.remove j;
-          /*
-          loc.intern_name.print; " -> ".print;
-          loc2.intern_name.print; '\n'.print;
-          */
+          free.remove j;          
         };
         loc.set_list_level current_list_level;
         loc.set_my_alias loc2;
@@ -114,52 +113,35 @@ Section Public
   );
   
   - push p:PUSH :STRING_CONSTANT <-
-  ( + tab:FAST_ARRAY(LOCAL);    
-    + t:TYPE_FULL;
-    + loc,loc2:LOCAL;
-    + j:INTEGER;
+  ( + loc,loc2:LOCAL;    
     + result:STRING_CONSTANT;
     
     loc  := p.context;
     (is_on).if {      
-      (loc.my_alias = NULL).if {  // BSBS: .is_first devrait marcher => pb!!!
-        j := free_context.lower;
-        {
-          (j <= free_context.upper) && 
-          {free_context.item j.list_level <= current_list_level}
-        }.while_do {
-          j := j + 1;
-        };
-        (j > free_context.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;        
-          free_context.add_last loc;          
-        } else {
-          loc2 := free_context.item j;                    
-        };
-        loc2.set_list_level current_list_level;
+      (p.is_first).if {  
+        top_context := top_context + 1;
+        (top_context <= free_context.upper).if {          
+          loc2 := free_context.item top_context;
+        } else {          
+          free_context.add_last loc;
+          loc2 := loc;
+          add_var_size loc;
+        };  
         loc.set_my_alias loc2;
+        loc.set_list_level top_context;        
+      } else {
+        top_context := loc.list_level;
       };
       result := loc.my_alias.intern_name;
     } else {
-      //(p.is_first).if {  // BSBS: SUPER LOUCHE !
+      (p.is_first).if {  
         add_var_size loc;
-      //};
+      };
       result := loc.intern_name;
     };
     result
   );
-  
+    
 Section ALIASER_LOCAL, READ_LOCAL
   
   - add_var_size v:LOCAL <-
diff --git a/src2/avoir.txt b/src2/avoir.txt
index 7b0beb5..e69de29 100644
--- a/src2/avoir.txt
+++ b/src2/avoir.txt
@@ -1,25 +0,0 @@
-__tmp__5SK -> __tmp__1SK
-__tmp__NG -> __tmp__3SK
-__tmp__CSK -> __tmp__2SK
-__tmp__TV -> __tmp__1SK
-__tmp__IW -> __tmp__2SK
-__tmp__END -> __tmp__1SK
-result__QYD -> __tmp__2SK
-__tmp__AZD -> __tmp__1SK
-__tmp__PWB -> __tmp__LSK
-__tmp__4T -> __tmp__3SK
-__tmp__BU -> __tmp__LSK
-idx__HPE -> __tmp__3SK
-Self__ULF -> __tmp__DRE
-__tmp__VMF -> __tmp__MR
-siz__XLF -> __tmp__LSK
-idx__OK -> __tmp__TC
-__tmp__40 -> __tmp__A2J
-__tmp__P2J -> __tmp__A2J
-__tmp__G2 -> __tmp__A1
-Result__WZ -> __tmp__A2J
-__tmp__ZAD -> new_mem__EIE
-Self__1RK -> __tmp__BJB
-Self__BTK -> __tmp__BJB
-__tmp__4JB -> __tmp__BJB
-run `gcc knight.c -o knight -lm -lX11 ' OK
diff --git a/src2/code_life/call_slot.li b/src2/code_life/call_slot.li
index acd672f..6b682ca 100644
--- a/src2/code_life/call_slot.li
+++ b/src2/code_life/call_slot.li
@@ -518,6 +518,7 @@ Section Private
     + new_val:EXPR;
     + new_wrt:INSTR;
     + result:LOOP;
+    + push:PUSH;
     
     result := LOOP.create position name (profil.name) body source;
     
@@ -552,12 +553,9 @@ Section Private
     };
         
     (debug_level_option != 0).if {      
-      ? { + push:PUSH;      
-	push ?= source.first;
-	(push != NULL) && {push.is_first}
-      };
-      list_current.insert (source.first) to (list_current.index);      
-      source.put NOP to (source.lower);
+      push ?= source.first;
+      list_current.insert (push.my_copy) to (list_current.index);      
+      push.set_first FALSE;
     };
     
     // Extract Switch/body:
diff --git a/src2/code_life/list.li b/src2/code_life/list.li
index dd8d14b..8276a1f 100644
--- a/src2/code_life/list.li
+++ b/src2/code_life/list.li
@@ -342,7 +342,11 @@ Section Private
         loc.is_result.if_false {
           local_counter := local_counter + 1;
           
-          (loc.ensure_count != 0).if {
+          (
+            (loc.ensure_count != 0) && 
+            {profil_current != NULL} && 
+            {loc.type.raw != TYPE_CONTEXT}
+          ).if {            
             i := profil_current.result_list.lower;
             {
               (i <= profil_current.result_list.upper) && 
diff --git a/src2/code_life/push.li b/src2/code_life/push.li
index 19ccfc1..1621cd4 100644
--- a/src2/code_life/push.li
+++ b/src2/code_life/push.li
@@ -123,7 +123,7 @@ Section Public
   - genere buffer:STRING <-
   ( + id:UINTEGER_32;
     + idf:STRING_CONSTANT;
-    
+        
     idf := ALIASER_LOCAL.push Self; 
     (is_first).if {      
       buffer.append "push_first(&";
@@ -146,7 +146,6 @@ Section Public
     position.line.append_in buffer;
     buffer.add_last ' ';
     buffer.append (position.prototype.name);    
-    
   );
 
   //
diff --git a/src2/code_life/switch.li b/src2/code_life/switch.li
index c2ede6f..3f375b6 100644
--- a/src2/code_life/switch.li
+++ b/src2/code_life/switch.li
@@ -278,7 +278,7 @@ Section Public
         is_genered := TRUE;
         buffer.append ".__id==0";
       } else {        
-        typ_first.put_access_id expr in buffer;      
+        typ_first.put_access_id expr in buffer;        
         is_genered := TRUE;
         (expr.static_type.raw != type_boolean).if {
           buffer.append "==";
@@ -312,12 +312,14 @@ Section Public
       polymorphic_counter := polymorphic_counter + 1;            
       buffer.append "switch (";      
       (is_genered).if {
-        rd ?= expr;
+        //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);
         };
+        
       };
       list.item first_case.id.put_access_id expr in buffer;
       buffer.append ") {\n";
diff --git a/src2/dispatcher/dta.li b/src2/dispatcher/dta.li
index 763956c..f81870a 100644
--- a/src2/dispatcher/dta.li
+++ b/src2/dispatcher/dta.li
@@ -68,7 +68,7 @@ Section NODE_TYPE, DTA
         
     result := LIST.create (e.position);
     (t = TYPE_NULL).if {                  
-      TYPE_NULL.product_error position in result;            
+      TYPE_NULL.product_error position in result with context;            
       ? {result.count != 0};
     } else {
       lookup t with e in result;
diff --git a/src2/dispatcher/dta_block.li b/src2/dispatcher/dta_block.li
index 1120f76..e859c0b 100644
--- a/src2/dispatcher/dta_block.li
+++ b/src2/dispatcher/dta_block.li
@@ -105,7 +105,7 @@ Section NODE_TYPE, DTA
     
     result := LIST.create (e.position);
     (t = TYPE_NULL).if {                 
-      TYPE_NULL.product_error (e.position) in result;
+      TYPE_NULL.product_error (e.position) in result with context;
     } else {            
       t_block ?= t;                  
       
diff --git a/src2/dispatcher/dta_cast.li b/src2/dispatcher/dta_cast.li
index d07ce0b..8b90866 100644
--- a/src2/dispatcher/dta_cast.li
+++ b/src2/dispatcher/dta_cast.li
@@ -51,6 +51,11 @@ Section Public
   - make p:POSITION type t:TYPE_FULL <-
   (
     result_expr := t.get_temporary_expr p;
+    (profil_current = NULL).if {
+      context := context_main;
+    } else {
+      context := profil_current.context;
+    };
   );
 
   //
diff --git a/src2/dispatcher/dta_wr_code.li b/src2/dispatcher/dta_wr_code.li
index ef80ef9..c7c30cf 100644
--- a/src2/dispatcher/dta_wr_code.li
+++ b/src2/dispatcher/dta_wr_code.li
@@ -57,6 +57,11 @@ Section Public
     self_arg    := arg;
     result_expr := PROTOTYPE_CST.create (v.position) type (TYPE_VOID.default);
     code        := v;
+    (profil_current = NULL).if {
+      context := context_main;
+    } else {
+      context := profil_current.context;
+    };
   );
 
   //
diff --git a/src2/dispatcher/dta_wr_value.li b/src2/dispatcher/dta_wr_value.li
index 106916a..7914764 100644
--- a/src2/dispatcher/dta_wr_value.li
+++ b/src2/dispatcher/dta_wr_value.li
@@ -59,6 +59,11 @@ Section Public
     self_arg    := arg;
     result_expr := v.my_copy; 
     value       := v;
+    (profil_current = NULL).if {
+      context := context_main;
+    } else {
+      context := profil_current.context;
+    };
   );
 
   //
@@ -90,7 +95,7 @@ Section NODE_TYPE, DTA
     
     result := LIST.create (e.position);
     (t = TYPE_NULL).if {
-      TYPE_NULL.product_error position in result;
+      TYPE_NULL.product_error position in result with context;
     } else {
       lookup t with e in result;
     };
diff --git a/src2/dispatcher/node_style.li b/src2/dispatcher/node_style.li
index 485344d..56f6857 100644
--- a/src2/dispatcher/node_style.li
+++ b/src2/dispatcher/node_style.li
@@ -230,11 +230,15 @@ Section Private
       //      
       (debug_level_option != 0).if {	        
         // BSBS: Poser le PUSH avant le NODE
-	(data.context = NULL).if {
-	  ctext := context_main;
-	} else {
-	  ctext := data.context;
-	};
+	//(data.context = NULL).if {
+	//  ctext := context_main;
+        //} else {
+        (data.context = NULL).if {
+          crash_with_message "NODE_STYLE : data.context = NULL!\n";
+        };
+        
+        ctext := data.context;
+	//};
 	result.add_last (
 	  PUSH.create position context ctext first FALSE
         );     
diff --git a/src2/external/comparison/expr_equal.li b/src2/external/comparison/expr_equal.li
index aa54cad..03d2fba 100644
--- a/src2/external/comparison/expr_equal.li
+++ b/src2/external/comparison/expr_equal.li
@@ -72,6 +72,8 @@ Section Public
 	{left.static_type.is_expanded}  &&
 	{left.static_type.raw != type_pointer}
       ).if {
+        left .remove;
+        right.remove;
 	result := PROTOTYPE_CST.create position type (type_false.default);
       };
     };
diff --git a/src2/external/comparison/expr_not_equal.li b/src2/external/comparison/expr_not_equal.li
index b221b3d..69f42cd 100644
--- a/src2/external/comparison/expr_not_equal.li
+++ b/src2/external/comparison/expr_not_equal.li
@@ -73,6 +73,8 @@ Section Public
 	{left.static_type.is_expanded}  &&
 	{left.static_type.raw != type_pointer}
       ).if {
+        left .remove;
+        right.remove;
 	result := PROTOTYPE_CST.create position type (type_true.default);	
       };
     };    
diff --git a/src2/external/get_type_id.li b/src2/external/get_type_id.li
index 5270651..6ce0975 100644
--- a/src2/external/get_type_id.li
+++ b/src2/external/get_type_id.li
@@ -36,7 +36,7 @@ Section Public
   
   - is_invariant:BOOLEAN <- TRUE;
   
-  + receiver:EXPR;
+  + receiver:TYPE_FULL;
     
   - static_type:TYPE_FULL <- type_integer.default;
   
@@ -49,7 +49,7 @@ Section Public
   // Creation.
   //
   
-  - create p:POSITION receiver e:EXPR :SELF <-
+  - create p:POSITION receiver e:TYPE_FULL :SELF <-
   ( + result:SELF;
     
     result := clone;
@@ -57,13 +57,14 @@ Section Public
     result
   );
   
-  - make p:POSITION receiver e:EXPR <-
+  - make p:POSITION receiver e:TYPE_FULL <-
   (
     position := p;            
     receiver := e; 
   );
   
-  - my_copy:SELF <- SELF.create position receiver (receiver.my_copy);
+  - my_copy:SELF <- SELF.create position receiver receiver;
+  // BSBS: Tu peux renvoyer Self ! Non ?
   
   //
   // Remove
@@ -71,7 +72,7 @@ Section Public
   
   - remove <-
   (
-    receiver.remove;
+    // Nothing.
   );
   
   //
@@ -80,13 +81,11 @@ Section Public
   
   - execute_unlink:INSTR <-
   (     
-    remove;
     NULL
   );
   
   - execute_link:EXPR <-
-  (         
-    receiver := receiver.execute_link;
+  (          
     Self
   );
     
@@ -96,11 +95,11 @@ Section Public
   
   - genere buffer:STRING <-
   (
-    (receiver.static_type.is_late_binding).if {
+    (receiver.is_late_binding).if {
       buffer.append "-1";
     } else {
       buffer.append (ALIAS_STR.separate);
-      buffer.append (receiver.static_type.raw.intern_name);
+      buffer.append (receiver.raw.intern_name);
       buffer.append (ALIAS_STR.separate); // <=> "__";
     };
   );
diff --git a/src2/external/size_of.li b/src2/external/size_of.li
index 1ba36c8..f875ef8 100644
--- a/src2/external/size_of.li
+++ b/src2/external/size_of.li
@@ -36,7 +36,7 @@ Section Public
   
   - is_invariant:BOOLEAN <- TRUE;  
   
-  + receiver:EXPR;
+  + receiver:TYPE_FULL;
     
   - static_type:TYPE_FULL <- type_integer.default;
   
@@ -49,7 +49,7 @@ Section Public
   // Creation.
   //
   
-  - create p:POSITION receiver e:EXPR :SELF <-
+  - create p:POSITION receiver e:TYPE_FULL :SELF <-
   ( + result:SELF;
     
     result := clone;
@@ -57,13 +57,14 @@ Section Public
     result
   );
   
-  - make p:POSITION receiver e:EXPR <-
+  - make p:POSITION receiver e:TYPE_FULL <-
   (
     position := p;            
     receiver := e; 
   );
   
-  - my_copy:SELF <- SELF.create position receiver (receiver.my_copy);
+  - my_copy:SELF <- SELF.create position receiver receiver; 
+  // BSBS: Tu peux meme juste renvoyer Self! Non ?
   
   //
   // Remove
@@ -71,7 +72,7 @@ Section Public
   
   - remove <-
   (
-    receiver.remove;
+    // Nothing.
   );
   
   //
@@ -80,12 +81,11 @@ Section Public
   
   - execute_unlink:INSTR <-
   (     
-    receiver.execute_unlink
+    NULL
   );
   
   - execute_link:EXPR <-
-  (   
-    receiver := receiver.execute_link;
+  (       
     Self
   );
     
@@ -94,11 +94,10 @@ Section Public
   //
   
   - genere buffer:STRING <-
-  ( + t:TYPE_FULL;
-    buffer.append "sizeof(";
-    t := receiver.static_type;
-    t.raw.put_expanded_declaration buffer;
-    buffer.add_last ')';    
+  ( 
+    buffer.append "sizeof(";    
+    receiver.raw.put_expanded_declaration buffer;
+    buffer.add_last ')';        
   );
   
   //
diff --git a/src2/item/itm_external.li b/src2/item/itm_external.li
index dcf1bd5..7437cbc 100644
--- a/src2/item/itm_external.li
+++ b/src2/item/itm_external.li
@@ -73,9 +73,9 @@ Section Public
 	exp1 := profil_slot.argument_list.first.read position;
 	result := IS_EXPANDED.create position receiver exp1;
       }
-      .when 1 then { // type_id_intern:INTEGER
-	exp1 := profil_slot.argument_list.first.read position;
-	result := GET_TYPE_ID.create position receiver exp1;
+      .when 1 then { // type_id_intern:INTEGER	
+        result := GET_TYPE_ID.create position receiver
+        (profil_slot.argument_list.first.type);
       }
       .when 2 then { // INTEGER > INTEGER -> BOOLEAN.
 	left   := profil_slot.argument_list.first .read position;
@@ -127,8 +127,8 @@ Section Public
 	result := INTEGER_CST.create position value debug_level_option type (type_integer.default);
       }
       .when 12 then { // object_size -> INTEGER.	
-	exp1 := profil_slot.argument_list.first.read position;
-	result := SIZE_OF.create position receiver exp1;
+        result := SIZE_OF.create position receiver 
+        (profil_slot.argument_list.first.type);
       }
       .when 13 then { // CONVERT SRC TO DST.on src:SRC :DST.
         type := profil_slot.result_list.first.type;        
diff --git a/src2/shorter.li b/src2/shorter.li
index 963d7c1..22e5aa8 100644
--- a/src2/shorter.li
+++ b/src2/shorter.li
@@ -26,11 +26,11 @@ Section Header
 
   
   - bibliography:= "http://IsaacOS.com";
-  - author      := "Matthieu Brehier, Sonntag Benoit (bsonntag at loria.fr)";
+  - author      := "Sonntag Benoit (bsonntag at loria.fr)";
   - comment     := "Shorter source code.";
   
   - external := `#include "path.h"`;
-  
+    
 Section Inherit
   
   - parent_any:ANY := ANY;
diff --git a/src2/type/type_null.li b/src2/type/type_null.li
index 3f05b71..482e86c 100644
--- a/src2/type/type_null.li
+++ b/src2/type/type_null.li
@@ -61,15 +61,9 @@ Section Public
   
   //- bug:INTEGER;
   
-  - product_error p:POSITION in lst:LIST <-
-  ( + ctext:LOCAL;
-    
+  - product_error p:POSITION in lst:LIST with ctext:LOCAL <-
+  (     
     (debug_level_option != 0).if {      
-      (profil_current = NULL).if {
-	ctext := context_main;
-      } else {
-	ctext := profil_current.context;
-      };
       lst.add_last (
 	PUSH.create p context ctext first FALSE
       );      
diff --git a/src2/variable/local.li b/src2/variable/local.li
index 886fd74..ffb6e40 100644
--- a/src2/variable/local.li
+++ b/src2/variable/local.li
@@ -107,8 +107,9 @@ Section Public
         
     (my_alias != NULL).if {      
       result := my_alias.read_direct p with NULL;
-    }.elseif {is_alias} then { // BSBS: voir Mildred
-      result := get_alias.read_direct p with NULL; // BSBS: cas impossible !!!
+    }.elseif {is_alias} then { 
+      // Case : Argument function (see CALL_SLOT)
+      result := get_alias.read_direct p with NULL; 
     } else {
       //? {! is_alias};
       result := read_direct p with NULL;
diff --git a/src2/variable/slot_data.li b/src2/variable/slot_data.li
index 00b54b2..0bb43d9 100644
--- a/src2/variable/slot_data.li
+++ b/src2/variable/slot_data.li
@@ -329,6 +329,7 @@ Section Public
     + wrt:WRITE;    
     + old_list:LIST;
     + rd:ITM_READ_ARG1;
+    + old_profil_current:PROFIL;
    /* 
     string_tmp.copy "init : ";
     string_tmp.append name; 
@@ -337,6 +338,8 @@ Section Public
     ((value_init = NULL) && {(affect != '<') || {Self = slot_id}}).if {
       // Context.      
       old_list := list_current;
+      old_profil_current := profil_current;
+      profil_current := NULL;
       value_init := list_current := LIST.create position;      
       
       (Self = slot_id).if {
@@ -361,11 +364,13 @@ Section Public
       } else {
         rec := NULL;
       };
+      
       (debug_level_option != 0).if {
         list_current.add_last (
           PUSH.create position context context_main first FALSE 
         );
       };
+      
       wrt := write position with rec value val;
       (is_zero val).if {
         wrt.set_quiet_generation;
@@ -374,6 +379,7 @@ Section Public
       list_current.add_last (PROTOTYPE_CST.create position type (TYPE_VOID.default)); // BSBS:Alias
       
       list_current := old_list;
+      profil_current := old_profil_current;
     };
   );
   
diff --git a/src2/variable/variable.li b/src2/variable/variable.li
index 1bc745b..f6a018b 100644
--- a/src2/variable/variable.li
+++ b/src2/variable/variable.li
@@ -292,12 +292,14 @@ Section Public
     result := new_read position with r;   
     ensure_count := ensure_count + 1;    
     /*
-    (intern_name == "Self__GMKU").if {
+    (intern_name == "k__ELZH").if {
       "Create : ".print;
       result.object_id.print;
-      '\n'.print;
-      //crash;
-      IO.read_character;
+      '\n'.print;      
+      //(result.object_id = 1).if {
+        crash;
+      //};
+      IO.read_character;      
     };
     */
     result
@@ -307,7 +309,7 @@ Section Public
   - unread e:READ <-
   (    
     /*
-    (intern_name == "Self__AJIU").if {
+    (intern_name == "k__ELZH").if {
       "Delete : ".print;
       e.object_id.print;
       '\n'.print;

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list