public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Add an int return type for logical, equality and relational operations.
@ 2007-11-12 22:47 tthomas
  0 siblings, 0 replies; only message in thread
From: tthomas @ 2007-11-12 22:47 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  c105e3372fba89b087d26ed5f4e98546851714bb (commit)
       via  e13132fb16f45165b5d1a3ce9aa54f87b2bfa5d3 (commit)
      from  ed081c0d3afa9702c4d2bbce9ffa39fd02bce1f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit c105e3372fba89b087d26ed5f4e98546851714bb
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Mon Nov 12 17:29:30 2007 -0500

    Add an int return type for logical, equality and relational operations.
    
    frysk-core/frysk/value/ChangeLog
    2007-11-12  Teresa Thomas  <tthomas@redhat.com>
    
    	* ArithmeticUnit.java (intType): New.
    	(ArithmeticUnit): New.
    	* IntegerUnit.java (IntegerUnit): Call super.
    	* FloatingPointUnit.java (FloatingPointUnit): Ditto.
    	* AddressUnit.java (AddressUnit): Ditto.
    	* IntegerType.java (getALU): Give wordSize to all ALUs.
    	* FloatingPointType.java (getALU): Ditto.

commit e13132fb16f45165b5d1a3ce9aa54f87b2bfa5d3
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Mon Nov 12 17:28:25 2007 -0500

    Comments added.
    
    frysk-core/frysk/value/ChangeLog
    2007-11-12  Teresa Thomas  <tthomas@redhat.com>
    
    	* ArrayType.java (getALU): Comments added.
    	* PointerType.java (getALU): Comments added.
    	* Type.java (getALU): Comments added.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/value/AddressUnit.java       |    2 ++
 frysk-core/frysk/value/ArithmeticUnit.java    |   16 ++++++++++++++++
 frysk-core/frysk/value/ArrayType.java         |    9 +++++----
 frysk-core/frysk/value/ChangeLog              |   14 ++++++++++++++
 frysk-core/frysk/value/FloatingPointType.java |   16 ++++++++--------
 frysk-core/frysk/value/FloatingPointUnit.java |    6 ++++--
 frysk-core/frysk/value/IntegerType.java       |   17 ++++++++---------
 frysk-core/frysk/value/IntegerUnit.java       |    9 ++++++---
 frysk-core/frysk/value/PointerType.java       |   15 +++++++--------
 frysk-core/frysk/value/Type.java              |    4 ++++
 10 files changed, 74 insertions(+), 34 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/value/AddressUnit.java b/frysk-core/frysk/value/AddressUnit.java
index 5d61db0..5f9b8f5 100644
--- a/frysk-core/frysk/value/AddressUnit.java
+++ b/frysk-core/frysk/value/AddressUnit.java
@@ -49,12 +49,14 @@ extends ArithmeticUnit
     private final int wordSize; 
     
     public AddressUnit (ArrayType t, int wordSize) {
+	super (wordSize);
 	retType = new PointerType(t.getName(), ByteOrder.BIG_ENDIAN, 
 		                  wordSize, t.getType());
 	this.wordSize = wordSize; 
     }
     
     public AddressUnit (PointerType t, int wordSize) {
+	super (wordSize);
 	retType = t;
 	this.wordSize = wordSize; 
     }
diff --git a/frysk-core/frysk/value/ArithmeticUnit.java b/frysk-core/frysk/value/ArithmeticUnit.java
index 1daa863..e68df96 100644
--- a/frysk-core/frysk/value/ArithmeticUnit.java
+++ b/frysk-core/frysk/value/ArithmeticUnit.java
@@ -39,14 +39,30 @@
 
 package frysk.value;
 
