Previous: Introduction Up: Global Pointers Next: Invoking Functions Through Global Pointers

Dereferencing Global Pointers

Because the communication needed to fetch the value referenced by a global pointer is implicit, we write expressions involving global pointers as if they were local pointers. For example:

{
  int *global gpint;
  int x = *gpint+1;
}

Here x is assigned the sum of 1 and the value referenced by gpint.

We can use gpint without knowing in which processor object the integer referenced by it resides. The integer might even be in the processor object where this statement is executed. If this is the case, then the expression is equivalent to the same expression using a local pointer:


{
  int* lpint; 
  int x = *lpint+1;
}

The current implementation of CC++ does not take full advantage of global pointers that reference local memory. Dereferencing such global pointers will take longer than if they were local pointers, but not as long as if the value resided on another processor object.

paolo@cs.caltech.edu