Last modified 25th March 2006 Channel-type type descriptions |
This page documents the type-descriptions generated by the occam-pi compiler, currently used for mobile channel-types.
[ compiling | type-descriptions ]
The only supported use of type-descriptions is currently for describing the structure and protocols within a mobile channel-type. Normally, this information will not be generated by the compiler. To explicitly include it, the "-zctt" compiler-flag must be used. Because it changes the structure of mobile channel-ends at run-time, this option must be either globally used or not-used. The use of this option also affects the type-hashes generated for mobile channel-types, affecting type-compatability checks (e.g. a mobile channel-end with type-descriptions cannot be passed to an external procedure compiled without that support).
The effect of this flag is two-fold. Firstly, type-descriptions are generated (as constant data-blocks) for each "CHAN TYPE" definition. Secondly, the allocation-size of a mobile channel-end increases by two words, incorporating a pointer to the constant type-description and a second word reserved for future use (attaching various run-time hooks to the mobile channel-end). These two words are placed above the reference-count and below the channel-words themselves.
Type-descriptions have a fairly standard format, generated as an array of "unsigned int"s:
[id:8 len:24] ...type-specific-data...
The "len" given for a type-description includes all of it, including itself and nested descriptions for deep types, in bytes. The "id" identifies the particular type, listed in the following table. The constants given are defined in typedesc.h exported by CCSP. The "typedescptr" pointers point at other type-descriptor blocks (the compiler actually outputs the typehash here, but it is fixed-up by the translator when generating native code).
Id | Constant | Description | Type-specific data |
---|---|---|---|
0 | MTID_PRIM | primitive type | [bytes:32] [typehash:32] |
1 | MTID_SEQPROTO | sequential protocol | [n-items:32] ...items... |
2 | MTID_CHANTYPE | mobile channel-type | [n-chans:32] [typehash:32] ...channels... |
3 | MTID_MCHANEND_IU | unshared server mobile channel-end | [typedescptr:32] |
4 | MTID_MCHANEND_OU | unshared client mobile channel-end | [typedescptr:32] |
5 | MTID_MCHANEND_IS | shared server mobile channel-end | [typedescptr:32] |
6 | MTID_MCHANEND_OS | shared client mobile channel-end | [typedescptr:32] |
7 | MTID_CHAN_I | input channel | ...channel-protocol... |
8 | MTID_CHAN_O | output channel | ...channel-protocol... |
9 | MTID_RECORD | record type | [bytes:32] [typehash:32] |
10 | MTID_TAGPROTO | tagged protocol | [n-tags:32] ...tags... |
11 | MTID_MARRAY | dynamic mobile array | [dim-count:32] ...sub-type... |
12 | MTID_MOBILE | static mobile | ...sub-type... |
13 | MTID_ARRAY | fixed-size array | [elem-count:32] ...sub-type... |
14 | MTID_COUNTED | counted array protocol | ...count-type... ...sub-type... |
15 | MTID_TAG | tag | [tag-val:32] [n-items:32] ...items... |
16 | MTID_MBARRIER | mobile barrier | |
17 | MTID_MPROC | mobile process | [typehash:32] |
18 | MTID_STYPE | structured type | [typehash:32] [n-bytes:32] [n-fields:32] ...fields... |
19 | MTID_FIELD | field | [offset:32] ...sub-type... |
255 | MTID_UNKNOWN | unknown type |
Copyright © 2005-2006, Fred Barnes, Department of Computer Science, University of Kent. |