drbobbeaty has joined #jruby
<headius> ick binding eval
<headius> hmmm peculiar
<headius> works interpreted (lines match), works AOT, but jit threshold=0 the eval produces 5
<headius> bytecode for the method looks ok and the script body should be the same as interp
<headius> to the debugger we go
<headius> aha
<headius> it's because we do not push backtrace information for jitted methods
<headius> caller etc work because they use the same logic as exceptions and will see the Java frame, but Kernel#binding only looks at the interpreter backtrace stack
<headius> it does not actually work at all in jit or aot mode because aot bails when it sees the binding call
<headius> this is the cause of the binding spec failures in the JIT mode run
<headius> AOT bails on compiling the script because it sees binding/eval, but JIT has no such limitation... it will compile with frame and binding but no backtrace
<headius> I had this marked to fix in 9.4 because it is rare that someone evals against a binding and expects the line numbers to be right
<enebo[m]> headius: I am ok with punting it and had noticed this failure in the past
<enebo[m]> I think it is at most annoying to someone who hits it
<enebo[m]> I got bugged and too curious and took https://github.com/jruby/jruby/issues/6748
<enebo[m]> It should be fixed. We were doing some weird stuff in those methods
<enebo[m]> Making a PR for it now
<enebo[m]> cat19 handles encoding for us so having logic for encoding in these methods are not needed
<headius> Ah I see
<enebo[m]> I also removed ensure since that is just like checking size an extra time
<enebo[m]> append will grow and not just grow by 1 so I don't think the ensure would probably ever reduce array growth of the bytelist
<enebo[m]> Also it was 2 + size + 1 and that 1 is not needed?
<enebo[m]> LOL: Array#inspect with encoding use the default external encoding if it is ascii compatible FAILED
<enebo[m]> we set our new string to US-ASCII by default vs default external so our extra setEncoding happened to fix it somehow
<enebo[m]> headius: you know anything which does this:
<enebo[m]> + Encoding encoding = runtime.getDefaultExternalEncoding();
<enebo[m]> + RubyString str = RubyString.newStringLight(runtime, DEFAULT_INSPECT_STR_SIZE, encoding.isAsciiCompatible() ? encoding : USASCIIEncoding.INSTANCE);
<enebo[m]> lol...those + messthat up
<enebo[m]> Encoding encoding = runtime.getDefaultExternalEncoding();
<enebo[m]> RubyString str = RubyString.newStringLight(runtime, DEFAULT_INSPECT_STR_SIZE, encoding.isAsciiCompatible() ? encoding : USASCIIEncoding.INSTANCE);
<enebo[m]> feels like not just RubyArray.inspect would have this logic
<enebo[m]> RubyString#inspect does it but RubyHash#inspect does not ... fun fun
<enebo[m]> So does RubySymbol. Hmm and these have extra defaultinternal logic too
<enebo[m]> unless I am blind MRI does not do any of this for Hash#inspect
<enebo[m]> Stupid codebase. My code works and is simpler but I see mri will call rb_enc_associate for n>0 elements of an array index on inspect. What we did was wrong (we just did setEncoding) but why all this logic?
<enebo[m]> I believe rb_str_buf_append will do encoding negotiation already
<enebo[m]> anyways...I guess I will push this branch
<enebo[m]> edipo.federle: I know you said you were looking at this but curiousity got the better of me: https://github.com/jruby/jruby/pull/6759