Metacircular Client Interface
Created by: wks
It has been proposed long ago that "everything the API can do should also be possible in the Mu IR".
This issue maintains a checklist of features not in the Mu IR. These functions should be gradually added to the IR.
Features in the API but not the IR:
- bundle loading
- stack introspection:
current_func_ver
,current_instruction
,dump_keepalives
- OSR:
pop_frame
,push_frame
- Handle traps and undefined functions in Mu IR. It depends on how the Mu VM itself is implemented.
- Handle watchpoint in Mu IR: an instruction which is a no-op when disabled, but a (maybe limited kind of) Mu function call when enabled.
Things that can be done dynamically via handles in the API, but can only be done statically in the IR. I am not sure how dynamic Mu should be, or need to be, because some of the items below can be worked around with some Mu IR code, such as maintaining a hash table implemented in Mu IR, or writing wrapper functions.
- Opaque handle type: a handle that holds any Mu value.
ref<T>
can be a candidate for this purpose. - Getting a Mu constant value (including constants, globals and functions) by its ID. This is a kind of introspection.
- This can be done with a type argument:
%c = GET_CONST <@T> %id
,%c
is a@T
- Or return a handle:
%ch = GET_CONST_H %id
,%ch
is aref<void>
- This can be done with a type argument:
- Creating Mu heap objects by a type ID.
- Calling a Mu function (or constructing a Mu frame) with both the callee and the arguments as handles. This allows calling a Mu function with a run-time-determined arity and arg types.
- Dump keepalive variables.
- This can be done with a type argument:
%sixth_ka = GET_KEEPALIVE <@T> %frame 6
- or return handle:
%sixth_ka_handle = GET_KEEPALIVE_H %frame 6
- This can be done with a type argument: