[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/Makefile cell.hh constants.hh coordinate.hh obstacle.hh ocean.cpp ocean.hh predator.hh prey.hh

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 4 20:35:31 PDT 2004



Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean:

Makefile added (r1.1)
cell.hh updated: 1.1 -> 1.2
constants.hh updated: 1.1 -> 1.2
coordinate.hh updated: 1.1 -> 1.2
obstacle.hh updated: 1.1 -> 1.2
ocean.cpp updated: 1.1 -> 1.2
ocean.hh updated: 1.1 -> 1.2
predator.hh updated: 1.1 -> 1.2
prey.hh updated: 1.1 -> 1.2
---
Log message:

Make this thing work, implement critical methods that are needed to avoid
going into an infinite loop, etc.


---
Diffs of the changes:  (+23 -21)

Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/Makefile
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/Makefile:1.1
*** /dev/null	Mon Oct  4 22:35:26 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/Makefile	Mon Oct  4 22:35:13 2004
***************
*** 0 ****
--- 1,7 ----
+ LEVEL = ../../../..
+ 
+ PROG     = ocean
+ #LIBS  = -lstdc++
+ LDFLAGS = -lstdc++
+ include $(LEVEL)/MultiSource/Makefile.multisrc
+ 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/cell.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/cell.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/cell.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/cell.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/cell.hh	Mon Oct  4 22:35:13 2004
@@ -20,7 +20,7 @@
   virtual Cell *reproduce(Coordinate anOffset);
 
 public:
-  Cell(Coordinate &aCoord) {
+  Cell(const Coordinate &aCoord) {
     offset = new Coordinate(aCoord);
     image = DefaultImage;
   }


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/constants.hh	Mon Oct  4 22:35:13 2004
@@ -1,12 +1,12 @@
 #ifndef Constants
 #define Constants
 
-#define MaxRows 25
-#define MaxCols 70
+#define MaxRows 2500
+#define MaxCols 5000
 
-#define DefaultNumObstacles 75
-#define DefaultNumPredators 20
-#define DefaultNumPrey 150
+#define DefaultNumObstacles 750
+#define DefaultNumPredators 200
+#define DefaultNumPrey 1000
 
 #define DefaultNumIterations 1000
 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/coordinate.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/coordinate.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/coordinate.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/coordinate.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/coordinate.hh	Mon Oct  4 22:35:13 2004
@@ -8,7 +8,7 @@
 
 public:
   Coordinate(unsigned anX, unsigned aY) : x(anX), y(aY) {}
-  Coordinate(Coordinate &aCoord) {
+  Coordinate(const Coordinate &aCoord) {
     x = aCoord.x;
     y = aCoord.y;
   }
@@ -18,14 +18,14 @@
   unsigned getY(void) {return y;}
   void setX(unsigned anX) {x = anX;}
   void setY(unsigned aY) {y = aY;}
-  void operator = (Coordinate &aCoord) {
+  void operator = (const Coordinate &aCoord) {
     x = aCoord.x;
     y = aCoord.y;
   }
-  int operator == (Coordinate &c) {
+  int operator == (const Coordinate &c) {
     return (x == c.x && y == c.y);
   }
-  int operator != (Coordinate &c) {
+  int operator != (const Coordinate &c) {
     return (x != c.x && y != c.y);
   }
 };


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/obstacle.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/obstacle.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/obstacle.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/obstacle.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/obstacle.hh	Mon Oct  4 22:35:13 2004
@@ -6,7 +6,6 @@
   Obstacle(Coordinate &aCoord) : Cell(aCoord) {
     image = ObstacleImage;
   }
-  virtual ~Obstacle(void) {Cell::~Cell();}
 };
 
 #endif


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.cpp	Mon Oct  4 22:35:13 2004
@@ -7,6 +7,8 @@
 #include "predator.hh"
 #include "obstacle.hh"
 
+#include <cstdlib>
+
 //cell.cc
 Cell *Cell::getCellAt(Coordinate aCoord) {
   return cells[aCoord.getY()][aCoord.getX()];
@@ -121,11 +123,11 @@
 #define MAX 32767
 
 float Random::randReal(void) {
-  return 0.0;
+  return random()/(float)RAND_MAX;
 }
 
 unsigned Random::nextIntBetween(int low, int high) {
-  return 0;
+  return (long long)(random())* high / RAND_MAX;
 }
 
 //ocean.cc
@@ -144,10 +146,6 @@
 
 void Ocean::initCells(void) {
   addEmptyCells();
-  if (numPredators == (size - numObstacles))
-    numPredators = size - numObstacles;
-  if (numPrey == (size - numObstacles - numPredators))
-    numPrey = size - numObstacles - numPredators;
   addObstacles();
   addPredators();
   addPrey();
@@ -229,7 +227,7 @@
   }
 }
 
-main() {
+int main() {
   Ocean *myOcean = new Ocean;
   myOcean->initialize();
   myOcean->run();


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/ocean.hh	Mon Oct  4 22:35:13 2004
@@ -9,7 +9,6 @@
 private:
   unsigned numRows;
   unsigned numCols;
-  unsigned size;
   unsigned numPrey;
   unsigned numPredators;
   unsigned numObstacles;


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/predator.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/predator.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/predator.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/predator.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/predator.hh	Mon Oct  4 22:35:13 2004
@@ -13,7 +13,6 @@
     timeToFeed = TimeToFeed;
     image = DefaultPredImage;
   }
-  virtual ~Predator(void) {Prey::~Prey();}
   virtual void process(void);
 };
 


Index: llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/prey.hh
diff -u llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/prey.hh:1.1 llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/prey.hh:1.2
--- llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/prey.hh:1.1	Mon Oct  4 15:01:14 2004
+++ llvm-test/MultiSource/Benchmarks/Prolangs-C++/ocean/prey.hh	Mon Oct  4 22:35:13 2004
@@ -13,7 +13,7 @@
     timeToReproduce = TimeToReproduce;
     image = DefaultPreyImage;
   }
-  ~Prey(void) {Cell::~Cell();}
+
   void process(void) {
     Coordinate toCoord;
 






More information about the llvm-commits mailing list