// For each line
for (int y = interval.yfrom; y < interval.yto; y++) {
-// for (int y = 0; y < 10; y++) {
double ylen = (double) (2.0 * y) / (double) interval.width - 1.0;
// System.out.println("Doing line " + y);
// For each pixel of the line, launch parallel sese
int line_checksum=0;
Ray tRay = new Ray();
Ray r = new Ray(view.from, new Vec(0,0,0));
- Isect inter=new Isect();
for (int x = 0; x < interval.width; x++) {
Vec col = new Vec();
r.D.add(viewVec);
r.D.normalize();
- col = trace(0, 1.0, r,inter,new Ray(),new Vec());
+ col = trace(0, 1.0, r,new Isect(),new Ray(),new Vec());
// computes the color of the ray
if (blue > 255)
blue = 255;
-// checksum += red;
-// checksum += green;
-// checksum += blue;
line_checksum += red;
line_checksum += green;
line_checksum += blue;
// row[pixCounter_t] = alpha | (red << 16) | (green << 8) | (blue);
tempArray[x]= alpha | (red << 16) | (green << 8) | (blue);
} // end for (x)
-
} // end of sese line
sese serial{
#if defined(THREADS) || defined(DSTM) || defined(STM)
#include "thread.h"
#endif
+#ifdef MLP
+#include "workschedule.h"
+#endif
#ifdef DMALLOC
#include "dmalloc.h"
long garbagearray[MAXSTATS];
#endif
-#if defined(THREADS) || defined(DSTM) || defined(STM)
+#if defined(THREADS) || defined(DSTM) || defined(STM)||defined(MLP)
int needtocollect=0;
struct listitem * list=NULL;
int listcount=0;
}
#endif
-#if defined(STM)||defined(THREADS)
+#if defined(STM)||defined(THREADS)||defined(MLP)
__thread char * memorybase=NULL;
__thread char * memorytop=NULL;
#endif
void collect(struct garbagelist * stackptr) {
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
needtocollect=1;
pthread_mutex_lock(&gclistlock);
while(1) {
#endif
}
#endif
-#if defined(STM)||defined(THREADS)
+#if defined(STM)||defined(THREADS)||defined(MLP)
memorybase=NULL;
#endif
/* Check current stack */
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
{
struct listitem *listptr=list;
while(1) {
}
stackptr=stackptr->next;
}
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
/* Go to next thread */
#ifndef MAC
//skip over us
#endif
}
#endif
-#if defined(STM)||defined(THREADS)
+#if defined(STM)||defined(THREADS)||defined(MLP)
*(listptr->base)=NULL;
#endif
stackptr=listptr->stackptr;
fixtags();
#endif
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
needtocollect=0;
pthread_mutex_unlock(&gclistlock);
#endif
return ptr;
}
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
void checkcollect(void * ptr) {
stopforgc((struct garbagelist *)ptr);
restartaftergc();
#ifdef THREADS
litem.locklist=pthread_getspecific(threadlocks);
#endif
-#if defined(STM)||defined(THREADS)
+#if defined(STM)||defined(THREADS)||defined(MLP)
litem.base=&memorybase;
#endif
#ifdef STM
}
#endif
-#if defined(STM)||defined(THREADS)
+#if defined(STM)||defined(THREADS)||defined(MLP)
#define MEMORYBLOCK 65536
void * helper(struct garbagelist *, int);
void * mygcmalloc(struct garbagelist * stackptr, int size) {
void * mygcmalloc(struct garbagelist * stackptr, int size) {
#endif
void *ptr;
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
while (pthread_mutex_trylock(&gclock)!=0) {
stopforgc(stackptr);
restartaftergc();
to_heaptop=to_heapbase+INITIALHEAPSIZE;
to_heapptr=to_heapbase;
ptr=curr_heapbase;
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
pthread_mutex_unlock(&gclock);
#endif
return ptr;
/* Not enough room :(, redo gc */
if (curr_heapptr>curr_heapgcpoint) {
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
pthread_mutex_unlock(&gclock);
#endif
return mygcmalloc(stackptr, size);
}
bzero(tmp, curr_heaptop-tmp);
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
pthread_mutex_unlock(&gclock);
#endif
return tmp;
}
} else {
-#if defined(THREADS)||defined(DSTM)||defined(STM)
+#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
pthread_mutex_unlock(&gclock);
#endif
return ptr;