Changes between Version 40 and Version 41 of IR2
- Timestamp:
- 04/28/21 17:13:01 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v40 v41 142 142 | (lvalue '=')? '$spawn' expr '(' arg-list? ')' ';' /* process creation */ 143 143 | 'return' expr? ';' /* return from function call */ 144 | '$parspawn' expr ',' expr ',' expr ';' /* parallel spawn */145 144 | (lvalue '=')? '$alloc' '(' expr ',' expr ',' type-name ')' ';' /* heap allocation */ 146 145 arg-list: expr (',' expr)* ; /* actual argument list */ … … 151 150 152 151 * For function calls and spawns, the first expression shall have type pointer-to-function-.... The function pointed to will be the one called or spawned. That function must be a system or defined function (not an abstract function). 153 * The 3 expressions in a `$parspawn` are (1) pointer to the first element of the process array, an expression of type `$proc*`, (2) an expression of type `$domain`, and (3) an expression of type pointer-to-function-.... The function must have the type that consumes n `$int`s, where n is the dimension of the domain, and returns `void`. The function is spawned once for each element of the domain. References to the new processes are stored in the process array.154 152 * The first expression following `$alloc` has type `$heap*`. It is a pointer to the heap that will be modified by allocating the new memory. The second expression has type `$int` and is the number of elements being allocated. This is followed by the element type. The function returns a pointer to the first element of an array, similar to C's malloc. It is deallocated using function`$free`. 155 153 … … 182 180 === `seq.cvh` === 183 181 182 === `set.cvh` === 183 184 184 === `map.cvh` === 185 186 === `rel.cvh` === 185 187 186 188 === `concurrency.cvh` === 187 189 190 {{{ 191 $parspawn($proc * proc_array, $domain d, void (*f)($int, ...)); /* parallel spawn */ 188 192 193 }}} 194 195 * In`$parspawn` `*f` must have the function type that consumes n `$int`s, where n is the dimension of the domain. The function is spawned once for each element of the domain. References to the new processes are stored in the process array. The call to `$parspawn` returns immediately.
