Changes between Version 109 and Version 110 of IR2
- Timestamp:
- 05/21/21 18:20:58 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v109 v110 128 128 | '$herbrand' '<' type-name '>' /* Herbrand type of non-Herbrand numeric type T */ 129 129 | '$proc' /* process type */ 130 | '$bundle' /* bundle type for sequence of any type (same as seq<T>?) */131 130 | '$heap' /* heap type, for dynamic allocation */ 132 131 | '$mem' /* set of memory locations */ … … 169 168 * a map cannot be executed in a call or spawn; nor can functions on maps have any side effects 170 169 * a function can return a map and can consume an argument of map type 171 172 170 * A type name in a type-args list may be `void`. In this case, the type name designates the type whose domain is the union, over all types `T` of the type name obtained by substituting T for `void`. For example, the domain of `$seq<void>` is the union over all types `T` of `$seq<T>`. The sequence `{1,2,3}` is in the domain of `$seq<$int>` and of `$seq<void>`. The sequence `{1,3.14}` is not in `$seq<void>` since there is no type `T` containing `$int` and `$real`. Hence `$seq<void>` is a super type of all `$seq<T>`, and an expression of type `$seq<T>` can be used where one of type `$seq<void>` is required. It is similar to the relation between `void*` and `T*`. 171 * A "bundle" type is not needed. A bundle is just a `$seq<void>`. 172 * A message in an MPI communication might be represented as an element of type `$seq<$seq<void>>`. That is, a sequence, each element of which is a sequence of elements of the same type. An example of a message would be `{{1,2,3}, {3.14,2.7},{'a','b','c'}}`. 173 * A general C "object" might be represented as a structure 174 {{{ 175 struct $object { 176 $int size; // number of bytes 177 $map<$int, $seq<void>> data; // offset (in bytes), contiguous values 178 }; 179 }}} 173 180 174 181 == Statements == … … 335 342 struct $object { 336 343 $int size; // in bytes 337 $map<$int,$ any> data; // byte offset -> element344 $map<$int,$seq<void>> data; // byte offset -> element sequence 338 345 } 339 346 typedef struct $object $object; 340 }}}341 But this requires `$any` ... (think about this) ...342 343 344 === bundle.cvh ===345 346 {{{347 $int $bundle_size($bundle b); // number of elements in bundle or size in bytes?348 $bundle $bundle_pack(void *ptr, int size);349 void $bundle_unpack($bundle bundle, void *ptr);350 void $bundle_unpack_apply($bundle data, void *buf, $operation op, int count, void *result);351 352 347 }}} 353 348
