[ library(asm) | Reference Manual | Alphabetic Index ]
disasm(+PredSpec, ?WAMCode)
Disassemble an existing predicate PredSpec in the current module to its WAM
abstract machine representation WAMCode.
- +PredSpec
- Atom/Integer.
- ?WAMCode
- Variable or a list of WAM instructions in the right format.
Description
Unifies WAMCode with the WAM instructions representing the abstract
machine code for the predicate specified by PredSpec (in Name/Arity
form). The WAM code is in the form of a list, with each element
representing one WAM instruction. The format of the WAMCode is the same
as that used by asm/2,3 and pasm/4 to assemble a predicate. Thus, the
WAM code generated by disasm/2,3 can be used to load the predicate into
ECLiPSe without having to compile the source Prolog form.
The library asm must be loaded to use diasm/2.
Currently asm/2 cannot disassemble dynamic predicates.
Fail Conditions
Fails if WAMCode is initially instantiated and does not unify with the WAM code generated by asm/1 for the predicate, or if PredSpec is dynamic.
Resatisfiable
No.
Exceptions
- (5) type error
- PredSpec is not in correct form.
- (60) referring to an undefined procedure
- PredSpec does not exist in current module.
Examples
for fruit/1 defined by:
fruit(orange).
?- disasm(fruit / 1, W).
W = [get_atom(a(1), orange), retd, code_end]
See Also
disasm / 3, asm / 2, asm / 3, pasm / 4, wam / 1