+import inua.eio.ByteOrder;
+
 /**
  * Arithmetic and Logical Operation handling
  * for different types.
  */
 public abstract class ArithmeticUnit 
 {
+    // Return type based on the type of operands - used for 
+    // most operations.
     protected ArithmeticType retType;
     
+    // Integer return type for relational, equality
+    // and logical operations.
+    protected IntegerType intType;
+    
+    protected ArithmeticUnit(int wordSize) {
+	// XXX: Is endianness okay?
+	// Create an int type with size equal to word
+	// size of machine.
+	intType = new UnsignedType ("int", ByteOrder.LITTLE_ENDIAN, 
+		                    wordSize);
+    }
+    
     // Multiplicative and Additive expressions
     public Value add(Value v1, Value v2) {
 	throw new InvalidOperatorException
diff --git a/frysk-core/frysk/value/ArrayType.java b/frysk-core/frysk/value/ArrayType.java
index 9505874..12d2480 100644
--- a/frysk-core/frysk/value/ArrayType.java
+++ b/frysk-core/frysk/value/ArrayType.java
@@ -252,14 +252,15 @@ public class ArrayType
 	this.toPrint("", writer);
     }
     
+    /* getALUs are double dispatch functions to determine 
+     * the ArithmeticUnit for an operation between two types.
+     */    
     public ArithmeticUnit getALU(Type type, int wordSize) {
 	return type.getALU(this, wordSize);
-    }
-    
+    }    
     public ArithmeticUnit getALU(IntegerType type, int wordSize) {
 	return new AddressUnit(this, wordSize);
-    }   
-    
+    }       
     public ArithmeticUnit getALU(PointerType type, int wordSize) {
 	throw new RuntimeException("Invalid Pointer Arithmetic");
     }
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index 39d3690..9744fcc 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,5 +1,19 @@
 2007-11-12  Teresa Thomas  <tthomas@redhat.com>
 
+	* ArithmeticUnit.java (intType): New.
+	(ArithmeticUnit): New.
+	* IntegerUnit.java (IntegerUnit): Call super.
+	* FloatingPointUnit.java (FloatingPointUnit): Ditto.	
+	* AddressUnit.java (AddressUnit): Ditto.
+	* IntegerType.java (getALU): Give wordSize to all ALUs.	
+	* FloatingPointType.java (getALU): Ditto.	
+			
+	* ArrayType.java (getALU): Comments added.
+	* PointerType.java (getALU): Comments added.
+	* Type.java (getALU): Comments added.		
+	
+2007-11-12  Teresa Thomas  <tthomas@redhat.com>
+
 	* IntegerUnit.java: Use BigInteger for logical
 	operations.
 
diff --git a/frysk-core/frysk/value/FloatingPointType.java b/frysk-core/frysk/value/FloatingPointType.java
index f20a8e8..f0456d2 100644
--- a/frysk-core/frysk/value/FloatingPointType.java
+++ b/frysk-core/frysk/value/FloatingPointType.java
@@ -93,18 +93,18 @@ public class FloatingPointType
 	location.put(order(), f.toByteArray(getSize()), 0);
     }
     
+    /* getALUs are double dispatch functions to determine 
+     * the ArithmeticUnit for an operation between two types.
+     */
     public ArithmeticUnit getALU(Type type, int wordSize) {
 	return type.getALU(this, wordSize);
-    }
-    
+    }    
     public ArithmeticUnit getALU(IntegerType type, int wordSize) {
-	return new FloatingPointUnit(this);
-    }
-    
+	return new FloatingPointUnit(this, wordSize);
+    }    
     public ArithmeticUnit getALU(FloatingPointType type, int wordSize) {
-	return new FloatingPointUnit(this, type);
-    }   
-    
+	return new FloatingPointUnit(this, type, wordSize);
+    }       
     public ArithmeticUnit getALU(PointerType type, int wordSize) {
 	throw new RuntimeException("Invalid Pointer Arithmetic");
     }    
