Dataflow Software Stack  032db78
Master Thesis of Mathijs Saey at the VUB
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
core.tokenizer.ContextManager Class Reference

Context Manager. More...

Inherits object.

Public Member Functions

def __init__
 Stores the contexts that have already been created. More...
 
def bindMany
 Send a token to a different context. More...
 
def bind
 Bind a new context to a given context and destination. More...
 
def restore
 Restore a token. More...
 

Public Attributes

 tokenizer
 
 contextMap
 
 restoreMap
 

Detailed Description

Context Manager.

The Context manager is reponsible for changing and restoring the context of tokens.

Constructor & Destructor Documentation

def core.tokenizer.ContextManager.__init__ (   self,
  tokenizer 
)

Stores the contexts that have already been created.

This is needed incase multiple tokens need to be sent to the same context (e.g. function call) Stores the old context and the destination for restoring contexts.

Member Function Documentation

def core.tokenizer.ContextManager.bindMany (   self,
  token,
  inst,
  dest,
  retInst,
  binds,
  restores 
)

Send a token to a different context.

Create this context first if it does not exist yet. Further tokens from the same source (instruction, context) pair will be sent to the same context.

Parameters
tokenThe token to change and send.
instThe instruction that wants to change the token.
destThe new destination of the token.
retInstThe instance to send the token to when restoring the context.
bindsThe amount of tokens that will be bound to the context.
restoresThe amount of tokens the context will produce before being deleted.
def core.tokenizer.ContextManager.bind (   self,
  destInst,
  destPort,
  context,
  restores 
)

Bind a new context to a given context and destination.

When a token with the new context encounters a context restore operation, it will be bound to the old context, and new instruction.

Parameters
destinationThe instruction to bind to the context.
portThe port to bind to the context. None if the port should not change.
contextThe context to restore.
restoresThe amount of tokens the context will produce.
def core.tokenizer.ContextManager.restore (   self,
  token 
)

Restore a token.

In order to do this, we simply change the destination and context of the token to those found in the restoremap.

Member Data Documentation

core.tokenizer.ContextManager.tokenizer
core.tokenizer.ContextManager.contextMap
core.tokenizer.ContextManager.restoreMap