aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/health/ssplain.h
blob: 157c1cbe89e7e109c6e559e3831dd350d60b912d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef SS_PLAIN_H
#define SS_PLAIN_H

void * ssplain_malloc(int size);
void * ssplain_calloc(int nelems, int size);
void ssplain_alloc_stats();
 
/* Convert MP shutdown to exit */
#define __ShutDown(ID)     { ssplain_alloc_stats(); exit(ID); } 

/* All these CM-5 things are nops */
#define CMMD_node_timer_clear(ID)
#define CMMD_node_timer_start(ID)
#define CMMD_node_timer_stop(ID)
#define CMMD_node_timer_elapsed(ID)   ((double)0)

#define CMMD_self_address()   0

#define ClearAllStats()

/* define away the CM-5 allocator */
#include <stdlib.h>

#ifndef ALLOC
#define ALLOC(NUM,ESIZE)  ssplain_calloc (NUM+1,ESIZE)
#endif ALLOC

#ifndef mymalloc
#define mymalloc malloc
#endif mymalloc

/* Get all of these multiprocessing things out of here. */
/* My id will stay that way */
#define IDMASK 0xffffffff

/* Nothing is getting tested */
#ifndef RETEST
#define RETEST()
#endif RETEST

#ifndef NOTEST
#define NOTEST()
#endif NOTEST

/* Everything is local */
#ifndef local
#define local            
#endif local

#ifndef LOCAL
#define LOCAL(VAL)      (VAL)
#endif LOCAL

#ifndef ISLOCPTR
#define ISLOCPTR(VAL)   (1)
#endif ISLOCPTR

#ifndef MLOCAL
#define MLOCAL(VAL)
#endif MLOCAL

/* An atomic increment is a normal increment */
#ifndef ATOMICINC
#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
#endif ATOMICINC

/* Nothing is migrating anywhere */
#ifndef MIGRATE
#define MIGRATE(ID)     
#endif MIGRATE

#ifndef MIGRPH
#define MIGRPH()
#endif MIGRPH

#ifndef UNPHASE
#define UNPHASE()
#endif UNPHASE

#ifndef PID
#define PID(VAL)  (0)
#endif PID

/* All these functions */
#ifdef CCURED
  #pragma ccuredvararg("chatting", printf(1))
#endif
void chatting(char *s, ...);

/* just define these guys, they are not going to change */
#define __NumNodes 1
#define __MyNodeId 0
#define __NDim     0

typedef struct ss_future_cell_int {
  int value;
} future_cell_int;

/* Where are these things for real? */
#ifdef SS_RAND
long lrand48();
double drand48();
void srand48(long seed);
#endif SS_RAND

#define MOD(V,M) ((V) & ((M) - 1))
#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))

/* Prefetch instructions */

/* Use these for 1 lookahead prefetching */

#ifdef OVERHEAD_ONLY
#define ASSEMBLE_PREFETCH(ARG)
#define ASSEMBLE_PREFETCH_HEAD(ARG)
#else !OVERHEAD_ONLY

#define ASSEMBLE_PREFETCH(ARG) \
     asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
 
/* Use these for infinite lookahead prefetching */
#define ASSEMBLE_PREFETCH_HEAD(ARG) \
     asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))

#endif OVERHEAD_ONLY

#endif SS_PLAIN_H