Dataflow Software Stack
032db78
Master Thesis of Mathijs Saey at the VUB
|
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 | |
Context Manager.
The Context manager is reponsible for changing and restoring the context of tokens.
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.
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.
token | The token to change and send. |
inst | The instruction that wants to change the token. |
dest | The new destination of the token. |
retInst | The instance to send the token to when restoring the context. |
binds | The amount of tokens that will be bound to the context. |
restores | The 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.
destination | The instruction to bind to the context. |
port | The port to bind to the context. None if the port should not change. |
context | The context to restore. |
restores | The 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.
core.tokenizer.ContextManager.tokenizer |
core.tokenizer.ContextManager.contextMap |
core.tokenizer.ContextManager.restoreMap |