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

corrupted JIT byte-code for method #4429

Closed
kares opened this Issue Jan 8, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@kares
Member

kares commented Jan 8, 2017

Environment

Noticed this with the verifier being switched off. Happens in 9.1.5/9.1.6 as well as on master.

  • JAVA_OPTS=-noverify

Somehow I am failing to reproduce in isolation, even as I try with a empty Rails app (will try more).

Was able to cause a JVM segfault running tests as well as with rake assets:precompile.

Problematic piece (from sass gem) :

def rgba(*args)
  case args.size
    when 2
      color, alpha = args

      assert_type color, :Color, :color
      if calc?(alpha)
        unquoted_string("rgba(#{color.red}, #{color.green}, #{color.blue}, #{alpha})")
      else
        assert_type alpha, :Number, :alpha
        check_alpha_unit alpha, 'rgba'
        color.with(:alpha => alpha.value)
      end
    when 4
      red, green, blue, alpha = args
      if calc?(red) || calc?(green) || calc?(blue) || calc?(alpha)
        unquoted_string("rgba(#{red}, #{green}, #{blue}, #{alpha})")
      else
        rgba(rgb(red, green, blue), alpha)
      end
    else
      raise ArgumentError.new("wrong number of arguments (#{args.size} for 4)")
  end
end

Expected Behavior

  • Generated (method) byte-code should not be refected by the verifier.

Thinking JRuby might want to set -noverify for some of its jit test suite - thus JIT compiler issues would be caught earlier, make sense?

Full Log: for the problematic (`Sass::Script::Functions.rgba`) method

