sslang-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Codegen.LibSSM

Description

Bindings to the ssm-runtime library.

Synopsis

Documentation

newtype CIdent Source #

Identifiers in C.

Constructors

CIdent Identifier 

Instances

Instances details
Eq CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Methods

(==) :: CIdent -> CIdent -> Bool #

(/=) :: CIdent -> CIdent -> Bool #

Ord CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Show CIdent Source # 
Instance details

Defined in Codegen.LibSSM

IsString CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Methods

fromString :: String -> CIdent #

Semigroup CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Monoid CIdent Source # 
Instance details

Defined in Codegen.LibSSM

ToIdent CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Methods

toIdent :: CIdent -> SrcLoc -> Id

Identifiable CIdent Source # 
Instance details

Defined in Codegen.LibSSM

Methods

ident :: CIdent -> String Source #

ctype :: CIdent -> Type Source #

Construct a type name from a C identifier.

cexpr :: CIdent -> Exp Source #

Construct an expression from a C identifier.

csizeof :: Type -> Exp Source #

Construct an expression of the size of a C type.

cint :: Int -> Exp Source #

Construct an integer literal in C.

ccall :: Exp -> [Exp] -> Exp Source #

amp :: Exp -> Exp Source #

star :: Exp -> Exp Source #

data CSize Source #

Natively supported sizes in C.

Constructors

Size8 
Size16 
Size32 
Size64 

Instances

Instances details
Eq CSize Source # 
Instance details

Defined in Codegen.LibSSM

Methods

(==) :: CSize -> CSize -> Bool #

(/=) :: CSize -> CSize -> Bool #

Ord CSize Source # 
Instance details

Defined in Codegen.LibSSM

Methods

compare :: CSize -> CSize -> Ordering #

(<) :: CSize -> CSize -> Bool #

(<=) :: CSize -> CSize -> Bool #

(>) :: CSize -> CSize -> Bool #

(>=) :: CSize -> CSize -> Bool #

max :: CSize -> CSize -> CSize #

min :: CSize -> CSize -> CSize #

size_to_int :: CSize -> Int Source #

Convert a CSize into an integer.

size_to_string :: IsString s => CSize -> s Source #

Convert a CSize into some string identifier of the size.

data SSMError Source #

enum ssm_error, an enumeration of possible runtime errors.

Constructors

INTERNAL_ERROR

Reserved for unforeseen, non-user-facing errors.

EXHAUSTED_ACT_QUEUE

Tried to insert into full ready queue.

EXHAUSTED_EVENT_QUEUE

Tried to insert into full event queue.

EXHAUSTED_MEMORY

Could not allocate more memory.

EXHAUSTED_PRIORITY

Tried to exceed available recursion depth.

NOT_READY

Not yet ready to perform the requested action.

INVALID_TIME

Specified invalid time.

INVALID_MEMORY

Invalid memory layout.

Instances

Instances details
Show SSMError Source # 
Instance details

Defined in Codegen.LibSSM

ToIdent SSMError Source # 
Instance details

Defined in Codegen.LibSSM

Methods

toIdent :: SSMError -> SrcLoc -> Id

throw :: SSMError -> Exp Source #

SSM_THROW, throw a runtime error.

word_t :: Type Source #

ssm_word_t, the largest supported machine word size.

value_t :: Type Source #

ssm_value_t, runtime representation for sslang values.

packed_val :: CIdent Source #

Name of the packed_val field in a value_t.

heap_ptr :: CIdent Source #

Name of the heap_ptr field in a value_t.

marshal :: Exp -> Exp Source #

ssm_marshal, construct a value_t out of a 31-bit integral value.

unmarshal :: Exp -> Exp Source #

ssm_unmarshal, extract 31-bit integral value out of a value_t.

on_heap :: Exp -> Exp Source #

ssm_on_heap, whether a value_t points to something on the heap.

dup :: Exp -> Exp Source #

ssm_dup, increment the reference count of a value.

dups :: Exp -> Exp -> Exp Source #

ssm_dups, increment the reference count on a vector of values.

drop :: Exp -> Exp Source #

ssm_drop, drop the reference count of a value and free if necessary.

time_t :: Type Source #

ssm_time_t, 64-bit time type.

time_obj_t :: Type Source #

struct ssm_time, the heap-representation of a time_t.

never :: Exp Source #

SSM_NEVER, a time_t that is never reached.

now :: Exp Source #

ssm_now, the current time.

new_time :: Exp -> Exp Source #

ssm_new_time, allocate a time_obj_t on the heap.

read_time :: Exp -> Exp Source #

ssm_time_read, read the time in a time_obj_t.

sv_last_updated :: Exp -> Exp Source #

Read the last_updated field of an ssm_value_t pointing to a scheduled variable.

priority_t :: Type Source #

ssm_priority_t, thread priority.

depth_t :: Type Source #

ssm_depth_t, thread depth.

root_priority :: Exp Source #

SSM_ROOT_PRIORITY, the depth of the root process.

root_depth :: Exp Source #

SSM_ROOT_DEPTH, the depth of the root process.

act_t :: Type Source #

ssm_act_t, the generic activation record type.

act_pc :: CIdent Source #

Name of the program counter field in an act_t.

act_caller :: CIdent Source #

Name of the caller field in an act_t.

act_depth :: CIdent Source #

Name of the depth field in an act_t.

act_priority :: CIdent Source #

Name of the priority field in an act_t.

trigger_t :: Type Source #

ssm_trigger_t, nodes in the linked list of triggers.

enter :: Exp -> Exp -> Exp -> Exp -> Exp -> Exp Source #