diff --git a/frysk-core/frysk/value/FloatingPointUnit.java b/frysk-core/frysk/value/FloatingPointUnit.java
index dd71a5a..c7bee21 100644
--- a/frysk-core/frysk/value/FloatingPointUnit.java
+++ b/frysk-core/frysk/value/FloatingPointUnit.java
@@ -46,12 +46,14 @@ package frysk.value;
 public class FloatingPointUnit
      extends ArithmeticUnit
 {   
-    public FloatingPointUnit (FloatingPointType t1, FloatingPointType t2) {
+    public FloatingPointUnit (FloatingPointType t1, FloatingPointType t2, int wSize) {
+	super (wSize);
 	// Return type should be the larger type.
 	retType = (t1.getSize() > t2.getSize()) ?  t1 : t2;
     }
 
-    public FloatingPointUnit (FloatingPointType t1) {
+    public FloatingPointUnit (FloatingPointType t1, int wSize) {
+	super (wSize);
 	retType = t1;
     }	
     
diff --git a/frysk-core/frysk/value/IntegerType.java b/frysk-core/frysk/value/IntegerType.java
index 8cf8778..28ed015 100644
--- a/frysk-core/frysk/value/IntegerType.java
+++ b/frysk-core/frysk/value/IntegerType.java
@@ -78,22 +78,21 @@ public abstract class IntegerType
 	putBigInteger(location, i);
     }
 
+    /* getALUs are double dispatch functions to determine 
+     * the ArithmeticUnit for an operation between two types.
+     */
     public ArithmeticUnit getALU(Type type, int wordSize) {
 	return type.getALU(this, wordSize);
-    }
-    
+    }    
     public ArithmeticUnit getALU(IntegerType type, int wordSize) {
-	return new IntegerUnit(this, type);
-    }
-    
+	return new IntegerUnit(this, type, wordSize);
+    }    
     public ArithmeticUnit getALU(PointerType type, int wordSize) {
 	return new AddressUnit(type, wordSize);
-    }
-    
+    }    
     public ArithmeticUnit getALU(FloatingPointType type, int wordSize) {
-	return new FloatingPointUnit(type);
+	return new FloatingPointUnit(type, wordSize);
     }   
-
     public ArithmeticUnit getALU(ArrayType type, int wordSize) {
 	return new AddressUnit(type, wordSize);
     }  
diff --git a/frysk-core/frysk/value/IntegerUnit.java b/frysk-core/frysk/value/IntegerUnit.java
index 3c6d9e4..1f96e2c 100644
--- a/frysk-core/frysk/value/IntegerUnit.java
+++ b/frysk-core/frysk/value/IntegerUnit.java
@@ -40,14 +40,17 @@
 package frysk.value;
 
 import java.math.BigInteger;
+
 /**
- * Arithmetic and logical Operation handling 
- * for integers.
+ *  Arithmetic and logical Operation handling 
+ *  for integers. All arithmetic done using 
+ *  BigInteger.
  */
 public class IntegerUnit
      extends ArithmeticUnit
 {
-    public IntegerUnit (IntegerType t1, IntegerType t2) {
+    public IntegerUnit (IntegerType t1, IntegerType t2, int wordSize) {
+	super (wordSize);
 	// Return type should be the larger type.
 	retType = (t1.getSize() > t2.getSize()) ?
 		  t1 : t2;
diff --git a/frysk-core/frysk/value/PointerType.java b/frysk-core/frysk/value/PointerType.java
index 90a84f7..d056ec1 100644
--- a/frysk-core/frysk/value/PointerType.java
+++ b/frysk-core/frysk/value/PointerType.java
@@ -130,22 +130,21 @@ public class PointerType
 	return dereference (offset, taskMem) ;      
     }    
 
+    /* getALUs are double dispatch functions to determine 
+     * the ArithmeticUnit for an operation between two types.
+     */  
     public ArithmeticUnit getALU(Type type, int wordSize) {
 	return type.getALU(this, wordSize);
-    }
-    
+    }    
     public ArithmeticUnit getALU(IntegerType type, int wordSize) {
 	return new AddressUnit(this, wordSize);
-    }   
-    
+    }       
     public ArithmeticUnit getALU(PointerType type, int wordSize) {
 	throw new RuntimeException("Invalid Pointer Arithmetic");
-    } 
-    
+    }     
     public ArithmeticUnit getALU(FloatingPointType type, int wordSize) {
 	throw new RuntimeException("Invalid Pointer Arithmetic");
-    } 
-    
+    }     
     public ArithmeticUnit getALU(ArrayType type, int wordSize) {
 	throw new RuntimeException("Invalid Pointer Arithmetic");
     }
diff --git a/frysk-core/frysk/value/Type.java b/frysk-core/frysk/value/Type.java
index 7f3bf17..9188070 100644
--- a/frysk-core/frysk/value/Type.java
+++ b/frysk-core/frysk/value/Type.java
@@ -128,6 +128,10 @@ public abstract class Type {
 	return stringWriter.toString();
     }
 
+    /* getALUs are double dispatch functions to determine the 
+     * ArithmeticUnit for an arithmetic or logical operation
+     * between two types.
+     */  
     public ArithmeticUnit getALU(Type type, int wordSize) {
 	throw new RuntimeException("Invalid Arithmetic Unit");
     }


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-12 22:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-12 22:47 [SCM] master: Add an int return type for logical, equality and relational operations tthomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).