Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/lamont/src/compiler/c-target/fragments/alloc.in
ViewVC logotype

Annotation of /branches/lamont/src/compiler/c-target/fragments/alloc.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2191 - (view) (download)

1 : jhr 1722 //! allocate the initial strands and initialize the rest of the world structure.
2 :     static bool AllocInitially (
3 :     @PREFIX@World_t *wrld, // world
4 :     bool isArray, // is the initialization an array or collection?
5 :     uint32_t nAxes, // depth of iteration nesting
6 :     uint32_t *base, // nAxes array of base indices
7 :     uint32_t *size) // nAxes array of iteration sizes
8 :     {
9 :     wrld->isArray = isArray;
10 :     wrld->nAxes = nAxes;
11 :     wrld->base = NEWVEC(uint32_t, nAxes);
12 :     wrld->size = NEWVEC(uint32_t, nAxes);
13 :     size_t numStrands = 1;
14 :     for (uint32_t i = 0; i < wrld->nAxes; i++) {
15 :     numStrands *= size[i];
16 :     wrld->base[i] = base[i];
17 :     wrld->size[i] = size[i];
18 :     }
19 :    
20 :     if (wrld->verboseFlg) {
21 :     fprintf (stderr, "AllocInitially: %d", size[0]);
22 :     for (uint32_t i = 1; i < nAxes; i++) fprintf(stderr, " x %d", size[i]);
23 :     fprintf (stderr, "\n");
24 :     }
25 :    
26 :     // allocate the strand state pointers
27 :     wrld->numStrands = numStrands;
28 : jhr 1917 #ifdef DIDEROT_TARGET_PARALLEL
29 :     wrld->sched->numActive = numStrands;
30 :     #else /* DIDEROT_TARGET_C */
31 :     wrld->numActive = numStrands;
32 :     #endif
33 : jhr 1722 wrld->inState = NEWVEC(@STRANDTY@ *, numStrands);
34 :     wrld->outState = NEWVEC(@STRANDTY@ *, numStrands);
35 :     wrld->status = NEWVEC(uint8_t, numStrands);
36 :     if ((wrld->inState == 0) || (wrld->outState == 0) || (wrld->status == 0)) {
37 : jhr 1862 biffMsgAdd (wrld->errors, "unable to allocate strand states\n");
38 : jhr 1722 return true;
39 :     }
40 :    
41 : lamonts 2191 @QUERY_POOL_ALLOCATION@
42 :    
43 : jhr 1722 // initialize strand state pointers etc.
44 :     for (size_t i = 0; i < numStrands; i++) {
45 :     wrld->inState[i] = NEW(@STRANDTY@);
46 :     wrld->outState[i] = NEW(@STRANDTY@);
47 :     wrld->status[i] = DIDEROT_ACTIVE;
48 :     }
49 :    
50 :     return false;
51 :    
52 :     } // AllocInitially

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0