Last active
April 29, 2017 20:53
-
-
Save ghadishayban/b89eef68a3e6853f21e0c0ac74a8544a to your computer and use it in GitHub Desktop.
clojure "map template" using invokedynamic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static java.lang.Object invokeStatic(java.lang.Object, java.lang.Object, java.lang.Object); | |
Code: | |
0: bipush 10 | |
2: anewarray #13 // class java/lang/Object | |
5: dup | |
6: iconst_0 | |
7: getstatic #17 // Field const__0:Lclojure/lang/Keyword; | |
10: aastore | |
11: dup | |
12: iconst_1 | |
13: aload_0 | |
14: aconst_null | |
15: astore_0 | |
16: aastore | |
17: dup | |
18: iconst_2 | |
19: getstatic #20 // Field const__1:Lclojure/lang/Keyword; | |
22: aastore | |
23: dup | |
24: iconst_3 | |
25: getstatic #23 // Field const__2:Lclojure/lang/Keyword; | |
28: aastore | |
29: dup | |
30: iconst_4 | |
31: getstatic #26 // Field const__3:Lclojure/lang/Keyword; | |
34: aastore | |
35: dup | |
36: iconst_5 | |
37: getstatic #30 // Field const__4:Ljava/lang/Object; | |
40: aastore | |
41: dup | |
42: bipush 6 | |
44: getstatic #33 // Field const__5:Lclojure/lang/Keyword; | |
47: aastore | |
48: dup | |
49: bipush 7 | |
51: aload_1 | |
52: aconst_null | |
53: astore_1 | |
54: aastore | |
55: dup | |
56: bipush 8 | |
58: getstatic #36 // Field const__6:Lclojure/lang/Keyword; | |
61: aastore | |
62: dup | |
63: bipush 9 | |
65: aload_2 | |
66: aconst_null | |
67: astore_2 | |
68: aastore | |
69: invokestatic #42 // Method clojure/lang/RT.mapUniqueKeys:([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; | |
72: areturn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn testmap [a b c] | |
{:foo a | |
:bar :baz | |
:biz 42 | |
:bon b | |
:quux c}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static java.lang.Object invokeStatic(java.lang.Object, java.lang.Object, java.lang.Object); | |
Code: | |
0: aload_0 PUSH ARG A to STACK | |
1: aconst_null | |
2: astore_0 | |
3: getstatic #15 PUSH 42 // Field const__4:Ljava/lang/Object; | |
6: aload_1 PUSH ARG B to STACK | |
7: aconst_null | |
8: astore_1 | |
9: aload_2 PUSH ARG C to STACK | |
10: aconst_null | |
11: astore_2 | |
12: invokedynamic #39, 0 // InvokeDynamic #0:kwMap:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lclojure/lang/IPersistentMap; | |
17: areturn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment