-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] Replace transferToInterpreter to transferToInterpreterAndIn…
…validate. * Since Truffle only cares about the first one and * there is no valid use case for transferToInterpreter.
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
Showing
122 changed files
with
344 additions
and
344 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Oops, something went wrong.
1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this result in unnecessary repeated recompiles?
For example in a code like this:
Isn't it the case, that previously
foo
(or the containingeach
block) would compile, run at full speed, on exception transfer to interpreter, throw an error, and then go back into full speed JIT-ed code? Whereas now on transfer it additionally discards the JIT-ed code, recompilesfoo
again (into an identical machine code) and then go back to full speed?Before ~999,900 compiled calls, 100 transfers; after: ~999,900 compiled calls, 100 transfers, 100 identical recompiles of
compute
? What am I missing?1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thedarkone It could, but in practice
transferToInterpreter
is almost never the right tool.In a dynamic compiler, one needs to make sure the code does not continuously deoptimize, so once we do we want to take action so it does not happen a second time for the same reason (or a very small bounded number of times).
An error like a division by 0 should first deopt, then be checked actively (
raise if b == 0
) so it does not deopt anymore. So we really want only 1 transfer there.BTW,
rescue
nor throwing a Ruby exception needs a transfer.But, currently the division node is indeed bugged because it never checks actively for
b == 0
and relies wrongly on theArithmeticException
which is always a deopt. Fix coming...1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thedarkone The division by zero thing is fixed as of fd17285.
Now it compiles into a nice mostly-empty loop with no deopts.
1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I get it, you like to invalidate things 😝.
Trans&invalidates look fine to me in cases of unreachable
default
s and right beforeinsert()
, but I think you should audit all other cases (similarly to that div byFixnum
0
).I think there are other
zeroDivisionError
, also check out:I went scrolling upwards and gave up after about 20% of the commit, I'll leave the rest of it up to you guys!
1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thedarkone Good catch, indeed that one should be profiled instead.
The reason I did it for all usages is even if
transferToInterpreter
would be more appropriate, is it does not produce good results either as it constantly deoptimizes.Thank you for your watchful eye 😃
1fdc645
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, I see that I failed at copy-pasting. The above links were not meant to be identical ;). The second example is this: 1fdc645#diff-0631793139d5299a8e27ab21a2b2880aR93