*** Dumping opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.RUBY$method$rgba$0 ***
   L0
   L1
    NOP
   L2
    NOP
    ALOAD 0
    ALOAD 1
    ALOAD 3
    LDC 0
    LDC 0
    LDC true
    LDC false
    LDC -1
    ACONST_NULL
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.checkArity (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/parser/StaticScope;[Ljava/lang/Object;IIZZILorg/jruby/runtime/Block$Type;)V
    ALOAD 0
    ALOAD 3
    ICONST_0
    ICONST_0
    LDC false
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.receiveRestArg (Lorg/jruby/runtime/ThreadContext;[Ljava/lang/Object;IIZ)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 8
   L3
    LINENUMBER 694 L3
    ALOAD 0
    ALOAD 2
    ALOAD 8
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther0:size (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 9
    ALOAD 9
    DUP
    INSTANCEOF org/jruby/RubyFixnum
    IFEQ L4
    CHECKCAST org/jruby/RubyFixnum
    INVOKEVIRTUAL org/jruby/RubyFixnum.getIntValue ()I
    TABLESWITCH
      2: L5
      3: L6
      default: L7
   L4
    POP
   L8
   L8
    NOP
    ALOAD 0
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fixnum1 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyFixnum;
    ALOAD 9
    GETSTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther2:=== : Lorg/jruby/runtime/callsite/CachingCallSite;
    DUP
    IFNONNULL L9
    POP
    LDC "==="
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.newFunctionalCachingCallSite (Ljava/lang/String;)Lorg/jruby/runtime/callsite/FunctionalCachingCallSite;
    DUP
    PUTSTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther2:=== : Lorg/jruby/runtime/callsite/CachingCallSite;
   L9
    LDC true
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.isEQQ (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/CallSite;Z)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 10
    ALOAD 10
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFNE L5
   L10
    NOP
    ALOAD 0
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fixnum3 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyFixnum;
    ALOAD 9
    GETSTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther4:=== : Lorg/jruby/runtime/callsite/CachingCallSite;
    DUP
    IFNONNULL L11
    POP
    LDC "==="
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.newFunctionalCachingCallSite (Ljava/lang/String;)Lorg/jruby/runtime/callsite/FunctionalCachingCallSite;
    DUP
    PUTSTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther4:=== : Lorg/jruby/runtime/callsite/CachingCallSite;
   L11
    LDC true
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.isEQQ (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/CallSite;Z)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 11
    ALOAD 11
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFNE L6
   L12
    NOP
   L7
    NOP
   L13
    LINENUMBER 714 L13
    ALOAD 0
    ALOAD 1
    INVOKEDYNAMIC searchConst(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/parser/StaticScope;)Lorg/jruby/runtime/builtin/IRubyObject; [
      // handle kind 0x6 : INVOKESTATIC
      org/jruby/ir/targets/ConstantLookupSite.constLookup(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite;
      // arguments:
      "ArgumentError", 
      0
    ]
    ASTORE 12
    ALOAD 0
    ALOAD 2
    ALOAD 8
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther5:size (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 13
    ALOAD 0
    GETFIELD org/jruby/runtime/ThreadContext.runtime : Lorg/jruby/Ruby;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.bytelist6 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/util/ByteList;
    LDC 0
    INVOKESTATIC org/jruby/RubyString.newStringShared (Lorg/jruby/Ruby;Lorg/jruby/util/ByteList;I)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring7 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 13
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring8 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ASTORE 14
    ALOAD 0
    ALOAD 2
    ALOAD 12
    ALOAD 14
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther9:new (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 15
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 15
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther10:raise (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 16
    ALOAD 16
    ARETURN
   L14
    NOP
    ALOAD 0
    GETFIELD org/jruby/runtime/ThreadContext.nil : Lorg/jruby/runtime/builtin/IRubyObject;
    ARETURN
   L6
    NOP
   L15
    LINENUMBER 707 L15
    ALOAD 0
    ALOAD 8
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irToAry (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 17
    ALOAD 0
    ALOAD 17
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_0
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 18
    ALOAD 0
    ALOAD 17
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_1
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 19
    ALOAD 0
    ALOAD 17
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_2
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 20
    ALOAD 0
    ALOAD 17
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_3
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 21
    ALOAD 18
    ASTORE 22
    ALOAD 19
    ASTORE 23
    ALOAD 20
    ASTORE 24
    ALOAD 21
    ASTORE 25
   L16
    LINENUMBER 708 L16
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 18
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther11:calc? (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 26
    ALOAD 26
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFNE L17
   L18
    NOP
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 23
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther12:calc? (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 27
    ALOAD 27
    ASTORE 26
   L17
    NOP
    ALOAD 26
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFNE L19
   L20
    NOP
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 24
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther13:calc? (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 28
    ALOAD 28
    ASTORE 26
   L19
    NOP
    ALOAD 26
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFNE L21
   L22
    NOP
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 25
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther14:calc? (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 29
    ALOAD 29
    ASTORE 26
   L21
    NOP
    ALOAD 26
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFEQ L23
   L24
    NOP
   L25
    LINENUMBER 709 L25
    ALOAD 0
    GETFIELD org/jruby/runtime/ThreadContext.runtime : Lorg/jruby/Ruby;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.bytelist6 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/util/ByteList;
    LDC 0
    INVOKESTATIC org/jruby/RubyString.newStringShared (Lorg/jruby/Ruby;Lorg/jruby/util/ByteList;I)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring15 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 22
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 23
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 24
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 25
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring17 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ASTORE 30
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 30
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther18:unquoted_string (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 31
    GOTO L26
   L23
    NOP
   L27
    LINENUMBER 711 L27
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 22
    ALOAD 23
    ALOAD 24
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther19:rgb (Lorg/jruby/runtime/ThreadContext;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;
    ASTORE 32
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 32
    ALOAD 25
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther20:rgba (Lorg/jruby/runtime/ThreadContext;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;
    ASTORE 33
    ALOAD 33
    ASTORE 31
   L26
    NOP
    ALOAD 31
    ASTORE 34
   L28
    NOP
    ALOAD 34
    ARETURN
   L5
    NOP
   L29
    LINENUMBER 696 L29
    ALOAD 0
    ALOAD 8
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irToAry (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 35
    ALOAD 0
    ALOAD 35
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_0
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 36
    ALOAD 0
    ALOAD 35
    CHECKCAST org/jruby/RubyArray
    ICONST_M1
    ICONST_1
    ICONST_M1
    INVOKESTATIC org/jruby/ir/runtime/IRRuntimeHelpers.irReqdArgMultipleAsgn (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/RubyArray;III)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 37
    ALOAD 36
    ASTORE 38
    ALOAD 37
    ASTORE 25
   L30
    LINENUMBER 698 L30
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 36
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.symbol21 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubySymbol;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.symbol22 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubySymbol;
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther23:assert_type (Lorg/jruby/runtime/ThreadContext;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;
    ASTORE 39
   L31
    LINENUMBER 699 L31
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 37
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther24:calc? (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 40
    ALOAD 40
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.isTrue ()Z
    IFEQ L32
   L33
    NOP
   L34
    LINENUMBER 700 L34
    ALOAD 0
    ALOAD 2
    ALOAD 38
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther25:red (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 41
    ALOAD 0
    ALOAD 2
    ALOAD 38
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther26:green (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 42
    ALOAD 0
    ALOAD 2
    ALOAD 38
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther27:blue (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 43
    ALOAD 0
    GETFIELD org/jruby/runtime/ThreadContext.runtime : Lorg/jruby/Ruby;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.bytelist6 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/util/ByteList;
    LDC 0
    INVOKESTATIC org/jruby/RubyString.newStringShared (Lorg/jruby/Ruby;Lorg/jruby/util/ByteList;I)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring15 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 41
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 42
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 43
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring16 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 25
    INVOKEINTERFACE org/jruby/runtime/builtin/IRubyObject.asString ()Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.fstring17 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubyString;
    INVOKEVIRTUAL org/jruby/RubyString.append19 (Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/RubyString;
    ASTORE 44
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 44
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther28:unquoted_string (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 45
    GOTO L35
   L32
    NOP
   L36
    LINENUMBER 702 L36
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 25
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.symbol29 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubySymbol;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.symbol30 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubySymbol;
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther31:assert_type (Lorg/jruby/runtime/ThreadContext;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;
    ASTORE 46
   L37
    LINENUMBER 703 L37
    ALOAD 0
    GETFIELD org/jruby/runtime/ThreadContext.runtime : Lorg/jruby/Ruby;
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.bytelist32 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/util/ByteList;
    LDC 16
    INVOKESTATIC org/jruby/RubyString.newStringShared (Lorg/jruby/Ruby;Lorg/jruby/util/ByteList;I)Lorg/jruby/RubyString;
    ASTORE 47
    ALOAD 0
    ALOAD 2
    ALOAD 2
    ALOAD 25
    ALOAD 47
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther33:check_alpha_unit (Lorg/jruby/runtime/ThreadContext;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;
    ASTORE 48
   L38
    LINENUMBER 704 L38
    ALOAD 0
    ALOAD 2
    ALOAD 25
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther34:value (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 49
    ALOAD 0
    ALOAD 0
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.symbol30 (Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/RubySymbol;
    ALOAD 49
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.hash:1 (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 50
    ALOAD 0
    ALOAD 2
    ALOAD 38
    ALOAD 50
    INVOKESTATIC opt/local/rvm/gems/jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian/gems/sass_minus_3_dot_4_dot_22/lib/sass/script/functions.invokeOther35:with (Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;
    ASTORE 51
    ALOAD 51
    ASTORE 45
   L35
    NOP
    ALOAD 45
    ASTORE 34
    GOTO L28
2017-01-08T11:16:21.287+01:00 [main] INFO JITCompiler : done jitting: Functions Sass::Script::Functions.rgba at /opt/local/rvm/gems/jruby-9.1.6.0@enrian/gems/sass-3.4.22/lib/sass/script/functions.rb:692
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f87d5021001, pid=8422, tid=0x00007f87e92b0700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_112-b15) (build 1.8.0_112-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.112-b15 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# j  opt.local.rvm.gems.jruby_minus_9_dot_1_dot_6_dot_0_at_40_enrian.gems.sass_minus_3_dot_4_dot_22.lib.sass.script.functions.RUBY$method$rgba$0(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/parser/StaticScope;Lorg/jruby/runtime/builtin/IRubyObject;[Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;Lorg/jruby/RubyModule;Ljava/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;+51
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/kares/workspace/work/enrian/sblending/hs_err_pid8422.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Aborted (core dumped)

@kares kares added the jit label Jan 8, 2017

kares added a commit to kares/jruby that referenced this issue Jan 8, 2017

reproduce and resolve generated 'tableswitch' byte-code problem
... [2, 4] was considered consecutive generating corrupt jump code!

fixes #4429

kares added a commit to kares/jruby that referenced this issue Jan 8, 2017

reproduce and resolve generated 'tableswitch' byte-code problem
... [2, 4] was considered consecutive generating corrupt jump code!

fixes #4429
@kares

This comment has been minimized.

Show comment
Hide comment
@kares

kares Jan 8, 2017

Member

turns out this is a fairly simple tableswitch generated byte-code problem :
case 2; case 4 -> was considered consecutive transforming to a Java switch with an incorrect jump for 4

    INVOKEVIRTUAL org/jruby/RubyFixnum.getIntValue ()I
    TABLESWITCH
      2: L5
      3: L6
      default: L7

... ending up as the folowing byte-code :

      42: instanceof    #45                 // class org/jruby/RubyFixnum
      45: ifeq          76
      48: checkcast     #45                 // class org/jruby/RubyFixnum
      51: invokevirtual #49                 // Method org/jruby/RubyFixnum.getIntValue:()I
      54: tableswitch   { // 2 to 4
                     2: 573
                     3: 250
                     4: 1459628640
               default: 162
          }
Member

kares commented Jan 8, 2017

turns out this is a fairly simple tableswitch generated byte-code problem :
case 2; case 4 -> was considered consecutive transforming to a Java switch with an incorrect jump for 4

    INVOKEVIRTUAL org/jruby/RubyFixnum.getIntValue ()I
    TABLESWITCH
      2: L5
      3: L6
      default: L7

... ending up as the folowing byte-code :

      42: instanceof    #45                 // class org/jruby/RubyFixnum
      45: ifeq          76
      48: checkcast     #45                 // class org/jruby/RubyFixnum
      51: invokevirtual #49                 // Method org/jruby/RubyFixnum.getIntValue:()I
      54: tableswitch   { // 2 to 4
                     2: 573
                     3: 250
                     4: 1459628640
               default: 162
          }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment