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

Add interpreter emulator for ECS in inliner #7785

Merged
merged 1 commit into from
Dec 9, 2019

Conversation

cathyzhyi
Copy link
Contributor

@cathyzhyi cathyzhyi commented Nov 18, 2019

This change adds the infrastructure to emulate the interpreter
execution during estimate code size of target in inliner.

Also the loop looking for callsites in ECS is refactored and moved
to findAndCreateCallsitesFromBytecodes. ECS will be changed to call
this function in a following commit.

issue: #6204
Signed-off-by: Yi Zhang [email protected]

@andrewcraik
Copy link
Contributor

FYI @efferifick since you are also working in this space

@andrewcraik
Copy link
Contributor

What is the lifetime of the CallSites that are allocated? to make the code easier to maintain, I'd almost suggest that the CallSites be allocated in a region held by the interpreter object so that if we wanted to generate this info and throw it away at some later point during the compile we would have that flexibility. Baking use of the compilation heap in for something as big as this seems a bit dirty - it would be better to control when the memory is freed.

@andrewcraik
Copy link
Contributor

Why is all the operand tracking etc done using the stack region rather than a region specifically tied to the lifetime of interpretation so we can free it as soon as the interpreter is done running to keep the footprint lower?

Copy link
Contributor

@andrewcraik andrewcraik left a comment

Choose a reason for hiding this comment

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

Just marking that I requested changes and further review will be needed once the PR is updated/commented on.

@cathyzhyi
Copy link
Contributor Author

What is the lifetime of the CallSites that are allocated? to make the code easier to maintain, I'd almost suggest that the CallSites be allocated in a region held by the interpreter object so that if we wanted to generate this info and throw it away at some later point during the compile we would have that flexibility. Baking use of the compilation heap in for something as big as this seems a bit dirty - it would be better to control when the memory is freed.

TheCallsites would be needed for the actually inlining as well so they have been allocated on heap memory in estimiate code size as well as in other places in inliner. Allocating to memory that can be reclaimed when the inlining is finished would be a good idea but is probably out of the scope of this item.

@cathyzhyi
Copy link
Contributor Author

Why is all the operand tracking etc done using the stack region rather than a region specifically tied to the lifetime of interpretation so we can free it as soon as the interpreter is done running to keep the footprint lower?

Thanks for the suggestion. Allocated new memory region at the beginning of interpretation, namely findAndCreateCallsitesFromBytecodes so that as soon as findAndCreateCallsitesFromBytecodes returns the memories for operand tracking are release.

@andrewcraik
Copy link
Contributor

Allocating to memory that can be reclaimed when the inlining is finished would be a good idea but is probably out of the scope of this item.

Could you create an issue for this? It is definitely something we should look at when we need to shrink the footprint again...

@andrewcraik
Copy link
Contributor

Overall, this is getting close. Is the trace in the base bytecode iterator enough to know which cases etc the interpeter is processing? There is some debug trace in the methods you added, but it doesn't quite seem like enough to follow the whole interpretation - I'm guessing the 'missing' bits come from the base?

@cathyzhyi
Copy link
Contributor Author

Overall, this is getting close. Is the trace in the base bytecode iterator enough to know which cases etc the interpeter is processing? There is some debug trace in the methods you added, but it doesn't quite seem like enough to follow the whole interpretation - I'm guessing the 'missing' bits come from the base?

There is InterpreterEmulator::dumpStack() that dumps the stack content and the current bytecode. findAndCreateCallsitesFromBytecodescalls this after executing each bytecode.

@cathyzhyi
Copy link
Contributor Author

Allocating to memory that can be reclaimed when the inlining is finished would be a good idea but is probably out of the scope of this item.

Could you create an issue for this? It is definitely something we should look at when we need to shrink the footprint again...

Created an issue to track the problem. #7950.

This change adds the infrastructure to emulate the interpreter
execution during estimate code size of target in inliner.

Also the loop looking for callsites in ECS is refactored and moved
to `findAndCreateCallsitesFromBytecodes`. ECS will be changed to call
this function in a following commit.

Signed-off-by: Yi Zhang <[email protected]>
@andrewcraik
Copy link
Contributor

Jenkins test sanity all jdk11

@andrewcraik
Copy link
Contributor

the failed job is just infra - the rest of the testing is sufficient to merge this

@andrewcraik andrewcraik merged commit 4b5a2d4 into eclipse-openj9:master Dec 9, 2019
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.

2 participants