-
Notifications
You must be signed in to change notification settings - Fork 31
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
(funcall (java:jfield org.armedbear.lisp.Function FUNCTION_CLASS_BYTE… #437
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,20 @@ | |
(in-package :system) | ||
(require :clos) | ||
|
||
(eval-when (:load-toplevel) | ||
(defvar *available-disassemblers* | ||
(let ((files | ||
(directory (merge-pathnames | ||
"abcl-introspect/*.lisp" | ||
sys::*abcl-contrib*)))) | ||
(loop for f in files | ||
append | ||
(with-open-file (s f :direction :input) | ||
(loop for line = (read-line s nil :eof) | ||
until (eq line :eof) | ||
when (search "disassemble-class-bytes" line) | ||
do (return (list (intern (string-upcase (pathname-name f)) :keyword))))))))) | ||
|
||
(defvar *disassembler-function* nil | ||
"The currently used function for CL:DISASSEMBLE. | ||
|
||
|
@@ -63,6 +77,8 @@ SYS:*DISASSEMBLERS*." | |
(flet ((sane-disassembler-p (disassembler) | ||
(and disassembler | ||
(fboundp disassembler)))) | ||
(when (member name *available-disassemblers*) | ||
(require name)) | ||
(setf *disassembler-function* | ||
(if name | ||
(let ((disassembler (cdr (assoc name *disassemblers*)))) | ||
|
@@ -149,7 +165,9 @@ SYS:*DISASSEMBLERS*." | |
(if (or (java:jinstance-of-p classloader "org.armedbear.lisp.MemoryClassLoader") | ||
(java:jinstance-of-p classloader "org.armedbear.lisp.FaslClassLoader")) | ||
(disassemble-bytes | ||
(java:jcall "getFunctionClassBytes" classloader class)) | ||
(funcall (java:jfield "org.armedbear.lisp.Function" "FUNCTION_CLASS_BYTES") function) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this better than calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getFunctionClassBytes didn't work sometimes and I couldn't figure out why, but this works. Should be tracked down. By someone else ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, we should modify by adding the strategy to an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine with me. |
||
;(java:jcall "getFunctionClassBytes" classloader class) | ||
) | ||
(disassemble-bytes | ||
(read-byte-array-from-stream | ||
(java:jcall-raw | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One cannot assume the presences of a the ABCL-INTROSPECT in the core implementation. Additionally, the presence of the function in a file does not necessarily mean the assembler is available, as it might have unsatisfied Maven load dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there aren't any disassemblers then available-disassemblers will be nil. It's a directory probe which simply fails. The require loads the appropriate system, which resolves the maven dependencies.