Created
October 28, 2011 17:54
-
-
Save abedra/1322893 to your computer and use it in GitHub Desktop.
JRuby bytecode test
This file contains hidden or 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
~/Desktop> jrubyc test.rb | |
~/Desktop> javap -c test | |
Compiled from "test.rb" | |
public class test extends org.jruby.ast.executable.AbstractScript{ | |
public test(); | |
Code: | |
0: aload_0 | |
1: invokespecial #18; //Method org/jruby/ast/executable/AbstractScript."<init>":()V | |
4: aload_0 | |
5: ldc #8; //String test.rb | |
7: putfield #22; //Field filename:Ljava/lang/String; | |
10: aload_0 | |
11: new #191; //class org/jruby/ast/executable/RuntimeCache | |
14: dup | |
15: invokespecial #192; //Method org/jruby/ast/executable/RuntimeCache."<init>":()V | |
18: putfield #196; //Field org/jruby/ast/executable/AbstractScript.runtimeCache:Lorg/jruby/ast/executable/RuntimeCache; | |
21: aload_0 | |
22: ldc #198; //String puts?F? | |
24: invokevirtual #201; //Method org/jruby/ast/executable/AbstractScript.initFromDescriptor:(Ljava/lang/String;)V | |
27: aload_0 | |
28: ldc #108; //int 0 | |
30: ldc #203; //String ASCII-8BIT | |
32: invokevirtual #207; //Method org/jruby/ast/executable/AbstractScript.setEncoding:(ILjava/lang/String;)V | |
35: aload_0 | |
36: ldc #208; //int 2 | |
38: ldc #210; //String two | |
40: aload_0 | |
41: invokevirtual #214; //Method getEncoding0:()Lorg/jcodings/Encoding; | |
44: invokevirtual #218; //Method org/jruby/ast/executable/AbstractScript.setByteList:(ILjava/lang/String;Lorg/jcodings/Encoding;)V | |
47: aload_0 | |
48: ldc #108; //int 0 | |
50: ldc #220; //String 123 | |
52: aload_0 | |
53: invokevirtual #214; //Method getEncoding0:()Lorg/jcodings/Encoding; | |
56: invokevirtual #218; //Method org/jruby/ast/executable/AbstractScript.setByteList:(ILjava/lang/String;Lorg/jcodings/Encoding;)V | |
59: aload_0 | |
60: ldc #106; //int 1 | |
62: ldc #222; //String one | |
64: aload_0 | |
65: invokevirtual #214; //Method getEncoding0:()Lorg/jcodings/Encoding; | |
68: invokevirtual #218; //Method org/jruby/ast/executable/AbstractScript.setByteList:(ILjava/lang/String;Lorg/jcodings/Encoding;)V | |
71: aload_0 | |
72: ldc #223; //int 3 | |
74: ldc #225; //String enough already | |
76: aload_0 | |
77: invokevirtual #214; //Method getEncoding0:()Lorg/jcodings/Encoding; | |
80: invokevirtual #218; //Method org/jruby/ast/executable/AbstractScript.setByteList:(ILjava/lang/String;Lorg/jcodings/Encoding;)V | |
83: return | |
public static org.jruby.runtime.builtin.IRubyObject __file__(test, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.builtin.IRubyObject[], org.jruby.runtime.Block); | |
Code: | |
0: aload_1 | |
1: getfield #28; //Field org/jruby/runtime/ThreadContext.nil:Lorg/jruby/runtime/builtin/IRubyObject; | |
4: astore 9 | |
6: aload_1 | |
7: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
10: aload_0 | |
11: aload_1 | |
12: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
15: ldc #37; //String foo | |
17: invokevirtual #41; //Method getSymbol0:(Lorg/jruby/Ruby;Ljava/lang/String;)Lorg/jruby/RubySymbol; | |
20: aload_0 | |
21: aload_1 | |
22: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
25: bipush 32 | |
27: invokevirtual #45; //Method getString0:(Lorg/jruby/Ruby;I)Lorg/jruby/RubyString; | |
30: aload_0 | |
31: aload_1 | |
32: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
35: ldc #47; //String bar | |
37: invokevirtual #50; //Method getSymbol1:(Lorg/jruby/Ruby;Ljava/lang/String;)Lorg/jruby/RubySymbol; | |
40: aload_1 | |
41: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
44: aload_0 | |
45: aload_1 | |
46: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
49: ldc #52; //String baz | |
51: invokevirtual #55; //Method getSymbol2:(Lorg/jruby/Ruby;Ljava/lang/String;)Lorg/jruby/RubySymbol; | |
54: aload_1 | |
55: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
58: aload_0 | |
59: aload_1 | |
60: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
63: bipush 32 | |
65: invokevirtual #58; //Method getString1:(Lorg/jruby/Ruby;I)Lorg/jruby/RubyString; | |
68: aload_0 | |
69: aload_1 | |
70: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
73: bipush 32 | |
75: invokevirtual #61; //Method getString2:(Lorg/jruby/Ruby;I)Lorg/jruby/RubyString; | |
78: aload_1 | |
79: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
82: invokestatic #67; //Method org/jruby/RubyFixnum.three:(Lorg/jruby/Ruby;)Lorg/jruby/RubyFixnum; | |
85: aload_1 | |
86: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
89: invokestatic #70; //Method org/jruby/RubyFixnum.four:(Lorg/jruby/Ruby;)Lorg/jruby/RubyFixnum; | |
92: invokestatic #76; //Method org/jruby/javasupport/util/RuntimeHelpers.constructRubyArray:(Lorg/jruby/Ruby;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyArray; | |
95: invokestatic #80; //Method org/jruby/javasupport/util/RuntimeHelpers.constructHash:(Lorg/jruby/Ruby;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyHash; | |
98: aload_0 | |
99: aload_1 | |
100: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
103: ldc #82; //String quux | |
105: invokevirtual #85; //Method getSymbol3:(Lorg/jruby/Ruby;Ljava/lang/String;)Lorg/jruby/RubySymbol; | |
108: aload_0 | |
109: aload_1 | |
110: getfield #35; //Field org/jruby/runtime/ThreadContext.runtime:Lorg/jruby/Ruby; | |
113: bipush 32 | |
115: invokevirtual #88; //Method getString3:(Lorg/jruby/Ruby;I)Lorg/jruby/RubyString; | |
118: invokestatic #91; //Method org/jruby/javasupport/util/RuntimeHelpers.constructHash:(Lorg/jruby/Ruby;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyHash; | |
121: astore 9 | |
123: aload_0 | |
124: invokevirtual #95; //Method getCallSite0:()Lorg/jruby/runtime/CallSite; | |
127: aload_1 | |
128: aload_2 | |
129: aload_2 | |
130: aload 9 | |
132: invokevirtual #101; //Method org/jruby/runtime/CallSite.call:(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject; | |
135: areturn | |
public org.jruby.runtime.builtin.IRubyObject __file__(org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.builtin.IRubyObject[], org.jruby.runtime.Block); | |
Code: | |
0: aload_0 | |
1: aload_1 | |
2: aload_2 | |
3: aload_3 | |
4: aload 4 | |
6: invokestatic #31; //Method __file__:(Ltest;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject; | |
9: areturn | |
public org.jruby.runtime.builtin.IRubyObject load(org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, boolean); | |
Code: | |
0: aload_1 | |
1: ldc #115; //String a,0,0,-2 | |
3: iload_3 | |
4: invokestatic #119; //Method org/jruby/javasupport/util/RuntimeHelpers.preLoad:(Lorg/jruby/runtime/ThreadContext;Ljava/lang/String;Z)V | |
7: aload_0 | |
8: aload_1 | |
9: aload_2 | |
10: getstatic #125; //Field org/jruby/runtime/builtin/IRubyObject.NULL_ARRAY:[Lorg/jruby/runtime/builtin/IRubyObject; | |
13: getstatic #131; //Field org/jruby/runtime/Block.NULL_BLOCK:Lorg/jruby/runtime/Block; | |
16: invokestatic #31; //Method __file__:(Ltest;Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject; | |
19: aload_1 | |
20: invokestatic #135; //Method org/jruby/javasupport/util/RuntimeHelpers.postLoad:(Lorg/jruby/runtime/ThreadContext;)V | |
23: areturn | |
24: aload_1 | |
25: invokestatic #135; //Method org/jruby/javasupport/util/RuntimeHelpers.postLoad:(Lorg/jruby/runtime/ThreadContext;)V | |
28: athrow | |
Exception table: | |
from to target type | |
0 24 24 any | |
public static void main(java.lang.String[]); | |
Code: | |
0: new #2; //class test | |
3: dup | |
4: invokespecial #140; //Method "<init>":()V | |
7: dup | |
8: ldc #2; //class test | |
10: invokevirtual #146; //Method java/lang/Class.getClassLoader:()Ljava/lang/ClassLoader; | |
13: ldc #148; //String test.class | |
15: invokevirtual #154; //Method java/lang/ClassLoader.getResource:(Ljava/lang/String;)Ljava/net/URL; | |
18: invokevirtual #160; //Method java/lang/Object.toString:()Ljava/lang/String; | |
21: astore_1 | |
22: aload_1 | |
23: invokevirtual #164; //Method org/jruby/ast/executable/AbstractScript.setFilename:(Ljava/lang/String;)V | |
26: new #166; //class org/jruby/RubyInstanceConfig | |
29: dup | |
30: invokespecial #167; //Method org/jruby/RubyInstanceConfig."<init>":()V | |
33: dup | |
34: aload_0 | |
35: invokevirtual #170; //Method org/jruby/RubyInstanceConfig.setArgv:([Ljava/lang/String;)V | |
38: dup | |
39: aload_1 | |
40: invokevirtual #173; //Method org/jruby/RubyInstanceConfig.setScriptFileName:(Ljava/lang/String;)V | |
43: invokestatic #179; //Method org/jruby/Ruby.newInstance:(Lorg/jruby/RubyInstanceConfig;)Lorg/jruby/Ruby; | |
46: dup | |
47: invokevirtual #183; //Method org/jruby/Ruby.getCurrentContext:()Lorg/jruby/runtime/ThreadContext; | |
50: swap | |
51: invokevirtual #187; //Method org/jruby/Ruby.getTopSelf:()Lorg/jruby/runtime/builtin/IRubyObject; | |
54: ldc #108; //int 0 | |
56: invokevirtual #189; //Method load:(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Z)Lorg/jruby/runtime/builtin/IRubyObject; | |
59: return | |
} |
This file contains hidden or 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
a = {:foo => "123", :bar => {:baz => ["one", "two", 3, 4]}, :quux => "enough already"} | |
puts a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment