Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --release option to build JRuby extension for older platforms #201

Merged
merged 4 commits into from
Jan 22, 2022

Conversation

tagomoris
Copy link
Contributor

Fixes #200

The patch can solve the problem msgpack/msgpack-ruby#239

Without this option (see Method java/nio/ByteBuffer.clear:()Ljava/nio/ByteBuffer; at 39):

$ javap -p -c -s -v -l -constants tmp/java/msgpack/org/msgpack/jruby/Encoder.class
(snip)
  private org.jruby.runtime.builtin.IRubyObject readRubyString();
    descriptor: ()Lorg/jruby/runtime/builtin/IRubyObject;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=8, locals=2, args_size=1
         0: aload_0
         1: getfield      #15                 // Field runtime:Lorg/jruby/Ruby;
         4: new           #89                 // class org/jruby/util/ByteList
         7: dup
         8: aload_0
         9: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        12: invokevirtual #78                 // Method java/nio/ByteBuffer.array:()[B
        15: iconst_0
        16: aload_0
        17: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        20: invokevirtual #82                 // Method java/nio/ByteBuffer.position:()I
        23: aload_0
        24: getfield      #41                 // Field binaryEncoding:Lorg/jcodings/Encoding;
        27: iconst_0
        28: invokespecial #91                 // Method org/jruby/util/ByteList."<init>":([BIILorg/jcodings/Encoding;Z)V
        31: invokevirtual #94                 // Method org/jruby/Ruby.newString:(Lorg/jruby/util/ByteList;)Lorg/jruby/RubyString;
        34: astore_1
        35: aload_0
        36: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        39: invokevirtual #98                 // Method java/nio/ByteBuffer.clear:()Ljava/nio/ByteBuffer;
        42: pop
        43: aload_1
        44: areturn
      LineNumberTable:
        line 69: 0
        line 70: 35
        line 71: 43
(snip)

With this option (see Method java/nio/ByteBuffer.clear:()Ljava/nio/Buffer; at 39 as well)

  private org.jruby.runtime.builtin.IRubyObject readRubyString();
    descriptor: ()Lorg/jruby/runtime/builtin/IRubyObject;
    flags: (0x0002) ACC_PRIVATE
    Code:
      stack=8, locals=2, args_size=1
         0: aload_0
         1: getfield      #15                 // Field runtime:Lorg/jruby/Ruby;
         4: new           #89                 // class org/jruby/util/ByteList
         7: dup
         8: aload_0
         9: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        12: invokevirtual #78                 // Method java/nio/ByteBuffer.array:()[B
        15: iconst_0
        16: aload_0
        17: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        20: invokevirtual #82                 // Method java/nio/ByteBuffer.position:()I
        23: aload_0
        24: getfield      #41                 // Field binaryEncoding:Lorg/jcodings/Encoding;
        27: iconst_0
        28: invokespecial #91                 // Method org/jruby/util/ByteList."<init>":([BIILorg/jcodings/Encoding;Z)V
        31: invokevirtual #94                 // Method org/jruby/Ruby.newString:(Lorg/jruby/util/ByteList;)Lorg/jruby/RubyString;
        34: astore_1
        35: aload_0
        36: getfield      #25                 // Field buffer:Ljava/nio/ByteBuffer;
        39: invokevirtual #98                 // Method java/nio/ByteBuffer.clear:()Ljava/nio/Buffer;
        42: pop
        43: aload_1
        44: areturn
      LineNumberTable:
        line 69: 0
        line 70: 35
        line 71: 43

lib/rake/javaextensiontask.rb Outdated Show resolved Hide resolved
@tagomoris
Copy link
Contributor Author

I'll report on this pull request once the pre-released gem worked well.

@tagomoris
Copy link
Contributor Author

We've confirmed that this change works well!
msgpack/msgpack-ruby#239 (comment)

@kou
Copy link
Member

kou commented Jan 22, 2022

OK.
I'll merge this and release a new version.

@kou kou merged commit 36aad47 into rake-compiler:master Jan 22, 2022
@tagomoris tagomoris deleted the support-release-option-for-jruby branch January 22, 2022 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support --release flag
2 participants