• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Clojureによるバイトコードプログラミング
 

Clojureによるバイトコードプログラミング

on

  • 2,279 views

 

Statistics

Views

Total Views
2,279
Views on SlideShare
1,463
Embed Views
816

Actions

Likes
4
Downloads
3
Comments
0

8 Embeds 816

http://d.hatena.ne.jp 738
http://athos.hatenablog.com 45
https://twitter.com 17
http://a0.twimg.com 6
http://paper.li 6
http://webcache.googleusercontent.com 2
http://asakusasatellite.heroku.com 1
http://rss.ameba.jp 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Clojureによるバイトコードプログラミング Clojureによるバイトコードプログラミング Presentation Transcript

    • 2
    • public java.lang.Object invoke(java.lang.Object); Code: Stack=8, Locals=8, Args_size=2 0: aload_1 1: aconst_null 2: astore_1 3: invokestatic #65; //Method clojure/lang 6: lstore_2 7: lconst_1 8: lstore 4 10: lload_2 11: lconst_0 12: lcmp 13: ifne 25 16: lload 4 18: invokestatic #71; //Method clojure/lang 21: goto 38 24: pop 25: lload_2 26: lconst_1 27: lsub 28: lload_2 29: lload 4(defn fact [n] 31: lmul (loop [n (long n), a 1] 32: lstore 4 (if (== n 0) 34: lstore_2 a 35: goto 10 (recur (dec n) (* n a))))) 38: areturn 3
    • (def fact (fn-iasm [n] (aload_1) (checkcast Integer) (invokevirtual ^int Integer/intValue []) (istore_2) (iconst_1) (istore_3) :loop (iload_2) (ifeq :end) (ilaod_2) (iload_3) (imul) (istore_3) (iinc 2 -1) (goto :loop) :end (iload_3) (invokestatic ^Integer Integer/valueOf [int]) (areturn))) 4
    • (def fact public final java.lang.Object invoke(java.lang. (fn-iasm [n] Code: (aload_1) Stack=2, Locals=6, Args_size=2 (checkcast Integer) 0: aload_1 (invokevirtual ^int Integer/intValue []) 1: checkcast #25; //class java/lang/I (istore_2) 4: invokevirtual #29; //Method java/lang/ (iconst_1) 7: istore_2 (istore_3) 8: iconst_1 :loop 9: istore_3 (iload_2) 10: iload_2 (ifeq :end) 11: ifeq 24 (ilaod_2) 14: iload_2 (iload_3) 15: iload_3 (imul) 16: imul (istore_3) 17: istore_3 (iinc 2 -1) 18: iinc 2, -1 (goto :loop) 21: goto 10 :end 24: iload_3 (iload_3) 25: invokestatic #33; //Method java/lang/ (invokestatic ^Integer Integer/valueOf [int]) 28: areturn (areturn))) 4
    • public java.lang.Object invoke(java.lang.Object); Code: Stack=8, Locals=8, Args_size=2 0: aload_1 1: aconst_null 2: astore_1 3: invokestatic #65; //Method clojure/lang 6: lstore_2 7: lconst_1 8: lstore 4 macro 10: lload_2 11: lconst_0(defn fact [n] (loop [n (long n), a 1] expand analyze emit 12: lcmp 13: ifne 25 (if (== n 0) 16: lload 4 a 18: invokestatic #71; //Method clojure/lang (recur (dec n) (* n a))))) 21: goto 38 24: pop 25: lload_2 26: lconst_1 27: lsub 28: lload_2 29: lload 4 31: lmul 32: lstore 4 34: lstore_2 35: goto 10 38: areturn 5
    • public java.lang.Object invoke(java.lang.Object); Code: Stack=8, Locals=8, Args_size=2 0: aload_1 1: aconst_null 2: astore_1 3: invokestatic #65; //Method clojure/lang 6: lstore_2 7: lconst_1 8: lstore 4 macro 10: lload_2 11: lconst_0(defn fact [n] (loop [n (long n), a 1] expand analyze emit 12: lcmp 13: ifne 25 (if (== n 0) 16: lload 4 a 18: invokestatic #71; //Method clojure/lang (recur (dec n) (* n a))))) 21: goto 38 24: pop 25: lload_2 26: lconst_1 27: lsub 28: lload_2 29: lload 4 31: lmul 32: lstore 4 34: lstore_2 35: goto 10 38: areturn 5
    • public java.lang.Object invoke(java.lang.Object); Code: Stack=8, Locals=8, Args_size=2 0: aload_1 1: aconst_null 2: astore_1 3: invokestatic #65; //Method clojure/lang 6: lstore_2 7: lconst_1 8: lstore 4 macro 10: lload_2 11: lconst_0(defn fact [n] (loop [n (long n), a 1] expand analyze emit 12: lcmp 13: ifne 25 (if (== n 0) 16: lload 4 a 18: invokestatic #71; //Method clojure/lang (recur (dec n) (* n a))))) 21: goto 38 24: pop 25: lload_2 26: lconst_1 27: lsub 28: lload_2 29: lload 4 31: lmul 32: lstore 4 34: lstore_2 35: goto 10 38: areturn 5
    • public java.lang.Object invoke(java.lang.Object); Code: Stack=8, Locals=8, Args_size=2 0: aload_1 1: aconst_null 2: astore_1 3: invokestatic #65; //Method clojure/lang 6: lstore_2 7: lconst_1 8: lstore 4 macro 10: lload_2 11: lconst_0(defn fact [n] (loop [n (long n), a 1] expand analyze emit 12: lcmp 13: ifne 25 (if (== n 0) 16: lload 4 a 18: invokestatic #71; //Method clojure/lang (recur (dec n) (* n a))))) 21: goto 38 24: pop 25: lload_2 public java.lang.Object invoke(java.lang.Object); 26: lconst_1 Code: 27: lsub Stack=8, Locals=8, Args_size=2 28: lload_2 0: aload_1 29: lload 4 1: aconst_null 31: lmul 2: astore_1 32: lstore 4 3: invokestatic #65; //Method clojure/lang 34: lstore_2 6: lstore_2 35: goto 10 7: lconst_1 38: areturn 8: lstore 4 10: lload_2 11: lconst_0 12: lcmp 13: ifne 25 16: lload 4 18: invokestatic #71; //Method clojure/lang 21: goto 38 24: pop 25: lload_2 26: lconst_1 27: lsub 28: lload_2 29: lload 4 31: lmul 32: lstore 4 34: lstore_2 35: goto 10 38: areturn 5
    • 6
    • 7
    • 0.60 Clojure 1.2.1 iasm0.450.300.15 0 100 200 300 400 9
    • 10