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

%apply-in-frame has bitrotted #497

Open
SuperDisk opened this issue Jun 18, 2024 · 1 comment
Open

%apply-in-frame has bitrotted #497

SuperDisk opened this issue Jun 18, 2024 · 1 comment

Comments

@SuperDisk
Copy link

I'm sure you're aware of this already, but I was just curious what it would take to make this work again:

(error "%apply-in-frame has bitrotted"))))

Right now this message appears when using r to restart a frame in the SLIME debugger.

@xrme
Copy link
Member

xrme commented Jun 18, 2024

I think what happened here is a side effect of a new, partly working, register allocator being added to the x86-64 backend. This allocator is opt-in-only; it's not used by default. The file Clozure/ccl/doc/compiler-changes-in-CCL-trunk.pdf contains some notes about the allocator.

Prior to that change, it was possible to know where all the frame locals, etc., were.

ccl/lib/x86-backtrace.lisp

Lines 426 to 462 in 55ebe5d

(defun %apply-in-frame (frame function arglist)
(target-arch-case
(:x8632 (error "%apply-in-frame doesn't work for x8632 yet"))
(:x8664
(let* ((target-catch (last-catch-since frame nil))
(start-fp (if target-catch
(uvref target-catch x8664::catch-frame.rbp-cell)
(%get-frame-ptr)))
(target-xcf (last-xcf-since frame start-fp nil))
(target-db-link (last-binding-before frame))
(target-tsp (last-tsp-before frame))
(target-foreign-sp (last-foreign-sp-before frame)))
(multiple-value-bind (save0-loc save1-loc save2-loc save3-loc)
(find-x8664-saved-nvrs frame start-fp nil)
(let* ((thunk (%clone-x86-function #'%%apply-in-frame-proto
frame
target-catch
target-db-link
target-xcf
target-tsp
target-foreign-sp
(if save0-loc
(- save0-loc frame)
0)
(if save1-loc
(- save1-loc frame)
0)
(if save2-loc
(- save2-loc frame)
0)
(if save3-loc
(- save3-loc frame)
0)
(coerce-to-function function)
arglist
0)))
(funcall thunk)))))))

I think in order for this to work again, the "new" allocator would have to record debugging information about where to find the frame locals, etc.

I'm not sure, frankly, whether to try to press ahead with this "new" allocator, or to back it out.

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

No branches or pull requests

2 participants