<GitHub115>
jruby/master 7f9866b Thomas E Enebo: Merge pull request #4159 from headius/sprintf_rounding...
<GitHub140>
[jruby] enebo closed pull request #4159: Format initial string to specific precision, so rounding works. (master...sprintf_rounding) https://git.io/vioM5
bjfish2 has joined #jruby
vali has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<lopex>
enebo: too bad only one =~ form is a syntax thingy when you can optimize things
<lopex>
like the named captures as locals etc
camlow325 has joined #jruby
<lopex>
yeah it's the only thing in parse.y
djellemah has joined #jruby
pawnbox has joined #jruby
nicksieger has joined #jruby
nicksieger has quit [Ping timeout: 260 seconds]
<lopex>
chrisseaton: do you have any idea how differently graal and hotspot treat final instance fields wrt optimization ?
<chrisseaton>
lopex: Graal on its own still doesn't fold through final fields I don't believe - because there isn no notification from HotSpot when reflection modifies them - but Graal when compiling Truffle treats them as proper final fields, and provides an annotation for say that a field may change in the interpreter but not in a compiler and to treat it as final when
<chrisseaton>
compiling
<lopex>
chrisseaton: so it all depends on call paths then right ?
<chrisseaton>
Sorry I'm not sure what 'calls paths' means?
<lopex>
like I have new Foo(x) where x becomes a final instance field
<lopex>
yet x can be whatever before that
<chrisseaton>
Sorry I don't follow - are you saying x is a final instance field, or not?
yfeldblum has quit [Quit: Leaving...]
<lopex>
chrisseaton: I'm boiling it down to Kevins request to make isUtf8 a final instance field in an encoding
<chrisseaton>
I think he just wants a plain old final instance field then
<chrisseaton>
Where the value comes from before it goes in that field isn't important
<lopex>
chrisseaton: it being a singleton makes a difference right ?
<lopex>
actually it boils down to singletons
<lopex>
so it might behave like a static final field
<lopex>
chrisseaton: actually, there isnt a need for any speculation in this case
<lopex>
if can be constant propagated
<lopex>
in runtime of course
<lopex>
since when you do pass UTF8Encoding.INSTANCE you basically make it final upfront
<lopex>
chrisseaton: am I more clear now ?
akp_ has joined #jruby
<chrisseaton>
The JVM doesn't do anything special for singletons
<lopex>
but am I correct this can be explited ?
<lopex>
*exploited
<chrisseaton>
We're taking about isUtf8? If that isn't final, there is no way that it will be compilation constant (unless it doesn't escape a single method)
<lopex>
but it can be propagated in runtime a bit faster if it was final
akp has quit [Ping timeout: 248 seconds]
<lopex>
or, how does it differ from foo(false) it's only an indirection
<lopex>
the instance is chosen statically
<lopex>
chrisseaton: and yeah, I'm talking about the case when it becomes final
<chrisseaton>
Sorry I can't follow anything anymore
<chrisseaton>
I don't know what method you mean by foo()
<chrisseaton>
The value will never be compilation constant unless the field is final
<chrisseaton>
(or if it doesn't escape)
<chrisseaton>
I'll get nirvdrum to join us...
<lopex>
chrisseaton: so making it final will make a different
<lopex>
yeah my intuition made me fell it will
<lopex>
chrisseaton: but from my past benchmarking it seemed hotspot doesnt care about them being final
<lopex>
that's why I'm asking about graal
<chrisseaton>
Neither HotSpot nor Graal take any notice of final fields - but Graal when partially evaluation Truffle will do
<chrisseaton>
Which is what we care about
<lopex>
ok
<lopex>
so via PE
<lopex>
only
<lopex>
the other thing I was wondering about static final singleton instances with final fields in them
<lopex>
that's a lot of more knowledge
<chrisseaton>
HotSpot and Graal have to assume final fields are mutable, whether they're referenced through a singleton or not
<lopex>
because of reflection as you mentioned
<lopex>
yeah, I lacked that piece
<lopex>
so only PE and the culprit is the reflection semantics
vali has joined #jruby
<lopex>
actually knew that just didnt connect the dots :/
<nirvdrum>
Sorry, just joining now.
<lopex>
nirvdrum: turned out I was asking stupid question
nicksieger has joined #jruby
vali has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
<nirvdrum>
I didn't realize HotSpot couldn't do anything with final fields, personally. But unless there's a reason to mutate a field, I try to make them final anyway.
<lopex>
nirvdrum: yeah, but the isUTF8 is trickier
<lopex>
it boils down to passing it through ctors
beawesomeinstead has quit [Read error: Connection reset by peer]
<nirvdrum>
Is that really tricky though?
<lopex>
messy ctos args passing
<lopex>
that's all
<lopex>
*ctors
<lopex>
and I hate overloaded ctors
<nirvdrum>
I realize you don't want to blow up the number of constructors, but you have one without the field and one with the field. Only BaseUTF8Encoding calls the one with the field. The other defaults to false.
<lopex>
yep
beawesomeinstead has joined #jruby
<lopex>
all of those fields should have been final
<lopex>
but as the dummy and aliases were added it was easier
nicksieger has quit [Remote host closed the connection]
FINbit has joined #jruby
FINbit has quit [Ping timeout: 268 seconds]
nicksieger has joined #jruby
cprice has quit [Ping timeout: 248 seconds]
cprice_ has joined #jruby
akp_ has quit [Remote host closed the connection]
akp has joined #jruby
vali has joined #jruby
vali has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
tcrawley-away is now known as tcrawley
djellemah has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]