-
Notifications
You must be signed in to change notification settings - Fork 136
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
ECJ fails to track operand stack size across branch edges #2171
ECJ fails to track operand stack size across branch edges #2171
Conversation
2599528
to
7d7bb06
Compare
@laeubi - is there a way I can trigger an I build without merging to get a preview of (a) any build issues due to new asserts added to the compiler (b) tests status (c) comparator errors ? ? I have JDT specific data from the PR here : https://ci.eclipse.org/jdt/job/eclipse.jdt.core-Github/job/PR-2171/12/consoleText and that indicates massive changes - nearly 100+ class files change. Basically there is a bug fix to indy string concatenation - it was computing the stack size incorrectly and it is now rectified. Being a common operation string concatenation code generation change will result in large number of differences. I haven't yet sanity checked JDT comparator differences - I will before the merge, |
This one shows how to collect the comparator data but it was not merged and now has conflicts, maybe you still want to enable these options in either a local build or for your PR: |
Hmm. I think for now, I will validate JDT class files changed + get code review before merge. Thanks. |
...lipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java
Show resolved
Hide resolved
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.
please see the interim review comments
...lipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java
Show resolved
Hide resolved
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.
Rest of the code looks good
...lipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java
Show resolved
Hide resolved
Question still remains what we should do when we see an instruction with a label which has never so far been branched into (i.e., no forward branches) and is preceded by a |
The last commit introduces further asserts during code generation to ensure operand stack is empty after a full statement's translation. These asserts also help catch a problem in indy string concat code generation. There was a wrong decrement of stackDepth by 189. |
@srikanth-sankaran this is now merged: so if you rebase your PR you should get artifact comparison zips for every project that has a baseline difference. |
I took the freedom to rebase it so we can see it in action. |
When you say every project - you mean every project in jdt.core ? In my conversation with @iloveeclipse yesterday I understood it to be the case that when a JDT PR is raised, the proposed code is used to build jdt core projects but rest of SDK will get built using the PR's changes only post merge to master |
No problem. Is https://ci.eclipse.org/jdt/job/eclipse.jdt.core-Github/job/PR-2171/14/artifact/ the place one would look for files that differ ? In particular does the single download link labelled |
You can download all or for example individual items like or even individual class files: |
Opened issue for the comparator errors: eclipse-platform/eclipse.platform.releng.aggregator#1923 @srikanth-sankaran , @sravanlakkimsetti , how do we continue here? Who checks if the changes are expected? Ideally we would have had 2 builds between the changes from #2181 and #2171, unfortunately we have only 1 build for both changes. So we don't know which PR results in which comparator errors. |
This is only partially true. If you look at the log then search for Its a bit unfortunate that this is not done, I would have expsected that a PR is never merged with comparator errors in JDT as otherwise build failures are guaranteed! |
Quoting from an earlier comment in this thread: "I have inspected several dozens of different class files from jdt projects and they all seem reasonable. Unfortunately this PR fixes an issue in a super-common operation: string concatenation with + that it is going to trigger gazillion comparator errors in the SDK build. The only difference pattern is MAXSTACK estimate going down wrt to baseline; The new value can be lower by as many makeConcatWithConstants invokedynamic instructions needed in a statement in the method." |
@laeubi I am trying to comprehend what you mean by "PR is never merged with comparator errors in JDT" - in this case there are comparator errors and having inspected several dozens of differing class files I concluded these are along the expected lines. So no bug is suspected. What should I have done differently before merging ?? This is NOT asked confrontationally. Thanks for educating/enlightening me. |
Thanks @trancexpress : I'll follow up by inspecting the class files. I'll rope in help from @mpalat and @jarthana as needed. Help from any one else is welcome too. The only difference pattern is MAXSTACK estimate going down wrt to baseline; The new value can be lower by as many makeConcatWithConstants invokedynamic instructions needed in a statement in the method." Anything else needs to be analyzed for suspect change. |
Sorry, JDT core is its own repository. You expect a PR in it to be blocked by the rest of the Eclipse platform having some checker that complains about the latest code in JDT core? That doesn't sound reasonable to me. Maybe using the latest JDT for the platform build should be blocked by comparator errors, that sounds OK to me. Or you mean comparator errors in just JDT core itself? That I guess could be checked, but considering there are 200+ bundles with comparator errors right now, I don't think that does much. |
@srikanth-sankaran if you have inspected a difference and think its fine there are two options:
That way you should have a "clean" PR (of course other non jdt bundles later would maybe need version increments). @trancexpress yes I mean comparator errors in jdt.core, even if they are only a few, they should be analyzed and fixed as part of the PR otherwise it might result in "unexpected" changes that the put pressure on fixing them when they are already in. Of course there is no guarantee for that we not discover anything later, but what could be analyzed and fixed locally should be done at JDT, at best one run the aggregator build and check a wider range of bundle like described here: if you pass in |
Let me understand. By a "clean" PR you mean a PR with no comparator errors against jdt core itself. Is that right ? But a clean PR can produce comparator error in 200 other bundles legitimately, because a super basic super ubiquitous operation like string concatenation gets a bug fix ?? If so, the steps you suggest above don't sound like a big win to me. Or have I misunderstood ?? I am with you that before merging in a PR, it is useful and necessary to see if there are comparator errors in JDT itself and validate them. In the last round for PR 2011 I didn't do it - it resulted in comparator errors in 167 bundles IIRC, from 1 bug and 2 not-incorrect but still avoidable change. It would have been prudent to have looked at jdt logs. So far I am with you. Where you lost me is what a compiler engineer is supposed to do when he has validated the comparator diffs in jdt core but still anticipates thousands of comparator errors across the SDK build. As it happened this time. I did inspect several dozens of class files before merging.
ISTM the raison d'etre for an integration build is to validate a build by bringing together components. And to discover problems in the process. Your suggestion seems to want to hoist the purpose of an integration build to outside the loop. Ultimately it could be a problem of nomenclature. I challenge the labeling of builds with comparator errors as "unstable". That is poor choice perhaps. See that all tests across all SDK projects may be green and the build can still be labeled "unstable."
|
@srikanth-sankaran I am just listing the reasons for taking the approach of labelling "unstable". Earlier we used to publish the build and add its p2 repo to I-build composite. This has caused a problem when there are comparator errors specifically when we missed increment of swt versions(earlier this used to be a manual process). To avoid this situation we came up with this approach Whenever there are comparator errors we label the build as unstable and not add to I-build repository. This way we have a clear warning to identify what is causing the trouble and at the same time protect upgrades from not using problematic build.
When this labelling was introduced we have introduced a process to remove this label and add to I-build repository as well. Mark Stable job is specifically written to remove the label. This can be used if build is verified as stable build(tests are green and sanity tested). We went with this approach to be better safe than sorry PS: we also have Mark Unstable to mark a build unstable in case a build found to be problematic during the testing. |
Thanks for the explanation @sravanlakkimsetti |
POA: I will come up with a script to mechanically check if there are any differences other than stack size going down. If there is no other differences and the tests are all green, we can move forward to updating the bundles. |
Correct.
Yes that's something one currently can't avoid, but at least for the scope of the PR (this repository) everything is already fixed (so we save one additional commit afterwards) and probably an undesired change can be identified before the merge.
Every little gain is worth it, you can't avoid the work anyways so why postpone it if it is guaranteed to fail?
I'm not that deep inside the compiler topic itself but in the end it is the question who if not the PR writer is able to validate the side-effects? So it is more if one want to make additional check before the submission, we can even enhance the tools if someone can give hints on how to do it, e.g can some things be automated (one example would be to map changed byte code back to the source code, give some comprehensive analysis about stack sizes and so on. But for that we need some support of the compiler experts. In this particular case the question would be: If I have two classes A and B and the only differ in the stack size, is this a relevant change that should lead to a comparator error? If not, a maybe mor sustainable fix would be to enhance the comparator to ignore stacksize changes. |
Yes, it is. PR fixes stack size calculation and in worst case the bytecode emitted before could lead to VerifyError at runtime. |
Can't argue with that 😄
Yes, if we underestimate the stack size, we can get a verify error at run time. If we overestimate the stack, we can get stack overflow error at runtime on deeply recursive call chains sooner than otherwise. So yes it is material and should not be ignored. I have some suggestions for how we may improve this overall process, I will list them after we cross the bridge. For the time being, just to set the record straight, I reiterate (a) that the jdt.core logs were inspected (several dozen class files out of hundred+ that differed) and found to be reasonable ahead of the merge and (b) three days ago, I asked in this thread if you pass in -Dcompare-version-with-baselines.skip=false and -Dtycho.debug.artifactcomparator you can discover any changes (and even prepare PRs if you want) before running the full ibuild.` came only hours ago. Not finding fault @laeubi - your suggestions, inputs and help have been valuable! Thanks. |
Good morning gentlemen, The build looks good from tests p.o.v. I inspected the tests that fail on all 5 platforms and we have only this one new: (We also have #2187 - don't know yet why this didn't fail in I-build) |
Except for these errors - which I think are due to excessively long path names - the unzip went fine
`$ find 2>/tmp/err . -name '*.class-baseline' > baseline-classes $ cat /tmp/err #### To verify no errors - yes no errors. $ head baseline-classes $ wc -l baseline-classes So, OK we got
The accumulated text diffs look like this:$head -30 classfile-diff.out
Now the job is to verify that only stack depth changes are encountered in this file. Anything else needs scruitiny |
I have mechanically verified that the textual diffs contains only stack size reductions. The one lone exception is called out below. Now corelating the stacksize reductions to indy instructions count is not undertaken for the full set of The exception is (1) this diff below that needs to be studied.
(2) the unzip errors: these class files would have to be analyzed somehow:
I'll continue. |
I agree. |
I agree the PR author is in the best position to validate. What would help me personally is:
|
The problem with that approach is, that it makes it harder to find out which change in compiler caused regression and to provide and validate an appropriate fix in same release. We had bugs appearing in RC builds. Patching bugs in code generation at this time is risky, not patching is shipping buggy compiler. So I believe current immediate validation is the right thing. The extra work we have results in a better quality of the release. |
We already have something similar for SWT performance tests, I'll try to provide an extra validation step to JDT, given we have these comparator errors now seems a good way to test ist but I would maybe need some "extra power" from JDT commiters to allow workflow runs. |
…t#2171) * Fixes eclipse-jdt#2160 * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544298 and refix * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544556 and refix * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544204 and refix * Fix arbitrary and incorrect stack manipulation code in string concatenation invoke dynamic call * Fix incorrect stack manipulation in string templates invoke dynamic call * Fix argument and receiver size calculation error for captured outer locals * Replace various ad-hoc stack adjustment calls with structured stack size tracking
…t#2171) * Fixes eclipse-jdt#2160 * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544298 and refix * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544556 and refix * Revert fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=544204 and refix * Fix arbitrary and incorrect stack manipulation code in string concatenation invoke dynamic call * Fix incorrect stack manipulation in string templates invoke dynamic call * Fix argument and receiver size calculation error for captured outer locals * Replace various ad-hoc stack adjustment calls with structured stack size tracking
What it does
How to test
Author checklist