ssm_enter, allocate and initialize activation record.

leave :: Exp -> Exp -> Exp Source #

ssm_leave, deallocate an activation record before leaving.

has_children :: Exp -> Exp Source #

ssm_has_children, returns non-zero if act has at least one child.

activate :: Exp -> Exp Source #

ssm_activate, schedule an activation record on the ready queue.

top_parent :: Exp Source #

ssm_top_parent, Name of top level parent activation record

sv_t :: Type Source #

ssm_sv_t, polymorphic scheduled variables.

new_sv :: Exp -> Exp Source #

ssm_new_sv, allocate a new sv_t on the heap.

to_sv :: Exp -> Exp Source #

ssm_to_sv, retrieve the sv_t pointer pointed to by a value_t.

deref :: Exp -> Exp Source #

ssm_deref, read the value of an sv_t pointed to by a value_t.

assign :: Exp -> Exp -> Exp -> Exp Source #

ssm_assign, assign to a scheduled variable.

later :: Exp -> Exp -> Exp -> Exp Source #

ssm_later, schedule a delayed assignment to a scheduled variable.

sensitize :: Exp -> Exp -> Exp Source #

ssm_sensitize, sensitize a trigger to a variable.

desensitize :: Exp -> Exp Source #

ssm_sensitize, sensitize a trigger to a variable.

new_adt :: Int -> DConId -> Exp Source #

ssm_new_adt, allocate a new ADT object on the heap.

adt_field :: Exp -> Int -> Exp Source #

ssm_adt_field, access the ith field of an ADT object. Assignable.

adt_tag :: Exp -> Exp Source #

ssm_tag, extract the tag of an ADT value.

closure1_t :: Type Source #

ssm_closure1_t, the (template) type of a closure with a single argument.

static_closure :: Exp -> Int -> Initializer Source #

Inintializer for a "static" closure that contains no arguments.

FIXME: An ugly hack that shouldn't exist because John didn't have the foresight to provide an interface to define static closures.

static_value :: CIdent -> Exp Source #

Promote a static object to an ssm_value_t (warning: hacky!).

new_closure :: CIdent -> Int -> Exp Source #

ssm_new_closure, allocate a new closure object on the heap.

closure_push :: Exp -> Exp -> Exp Source #

ssm_closure_push, add a new argument to a closure.

closure_pop :: Exp -> Exp Source #

ssm_closure_pop, remove an argument from a closure.

closure_apply :: Exp -> Exp -> Exp -> Exp -> Exp -> Exp -> Exp Source #

ssm_closure_apply, apply a closure to an argument.

closure_apply_final :: Exp -> Exp -> Exp -> Exp -> Exp -> Exp -> Exp Source #

ssm_closure_apply, apply a closure to an argument, consuming the closure.

closure_free :: Exp -> Exp Source #

ssm_closure_free, free a closure (without performing reference counting).

container_of :: CIdent Source #

Name of the pseudonymous macro from the Linux kernel.

program_init :: CIdent Source #

Name of program initialization hook, called to set up program with runtime.

program_exit :: CIdent Source #

Name of program destruction hook, called before gracefully exiting program.

stdout_handler_enter :: CIdent Source #

Name of stdout handler enter function, used to bind stdout for POSIX platforms. NOTE: this is a hack

stdin_handler_spawn :: CIdent Source #

Name of stdin handler spawner, used to bind stdin for POSIX platforms. NOTE: this is a hack

stdin_handler_kill :: CIdent Source #

Name of stdin handler killer, used to destroy handler thread on POSIX. NOTE: this is a hack

act_typename :: VarId -> CIdent Source #

Obtain the name of a process activation record struct.

act_member :: CIdent Source #

Identifier for act member in act struct.

act_ :: VarId -> Type Source #

Obtain the type of a process activation record.

to_act :: Exp -> VarId -> Exp Source #

Obtain the process-specific activation record from a generic one.

enter_ :: VarId -> CIdent Source #

Obtain the name for the enter function of a routine.

closure_ :: VarId -> CIdent Source #

Obtain the name for the static closure of a routine.

step_ :: VarId -> CIdent Source #

Obtain the name of the step function of a routine.

trig_ :: Int -> CIdent Source #

Obtain the name of each trigger for a routine.

tmp_ :: Int -> CIdent Source #

Obtain the name of a temporary variable.

label_ :: Int -> CIdent Source #

Obtain the name of a label.

arg_ :: Int -> CIdent Source #

Obtain the name of an argument variable.

argv :: CIdent Source #

Obtain the name of an argument variable.

ret_val :: CIdent Source #

Name of return argument.

actg :: CIdent Source #

Identifier for generic (inner) struct act.

acts :: CIdent Source #

Identifier for specialized (outer) struct act.

acts_ :: CIdent -> Exp Source #

Access activation record member.

enter_caller :: CIdent Source #

Name of the caller argument of an enter call.

enter_priority :: CIdent Source #

Name of the priority argument of an enter call.

enter_depth :: CIdent Source #

Name of the depth argument of an enter call.

leave_label :: CIdent Source #

Label to jump to terminate execution.

cast_to_signed :: CSize -> Exp -> Exp Source #

Cast to a signed integer of a particular size.

cast_to_unsigned :: CSize -> Exp -> Exp Source #

Cast to an unsigned integer of a particular size.

cast_to_int :: Bool -> CSize -> Exp -> Exp Source #

Cast to an integer of a particular size and signedness.

shl :: Exp -> Exp -> Exp Source #

Shift left by the specified amount.

shr :: Exp -> Exp -> Exp Source #

Shift right by the specified amount.