Is the WAM Instruction set generated or hardcoded? #2750
Replies: 1 comment 1 reply
-
That's right, the instruction set is programmatically generated. It's explained somewhat in this wiki article if you haven't seen it: https://github.com/mthom/scryer-prolog/wiki/Flying-Roll-%231:-instructions.rs-and-the-Dispatch-Loop Functions from build/instruction_template.rs are run to generate the source file instructions.rs, which is linked into the final binary. It's responsible for generating the flattened Generation of the module is preferred because that way we can add new Instructions to the the template file and have them inserted into boiler plate functions automatically, eliminating the need to update them by hand. It's so much more convenient. Incidentally, I'm finally writing a second Flying Roll on attributed variables in Scryer. |
Beta Was this translation helpful? Give feedback.
-
I asked this tiny question in the Libera IRC but was recommended to try here instead. I'm a newbie dev who's new to Scryer so my apologies in advance if this is a naive question. I was just curious as to why the WAM instruction set seem to be generated rather than "hardcoded", if that's correct? Would appreciate any help in getting started in trying to understand how the instruction set is implemented. Thanks in advance for any help.
This is the section of code that I'm trying to understand:
scryer-prolog/build/instructions_template.rs
Line 1167 in d57f871
Beta Was this translation helpful? Give feedback.
All reactions