Replies: 1 comment 1 reply
-
I absolutely agree, this is all valid criticism. And I expect the crate boundary would ensure client code can't futz directly with MachineState. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, we have a system calls architecture defined per Flying roll #1. However, as I started experimenting with some stuff I'm not sure if the current approach will scale.
First of all, I think instructions can be separated in two groups, core and non-core. This distinction is already present as we could say all instructions currently with type SystemClauseType are non-core. While the current approach may be still fine for core, I'm not sure about non-core ones. Why?
All instructions have direct and raw access to the Machine State. In the case of non-core syscalls, most of the work is tedious and error prone (How to ensure proper dereferencing? #1654). Having direct access to the Machine State only allows for a slightly better performance, though these non-core instructions are not called as often as core ones. Non-core syscalls often don't need full access to the Machine State, since they don't need to modify the internals in unusual ways. I don't know how they will look under the GC, but probably not much better.
Too tightly integrated code (ex. MachineState access) makes it difficult to move the code around. Lots of syscalls are full of code that does many other things apart from "just" Prolog. Compilation times could be improved by moving this code to another crate. Also, if we ever want to support JIT / AOT, this tight coupling would require a rewrite of all the code. And in the case of supporting both interpreter and JIT, an abstract interface would be required to not duplicate things. Another interesting aspect of "abstracting" the integration is that the same interface could be applied to external plugins that extend Scryer Prolog functionality without cluttering the core.
These are some of my thoughts. I'll greatly appreciate any criticism or comment, especially from @mthom since I'm sure he understands the big picture of everything better than me.
Greetings,
Adrián
Beta Was this translation helpful? Give feedback.
All reactions