Created
January 22, 2020 22:16
-
-
Save headius/a412702789dfd1d321a594269866bb46 to your computer and use it in GitHub Desktop.
Example of JRuby 9k AOT without JVM bytecode compilation
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
[] ~/projects/jruby $ cat blah.rb | |
def foo | |
puts "hello" | |
end | |
foo | |
[] ~/projects/jruby $ jruby --dev -S jrubyc blah.rb | |
[] ~/projects/jruby $ javap -c -private blah | |
Compiled from "blah.rb" | |
public class blah { | |
private static final java.lang.String script_ir; | |
public static {}; | |
Code: | |
0: new #11 // class java/lang/StringBuilder | |
3: dup | |
4: invokespecial #14 // Method java/lang/StringBuilder."<init>":()V | |
7: ldc #16 // String ÿÿÿÿ\tRtsRt_C0C\"foUS-ASCIISt(t\tRtsRt_OffÿÿÿÿÿCRt'zhelloUTF-8blah.rbputUS-ASCIIStt(tblah.rbÿÿÿÿÿÿÿ | |
foUS-ASCIIÿÿÿÿÿÿÿ; | |
9: invokevirtual #20 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
12: invokevirtual #24 // Method java/lang/Object.toString:()Ljava/lang/String; | |
15: putstatic #26 // Field script_ir:Ljava/lang/String; | |
18: return | |
public static void main(java.lang.String[]); | |
Code: | |
0: invokestatic #34 // Method org/jruby/Ruby.newInstance:()Lorg/jruby/Ruby; | |
3: astore_1 | |
4: aload_1 | |
5: aload_1 | |
6: getstatic #26 // Field script_ir:Ljava/lang/String; | |
9: ldc #36 // String ISO-8859-1 | |
11: invokevirtual #42 // Method java/lang/String.getBytes:(Ljava/lang/String;)[B | |
14: ldc #43 // String blah.rb | |
16: invokestatic #49 // Method org/jruby/ir/runtime/IRRuntimeHelpers.decodeScopeFromBytes:(Lorg/jruby/Ruby;[BLjava/lang/String;)Lorg/jruby/ir/IRScope; | |
19: invokevirtual #53 // Method org/jruby/Ruby.runInterpreter:(Lorg/jruby/ParseResult;)Lorg/jruby/runtime/builtin/IRubyObject; | |
22: return | |
public static org.jruby.ir.IRScope loadIR(org.jruby.Ruby, java.lang.String); | |
Code: | |
0: aload_0 | |
1: getstatic #26 // Field script_ir:Ljava/lang/String; | |
4: ldc #36 // String ISO-8859-1 | |
6: invokevirtual #42 // Method java/lang/String.getBytes:(Ljava/lang/String;)[B | |
9: aload_1 | |
10: invokestatic #49 // Method org/jruby/ir/runtime/IRRuntimeHelpers.decodeScopeFromBytes:(Lorg/jruby/Ruby;[BLjava/lang/String;)Lorg/jruby/ir/IRScope; | |
13: areturn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment