-
-
Notifications
You must be signed in to change notification settings - Fork 29
\RPLPTR when run interpreted doesn't work with large vmem pointers #866
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
Conversation
|
Does the |
|
The opcode RPLPTR does preserve the high-order 4 bits of the target. Was that the "oops, misread..." ? |
|
I went through the functions / UFNs in LLNEW and compared against the Maiko definitions. |
|
I can't get to this for a few hours, but will review today. |
|
OK, the only difference I see now is that the LLNEW implementation of \GETBASEPTR will return the full 32 bits of the result while the maiko GETBASEPTR_N opcode returns only the lower 28 bits of the result. There's a comment in the VAG2 opcode saying |
Yes, there are unboxed ops operating on floating point numbers, I believe. But -- \GETBASEPTR masks off the high nibble in the input to \VAG2's first argument, but the result of \VAG2 is going to have the high-order nibble of the result intact because of the \VAG2 opcode implementation. Compare with GETBASEPTR.N, (copied from above, shortened so it's more obvious): |
|
I don't understand. This PR attempts to make the Lisp and C implementations agree. |
|
Yes, you missed. The VAG2 opcode does not strip off the pointer flags, so in the \GETBASEPTR implementation where it just returns the result of \VAG2(...) it is not doing what the GETBASEPTR.N where it masks off the top nibble of the result. |
|
In the LLNEW lisp implementation, \GETBASEPTR is defined by performing two \GETBASE calls which return SMALLPs, and then, after masking the "hiloc", using VAG2 to put together the result. |
|
Yes... but it doesn't mask off the top 4 bits of the result of the VAG2, it just returns it. |
|
If returning a full 32-bit value is OK then there should be a comment in the Lisp code noting that this is different from the GETBASEPTR.N opcode and why it's OK and/or why it's not possible to do it "correctly". |
|
I finally see what was confusing me -- the \VAG2 is just combining the two halves without an additional indirect. The difference between this code and the maiko code is that maiko does (X & POINTERMASK) before using it while the lisp code assumes that the X argument is already only 28 bits. |


The code in \RPLPTR (which is only run when running interpreted, e.g., with LOOPS low-level code) hadn't been updated for the large VMEM changes. The address space was increased from 24-bit pointers (8 bits padding, 8 bits HILOC, 16 bits LOLOC) to 28 bits. RPLPTR opcode in maiko saves the existing high bits (used, e.g., in CDR-coding and tightly packed datatypes. Oddly, PUTBASEPTR just clears the high bits.)
We should be on the lookout for other instances of this bug.