Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clasp catchup #6

Merged
merged 8 commits into from
Oct 1, 2023
Merged

Clasp catchup #6

merged 8 commits into from
Oct 1, 2023

Conversation

Bike
Copy link
Member

@Bike Bike commented Oct 1, 2023

Brings cvm up to the 0.12 format I already hacked up in Clasp, and then a little farther to pending 0.13 since I realized there was a problem with the fdesignator instruction.

This makes it so that call arguments are on the stack for both MV
and regular calls. It also skips messing about with vm-values,
which is really slow and dumb.

It also makes the bytecode more regular for IR purposes.

See also the older Clasp commit where I implemented this first:
clasp-developers/clasp@fad16ca
It's special, and changing it when we add new opcodes is silly.
This simplifies both the compilation of and generated bytecode for
SETQ, and is pretty trivial to implement.

Implemented earlier in Clasp:
clasp-developers/clasp@0ce7eae
This lets VM functions create closures and stuff without consulting
the mutable m:*client* dynamic variable. This ssssshould make it
possible for cross and native VM functions to coexist smoothly,
but I haven't tried it.
This is like fdefinition, but can be optimized since the VM knows
that the result is only called and not otherwise stored. So for
example you can skip an fboundp check if your environment works
such that unfbound function names are bound to functions that
immediately signal UNDEFINED-FUNCTION.

Since neither VM here can actually use this they just do
FDEFINITION. I'm not totally sure about this instruction, honestly,
but at least for now it's not like we're lacking opcode space.

Added in Clasp earlier:
clasp-developers/clasp@56dab78
This lets us compile MULTIPLE-VALUE-CALL without requiring that
the loader environment give if, type predicates, or CL:FDEFINITION
their usual definitions. We could also use it to compile code like
(CL:FUNCALL FOO ...) more efficiently, but that would entail the
compiler have a principled way to learn that it's allowed to
optimize CL:FUNCALL calls, so I held off for now.

When I implemented this in Clasp earlier I neglected to consider
first class environments. Therefore this version gives FDESIGNATOR
a constant parameter representing the loader environment, which
Clasp's doesn't yet. Without this parameter, a name has to be
looked up in "the current global environment", but that may differ
from the loader environment if it even exists, which could lead to
weird situations like (let ((x 'foo)) (multiple-value-call x))
doing something different from (multiple-value-call 'foo).

Original clasp commit, which also added CALLED-FDEFINITION:
clasp-developers/clasp@56dab78
@Bike Bike merged commit 89f55cc into main Oct 1, 2023
2 checks passed
@Bike Bike deleted the clasp-catchup branch October 1, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant