BREADBYTECODE 1.0.0 DOCUMENTATION
(Rough Draft)
This page was generated from https://github.com/ostracod/breadsystem-spec at 7/1/2020, 10:11 PM EDT.
BreadBytecode is the programming language provided by BreadSystem for applications. This document describes the syntax and instructions of BreadBytecode.
DATA TYPES AND STRUCTURES
All integers in BreadBytecode are stored in little-endian order. All signed integers use two's complement to express negative values. All floating point numbers are stored in the IEEE 754 format.
List of primitive data types:
- p = Pointer
- u8 = Unsigned 8-bit integer
- u16 = Unsigned 16-bit integer
- u32 = Unsigned 32-bit integer
- u64 = Unsigned 64-bit integer
- s8 = Signed 8-bit integer
- s16 = Signed 16-bit integer
- s32 = Signed 32-bit integer
- s64 = Signed 64-bit integer
- f32 = 32-bit floating point number
- f64 = 64-bit floating point number
Subcomponents of u8:
- u1 = Unsigned 1-bit integer
- u2 = Unsigned 2-bit integer
- u4 = Unsigned 4-bit integer
Version number = [
u32 major,
u32 minor,
u32 patch
]
Frame length = [
u64 alpha length,
u64 beta length
]
Dependency attributes = [
u1 x5 unused bits,
u1 is optional,
u1 is implemented,
u1 is guarded
]
A dependency may only be implemented or guarded if the dependency is an interface.
Public function attributes = [
u32 interface index,
s32 arbiter index
]
Guard function attributes = [
u32 interface index
]
Interface function attributes = [
s32 arbiter index
]
The interface index and arbiter index are indexes to dependency regions. If the arbiter index is -1, the function does not have an arbiter.
Argument permissions are automatically granted by the system for input and output heap allocations.
Argument permission = [
u16 pointer argument index,
u2 permission type,
u2 permission recipient,
u1 unused bit,
u1 permission is recursive,
u1 permission has infinite propagation count,
u1 permission is temporary
]
Argument permission types:
- 0x0 = Direct read access
- 0x1 = Direct write access
- 0x2 = Read access through associated sentry instructions and functions
- 0x3 = Write access through associated sentry instructions and functions
Argument permission recipients:
- 0x0 = Arbiter (Granted before guard function invocation)
- 0x1 = Implementer (Granted before public function invocation)
- 0x2 = Caller (Granted after public function invocation)
Argument permission flags:
- A recursive permission will be recursively granted for all allocations referenced by the argument allocation.
- If permission propagation count is not infinite, the propagation count will be zero.
- A temporary permission will be removed after invocation has completed.
File types:
- 0 = Generic file
- 1 = Bytecode application file
- 2 = System application file
- 3 = Interface file
Directory types:
- 0 = Generic directory
- 1 = Application bundle
- 2 = Interface bundle
Stack trace = [
Array of instruction locations
]
Instruction locations in a stack trace are ordered from deepest to most shallow.
Instruction location = [
Pointer to agent,
u64 function index,
u64 instruction index
]
The function index is an index to a function region.
Region = [
u16 region type,
u8 length of region data size,
Region data size,
Region data
]
The length of region data size is measured in bytes. This value may be 1, 2, 4, or 8.
ATOMIC REGIONS
These regions do not contain any subregions.
fileFormatVer region type = 0x0000
Specifies the format version number of a bytecode application file or interface file.
depVer region type = 0x0001
Specifies the version number of a dependency.
globalFrameLen region type = 0x0100
Specifies the global frame length of a bytecode application.
localFrameLen region type = 0x0101
Specifies the local frame length of a function.
argFrameLen region type = 0x0102
Specifies the argument frame length of a function.
depAttrs region type = 0x0200
Specifies the attributes of a dependency.
pubFuncAttrs region type = 0x0202
Specifies the attributes of a public function in a bytecode application file.
guardFuncAttrs region type = 0x0203
Specifies the attributes of a guard function in a bytecode application file.
ifaceFuncAttrs region type = 0x0204
Specifies the attributes of a function in an interface file.
name region type = 0x0300
Specifies the name of an entity.
path region type = 0x0301
Specifies the path of an entity.
desc region type = 0x0302
Specifies a human-readable description of an entity.
depIndexes region type = 0x0400
Specifies an array of u32 indexes in the deps region.
jmpTable region type = 0x0401
Specifies an array of u64 indexes in the instrs region.
argPerms region type = 0x0402
Specifies the array of argument permissions for a function.
instrs region type = 0x0500
Specifies the array of bytecode instructions for a function.
appData region type = 0x0600
Specifies the unstructured blob of immutable data for a bytecode application.
COMPOSITE REGIONS
These regions consist of an array of subregions.
pathDep region type = 0x8000
Defines a dependency with a path.
Required subregions:
- depAttrs (exactly one)
- path (exactly one)
verDep region type = 0x8001
Defines a bundle dependency with a version.
Required subregions:
- depAttrs (exactly one)
- path (exactly one)
- depVer (exactly one)
ifaceDep region type = 0x8002
Defines an application dependency with a set of interfaces.
Required subregions:
- depAttrs (exactly one)
- path (exactly one)
- depIndexes (exactly one)
privFunc region type = 0x8100
Defines a private function in a bytecode application file.
Required subregions:
- argFrameLen (exactly one)
- localFrameLen (exactly one)
- instrs (exactly one)
- jmpTable (zero or one)
- desc (zero or one)
pubFunc region type = 0x8101
Defines a public function in a bytecode application file.
Required subregions:
- argFrameLen (exactly one)
- localFrameLen (exactly one)
- instrs (exactly one)
- jmpTable (zero or one)
- pubFuncAttrs (exactly one)
- argPerms (zero or one)
- name (exactly one)
- desc (zero or one)
guardFunc region type = 0x8102
Defines a guard function in a bytecode application file.
Required subregions:
- argFrameLen (exactly one)
- localFrameLen (exactly one)
- instrs (exactly one)
- jmpTable (zero or one)
- guardFuncAttrs (exactly one)
- argPerms (zero or one)
- name (exactly one)
- desc (zero or one)
ifaceFunc region type = 0x8103
Defines a function in an interface file.
Required subregions:
- argFrameLen (exactly one)
- ifaceFuncAttrs (exactly one)
- argPerms (zero or one)
- name (exactly one)
- desc (zero or one)
deps region type = 0x8200
Defines an array of dependencies in a bytecode application file or interface file.
Required subregions:
- pathDep (any quantity)
- verDep (any quantity)
- ifaceDep (any quantity)
appFuncs region type = 0x8201
Defines an array of functions in a bytecode application file.
Required subregions:
- privFunc (any quantity)
- pubFunc (any quantity)
- guardFunc (any quantity)
ifaceFuncs region type = 0x8202
Defines an array of functions in an interface file.
Required subregions:
appFile region type = 0x8300
Defines a bytecode application file.
Required subregions:
- fileFormatVer (exactly one)
- deps (zero or one)
- globalFrameLen (exactly one)
- appFuncs (exactly one)
- appData (zero or one)
- desc (zero or one)
ifaceFile region type = 0x8301
Defines an interface file.
Required subregions:
- fileFormatVer (exactly one)
- deps (zero or one)
- ifaceFuncs (exactly one)
- desc (zero or one)
A bytecode application file consists of a single appFile region. An interface file consists of a single ifaceFile region.
MEMORY LAYOUT
Every thread has its own stack containing one or more frames. Each frame contains two separate regions:
- An "alpha region" stores pointers to heap allocations.
- A "beta region" stores a generic sequence of bytes.
For pointer safety, the beta region cannot store pointers, and the alpha region cannot store generic data.
The alpha and beta regions each have their own indexing systems. In the alpha region, each index refers to a distinct pointer. In the beta region, each index refers to a byte offset.
The lengths of alpha and beta regions in a frame remain fixed after they are allocated.
Each frame has one of three types:
- The "global frame" is available at all times after launch.
- A "local frame" is available to the current function invocation.
- An "argument frame" is available to both the invoking function and invoked function.
After the stack is initialized, it contains a single global frame. This frame is never removed.
To invoke a function, the calling function must perform the following steps:
- Allocate an argument frame.
- Populate the argument frame with arguments.
- Call the function and wait for invocation to finish.
- Read return values from the argument frame.
An invoked function follows the steps below:
- Read arguments from the argument frame provided by the calling function.
- Perform the desired set of operations.
- Store return values in the argument frame provided by the calling function.
- Return control to the calling function.
Every application has access to the unified system heap, which provides automatic garbage collection. Heap allocations contains alpha and beta regions in the same fashion as frames. However, a heap allocation may be resized after it is created.
Every heap allocation is associated with protected read and write abilities. An agent must have sufficient permissions to access a heap allocation.
Heap allocations are also associated with the following metadata:
- The agent which created the heap allocation
- A u16 sentry type which may be used for type validation
The default sentry type for a new heap allocation is 0x0000. A "sentry allocation" is a heap allocation whose sentry type is non-zero. The purpose of a sentry allocation is to provide a handle for a resource while restricting read/write access to underlying data.
System sentry types:
- 0x0001 = Error
- 0x0002 = Function handle
- 0x0003 = Thread
- 0x0004 = Launch options
- 0x0005 = Agent
- 0x0006 = Mutex
- 0x0007 = File handle
- 0x0008 = Protab
- 0x0009 = Permission
A vessel may either be a path or an agent sentry. A null agent sentry represents the system. For example, if the system created a heap allocation, the result of allocCreator will be null.
INSTRUCTION SYNTAX
Instruction = [
u16 opcode,
u8 argument amount,
Array of arguments
]
Argument prefix = [
u4 reference type,
u4 data type
]
Reference types:
- 0x0 = Constant
- 0x1 = Global frame
- 0x2 = Local frame
- 0x3 = Argument frame provided by calling function
- 0x4 = Argument frame which the next function invocation will receive
- 0x5 = Application data region
- 0x6 = Heap allocation
Data types:
- 0x0 = p
- 0x1 = u8
- 0x2 = u16
- 0x3 = u32
- 0x4 = u64
- 0x5 = s8
- 0x6 = s16
- 0x7 = s32
- 0x8 = s64
- 0x9 = f32
- 0xA = f64
When an argument has a pointer data type, the argument references an alpha region. When an argument has a non-pointer data type, the argument references a beta region.
Constant argument = [
Argument prefix,
Constant value
]
A constant pointer argument does not supply any inline constant value. All constant pointers are null.
Frame argument = [
Argument prefix,
Frame index as nested argument
]
Application data argument = [
Argument prefix,
Application data index as nested argument
]
Heap allocation argument = [
Argument prefix,
Pointer as nested argument,
Allocation index as nested argument
]
SYSTEM ERRORS
genericErr error code = 0x0000
Thrown if a problem occurs which cannot be described by a more specific error code.
noImplErr error code = 0x0001
Thrown if no implementation is available for the given operation. This includes the following circumstances:
- The interpreter tries to evaluate an instruction which has an unknown opcode
typeErr error code = 0x0002
Thrown if a value or resource has the wrong type. This includes the following circumstances:
- A volume item is a file when a directory is expected
- A volume item is a directory when a file is expected
- A file or directory has an unexpected type
- A file region has an unexpected type
- An instruction argument has an unknown reference type or data type
- An instruction argument is a pointer when a number is expected
- An instruction argument is a number when a pointer is expected
- An instruction argument has an unexpected sentry type
- An instruction argument is not constant when a constant value is expected
numRangeErr error code = 0x0003
Thrown if a number argument is not in an acceptable range. This includes the following circumstances:
- An argument representing a length, size, or number of elements is negative (unless a negative value holds special significance in the context of the instruction)
indexErr error code = 0x0004
Thrown if an index argument is out of bounds or refers to an invalid item. This includes the following circumstances:
- A dependency region index is out of bounds
- A pointer argument index is out of bounds
- An instruction index is out of bounds
- An index in a frame is out of bounds
- An index in the app data region is out of bounds
- An index in a heap allocation is out of bounds
nullErr error code = 0x0005
Thrown if a pointer argument has an unexpected null value.
dataErr error code = 0x0006
Thrown if an argument data structure contains malformed data. This includes the following circumstances:
- A file region has an unexpected size
- A path, name, or text allocation contain an alpha region with non-zero length
- A path contains invalid syntax
- A list contains a beta region with non-zero length
- A list contains a pointer which references an invalid element
argFrameErr error code = 0x0007
Thrown when invoking a function if the next argument frame has invalid structure.
missingErr error code = 0x0008
Thrown if a necessary resource does not exist. This includes the following circumstances:
- A volume required for an operation does not exist
- A volume item required for an operation does not exist
- An agent required for an operation has quit
stateErr error code = 0x0009
Thrown when trying to use a resource which is in an invalid state. This includes the following circumstances:
- A volume required for an operation is unformatted
compatErr error code = 0x000A
Thrown if a resource has the wrong version or interfaces. This includes the following circumstances:
- A bytecode app file or interface file has an incompatible file format version
- A bytecode app conforms to an interface but does not implement every interface function
- A bytecode app defines a public function with no corresponding interface function
- A bytecode app defines a public function in a manner inconsistent with its corresponding interface function
permErr error code = 0x000B
Thrown if the current agent has insufficient permissions to perform an action. This includes the following circumstances:
- An agent tries to directly read the alpha region or beta region of a heap allocation, but the agent does not hold permission to allocReadProtab on the allocation
- An agent tries to directly modify the alpha region, beta region, or sentry type of a heap allocation, but the agent does not hold permission to allocWrtProtab on the allocation
- An agent tries to invoke a public function, but does not hold all pointer argument permissions described by the function
capacityErr error code = 0x000C
Thrown if the system has insufficient hardware resources for the operation.
throttleErr error code = 0x000D
Thrown if the current thread should terminate prematurely. This includes the following circumstances:
- An agent tries to kill one of its own threads
- An agent tries to kill another agent
- The system tries to kill an agent to free memory
MEMORY INSTRUCTIONS
wrt dest, value
Writes a value from one memory location to another.
- wrt opcode = 0x0000
- dest = Destination for writing (number or pointer)
- value = Value to write (number or pointer)
newArgFrame aLen, bLen
Creates a new argument frame to feed into the next function invocation.
- newArgFrame opcode = 0x0001
- aLen = Length of alpha region in the new argument frame (number)
- bLen = Length of beta region in the new argument frame (number)
newAlloc dest, aLen, bLen
Creates a new heap allocation.
- newAlloc opcode = 0x0002
- dest = Destination for the new heap allocation (pointer)
- aLen = Length of alpha region in the new heap allocation (number)
- bLen = Length of beta region in the new heap allocation (number)
copyAlloc dest, alloc
Copies an existing heap allocation.
- copyAlloc opcode = 0x0003
- dest = Destination for the new heap allocation (pointer)
- alloc = Heap allocation (pointer)
allocALen dest, alloc
Retrieves the alpha region length of a heap allocation.
- allocALen opcode = 0x0004
- dest = Destination for the alpha region length (number)
- alloc = Heap allocation (pointer)
setAllocALen alloc, len
Modifies the alpha region length of a heap allocation. Either truncates existing values or appends additional null pointers.
- setAllocALen opcode = 0x0005
- alloc = Heap allocation (pointer)
- len = New length for the alpha region (number)
allocBLen dest, alloc
Retrieves the beta region length of a heap allocation.
- allocBLen opcode = 0x0006
- dest = Destination for the beta region length (number)
- alloc = Heap allocation (pointer)
setAllocBLen alloc, len
Modifies the beta region length of a heap allocation. Either truncates existing values or appends additional zeroes.
- setAllocBLen opcode = 0x0007
- alloc = Heap allocation (pointer)
- len = New length for the beta region (number)
setAllocLen alloc, aLen, bLen
Modifies both alpha and beta region lengths in the given heap allocation. This instruction may be more efficient that consecutive invocations of setAllocALen and setAllocBLen.
- setAllocLen opcode = 0x0008
- alloc = Heap allocation (pointer)
- aLen = New length for the alpha region (number)
- bLen = New length for the beta region (number)
allocCreator dest, alloc
Retrieves the sentry of the agent which created the given heap allocation. The result is null if the allocation was created by the system.
- allocCreator opcode = 0x0009
- dest = Destination for the result (pointer)
- alloc = Heap allocation (pointer)
allocSType dest, alloc
Retrieves the sentry type of a heap allocation.
- allocSType opcode = 0x000A
- dest = Destination for the sentry type (number)
- alloc = Heap allocation (pointer)
setAllocSType alloc, sType
Modifies the sentry type of a heap allocation. The sentry type must be within the range of u16.
- setAllocSType opcode = 0x000B
- alloc = Heap allocation (pointer)
- sType = New sentry type for the heap allocation (number)
- Throws numRangeErr if sType is not in the range of u16.
JUMP INSTRUCTIONS
jmp instrIndex
Jumps control flow to another instruction within the current function.
- jmp opcode = 0x0100
- instrIndex = Index of instruction within the current function (constant number)
jmpZ instrIndex, cond
Jumps control flow to another instruction if the given value is zero.
- jmpZ opcode = 0x0101
- instrIndex = Index of instruction within the current function (constant number)
- cond = Condition value (number)
jmpNZ instrIndex, cond
Jumps control flow to another instruction if the given value is not zero.
- jmpNZ opcode = 0x0102
- instrIndex = Index of instruction within the current function (constant number)
- cond = Condition value (number)
jmpTable tableIndex
Jumps control flow to another instruction. Uses the jump table of the current function to look up an instruction index.
- jmpTable opcode = 0x0103
- tableIndex = Index within the jump table of the current function (number)
- Throws indexErr if tableIndex is out of bounds.
ERROR INSTRUCTIONS
setErrJmp instrIndex
Configures an error handler within the current function. If an error is thrown, control flow will jump to the error handler.
- setErrJmp opcode = 0x0200
- instrIndex = Index of instruction within the current function (constant number)
clrErrJmp
Removes any error handler from the current function. If an error is thrown, it will be passed to the invoking function.
- clrErrJmp opcode = 0x0201
throw code, msg, data
Throws an error which will be handled by the invoking function. The error code must be in the range of u16.
- throw opcode = 0x0202
- code = Error code (number)
- msg = Human-readable description of the error (pointer)
- data = Additional data associated with the error (pointer)
- Throws numRangeErr if code is not in the range of u16.
rethrow err
Throws the given error again without resetting its stack trace.
- rethrow opcode = 0x0203
- err = Error sentry (pointer)
err dest
Retrieves the last error which was caught in the current function invocation. The result will be null if no error has been caught by an error handler.
- err opcode = 0x0204
- dest = Destination for the error sentry (pointer)
threadErr dest, thread
Retrieves the unhandled error which terminated the given thread. The result will be null if the given thread was not terminated by an unhandled error.
- threadErr opcode = 0x0205
- dest = Destination for the error sentry (pointer)
- thread = Thread sentry (pointer)
agentInitErr dest, agent
Retrieves the unhandled error which terminated the init function of the given agent. The result will be null if the given agent does not conform to the initable interface, or if the init function of the given agent was not terminated by an unhandled error.
- agentInitErr opcode = 0x0206
- dest = Destination for the error sentry (pointer)
- agent = Agent sentry (pointer)
errCode dest, err
Retrieves the error code of the given error.
- errCode opcode = 0x0207
- dest = Destination for the error code (number)
- err = Error sentry (pointer)
errMsg dest, err
Retrieves a human-readable description of the given error.
- errMsg opcode = 0x0208
- dest = Destination for the text heap allocation (pointer)
- err = Error sentry (pointer)
errData dest, err
Retrieves the data associated with the given error.
- errData opcode = 0x0209
- dest = Destination for the heap allocation (pointer)
- err = Error sentry (pointer)
errAgent dest, err
Retrieves the sentry of the agent which threw the given error.
- errAgent opcode = 0x020A
- dest = Destination for the agent sentry (pointer)
- err = Error sentry (pointer)
errTrace dest, err
Retrieves a stack trace for the given error.
- errTrace opcode = 0x020B
- dest = Destination for the stack trace (pointer)
- err = Error sentry (pointer)
FUNCTION HANDLE INSTRUCTIONS
indexFuncHandle dest, funcIndex
Retrieves a function handle for a private or public function in the current agent.
- indexFuncHandle opcode = 0x0300
- dest = Destination for the function handle sentry (pointer)
- funcIndex = Index of a function in the functions region (constant number)
ifaceFuncHandle dest, agent, ifacePath, funcName
Retrieves a function handle for a public function in the given agent.
- ifaceFuncHandle opcode = 0x0301
- dest = Destination for the function handle sentry (pointer)
- agent = Agent sentry (pointer)
- ifacePath = Interface file path (pointer)
- funcName = Function name (pointer)
- Throws compatErr if agent does not conform to the given interface.
- Throws compatErr if funcName does not exist in the given interface.
funcHandleIsPub dest, funcHandle
Retrieves whether the given function handle is public.
- funcHandleIsPub opcode = 0x0302
- dest = Destination for the result (number)
- funcHandle = Function handle sentry (pointer)
funcHandleAgent dest, funcHandle
Retrieves the agent to which the given function handle belongs.
- funcHandleAgent opcode = 0x0303
- dest = Destination for the agent sentry (pointer)
- funcHandle = Function handle sentry (pointer)
funcHandleIface dest, funcHandle
Retrieves the path of the interface to which the given function handle belongs. The result is null if the function is private.
- funcHandleIface opcode = 0x0304
- dest = Destination for the interface path (pointer)
- funcHandle = Function handle sentry (pointer)
funcHandleName dest, funcHandle
Retrieves the function name of the given function handle. The result is null if the function is private.
- funcHandleName opcode = 0x0305
- dest = Destination for the function name (pointer)
- funcHandle = Function handle sentry (pointer)
funcHandleIndex dest, funcHandle
Retrieves the function index of the given function handle.
- funcHandleIndex opcode = 0x0306
- dest = Destination for the function index (number)
- funcHandle = Function handle sentry (pointer)
FUNCTION INVOCATION INSTRUCTIONS
callIndex funcIndex
Synchronously invokes a function which is defined in the current agent. The function runs in the current thread.
- callIndex opcode = 0x0400
- funcIndex = Index of a function in the functions region (constant number)
callHandle funcHandle
Synchronously invokes the given function handle. The function runs in the current thread.
- callHandle opcode = 0x0401
- funcHandle = Function handle sentry (pointer)
ret
Exits the current function and returns control flow to the invoking function.
caller dest
Retrieves the sentry of the agent which invoked the current function.
- caller opcode = 0x0403
- dest = Destination for the agent sentry (pointer)
guardCaller dest
Retrieves the agent which invoked the public function corresponding to the current guard function.
- guardCaller opcode = 0x0404
- dest = Destination for the agent sentry (pointer)
- Throws typeErr if the current function is not a guard function.
guardImplementer dest
Retrieves the agent which implements the public function corresponding to the current guard function.
- guardImplementer opcode = 0x0405
- dest = Destination for the agent sentry (pointer)
- Throws typeErr if the current function is not a guard function.
funcMemPrio dest
Retrieves the memory priority of the current function invocation.
- funcMemPrio opcode = 0x0406
- dest = Destination for the memory priority (number)
setFuncMemPrio prio
Modifies the memory priority of the current function invocation. The priority must be in the range of u16.
- setFuncMemPrio opcode = 0x0407
- prio = Memory priority (number)
- Throws numRangeErr if prio is not in the range of u16.
funcCorePrio dest
Retrieves the core priority of the current function invocation.
- funcCorePrio opcode = 0x0408
- dest = Destination for the core priority (number)
setFuncCorePrio prio
Modifies the core priority of the current function invocation. The priority must be in the range of u16.
- setFuncCorePrio opcode = 0x0409
- prio = Core priority (number)
- Throws numRangeErr if prio is not in the range of u16.
THREAD INSTRUCTIONS
callIndexAsync dest, funcIndex
Asynchronously invokes a function which is defined in the current agent. The function runs in a new thread.
- callIndexAsync opcode = 0x0500
- dest = Destination for the sentry of the new thread (pointer)
- funcIndex = Index of a function in the functions region (constant number)
callHandleAsync dest, funcHandle
Asynchronously invokes the given function handle. The function runs in a new thread.
- callHandleAsync opcode = 0x0501
- dest = Destination for the sentry of the new thread (pointer)
- funcHandle = Function handle sentry (pointer)
thisThread dest
Retrieves a sentry for the current thread.
- thisThread opcode = 0x0502
- dest = Destination for the thread sentry (pointer)
threads dest
Retrieves a list of all threads in the current agent.
- threads opcode = 0x0503
- dest = Destination for the list of thread sentries (pointer)
threadAgent dest, thread
Retrieves a sentry of the agent to which the given thread belongs.
- threadAgent opcode = 0x0504
- dest = Destination for the agent sentry (pointer)
- thread = Thread sentry (pointer)
threadFuncHandle dest, thread
Retrieves a function handle for the base function in the given thread.
- threadFuncHandle opcode = 0x0505
- dest = Destination for the function handle sentry (pointer)
- thread = Thread sentry (pointer)
quitThread
Terminates the current thread.
- quitThread opcode = 0x0506
threadHasQuit dest, thread
Retrieves whether the given thread has quit.
- threadHasQuit opcode = 0x0507
- dest = Destination for the result (number)
- thread = Thread sentry (pointer)
killThread thread
Terminates the given thread. The thread must be in the current agent.
- killThread opcode = 0x0508
- thread = Thread sentry (pointer)
BITWISE INSTRUCTIONS
bNot dest, value
Performs bitwise NOT with the given value.
- bNot opcode = 0x0600
- dest = Destination for the result (number)
- value = Operand (number)
bOr dest, value1, value2
Performs bitwise OR with the given values.
- bOr opcode = 0x0601
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
bAnd dest, value1, value2
Performs bitwise AND with the given values.
- bAnd opcode = 0x0602
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
bXor dest, value1, value2
Performs bitwise XOR with the given values.
- bXor opcode = 0x0603
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
bLeft dest, value1, value2
Performs bitshift left with the given values.
- bLeft opcode = 0x0604
- dest = Destination for the result (number)
- value1 = Value to shift (number)
- value2 = Amount by which to shift (number)
bRight dest, value1, value2
Performs bitshift right with the given values.
- bRight opcode = 0x0605
- dest = Destination for the result (number)
- value1 = Value to shift (number)
- value2 = Amount by which to shift (number)
LOGICAL INSTRUCTIONS
lNot dest, value
Performs logical NOT with the given value.
- lNot opcode = 0x0700
- dest = Destination for the result (number)
- value = Operand (number)
lOr dest, value1, value2
Performs logical OR with the given values.
- lOr opcode = 0x0701
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
lAnd dest, value1, value2
Performs logical AND with the given values.
- lAnd opcode = 0x0702
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
lXor dest, value1, value2
Performs logical XOR with the given values.
- lXor opcode = 0x0703
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
COMPARISON INSTRUCTIONS
equ dest, value1, value2
Determines whether the given values are equal.
- equ opcode = 0x0800
- dest = Destination for the result (number)
- value1 = First operand (number or pointer)
- value2 = Second operand (number or pointer)
nEqu dest, value1, value2
Determines whether the given values are not equal.
- nEqu opcode = 0x0801
- dest = Destination for the result (number)
- value1 = First operand (number or pointer)
- value2 = Second operand (number or pointer)
gre dest, value1, value2
Determines whether the first value is greater than the second value.
- gre opcode = 0x0802
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
nGre dest, value1, value2
Determines whether the first value is not greater than the second value.
- nGre opcode = 0x0803
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
ARITHMETIC INSTRUCTIONS
add dest, value1, value2
Performs addition with the given values.
- add opcode = 0x0900
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
sub dest, value1, value2
Performs subtraction with the given values.
- sub opcode = 0x0901
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
mul dest, value1, value2
Performs multiplication with the given values.
- mul opcode = 0x0902
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
div dest, value1, value2
Performs division with the given values.
- div opcode = 0x0903
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
- Throws numRangeErr if value2 is zero.
mod dest, value1, value2
Performs the modulo operation with the given values.
- mod opcode = 0x0904
- dest = Destination for the result (number)
- value1 = First operand (number)
- value2 = Second operand (number)
- Throws numRangeErr if value2 is zero.
BUFFER INSTRUCTIONS
wrtBuff dest, buff, len
Copies a sequence of bytes or pointers between memory locations.
- wrtBuff opcode = 0x0A00
- dest = Start of the destination buffer (number or pointer)
- buff = Start of the source buffer (number or pointer)
- len = Number of bytes or pointers in the buffer (number)
- Throws numRangeErr if len reaches outside allocation bounds.
equBuff dest, buff1, len1, buff2, len2
Determines whether two sequences of bytes or pointers are equal.
- equBuff opcode = 0x0A01
- dest = Destination for the result (number)
- buff1 = Start of the first buffer (number or pointer)
- len1 = Number of bytes or pointers in the first buffer (number)
- buff2 = Start of the second buffer (number or pointer)
- len2 = Number of bytes or pointers in the second buffer (number)
- Throws numRangeErr if len1 or len2 reach outside allocation bounds.
findBuff dest, buff1, buff2, len2, strideOffset, strideCount
Searches for the second buffer in the first buffer. After each comparison, the search position changes by strideOffset. If strideOffset is positive, the position moves forward. If strideOffset is negative, the position moves backward. The result is the number of strides until the second buffer is found. If the second buffer is not found after strideCount strides, the result is -1.
- findBuff opcode = 0x0A02
- dest = Destination for the result (number)
- buff1 = Start of the buffer in which to search (number or pointer)
- buff2 = Start of the pattern buffer (number or pointer)
- len2 = Number of bytes or pointers in the pattern buffer (number)
- strideOffset = Number of bytes or pointers by which to advance for each stride (number)
- strideCount = Maximum number of strides (number)
- Throws numRangeErr if len2 or strideCount reach outside allocation bounds.
- Throws numRangeErr if strideOffset is zero.
fillBuff dest, len1, buff, len2
Fills the first buffer with copies of the second buffer. If len1 is not a multiple of len2, the last copy of the second buffer will be truncated.
- fillBuff opcode = 0x0A03
- dest = Destination buffer to fill (number or pointer)
- len1 = Number of bytes or pointers in the destination buffer (number)
- buff = Start of the pattern buffer (number or pointer)
- len2 = Number of bytes or pointers in the pattern buffer (number)
- Throws numRangeErr if len1 or len2 reach outside allocation bounds.
TEXT INSTRUCTIONS
cmpText dest, text1, text2
Determines the lexicographical ordering of two text heap allocations according to character values. The result is -1 if the first text is before the second text, 0 if the first text equals the second text, and 1 if the first text is after the second text.
- cmpText opcode = 0x0B00
- dest = Destination for the result (number)
- text1 = First text heap allocation (pointer)
- text2 = Second text heap allocation (pointer)
textToNum dest, text, base
Converts the given text heap allocation to a number.
- textToNum opcode = 0x0B01
- dest = Destination for the result (number)
- text = Text heap allocation (pointer)
- base = Base in which to interpret the text (number)
- Throw dataErr if text contains invalid number syntax.
- Throw numRangeErr if base is not between 2 and 36 inclusive.
numToText dest, num, base
Converts the given number to a text heap allocation.
- numToText opcode = 0x0B02
- dest = Destination for the result (pointer)
- num = Number to convert (number)
- base = Base for the new text allocation (number)
- Throw numRangeErr if base is not between 2 and 36 inclusive.
textToUpper text
Converts the given text heap allocation to uppercase.
- textToUpper opcode = 0x0B03
- text = Text heap allocation to convert (pointer)
textToLower text
Converts the given text heap allocation to lowercase.
- textToLower opcode = 0x0B04
- text = Text heap allocation to convert (pointer)
splitText dest, text, delim
Splits the given text heap allocation into a list of text heap allocations.
- splitText opcode = 0x0B05
- dest = Destination for the result (pointer)
- text = Text heap allocation to split (pointer)
- delim = Delimiter text heap allocation (pointer)
joinText dest, textList, delim
Joins the given list of text heap allocations into a single text heap allocation.
- joinText opcode = 0x0B06
- dest = Destination for the result (pointer)
- textList = List of text heap allocations to join (pointer)
- delim = Delimiter text heap allocation (pointer)
HIGHER-LEVEL MATHEMATIC INSTRUCTIONS
rand dest, min, max
Generates a pseudo-random number.
- rand opcode = 0x0C00
- dest = Destination for the result (number)
- min = Inclusive minimum value for the result (number)
- max = Exclusive maximum value for the result (number)
- Throws numRangeErr if max is less than min.
sin dest, value
Performs sine with the given value.
- sin opcode = 0x0C01
- dest = Destination for the result (number)
- value = Operand (number)
cos dest, value
Performs cosine with the given value.
- cos opcode = 0x0C02
- dest = Destination for the result (number)
- value = Operand (number)
tan dest, value
Performs tangent with the given value.
- tan opcode = 0x0C03
- dest = Destination for the result (number)
- value = Operand (number)
- Throws numRangeErr if value is equal to (1/2 + c) * pi for some integer c.
asin dest, value
Performs inverse sine with the given value.
- asin opcode = 0x0C04
- dest = Destination for the result (number)
- value = Operand (number)
- Throws numRangeErr if value is not between -1 and 1 inclusive.
acos dest, value
Performs inverse cosine with the given value.
- acos opcode = 0x0C05
- dest = Destination for the result (number)
- value = Operand (number)
- Throws numRangeErr if value is not between -1 and 1 inclusive.
atan dest, value
Performs inverse tangent with the given value.
- atan opcode = 0x0C06
- dest = Destination for the result (number)
- value = Operand (number)
pow dest, base, exp
Performs exponentiation with the given values.
- pow opcode = 0x0C07
- dest = Destination for the result (number)
- base = Base (number)
- exp = Exponent (number)
- Throws numRangeErr if the result would have an imaginary component.
log dest, base, value
Performs a logarithm with the given value.
- log opcode = 0x0C08
- dest = Destination for the result (number)
- base = Base (number)
- value = Logarithm argument (number)
- Throws numRangeErr if base or value are non-positive.
LAUNCH OPTION INSTRUCTIONS
newLaunchOpt dest
Creates a new launch options sentry with default values.
- newLaunchOpt opcode = 0x0D00
- dest = Destination for the launch options sentry (pointer)
launchOptIsRef dest, launchOpt
Retrieves whether the launched agent will be a reference of the current agent.
- launchOptIsRef opcode = 0x0D01
- dest = Destination for whether the launched agent will be a reference (number)
- launchOpt = Launch options sentry (pointer)
setLaunchOptIsRef launchOpt, isRef
Modifies whether the launched agent will be a reference of the current agent.
- setLaunchOptIsRef opcode = 0x0D02
- launchOpt = Launch options sentry (pointer)
- isRef = Whether the launched agent will be a reference (number)
launchOptMemQuota dest, launchOpt
Retrieves the memory quota size of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- launchOptMemQuota opcode = 0x0D03
- dest = Destination for the memory quota size (number)
- launchOpt = Launch options sentry (pointer)
setLaunchOptMemQuota launchOpt, size
Modifies the memory quota size of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- setLaunchOptMemQuota opcode = 0x0D04
- launchOpt = Launch options sentry (pointer)
- size = Memory quota size (number)
launchOptMemPrio dest, launchOpt
Retrieves the memory priority of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- launchOptMemPrio opcode = 0x0D05
- dest = Destination for the memory priority (number)
- launchOpt = Launch options sentry (pointer)
setLaunchOptMemPrio launchOpt, prio
Modifies the memory priority of the launched agent with respect to the current agent. The priority must be in the range of u16. This option is only valid if the launched agent is configured to be a life child of the launcher.
- setLaunchOptMemPrio opcode = 0x0D06
- launchOpt = Launch options sentry (pointer)
- prio = Memory priority (number)
- Throws numRangeErr if prio is not in the range of u16.
launchOptCoreQuota dest, launchOpt
Retrieves the core quota load of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- launchOptCoreQuota opcode = 0x0D07
- dest = Destination for the core quota load (number)
- launchOpt = Launch options sentry (pointer)
setLaunchOptCoreQuota launchOpt, load
Modifies the core quota load of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- setLaunchOptCoreQuota opcode = 0x0D08
- launchOpt = Launch options sentry (pointer)
- load = Core quota load (number)
- Throws numRangeErr if load is not between 0 and 1 inclusive.
launchOptCorePrio dest, launchOpt
Retrieves the core priority of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.
- launchOptCorePrio opcode = 0x0D09
- dest = Destination for the core priority (number)
- launchOpt = Launch options sentry (pointer)
setLaunchOptCorePrio launchOpt, prio
Modifies the core priority of the launched agent with respect to the current agent. The priority must be in the range of u16. This option is only valid if the launched agent is configured to be a life child of the launcher.
- setLaunchOptCorePrio opcode = 0x0D0A
- launchOpt = Launch options sentry (pointer)
- prio = Core priority (number)
- Throws numRangeErr if prio is not in the range of u16.
AGENT INSTRUCTIONS
launch dest, appPath, launchOpt
Launches the given application. launchOpt may be left null for default launch options.
- launch opcode = 0x0E00
- dest = Destination for the sentry of the new agent (pointer)
- appPath = Application file path (pointer)
- launchOpt = Launch options sentry (pointer)
findOrLaunch dest, appPath, launchOpt
Finds an agent running the given application. If such an agent does not exist, launches the application. launchOpt may be left null for default launch options.
- findOrLaunch opcode = 0x0E01
- dest = Destination for the agent sentry (pointer)
- appPath = Application file path (pointer)
- launchOpt = Launch options sentry (pointer)
thisAgent dest
Retrieves the sentry of the current agent.
- thisAgent opcode = 0x0E02
- dest = Destination for the agent sentry (pointer)
allAgents dest
Retrieves a list of all active agent sentries.
- allAgents opcode = 0x0E03
- dest = Destination for the list of agent sentries (pointer)
quitAgent
Terminates the current agent.
- quitAgent opcode = 0x0E04
agentHasQuit dest, agent
Retrieves whether the given agent has quit.
- agentHasQuit opcode = 0x0E05
- dest = Destination for the result (number)
- agent = Agent sentry (pointer)
agentAppPath dest, agent
Retrieves the application file path of the given agent.
- agentAppPath opcode = 0x0E06
- dest = Destination for the application file path (pointer)
- agent = Agent sentry (pointer)
agentLauncher dest, agent
Retrieves the agent which launched the given agent. The result is null if the agent was launched by the system.
- agentLauncher opcode = 0x0E07
- dest = Destination for the sentry of the launcher agent (pointer)
- agent = Agent sentry (pointer)
agentRefs dest, agent
Retrieves a list of agent references of agent.
- agentRefs opcode = 0x0E08
- dest = Destination for the list of agent sentries (pointer)
- agent = Agent sentry (pointer)
agentIsRef dest, agent
Retrieves whether agent is a reference of the current agent.
- agentIsRef opcode = 0x0E09
- dest = Destination for whether the given agent is a reference (number)
- agent = Agent sentry (pointer)
setAgentIsRef agent, isRef
Modifies whether agent is a reference of the current agent.
- setAgentIsRef opcode = 0x0E0A
- agent = Agent sentry (pointer)
- isRef = Whether the given agent should be a reference (number)
agentIsColl dest, agent
Retrieves whether the given agent is collectable when it is not a reference to any agent.
- agentIsColl opcode = 0x0E0B
- dest = Destination for whether the current agent is collectable (number)
- agent = Agent sentry (pointer)
setAgentIsColl isColl
Modifies whether the current agent is collectable when it is not a reference to any agent.
- setAgentIsColl opcode = 0x0E0C
- isColl = Whether the current agent should be collectable (number)
throttleAgent agent
Requests for the given agent to reduce memory usage
- throttleAgent opcode = 0x0E0D
- agent = Agent sentry (pointer)
killAgent agent
Requests for the given agent to terminate.
- killAgent opcode = 0x0E0E
- agent = Agent sentry (pointer)
MUTEX INSTRUCTIONS
newMutex dest
Creates a new mutex for cross-thread and cross-agent mutual exclusion.
- newMutex opcode = 0x0F00
- dest = Destination for the sentry of the new mutex (pointer)
lockMutex mutex
Acquires an exclusive lock on the given mutex. If the mutex is already locked, synchronously waits until the lock is released.
- lockMutex opcode = 0x0F01
- mutex = Mutex sentry (pointer)
lockMutexNoWait dest, mutex
Acquires an exclusive lock on the given mutex. If the mutex was already locked, another lock will not be acquired.
- lockMutexNoWait opcode = 0x0F02
- dest = Destination for whether the mutex was already locked (number)
- mutex = Mutex sentry (pointer)
relMutex mutex
Releases an exclusive lock on the given mutex.
- relMutex opcode = 0x0F03
- mutex = Mutex sentry (pointer)
- Throws stateErr if mutex is not locked.
VOLUME INSTRUCTIONS
allVols dest
Retrieves a list of all available volume names.
- allVols opcode = 0x1000
- dest = Destination for the list of volume names (pointer)
renameVol oldName, newName
Modifies the name of a volume.
- renameVol opcode = 0x1001
- oldName = Old volume name (pointer)
- newName = New volume name (pointer)
volDriver dest, vol
Retrieves the agent which is the volume driver for the given volume.
- volDriver opcode = 0x1002
- dest = Destination for the result (pointer)
- vol = Volume name (pointer)
ejectVol vol
Indicates to the system that the given volume will soon be physically disconnected.
- ejectVol opcode = 0x1003
- vol = Volume name (pointer)
volIsFormatted dest, vol
Retrieves whether the given volume has been formatted.
- volIsFormatted opcode = 0x1004
- dest = Destination for the result (number)
- vol = Volume name (pointer)
formatVol vol
Formats the given volume, erasing any old content.
- formatVol opcode = 0x1005
- vol = Volume name (pointer)
isVolClient dest, vol
Retrieves whether the current agent is a volume client of the given volume.
- isVolClient opcode = 0x1006
- dest = Destination for the result (number)
- vol = Volume name (pointer)
setIsVolClient vol, isClient
Modifies whether the current agent is a volume client of the given volume.
- setIsVolClient opcode = 0x1007
- vol = Volume name (pointer)
- isClient = Whether the current agent will be a volume client (number)
isVolDriver dest
Retrieves whether the current agent is a volume driver.
- isVolDriver opcode = 0x1008
- dest = Destination for the result (number)
setIsVolDriver isDriver
Modifies whether the current agent is a volume driver.
- setIsVolDriver opcode = 0x1009
- isDriver = Whether the current agent will be a volume driver (number)
VOLUME ITEM INSTRUCTIONS
vItemExists dest, path
Retrieves whether a volume item with the given path exists.
- vItemExists opcode = 0x1100
- dest = Destination for the result (number)
- path = Volume item path (pointer)
vItemIsDir dest, path
Retrieves whether the given volume item is a directory or a file. The result is 1 if the volume item is a directory, and 0 if the volume item is a file.
- vItemIsDir opcode = 0x1101
- dest = Destination for the result (number)
- path = Volume item path (pointer)
vItemIsSLink dest, path
Retrieves whether the given volume item is a soft link.
- vItemIsSLink opcode = 0x1102
- dest = Destination for the result (number)
- path = Volume item path (pointer)
moveVItem destPath, srcPath
Moves the given volume item from one path to another.
- moveVItem opcode = 0x1103
- destPath = Destination path for the volume item (pointer)
- srcPath = Source path for the volume item (pointer)
- Throws dataErr if destPath is a subdirectory of srcPath.
FILE INSTRUCTIONS
newFile path, type
Creates a new empty file.
- newFile opcode = 0x1200
- path = Path for the new file (pointer)
- type = Type for the new file (number)
copyFile destPath, srcPath
Creates a copy of the given file.
- copyFile opcode = 0x1201
- destPath = Destination path for the new file (pointer)
- srcPath = Source file path (pointer)
delFile path
Deletes the given file.
- delFile opcode = 0x1202
- path = File path (pointer)
fileType dest, path
Retrieves the type of the given file.
- fileType opcode = 0x1203
- dest = Destination for the file type (number)
- path = File path (pointer)
setFileType path, type
Modifies the type of the given file.
- setFileType opcode = 0x1204
- path = File path (pointer)
- type = File type (number)
openFile dest, path
Opens the given file for reading and writing.
- openFile opcode = 0x1205
- dest = Destination for the file handle sentry (pointer)
- path = File path (pointer)
flushFile fileHandle
Persists any cached file modifications to storage.
- flushFile opcode = 0x1206
- fileHandle = File handle sentry (pointer)
- Throws stateErr if fileHandle has been closed.
closeFile fileHandle
Frees resources associated with the given file handle. Flushes any cached file modifications.
- closeFile opcode = 0x1207
- fileHandle = File handle sentry (pointer)
- Throws stateErr if fileHandle has already been closed.
fileIsOpen dest, fileHandle
Retrieves whether the given file handle is open.
- fileIsOpen opcode = 0x1208
- dest = Destination for the result (number)
- fileHandle = File handle sentry (pointer)
fileSize dest, fileHandle
Retrieves the size of the contents in the given file.
- fileSize opcode = 0x1209
- dest = Destination for the file size (number)
- fileHandle = File handle sentry (pointer)
- Throws stateErr if fileHandle has been closed.
setFileSize fileHandle, size
Modifies the size of the contents in the given file. Truncates data or appends zeroes as necessary.
- setFileSize opcode = 0x120A
- fileHandle = File handle sentry (pointer)
- size = New size for the file (number)
- Throws stateErr if fileHandle has been closed.
readFile dest, fileHandle, offset, size
Reads a sequences of bytes from the given file into a buffer.
- readFile opcode = 0x120B
- dest = Destination for file data (number)
- fileHandle = File handle sentry (pointer)
- offset = Offset within the file (number)
- size = Number of bytes to read (number)
- Throws stateErr if fileHandle has been closed.
- Throws indexErr if offset is outside file bounds.
- Throws numRangeErr if size reaches outside file or allocation bounds.
wrtFile fileHandle, offset, buff, size
Writes a sequences of bytes from the given buffer into a file.
- wrtFile opcode = 0x120C
- fileHandle = File handle sentry (pointer)
- offset = Offset within the file (number)
- buff = Data buffer (number)
- size = Number of bytes to write (number)
- Throws stateErr if fileHandle has been closed.
- Throws indexErr if offset is outside file bounds.
- Throws numRangeErr if size reaches outside file or allocation bounds.
DIRECTORY INSTRUCTIONS
newDir path, type
Creates a new directory.
- newDir opcode = 0x1300
- path = Path for the new directory (pointer)
- type = Type for the new directory (number)
copyDir destPath, srcPath
Recursively creates a copy of the given directory and its contents.
- copyDir opcode = 0x1301
- destPath = Destination path for the new directory (pointer)
- srcPath = Source directory path (pointer)
delDir path
Recursively deletes the given directory and its contents.
- delDir opcode = 0x1302
- path = Directory path (pointer)
dirType dest, path
Retrieves the type of the given directory.
- dirType opcode = 0x1303
- dest = Destination for the directory type (number)
- path = Directory path (pointer)
setDirType path, type
Modifies the type of the given directory.
- setDirType opcode = 0x1304
- path = Directory path (pointer)
- type = Directory type (number)
dirItems dest, path
Retrieves a list of volume item names in the given directory.
- dirItems opcode = 0x1305
- dest = Destination for the list of names (pointer)
- path = Directory path (pointer)
SOFT LINK INSTRUCTIONS
newSLink path1, path2
Creates a soft link between the given paths.
- newSLink opcode = 0x1400
- path1 = Path in which to create the new soft link (pointer)
- path2 = Path to which the new soft link will point (pointer)
sLinkPath dest, path
Retrieves the path to which a soft link points.
- sLinkPath opcode = 0x1401
- dest = Destination for the result (pointer)
- path = Soft link path (pointer)
- Throws typeErr if the volume item at path is not a soft link.
setSLinkPath path1, path2
Modifies the path to which a soft link points.
- setSLinkPath opcode = 0x1402
- path1 = Path containing the soft link to modify (pointer)
- path2 = Path to which the soft link will point (pointer)
- Throws typeErr if the volume item at path is not a soft link.
PATH INSTRUCTIONS
depPath dest, depIndex
Retrieves the path of the given dependency. This path is resolved by the system when the application launches. If the dependency path could not be resolved, the result is null.
- depPath opcode = 0x1500
- dest = Destination for the result (pointer)
- depIndex = Index in the dependencies region (number)
splitPath tailDest, headDest, path
Splits the given path into parent directory and name components.
- splitPath opcode = 0x1501
- tailDest = Destination for the parent directory path (pointer)
- headDest = Destination for the volume item name (pointer)
- path = Path to split (pointer)
- Throws dataErr if path does not have a parent directory.
joinPath dest, tail, head
Joins the given parent directory and name components into a single path.
- joinPath opcode = 0x1502
- dest = Destination for the result (pointer)
- tail = Parent directory path (pointer)
- head = Volume item name (pointer)
pathVol dest, path
Retrieves the volume name of a path.
- pathVol opcode = 0x1503
- dest = Destination for the volume name (pointer)
- path = Volume item path (pointer)
setPathVol dest, path, vol
Sets the volume name in a path.
- setPathVol opcode = 0x1504
- dest = Destination for the modified path (pointer)
- path = Volume item path (pointer)
- vol = Volume name (pointer)
searchPaths dest, path
Retrieves the search paths associated with the given volume item.
- searchPaths opcode = 0x1505
- dest = Destination for the list of search paths (pointer)
- path = Volume item path (pointer)
setSearchPaths path, searchPaths
Modifies the search paths associated with the given volume item.
- setSearchPaths opcode = 0x1506
- path = Volume item path with which to bind the search paths (pointer)
- searchPaths = List of search paths (pointer)
COMPATIBILITY INSTRUCTIONS
verMeetsReq dest, ver, reqVer
Retrieves whether the first version number satisfies the requirement of the second version number.
- verMeetsReq opcode = 0x1600
- dest = Destination for the result (number)
- ver = Version number (pointer)
- reqVer = Requirement version number (pointer)
- Throws dataErr if ver or reqVer are malformed.
bytecodeVer dest
Retrieves the bytecode format version number of the current runtime environment.
- bytecodeVer opcode = 0x1601
- dest = Destination for the version number (pointer)
hasOpcode dest, opcode
Retrieves whether the given opcode is available in the current runtime environment.
- hasOpcode opcode = 0x1602
- dest = Destination for the result (number)
- opcode = Instruction opcode (number)
- Throws numRangeErr if opcode is not in the range of u16.
bundleVer dest, path
Retrieves the version number of the given application or interface file with respect to its bundle. The result is null if the file is not a member of a bundle.
- bundleVer opcode = 0x1603
- dest = Destination for the version number (pointer)
- path = Application or interface file path (pointer)
bundleVers dest, path
Retrieves the version numbers available in an application or interface bundle.
- bundleVers opcode = 0x1604
- dest = Destination for the list of version numbers (pointer)
- path = Application or interface bundle path (pointer)
bundleVerPath dest, path, ver
Retrieves the path of an application or interface file with the given bundle version.
- bundleVerPath opcode = 0x1605
- dest = Destination for the path (pointer)
- path = Application or interface bundle path (pointer)
- ver = Version number (pointer)
- Throws dataErr if ver is malformed.
appIfaces dest, appPath
Retrieves a list of interface paths to which the given application conforms. The result list may contain paths to interface files and interface bundles.
- appIfaces opcode = 0x1606
- dest = Destination for the list of interface paths (pointer)
- appPath = Application file path (pointer)
appHasIface dest, appPath, ifacePath
Retrieves whether the given application conforms to an interface.
- appHasIface opcode = 0x1607
- dest = Destination for the result (number)
- appPath = Application file path (pointer)
- ifacePath = Interface file or bundle path (pointer)
appIfaceVer dest, appPath, ifacePath
Retrieves the version number of the interface to which the given application conforms.
- appIfaceVer opcode = 0x1608
- dest = Destination for the version number (pointer)
- appPath = Application file path (pointer)
- ifacePath = Interface bundle path (pointer)
- Throws compatErr if appPath does not conform to ifacePath.
PROTAB INSTRUCTIONS
newProtab dest, data
Creates a new protab sentry. The current agent will be the arbiter for the new protab.
- newProtab opcode = 0x1700
- dest = Destination for the protab (pointer)
- data = Protab data (pointer)
protabArbiter dest, protab
Retrieves the arbiter vessel associated with the given protab.
- protabArbiter opcode = 0x1701
- dest = Destination for the result (pointer)
- protab = Protab sentry (pointer)
protabData dest, protab
Retrieves the data associated with the given protab.
- protabData opcode = 0x1702
- dest = Destination for the result (pointer)
- protab = Protab sentry (pointer)
PERMISSION INSTRUCTIONS
hasPerm dest, vessel, protab
Retrieves whether the given vessel holds permission for the given protab.
- hasPerm opcode = 0x1800
- dest = Destination for the result (number)
- vessel = Vessel which may hold permission (pointer)
- protab = Protab sentry (pointer)
perms dest, vessel, protab
Retrieves a list of permission sentries for the protab in the given vessel. The result will be null if the vessel does not hold permission for the given protab.
- perms opcode = 0x1801
- dest = Destination for the result (pointer)
- vessel = Vessel which holds the permissions (pointer)
- protab = Protab sentry (pointer)
permHolder dest, perm
Retrieves the vessel which holds the given permission. The result will be null if the permission is not held by any vessel.
- permHolder opcode = 0x1802
- dest = Destination for the vessel (pointer)
- perm = Permission sentry (pointer)
permIsImplicit dest, perm
Retrieves whether the given permission is implicit.
- permIsImplicit opcode = 0x1803
- dest = Destination for the result (number)
- perm = Permission sentry (pointer)
precedingPerms dest, perm
Retrieves the preceding permissions associated with the given permission.
- precedingPerms opcode = 0x1804
- dest = Destination for the list of preceding permissions (pointer)
- perm = Permission sentry (pointer)
permPropCount dest, perm
Retrieves the remaining propagation count of the given permission. The result is -1 if the propagation count is infinite.
- permPropCount opcode = 0x1805
- dest = Destination for the result (number)
- perm = Permission sentry (pointer)
permProtab dest, perm
Retrieves the protab associated with the given permission.
- permProtab opcode = 0x1806
- dest = Destination for the result (pointer)
- perm = Permission sentry (pointer)
newPerm dest, protab, propCount, precedingPerms
Creates a new permission. propCount may be -1 to indicate an infinite propagation count.
- newPerm opcode = 0x1807
- dest = Destination for the permission (pointer)
- protab = Protab sentry (pointer)
- propCount = Maximum propagation count (number)
- precedingPerms = List of preceding permissions which establish permission (pointer)
givePerm vessel, perm, propCount
Grants the given permission to the given vessel. propCount may be -1 to indicate an infinite propagation count.
- givePerm opcode = 0x1808
- vessel = Vessel which will receive the permission (pointer)
- perm = Permission sentry (pointer)
- propCount = Maximum propagation count (number)
delPerm perm, shouldRecur
Deletes the given permission from its vessel. If shouldRecur is true, recursively removes descendant permissions based on preceding permission.
- delPerm opcode = 0x1809
- perm = Permission sentry (pointer)
- shouldRecur = Whether to recursively remove descendant permissions (number)
LIFE PARENT INSTRUCTIONS
lifeChildren dest, vessel
Retrieves a list of life children of the given vessel.
- lifeChildren opcode = 0x1900
- dest = Destination for the list of vessels which are life children (pointer)
- vessel = Vessel (pointer)
lifeParents dest, vessel
Retrieves a list of life parents of the given vessel.
- lifeParents opcode = 0x1901
- dest = Destination for the list of vessels which are life parents (pointer)
- vessel = Vessel (pointer)
isLifeChild dest, vessel1, vessel2
Retrieves whether vessel1 is a life child of vessel2.
- isLifeChild opcode = 0x1902
- dest = Destination for whether the first vessel is a life child of the second vessel (number)
- vessel1 = Vessel which may be a life child (pointer)
- vessel2 = Vessel which may be a life parent (pointer)
setIsLifeChild vessel1, vessel2, isChild
Modifies whether vessel1 is a life child of vessel2.
- setIsLifeChild opcode = 0x1903
- vessel1 = Vessel which may be a life child (pointer)
- vessel2 = Vessel which may be a life parent (pointer)
- isChild = Whether the first vessel will be a life child of the second vessel (number)
- Throws dataErr if a life child cycle would be created.
launcherIsLifeParent dest, appPath
Retrieves whether a launcher of appPath will be assigned as a life parent of the launched agent.
- launcherIsLifeParent opcode = 0x1904
- dest = Destination for whether a launcher becomes a life parent of the given application (number)
- appPath = Application path (pointer)
setLauncherIsLifeParent appPath, isParent
Modifies whether a launcher of appPath will be assigned as a life parent of the launched agent.
- setLauncherIsLifeParent opcode = 0x1905
- appPath = Application path (pointer)
- isParent = Whether a launcher becomes a life parent of the given application (number)
MEMORY QUOTA INSTRUCTIONS
memQuota dest, child, parent
Retrieves the maximum allowed memory usage of the given life child with respect to the given parent.
- memQuota opcode = 0x1A00
- dest = Destination for the size (number)
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
setMemQuota child, parent, size
Modifies the maximum allowed memory usage of the given life child with respect to the given parent.
- setMemQuota opcode = 0x1A01
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
- size = Size for the quota (number)
memPrio dest, child, parent
Retrieves the memory priority of the given life child with respect to the given parent.
- memPrio opcode = 0x1A02
- dest = Destination for the memory priority (number)
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
setMemPrio child, parent, prio
Modifies the memory priority of the given life child with respect to the given parent. The priority must be in the range of u16.
- setMemPrio opcode = 0x1A03
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
- prio = Memory priority (number)
- Throws numRangeErr if prio is not in the range of u16.
memSizeUsed dest, vessel
Retrieves the amount of memory used by the given vessel.
- memSizeUsed opcode = 0x1A04
- dest = Destination for the amount (number)
- vessel = Vessel (pointer)
memSizeLeft dest, vessel
Retrieves the amount of memory left which the given vessel can use.
- memSizeLeft opcode = 0x1A05
- dest = Destination for the amount (number)
- vessel = Vessel (pointer)
CORE QUOTA INSTRUCTIONS
coreQuota dest, child, parent
Retrieves the maximum allowed core usage of the given life child with respect to the given parent.
- coreQuota opcode = 0x1B00
- dest = Destination for the load (number)
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
setCoreQuota child, parent, load
Modifies the maximum allowed core usage of the given life child with respect to the given parent. The load must be between 0 and 1 inclusive.
- setCoreQuota opcode = 0x1B01
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
- load = Load for the quota (number)
- Throws numRangeErr if load is not between 0 and 1 inclusive.
corePrio dest, child, parent
Retrieves the core priority of the given life child with respect to the given parent.
- corePrio opcode = 0x1B02
- dest = Destination for the core priority (number)
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
setCorePrio child, parent, prio
Modifies the core priority of the given life child with respect to the given parent. The priority must be in the range of u16.
- setCorePrio opcode = 0x1B03
- child = Vessel which is the life child (pointer)
- parent = Vessel which is the life parent (pointer)
- prio = Core priority (number)
- Throws numRangeErr if prio is not in the range of u16.
coreLoadUsed dest, vessel
Retrieves the amount of core load used by the given vessel.
- coreLoadUsed opcode = 0x1B04
- dest = Destination for the amount (number)
- vessel = Vessel (pointer)
coreLoadLeft dest, vessel
Retrieves the amount of core load left which the given vessel can use.
- coreLoadLeft opcode = 0x1B05
- dest = Destination for the amount (number)
- vessel = Vessel (pointer)
VOLUME QUOTA INSTRUCTIONS
volQuota dest, path
Retrieves the maximum allowed storage size of a volume item.
- volQuota opcode = 0x1C00
- dest = Destination for the size (number)
- path = Volume item path (pointer)
setVolQuota path, size
Modifies the maximum allowed storage size of a volume item.
- setVolQuota opcode = 0x1C01
- path = Volume item path (pointer)
- size = Size for the quota (number)
volSizeUsed dest, path
Retrieves the amount of storage used by the given volume item.
- volSizeUsed opcode = 0x1C02
- dest = Destination for the amount (number)
- path = Volume item path (pointer)
volSizeLeft dest, path
Retrieves the amount of storage left which the given volume item can use.
- volSizeLeft opcode = 0x1C03
- dest = Destination for the amount (number)
- path = Volume item path (pointer)
VESSEL MIRROR INSTRUCTIONS
vesselMirror dest, vessel
Retrieves the vessel from which vessel is a mirror. If there is no mirror, the result is null.
- vesselMirror opcode = 0x1D00
- dest = Destination for the vessel which is the mirror source (pointer)
- vessel = Vessel which may be a mirror destination (pointer)
setVesselMirror vessel1, vessel2
Configures vessel1 as a mirror of vessel2.
- setVesselMirror opcode = 0x1D01
- vessel1 = Vessel which will be the mirror destination (pointer)
- vessel2 = Vessel which will be the mirror source (pointer)
- Throws dataErr if a mirror cycle would be created.
clrVesselMirror vessel
Removes vessel as a mirror of any other vessel.
- clrVesselMirror opcode = 0x1D02
- vessel = Vessel which will no longer be a mirror destination (pointer)
SYSTEM PROTAB INSTRUCTIONS
allocReadProtab dest, alloc
Retrieves the protab to directly read a heap allocation.
- allocReadProtab opcode = 0x1E00
- dest = Destination for the protab (pointer)
- alloc = Heap allocation (pointer)
allocWrtProtab dest, alloc
Retrieves the protab to directly modify a heap allocation.
- allocWrtProtab opcode = 0x1E01
- dest = Destination for the protab (pointer)
- alloc = Heap allocation (pointer)
sentryReadProtab dest, sentry
Retrieves the protab to read a sentry allocation through associated instructions and functions.
- sentryReadProtab opcode = 0x1E02
- dest = Destination for the protab (pointer)
- sentry = Sentry allocation (pointer)
sentryWrtProtab dest, sentry
Retrieves the protab to modify a sentry allocation through associated instructions and functions.
- sentryWrtProtab opcode = 0x1E03
- dest = Destination for the protab (pointer)
- sentry = Sentry allocation (pointer)
vItemReadProtab dest, path
Retrieves the protab to read a volume item.
- vItemReadProtab opcode = 0x1E04
- dest = Destination for the protab (pointer)
- path = Volume item path (pointer)
vItemWrtProtab dest, path
Retrieves the protab to modify a volume item.
- vItemWrtProtab opcode = 0x1E05
- dest = Destination for the protab (pointer)
- path = Volume item path (pointer)
launchProtab dest, path
Retrieves the protab to launch an application.
- launchProtab opcode = 0x1E06
- dest = Destination for the protab (pointer)
- path = Application path (pointer)
permControlProtab dest, vessel
Retrieves the protab to manage the permissions of a vessel.
- permControlProtab opcode = 0x1E07
- dest = Destination for the protab (pointer)
- vessel = Vessel (pointer)
lifeControlProtab dest, vessel
Retrieves the protab to manage the memory and CPU usage of a vessel.
- lifeControlProtab opcode = 0x1E08
- dest = Destination for the protab (pointer)
- vessel = Vessel (pointer)
volDriverProtab dest
Retrieves the protab to be a volume driver.
- volDriverProtab opcode = 0x1E09
- dest = Destination for the protab (pointer)
adminProtab dest
Retrieves the protab to be a system administrator.
- adminProtab opcode = 0x1E0A
- dest = Destination for the protab (pointer)