occam-pi powered

Valid CSS!

Valid XHTML 1.1!

Last modified 25th March 2006
This document is maintained by Fred Barnes
Department of Computer Science, University of Kent.

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 ]

Compiling for 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

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).

IdConstantDescriptionType-specific data
0MTID_PRIMprimitive type[bytes:32] [typehash:32]
1MTID_SEQPROTOsequential protocol[n-items:32] ...items...
2MTID_CHANTYPEmobile channel-type[n-chans:32] [typehash:32] ...channels...
3MTID_MCHANEND_IUunshared server mobile channel-end[typedescptr:32]
4MTID_MCHANEND_OUunshared client mobile channel-end[typedescptr:32]
5MTID_MCHANEND_ISshared server mobile channel-end[typedescptr:32]
6MTID_MCHANEND_OSshared client mobile channel-end[typedescptr:32]
7MTID_CHAN_Iinput channel...channel-protocol...
8MTID_CHAN_Ooutput channel...channel-protocol...
9MTID_RECORDrecord type[bytes:32] [typehash:32]
10MTID_TAGPROTOtagged protocol[n-tags:32] ...tags...
11MTID_MARRAYdynamic mobile array[dim-count:32] ...sub-type...
12MTID_MOBILEstatic mobile...sub-type...
13MTID_ARRAYfixed-size array[elem-count:32] ...sub-type...
14MTID_COUNTEDcounted array protocol...count-type... ...sub-type...
15MTID_TAGtag[tag-val:32] [n-items:32] ...items...
16MTID_MBARRIERmobile barrier
17MTID_MPROCmobile process[typehash:32]
18MTID_STYPEstructured type[typehash:32] [n-bytes:32] [n-fields:32] ...fields...
19MTID_FIELDfield[offset:32] ...sub-type...
255MTID_UNKNOWNunknown type

Copyright © 2005-2006, Fred Barnes, Department of Computer Science, University of Kent.