LupineMarshal.mesa.
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited by
BZM on 10-Mar-82 16:56:13.
Birrell, September 8, 1983 3:41 pm
Bob Hagmann February 8, 1985 5:07:49 pm PST
LupineMarshal is exported by LupineMarshal*Impl.
DIRECTORY
LupineManagerPrivate USING [
Nest, Options, ParamPassingMethod, String ],
LupineSymbolTable USING [
Index, SymbolHandle, TransferTypes, TypeHandle, Types ];
LupineMarshal: DEFINITIONS =
BEGIN OPEN LupineManagerPrivate, ST: LupineSymbolTable;
Word and character counts.
Words: TYPE = LONG INTEGER;
Chars: TYPE = --LONG INTEGER-- CARDINAL;
These parameter protocol versions are checked during remote binding:
Version: TYPE = CARDINAL;
ParameterProtocolVersions: PROCEDURE
RETURNS [oldestSupported, newestSupported: Version];
These routines pull together information needed for marshaling:
ParamInfo: TYPE = REF --READONLY-- ParamInfoObject;
ParamInfoNIL: ParamInfo = NIL;
TransferDeclaration: TYPE = {inInterface, inRoutine};
TransferSite: TYPE = {caller, callee};
PktSite: TYPE = {stubFrame, rpcRuntime};
ParamIndex: TYPE = ST.Index[0..256); -- Origin is 1.
ParamRecordKind: TYPE = {argument, result};
ParamLocation: TYPE = {
inFrame, inPktOverlay, inFrameAndOverlay, inConversation, inStream };
OverlayParamType: TYPE = {static, address, other --must be last--};
ParamInfoObject: TYPE = RECORD [
paramRecord: ST.TypeHandle,
paramRecordKind: ParamRecordKind,
pktSite: PktSite,
transferType: ST.TransferTypes,
transferDeclaration: TransferDeclaration,
transferSite: TransferSite,
options: Options,
alwaysOnePkt, alwaysMultiplePkts: BOOLEAN,
hasOverlayParams, hasConversation: BOOLEAN,
hasOverlayParamType: PACKED ARRAY OverlayParamType OF BOOLEAN,
adrInfo: AddressInfo,
allocInfo: AllocInfo,
sizeOf: SizeInfo,
paramCount: ParamIndex, -- Of explicit parameters only.
RESULTCount: ParamIndex, -- Already included in paramCount.
RESULTsParamInfo: PRIVATE ParamInfo,
fields: PRIVATE SEQUENCE boundsCheck: ParamIndex OF FieldInfo ];
AddressInfo: TYPE = RECORD [
isStatic, isAddress, isDynamic, isTransfer: BOOLEANFALSE,
hasStatics, hasAddresses, hasDynamics, hasTransfers: BOOLEANFALSE,
hasGC, hasHeap, hasMds: BOOLEANFALSE,
hasShortPtrs: BOOLEANFALSE ];
FalseAddressInfo: AddressInfo = [];
SizeInfo: TYPE = RECORD [
overlayHeader: Words𡤀,
overlayParamRecord: Words𡤀,
pktToAllocate: Words𡤀 ];
ZeroSizeInfo: SizeInfo = [];
AllocZone: TYPE = {gc, heap, mds};
AllocDetails: TYPE = RECORD [
number: INTEGER ← 0,
isDynamic: BOOLEANFALSE ];
AllocInfo: TYPE = PACKED ARRAY AllocZone OF AllocDetails;
NoAllocations: AllocInfo = [];
FieldInfo: TYPE = RECORD [
type: ST.Types,
passingMethod: ParamPassingMethod,
location: ParamLocation,
overlayParamType: OverlayParamType,
adrInfo: AddressInfo,
allocInfo: AllocInfo,
size: Words,
minFlatSize, maxFlatSize: Words ];
MakeParamInfo: PROCEDURE [
paramRecord: ST.TypeHandle,
paramRecordKind: ParamRecordKind,
pktSite: PktSite,
RESULTsParamInfo: ParamInfo←ParamInfoNIL,
Must be NIL for argument records, nonNIL for results.
transferType: ST.TransferTypes,
transferDeclaration: TransferDeclaration,
transferSite: TransferSite,
options: Options ]
RETURNS[paramInfo: ParamInfo];
FreeParamInfo: PROCEDURE [paramInfo: ParamInfo];
ParamProcedure: TYPE = PROCEDURE [
paramName: ST.SymbolHandle,
paramType: ST.TypeHandle,
paramIndex: ParamIndex,
paramFieldInfo: FieldInfo ]
RETURNS[stop: BOOLEANFALSE];
EnumerateParams: PROCEDURE [
paramInfo: ParamInfo,
paramProc: ParamProcedure,
includeRESULTs: BOOLEANFALSE ];
These routines actually generate marshaling code:
OverlayHandling: TYPE = PACKED ARRAY OverlayParamType OF OverlayOperation;
OverlayOperation: TYPE = {
Marshal.ToPacket operations:
alreadyInPkt, copyToPkt,
Marshal.FromPacket operations:
leaveInPkt, copyToFrame, justCopyToFrame,
Illegal operation:
error } ← error;
VariableNames: TYPE = RECORD [
pkt, overlayPtr, pktLength, pktLimit, lastPkt: String ];
ToPacket: PROCEDURE [
paramInfo: ParamInfo,
overlayHandling: OverlayHandling,
varNames: VariableNames,
nest: Nest,
options: Options ];
FromPacket: PROCEDURE [
paramInfo: ParamInfo,
overlayHandling: OverlayHandling,
varNames: VariableNames,
nest: Nest,
options: Options ];
BeginAllocation: PROCEDURE [
paramInfo: ParamInfo,
nest: Nest,
options: Options ]
RETURNS [newNest: Nest];
EndAllocation: PROCEDURE [
paramInfo: ParamInfo,
justCloseBlocks: BOOLEANFALSE,
nest: Nest,
options: Options ]
RETURNS [newNest: Nest];
END. -- LupineMarshal.