Changeset 15280
- Timestamp:
- 05/13/20 06:04:44 (3 years ago)
- Location:
- trunk/abcl
- Files:
-
- 13 added
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/.travis.yml
r15268 r15280 61 61 62 62 script: 63 - ${ABCL_ROOT}/abcl --batch --load ${ABCL_ROOT}/ci/test-abcl-introspect.lisp 63 64 - ${ABCL_ROOT}/abcl --batch --load ${ABCL_ROOT}/ci/test-cffi.lisp 64 65 - ${ABCL_ROOT}/abcl --batch --load ${ABCL_ROOT}/ci/test-cl+ssl.lisp -
trunk/abcl/CHANGES
r15273 r15280 6 6 <https://gitlab.common-lisp.net/abcl/abcl/> 7 7 <https://abcl.org/svn/trunk/abcl/> 8 9 Enhancements 10 ============ 11 12 * [] Fix and extend SYS:CHOOSE-ASSEMBLER functionality for CL:DISASSEMBLE 8 13 9 14 -
trunk/abcl/abcl.rdf
r15273 r15280 20 20 doap:language "Common Lisp" ; 21 21 dc:created "01-JAN-2004" ; 22 dc:modified " 29-APR-2020" ;22 dc:modified "11-MAY-2020" ; 23 23 dc:version "abcl-1.6.2" ; 24 24 dc:release "dev" ; … … 163 163 164 164 abcl:abcl-introspect 165 rdfs:seeAlso <file:contrib/abcl-introspect/README. markdown> .165 rdfs:seeAlso <file:contrib/abcl-introspect/README.org> . 166 166 167 167 abcl:abcl-contrib -
trunk/abcl/contrib/abcl-introspect/abcl-introspect.asd
r15261 r15280 8 8 :components ((:file "abcl-introspect") 9 9 (:file "stacktrace")) 10 :in-order-to ((test-op (test-op abcl-introspect-test s))))10 :in-order-to ((test-op (test-op abcl-introspect-test)))) 11 11 -
trunk/abcl/contrib/abcl-introspect/objectweb.asd
r15013 r15280 1 1 (defsystem objectweb 2 :homepage "http ://asm.ow2.org"3 :de fsystem-depends-on (abcl-asdf)4 : components5 ((:module maven6 7 ((:mvn "org.ow2.asm/asm- all/5.2")))2 :homepage "https://asm.ow2.org" 3 :description "Disassembly to JVM byte code via Objectweb" 4 :version "8.0.1" 5 :defsystem-depends-on (abcl-asdf) :components 6 ((:module maven :components 7 ((:mvn "org.ow2.asm/asm-util/8.0.1"))) 8 8 (:module source 9 9 :depends-on (maven) 10 :pathname "" 11 :components 10 :pathname "" :components 12 11 ((:file "objectweb"))))) 13 12 -
trunk/abcl/contrib/abcl-introspect/objectweb.lisp
r15013 r15280 1 (in-package :cl-user) 2 (defpackage :abcl/build/jvm/tools/objectweb 1 (defpackage :abcl-introspect/jvm/tools/objectweb 3 2 (:use :cl) 4 3 (:export 5 4 #:disassemble-class-bytes)) 6 (in-package :abcl /build/jvm/tools/objectweb)5 (in-package :abcl-introspect/jvm/tools/objectweb) 7 6 8 7 (defun disassemble-class-bytes (object) … … 17 16 18 17 (eval-when (:load-toplevel :execute) 19 (pushnew `(:objectweb . abcl /build/jvm/tools/objectweb::disassemble-class-bytes)18 (pushnew `(:objectweb . abcl-introspect/jvm/tools/objectweb::disassemble-class-bytes) 20 19 sys::*disassemblers*) 21 20 (format cl:*load-verbose* "~&; ~a ; Successfully added Objectweb disassembler.~%" *package*)) -
trunk/abcl/contrib/abcl-introspect/t/disassemble.lisp
r15013 r15280 4 4 ext:*disassembler* #\Space)))) 5 5 (prove:plan 1) 6 (prove:ok (abcl-build:introspect-path-for disassembler) 7 (format nil 8 "Testing invocation of ~a specified by EXT:*DISASSEMBLER*âŠ" disassembler))) 6 (prove:ok 7 (abcl-build:introspect-path-for disassembler) 8 (format nil 9 "Testing invocation of ~a specified by EXT:*DISASSEMBLER*âŠ" disassembler))) 9 10 10 ;;; FIXME move dependency load into ASDF definitions 11 (asdf:load-system :objectweb) 12 (prove:plan 2) 13 (prove:is 14 (sys:choose-disassembler) 15 'ABCL/BUILD/JVM/TOOLS/OBJECTWEB::DISASSEMBLE-CLASS-BYTES) 16 (let ((output (make-string-output-stream))) 17 (let ((*standard-output* output)) 18 (disassemble #'cons)) 19 (let ((result (get-output-stream-string output))) 20 (prove:ok (and result 21 (stringp result) 22 (> (length result) 0)) 23 "Invocation of Objectweb disassembler."))) 11 (let ((disassemblers '(:objectweb :javap :jad :fernflower :cfr :procyon))) 12 (prove:plan (* 2 (length disassemblers))) 13 (dolist (disassembler disassemblers) 14 (prove:ok 15 (asdf:load-system disassembler) 16 (format nil "Loading ~a" disassembler)) 17 (prove:ok 18 (handler-case 19 (let ((expected (intern :disassemble-class-bytes 20 (format nil "ABCL-INTROSPECT/JVM/TOOLS/~a" (symbol-name disassembler))))) 21 (equal 22 (sys:choose-disassembler disassembler) 23 expected)) 24 (t (e) 25 (progn 26 (prove:diag (format nil "Choosing ~a failed: ~a" disassembler e)) 27 nil))) 28 (format nil "Able to choose ~a disassembler" disassembler))) 29 30 (prove:plan (length disassemblers)) 31 (dolist (disassembler disassemblers) 32 (let ((output (make-string-output-stream))) 33 (prove:ok 34 (handler-case 35 (let ((*standard-output* output)) 36 (sys:choose-disassembler disassembler) 37 (cl:disassemble #'cons) 38 (let ((result (get-output-stream-string output))) 39 (not (null (and result 40 (stringp result) 41 (> (length result) 0)))))) 42 (t (e) 43 (progn 44 (prove:diag (format nil "Invocation failed: ~a" e)) 45 nil))) 46 (format nil "Invocation of ~a disassembler" disassembler))))) 24 47 25 48 (prove:finalize) -
trunk/abcl/doc/manual/abcl.tex
r15273 r15280 12 12 \date{Version 1.6.2\\ 13 13 \smallskip 14 Unreleased 14 Unreleased} 15 15 \author{Mark Evenson \and Erik H\"{u}lsmann \and Rudolf Schlatte \and 16 16 Alessio Stalla \and Ville Voutilainen} … … 936 936 enabling the compiler to signal all warnings. 937 937 938 \subsection{Decompilation} 939 940 \label{CL:DISASSEMBLE} 941 Since \textsc{ABCL} compiles to JVM bytecode, the 942 \code{CL:DISASSEMBLE} function provides introspection for the result 943 of that compilation. By default the implementation attempts to find 944 and use the \code{javap} command line tool shipped as part of the Java 945 Development Kit to disassemble the results. Code for the use of 946 additional JVM bytecode introspection tools is packaged as part of the 947 ABCL-INTROSPECT contrib. After loading one of these tools via ASDF, 948 the \code{SYS:CHOOSE-DISASSEMBLER} function can be used to select the 949 tool used by \code{CL:DISASSEMBLE}. See 950 \ref{abcl-introspect-disassemblers} 951 on \pageref{abcl-introspect-disassemblers} for further details. 938 952 939 953 \section{Pathname} … … 1088 1102 1089 1103 \section{Package-Local Nicknames} 1090 \label{sec:pack -local-nickn}1104 \label{sec:package-local-nicknames} 1091 1105 1092 1106 ABCL allows giving packages local nicknames: they allow short and … … 1347 1361 \item \code{quicklisp-abcl} Boot a local Quicklisp installation 1348 1362 via the ASDF:IRI type introduced via ABCL-ASDF. 1349 1350 1363 \item \code{jfli} A descendant of Rich Hickey's pre-Clojure work 1351 1364 on the JVM. … … 1354 1367 Sucks 1355 1368 \item \code{abcl-introspect} Provides a framework for 1356 introspecting runtime Java and Lisp object values. 1369 introspecting runtime Java and Lisp object values. Include 1370 packaging for installing and using java decompilation tools 1371 for use with \code{CL:DISASSEMBLE}. 1357 1372 \item \code{abcl-build} Provides a toolkit for building ABCL 1358 1373 from source, as well as installing the necessary tools for … … 1535 1550 \label{section:jfli} 1536 1551 1537 The contrib contains a pure-Java version of JFLI. 1552 The contrib contains a pure-Java version of \textsc{JFLI}, apparently 1553 a descendent of Rich Hickey's early experimentations with using Java 1554 from Common Lisp. 1538 1555 1539 1556 \url{http://abcl.org/svn/tags/1.6.1/contrib/jfli/README}. … … 1541 1558 \section{abcl-introspect} 1542 1559 1543 \textsc{ABCL-INTROSPECT} offers more extensive systems for inspecting the state1544 of the implementation, most notably in integration with SLIME, where 1545 the backtrace mechanism is augmented to the point that local 1546 variables are inspectable.1560 \textsc{ABCL-INTROSPECT} offers more extensive functionality for 1561 inspecting the state of the implementation, most notably in 1562 integration with SLIME, where the backtrace mechanism is augmented to 1563 the point that local variables are inspectable. 1547 1564 1548 1565 A compiled function is an instance of a class - This class has … … 1557 1574 introspecting these constants. 1558 1575 1559 ABCL-INTROSPECTprovides access to those internal values, and1576 \textsc{ABCL-INTROSPECT} provides access to those internal values, and 1560 1577 uses them in at least two ways. First, to annotate locally defined 1561 1578 functions with the top-level function they are defined within, and … … 1571 1588 location of its 'owner' is instead returns. 1572 1589 1573 In order to record information about local functions, ABCL defines a 1574 function-plist, which is for the most part unused, but is used here 1575 with set of keys indicating where the local function was defined and 1576 in what manner, i.e. as normal local function, as a method function, 1577 or as an initarg function. There may be other places functions are 1578 stashed away (defstructs come to mind) and this file should be added 1579 to to take them into account as they are discovered. 1580 1581 ABCL-INTROSPECT does not depend on jss, but provides a bit of 1582 jss-specific functionality if jss *is* loaded. 1590 In order to record information about local functions, \textsc{ABCL} 1591 defines a function-plist, which is for the most part unused, but is 1592 used here with set of keys indicating where the local function was 1593 defined and in what manner, i.e. as normal local function, as a method 1594 function, or as an initarg function. There may be other places 1595 functions are stashed away (defstructs come to mind) and this file 1596 should be added to to take them into account as they are discovered. 1597 1598 \textsc{ABCL-INTROSPECT} does not depend on \textsc{JSS}, but provides 1599 a bit of jss-specific functionality if \textsc{JSS} *is* loaded. 1600 1601 \subsection{Implementations for CL:DISASSEMBLE} 1602 \label{abcl-introspect-disassemblers} 1603 1604 The following ASDF systems packages various external tools that may be 1605 selected by the \code{SYS:CHOOSE-DISASSEMBLER} interface: 1606 1607 \begin{enumerate} 1608 \item \code{objectweb} 1609 \item \code{jad} 1610 \item \code{javap} 1611 \item \code{fernweb} 1612 \item \code{cfr} 1613 \item \code{procyon} 1614 \end{enumerate} 1615 1616 To use one of these tools, first load the system via \textsc{ASDF} 1617 (and/or \textsc{Quicklisp}), then use the 1618 \code{SYS:CHOOSE-DISASSEMBLER} function to select the keyword that 1619 appears in \code{SYS:*DISASSEMBLERS*}. 1620 \begin{listing-lisp} 1621 CL-USER> (require :abcl-contrib)(asdf:load-system :objectweb) 1622 CL-USER> sys:*disassemblers* 1623 ((:OBJECTWEB 1624 . ABCL-INTROSPECT/JVM/TOOLS/OBJECTWEB:DISASSEMBLE-CLASS-BYTES) 1625 (:SYSTEM-JAVAP . SYSTEM:DISASSEMBLE-CLASS-BYTES)) 1626 CL-USER> (sys:choose-disassembler :objectweb) 1627 ABCL-INTROSPECT/JVM/TOOLS/OBJECTWEB:DISASSEMBLE-CLASS-BYTES 1628 CL-USER> (disassemble 'cons) 1629 ; // class version 52.0 (52) 1630 ; // access flags 0x30 1631 ; final class org/armedbear/lisp/Primitives$pf_cons extends org/armedbear/lisp/Primitive { 1632 ; 1633 ; // access flags 0x1A 1634 ; private final static INNERCLASS org/armedbear/lisp/Primitives$pf_cons org/armedbear/lisp/Primitives pf_cons 1635 ; 1636 ; // access flags 0x0 1637 ; <init>()V 1638 ; ALOAD 0 1639 ; GETSTATIC org/armedbear/lisp/Symbol.CONS : Lorg/armedbear/lisp/Symbol; 1640 ; LDC "object-1 object-2" 1641 ; INVOKESPECIAL org/armedbear/lisp/Primitive.<init> (Lorg/armedbear/lisp/Symbol;Ljava/lang/String;)V 1642 ; RETURN 1643 ; MAXSTACK = 3 1644 ; MAXLOCALS = 1 1645 ; 1646 ; // access flags 0x1 1647 ; public execute(Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;)Lorg/armedbear/lisp/LispObject; 1648 ; NEW org/armedbear/lisp/Cons 1649 ; DUP 1650 ; ALOAD 1 1651 ; ALOAD 2 1652 ; INVOKESPECIAL org/armedbear/lisp/Cons.<init> (Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;)V 1653 ; ARETURN 1654 ; MAXSTACK = 4 1655 ; MAXLOCALS = 3 1656 ; } 1657 NIL 1658 \end{listing-lisp} 1659 1583 1660 1584 1661 \url{http://abcl.org/svn/tags/1.6.1/contrib/abcl-introspect/}. -
trunk/abcl/src/org/armedbear/lisp/Lisp.java
r15137 r15280 2699 2699 public static final Symbol _DISASSEMBLER_ = 2700 2700 exportSpecial("*DISASSEMBLER*", PACKAGE_EXT, 2701 new SimpleString("ja d -a -p")); // or "jad -dis -p"2701 new SimpleString("javap -c -verbose")); // or "jad -dis -p" 2702 2702 2703 2703 // ### *speed* compiler policy -
trunk/abcl/src/org/armedbear/lisp/disassemble.lisp
r15013 r15280 41 41 42 42 (defvar *disassemblers* 43 `((:jad . disassemble-class-bytes)) 44 "Methods of invoking CL:DISASSEMBLE consisting of a pushable list of (name function), where function takes a object to disassemble, returns the results as a string. 45 46 The system is :jad using the venerable-but-still-works JAD. 43 `((:system-javap . disassemble-class-bytes)) 44 "Methods of invoking CL:DISASSEMBLE consisting of a enumeration of (keyword function) pairs 45 46 The pairs (keyword function) contain a keyword identifying this 47 particulat disassembler, and a symbol designating function takes a 48 object to disassemble. 49 50 Use SYS:CHOOSE-DISASSEMBLER to install a given disassembler as the one 51 used by CL:DISASSEMBLE. Additional disassemblers/decompilers are 52 packaged in the ABCL-INTROSPECT contrib. 53 54 The intial default is :javap using the javap command line tool which 55 is part of the Java Developement Kit. 47 56 ") 48 57 49 58 (defun choose-disassembler (&optional name) 50 "Hook to choose invoked behavior of CL:DISASSEMBLE by using one of the methods registered in SYSTEM:*DISASSEMBLERS*. 51 52 Optionally, prefer the strategy named NAME if one exists." 59 "Report current disassembler that would be used by CL:DISASSEMBLE 60 61 With optional keyword NAME, select the associated disassembler from 62 SYS:*DISASSEMBLERS*." 63 (flet ((sane-disassembler-p (disassembler) 64 (and disassembler 65 (fboundp disassembler)))) 53 66 (setf *disassembler-function* 54 67 (if name 55 68 (let ((disassembler (cdr (assoc name *disassemblers*)))) 56 (if (and disassembler 57 (fboundp disassembler)) 69 (if (sane-disassembler-p disassembler) 58 70 disassembler 59 71 (error "Disassembler ~a doesn't appear to work." name))) 60 (loop 61 :for (nil . disassembler) in *disassemblers* 62 :when (and disassembler 63 (fboundp disassembler)) 64 :do (return disassembler) 65 finally (warn "Can't find suitable disassembler."))))) 72 (if (sane-disassembler-p *disassembler-function*) 73 *disassembler-function* 74 ;; simplest strategy: choose the first working one 75 (loop 76 :for (nil . disassembler) in *disassemblers* 77 :when (sane-disassembler-p disassembler) 78 :do (return disassembler) 79 :finally (warn "Can't find suitable disassembler."))))))) 66 80 67 81 (eval-when (:compile-toplevel :load-toplevel :execute)
Note: See TracChangeset
for help on using the changeset viewer.