Skip to content
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

Changed dependency list overflow assert to fatal #4962

Merged
merged 2 commits into from Mar 26, 2020

Conversation

VermaSh
Copy link
Contributor

@VermaSh VermaSh commented Mar 20, 2020

With initial implementation, using a fallback such as an interpreter to execute method for which compilation failed due to dependency list overflow could result in silent performance issues.

Changing the assert to fatal helps avoid any potential silent performance issues by ensuring initialization of dependency list with correct capacity.

Signed-off-by: Shubham Verma shubhamv.sv@gmail.com

If not capturing jit log having a non fatal assert could cause list
overflow to slip under the radar

Signed-off-by: Shubham Verma <shubhamv.sv@gmail.com>
Comment on lines 410 to 414
// Printf added so it triggers some output even in prod build.
// If this failure is triggered in a prod build, you might
// not get a SEGV nor any meaningful error msg.
TR_ASSERT(0,"ERROR: addPostCondition list overflow\n");
TR_ASSERT_FATAL(0,"ERROR: addPostCondition list overflow\n");
_cg->comp()->failCompilation<TR::CompilationException>("addPostCondition list overflow, abort compilation\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra failCompilation is no longer needed since TR_ASSERT_FATAL terminates the process.
This whole if statement can be simplified to

TR_ASSERT_FATAL(_addCursorForPost < _numPostConditions, "addPostCondition list overflow");

(The extra "ERROR" at the start of the message adds no value since an assert failure is obviously an error).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent point Leo. Further to that, let's think about what would happen if we hit this assert in the wild. Would there be any other information that we could print that would be helpful in this case? I'd imagine the first thing one may want to know when debugging such a problem is what is the value of _numPostConditions? It would be helpful to print that as part of the assert, along with any other information you may think would be useful.

Copy link
Contributor Author

@VermaSh VermaSh Mar 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides _numPostConditions and _addCursorForPost, is there anything else that could be useful while debugging? I was just printing those two while debugging a bug in inlineVectorizedStringIndexOf Could register name be helpful?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the virtual register pointer and name would be very useful, in addition to _numPostConditions.

@fjeremic
Copy link
Contributor

fjeremic commented Mar 23, 2020

If not capturing jit log having a non fatal assert could cause list
overflow to slip under the radar

I don't think capturing a jit log has anything to do with the area of code being modified. An overflow in the dependency list would cause a method compilation failure, for which if there is a fallback such as an interpreter to execute the method, it could result in a silent performance problem.

The purpose of this change is to ensure the developer correctly sizes the dependency list during development and to avoid potential silent performance problems. Could we alter the commit message accordingly?

Since the assert will process to halt, we no longer need to raise a
compilation exception.
Added _addCursorForPost, _numPostConditions, virtual register name
and virtual register pointer to assert print statement

Signed-off-by: Shubham Verma <shubhamv.sv@gmail.com>
@fjeremic fjeremic self-assigned this Mar 26, 2020
@fjeremic
Copy link
Contributor

@genie-omr build all

@eclipse eclipse deleted a comment from VermaSh Mar 26, 2020
Copy link
Contributor

@Leonardo2718 Leonardo2718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@fjeremic fjeremic merged commit b044b09 into eclipse:master Mar 26, 2020
@VermaSh VermaSh deleted the addPostCondition_assert branch March 28, 2020 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants