Changeset 14943


Ignore:
Timestamp:
01/11/17 21:04:39 (5 years ago)
Author:
Mark Evenson
Message:

de-jss

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/disassemble.lisp

    r14942 r14943  
    8181;; disassemble more things
    8282(defun disassemble-function (arg)
    83   (let ((function (cond ((#"isInstance" (java:jclass "org.armedbear.lisp.CompiledClosure") arg)
     83  (let ((function (cond ((java:jcall "isInstance" (java:jclass "org.armedbear.lisp.CompiledClosure") arg)
    8484       (return-from disassemble-function "don't know how to disassemble CompiledClosure"))
    8585      ((java::java-object-p arg)
     
    9191             ;; because the latter checked java-object-p
    9292             ;; which fails since its a lisp object
    93              ((and (#"isInstance"  (java:jclass "org.armedbear.lisp.Closure") arg)
    94              (not (#"isInstance"  (java:jclass "org.armedbear.lisp.CompiledClosure") arg)))
     93             ((and (java:jcall "isInstance"  (java:jclass "org.armedbear.lisp.Closure") arg)
     94             (not (java:jcall "isInstance"  (java:jclass "org.armedbear.lisp.CompiledClosure") arg)))
    9595        (return-from disassemble-function
    9696          (with-output-to-string (s)
    9797            (format s "Not a compiled function: ~%")
    98             (pprint (#"getBody" arg) s))))
     98            (pprint (java:jcall "getBody" arg) s))))
    9999             ))
    100100      ((functionp arg)
     
    111111      (if bytes
    112112    (system::disassemble-class-bytes bytes)
    113     (let ((class (if (java:java-object-p function) function (#"getClass" function))))
    114       (let ((classloader (#"getClassLoader" class)))
     113    (let ((class (if (java:java-object-p function) function (java:jcall "getClass" function))))
     114      (let ((classloader (java:jcall "getClassLoader" class)))
    115115        (if (or (java:jinstance-of-p classloader "org.armedbear.lisp.MemoryClassLoader")
    116116          (java:jinstance-of-p classloader "org.armedbear.lisp.FaslClassLoader"))
    117117      (system::disassemble-class-bytes
    118        (#"getFunctionClassBytes" classloader class))
    119       (let ((path (jss::path-to-class (#"getName" class))))
    120         (let ((split (cl-user::split-at-char (#"replaceFirst" path "jar:file:" "") #\!)))
    121           (let ((jar (jss::new 'jarfile (car split))))
    122       (system::disassemble-class-bytes
    123        (#"toByteArray" 'ByteStreams
    124            (#"getInputStream" jar
    125                   (#"getJarEntry" jar (subseq (second split) 1)))))))))))))))
     118       (java:jcall "getFunctionClassBytes" classloader class))
     119      (system::disassemble-class-bytes
     120       (java:jstatic "toByteArray" "com.google.common.io.ByteStreams"
     121         (java:jcall-raw
     122          "getResourceAsStream"
     123          (java:jcall-raw "getClassLoader" class)
     124          (class-resource-path class)))))))))))
     125
    126126(defun disassemble (arg)
    127127  (write-string (disassemble-function arg) *standard-output*))
Note: See TracChangeset for help on using the changeset viewer.