source: trunk/abcl/contrib/abcl-introspect/objectweb.lisp @ 15013

Last change on this file since 15013 was 15013, checked in by Mark Evenson, 6 years ago

Restore the ability SYSTEM:CHOOSE-ASSEMBLER to use Objectweb

The Objectweb disassembler has been moved into the ABCL-INTROSPECT
contrib where it can be rationally installed via ABCL-ASDF
encapsulation of Maven artifacts.

To enable the Objectweb disassembler use

(require :abcl-contrib)
(require :objectweb)

File size: 999 bytes
1(in-package :cl-user)
2(defpackage :abcl/build/jvm/tools/objectweb
3  (:use :cl)
4  (:export
5   #:disassemble-class-bytes))
6(in-package :abcl/build/jvm/tools/objectweb)
8(defun disassemble-class-bytes (object)
9  (let* ((reader (java:jnew "org.objectweb.asm.ClassReader" object))
10         (writer (java:jnew ""))
11         (printer (java:jnew "" writer))
12         (tracer (java:jnew "org.objectweb.asm.util.TraceClassVisitor" java:+null+ printer))
13         ;; this is to support both the 1.X and subsequent releases
14         (flags (ignore-errors (java:jfield "org.objectweb.asm.ClassReader" "SKIP_DEBUG"))))
15    (java:jcall-raw "accept" reader tracer (or flags java:+false+))
16    (java:jcall "toString" writer)))
18(eval-when (:load-toplevel :execute)
19  (pushnew `(:objectweb . abcl/build/jvm/tools/objectweb::disassemble-class-bytes)
20           sys::*disassemblers*)
21  (format cl:*load-verbose* "~&; ~a ; Successfully added Objectweb disassembler.~%" *package*))
Note: See TracBrowser for help on using the repository browser.