|
@@ -510,6 +510,12 @@ NOP_MACRO_NAME = 'nop'
|
|
READ_DICT_KEYS_MACRO_NAME = 'read_dict_keys'
|
|
READ_DICT_KEYS_MACRO_NAME = 'read_dict_keys'
|
|
"""The name of the macro that reads all keys from a dictionary."""
|
|
"""The name of the macro that reads all keys from a dictionary."""
|
|
|
|
|
|
|
|
+READ_DICT_VALUE_MACRO_NAME = "read_dict_value"
|
|
|
|
+"""The name of the macro that reads the value for a given key from a dictionary."""
|
|
|
|
+
|
|
|
|
+READ_DICT_NODE_MACRO_NAME = "read_dict_node"
|
|
|
|
+"""The name of the macro that reads the node for a given key from a dictionary."""
|
|
|
|
+
|
|
READ_OUTGOING_EDGES_MACRO_NAME = 'read_outgoing_edges'
|
|
READ_OUTGOING_EDGES_MACRO_NAME = 'read_outgoing_edges'
|
|
"""The name of the macro that reads a node's outgoing edges as a list."""
|
|
"""The name of the macro that reads a node's outgoing edges as a list."""
|
|
|
|
|
|
@@ -950,6 +956,22 @@ def create_read_outgoing_edges(source_node):
|
|
calling_convention=MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
calling_convention=MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
has_value=True, has_side_effects=False)
|
|
has_value=True, has_side_effects=False)
|
|
|
|
|
|
|
|
+def create_read_dict_value(dict_node, key):
|
|
|
|
+ """Creates a call that reads the value with the given key in the specified dictionary."""
|
|
|
|
+ return DirectFunctionCall(
|
|
|
|
+ READ_DICT_VALUE_MACRO_NAME,
|
|
|
|
+ [('dict', dict_node), ('key', key)],
|
|
|
|
+ calling_convention=MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
|
|
+ has_value=True, has_side_effects=False)
|
|
|
|
+
|
|
|
|
+def create_read_dict_node(dict_node, key):
|
|
|
|
+ """Creates a call that reads the node with the given key in the specified dictionary."""
|
|
|
|
+ return DirectFunctionCall(
|
|
|
|
+ READ_DICT_NODE_MACRO_NAME,
|
|
|
|
+ [('dict', dict_node), ('key', key)],
|
|
|
|
+ calling_convention=MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
|
|
+ has_value=True, has_side_effects=False)
|
|
|
|
+
|
|
def create_gc_protect(protected_value, root):
|
|
def create_gc_protect(protected_value, root):
|
|
"""Creates a value that protects the first from the GC by drawing an
|
|
"""Creates a value that protects the first from the GC by drawing an
|
|
edge between it and the given root."""
|
|
edge between it and the given root."""
|