如何从repl检查Clojure生成的java字节码?

use*_*747 9 java bytecode clojure

我找不到关于这个主题的很多信息.看起来jswat可以用来完成这个,但我找不到任何一步一步的教程.

num*_*_cn 0

怎么样: https: //github.com/nathanmarz/serializes-fn

来自自述文件演示:

(use 'serializable.fn)

;; note that this function being created has a function value in its closure
(def f (let [x + c 2]
          (fn [a b] (x a b c))))

(println (f 1 2))

;; 5

(def b (serialize f))

(println (seq b))

;; (0 0 0 2 0 0 0 -79 0 0 0 2 0 1 99 0 0 0 90 0 0 0 3 0 0 0 82 -84 -19 0 5 115 114 0 14 106 97 118 97 46 108 97 110 103 46 76 111 110 103 59 -117 -28 -112 -52 -113 35 -33 2 0 1 74 0 5 118 97 108 117 101 120 114 0 16 106 97 118 97 46 108 97 110 103 46 78 117 109 98 101 114 -122 -84 -107 29 11 -108 -32 -117 2 0 0 120 112 0 0 0 0 0 0 0 2 0 1 120 0 0 0 25 0 0 0 1 0 0 0 17 0 12 99 108 111 106 117 114 101 46 99 111 114 101 0 1 43 0 4 117 115 101 114 0 36 40 115 101 114 105 97 108 105 122 97 98 108 101 46 102 110 47 102 110 32 91 97 32 98 93 32 40 120 32 97 32 98 32 99 41 41)

;; now, restart the repl

(def b
(byte-array (map byte '(0 0 0 2 0 0 0 -79 0 0 0 2 0 1 99 0 0 0 90 0 0 0 3 0 0 0 82 -84 -19 0 5 115 114 0 14 106 97 118 97 46 108 97 110 103 46 76 111 110 103 59 -117 -28 -112 -52 -113 35 -33 2 0 1 74 0 5 118 97 108 117 101 120 114 0 16 106 97 118 97 46 108 97 110 103 46 78 117 109 98 101 114 -122 -84 -107 29 11 -108 -32 -117 2 0 0 120 112 0 0 0 0 0 0 0 2 0 1 120 0 0 0 25 0 0 0 1 0 0 0 17 0 12 99 108 111 106 117 114 101 46 99 111 114 101 0 1 43 0 4 117 115 101 114 0 36 40 115 101 114 105 97 108 105 122 97 98 108 101 46 102 110 47 102 110 32 91 97 32 98 93 32 40 120 32 97 32 98 32 99 41 41))))

(use 'serializable.fn)

(def f (deserialize b))

(println f 1 2)

;; 5
Run Code Online (Sandbox Code Playgroud)