|
@@ -513,6 +513,9 @@ READ_DICT_KEYS_MACRO_NAME = 'read_dict_keys'
|
|
REVERSE_LIST_MACRO_NAME = 'reverse_list'
|
|
REVERSE_LIST_MACRO_NAME = 'reverse_list'
|
|
"""The name of the list reversal macro."""
|
|
"""The name of the list reversal macro."""
|
|
|
|
|
|
|
|
+INDEX_MACRO_NAME = 'index'
|
|
|
|
+"""The name of the macro that indexes a collection with a key."""
|
|
|
|
+
|
|
GC_PROTECT_MACRO_NAME = 'gc_protect'
|
|
GC_PROTECT_MACRO_NAME = 'gc_protect'
|
|
"""The name of the macro that unconditionally protects its first argument from the GC by
|
|
"""The name of the macro that unconditionally protects its first argument from the GC by
|
|
drawing an edge between it and the second argument."""
|
|
drawing an edge between it and the second argument."""
|
|
@@ -919,6 +922,23 @@ def create_nop():
|
|
calling_convention=MACRO_IO_CALLING_CONVENTION,
|
|
calling_convention=MACRO_IO_CALLING_CONVENTION,
|
|
has_value=False)
|
|
has_value=False)
|
|
|
|
|
|
|
|
+def create_index(collection, key):
|
|
|
|
+ """Creates a value that loads the element with the specified key in the given collection."""
|
|
|
|
+ return DirectFunctionCall(
|
|
|
|
+ INDEX_MACRO_NAME,
|
|
|
|
+ [('collection', collection),
|
|
|
|
+ ('key', key)],
|
|
|
|
+ calling_convention=MACRO_POSITIONAL_CALLING_CONVENTION,
|
|
|
|
+ has_value=True, has_side_effects=False)
|
|
|
|
+
|
|
|
|
+def create_pure_simple_call(target_name, argument):
|
|
|
|
+ """Creates a pure, simple positional call to the function with the given name."""
|
|
|
|
+ return DirectFunctionCall(
|
|
|
|
+ target_name,
|
|
|
|
+ [('argument', argument)],
|
|
|
|
+ calling_convention=SIMPLE_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."""
|