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

Refactor prex argInfo computation and propagation #11584

Open
1 of 3 tasks
liqunl opened this issue Jan 6, 2021 · 0 comments
Open
1 of 3 tasks

Refactor prex argInfo computation and propagation #11584

liqunl opened this issue Jan 6, 2021 · 0 comments
Labels

Comments

@liqunl
Copy link
Contributor

liqunl commented Jan 6, 2021

Prex argInfo is used in inliner to propagate argument type to help call target selection as well as local opts in ilgen. Currently, prex arginfo computation is done in many places

  1. In static functions of TR_PrexArgInfo, used during ECS (estimate code size) stage, the stage when call targets are selected
  2. In inliner utils, used during actual inlining, prex arg info will be used in IAP (InvariantArgumentPreexistence) or other ilgen opts.

Another limitation is during ECS (estimate code size) stage, the stage where we find call targets, we only propagate receiver type info down. If other arguments are used as the receiver in callee method, we won't have the most concrete type info.

Many logics are duplicated and computation assumes result to be stored to a specific place, such as call site _ecsPrexArgInfo or call target _ecsPrexArgInfo or _prexArgInfo. This has made future use of prex arginfo difficult . We should extract the common logic in prex arginfo computation and propagation and put it in one place.

The argument types of a call can be determined by
a. The type from signature of the called method
b. The type from the argument node if call node exists
c. The receiver type inside the inlined body can be refined by the inlining guard (in the case of a guard with vft test)

The solution is to compute prex arginfo based on a, b, c and return the result instead of storing them to a hard coded place. Same as variant arginfo invalidation, which is in OMR.

As for arginfo propagation, two prex arginfo can be merged using TR_PrexArgInfo::enhance, we can compute the arginfo from different sources and merge them.

liqunl pushed a commit to liqunl/omr that referenced this issue Jan 6, 2021
Part of an effort to refactor prex arg info. This commit contains the
following changes:

- Move two TR_PrexArgInfo functions from OpenJ9 to OMR such that we can
merge prex arg infos in OMR.
- When creating prex arg info for a target, propagate arg info from call
site.
- Add an inliner util to clear arg info for variant argument given a
prex arg info
- `computePrexInfo` will not assume storing the result to `_prexArgInfo`
of a target, instead, the user will take the result and store it to the
place they want.

Part of eclipse-openj9/openj9#11584

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/openj9-omr that referenced this issue Jan 6, 2021
Part of an effort to refactor prex arg info. This commit contains the
following changes:

- Move two TR_PrexArgInfo functions from OpenJ9 to OMR such that we can
merge prex arg infos in OMR.
- When creating prex arg info for a target, propagate arg info from call
site.
- Add an inliner util to clear arg info for variant argument given a
prex arg info
- `computePrexInfo` will not assume storing the result to `_prexArgInfo`
of a target, instead, the user will take the result and store it to the
place they want.

Part of eclipse-openj9/openj9#11584

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/omr that referenced this issue Jan 6, 2021
Part of an effort to refactor prex arg info. This commit contains the
following changes:

- Move two TR_PrexArgInfo functions from OpenJ9 to OMR such that we can
merge prex arg infos in OMR.
- When creating prex arg info for a target, propagate arg info from call
site.
- Add an inliner util to clear arg info for variant argument given a
prex arg info
- `computePrexInfo` will not assume storing the result to `_prexArgInfo`
of a target, instead, the user will take the result and store it to the
place they want.

Part of eclipse-openj9/openj9#11584

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/omr that referenced this issue Jan 11, 2021
Part of an effort to refactor prex arg info. This commit contains the
following changes:

- Move two TR_PrexArgInfo functions from OpenJ9 to OMR such that we can
merge prex arg infos in OMR.
- When creating prex arg info for a target, propagate arg info from call
site.
- Add an inliner util to clear arg info for variant argument given a
prex arg info
- `computePrexInfo` will not assume storing the result to `_prexArgInfo`
of a target, instead, the user will take the result and store it to the
place they want.

Part of eclipse-openj9/openj9#11584

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/openj9 that referenced this issue Jan 11, 2021
This commit addresses problem described in eclipse-openj9#11584 to get prex arg info
computation and propagation into a better shape. It does the following

- Move prex arg info computation into inliner util `computePrexInfo`.
`computePrexInfo` will not store the result into `_prexArgInfo` of a
call target such that it can be used more broadly.
- There is also a small improvement to arg info computation, where we
walk the trees backwards to find the value of an auto if the auto is
used as a call argument.
- Move `enhance` and `stronger` from `TR_PrexArgInfo` into OMR as OMR
uses them.
- Implement `TR_PrexArgInfo::getCallTree`, which is to be used to
update call site call tree which is needed in prex arg computation.

These changes will allow uniformed way of prex arg info compuation and
propagation in different stages of inliner.

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/openj9-omr that referenced this issue Jan 25, 2021
Part of an effort to refactor prex arg info. This commit contains the
following changes:

- Move two TR_PrexArgInfo functions from OpenJ9 to OMR such that we can
merge prex arg infos in OMR.
- When creating prex arg info for a target, propagate arg info from call
site.
- Add an inliner util to clear arg info for variant argument given a
prex arg info
- `computePrexInfo` will not assume storing the result to `_prexArgInfo`
of a target, instead, the user will take the result and store it to the
place they want.

Part of eclipse-openj9/openj9#11584

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/openj9 that referenced this issue Jan 25, 2021
This commit addresses problem described in eclipse-openj9#11584 to get prex arg info
computation and propagation into a better shape. It does the following

- Move prex arg info computation into inliner util `computePrexInfo`.
`computePrexInfo` will not store the result into `_prexArgInfo` of a
call target such that it can be used more broadly.
- There is also a small improvement to arg info computation, where we
walk the trees backwards to find the value of an auto if the auto is
used as a call argument.
- Move `enhance` and `stronger` from `TR_PrexArgInfo` into OMR as OMR
uses them.
- Implement `TR_PrexArgInfo::getCallTree`, which is to be used to
update call site call tree which is needed in prex arg computation.

These changes will allow uniformed way of prex arg info compuation and
propagation in different stages of inliner.

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
liqunl pushed a commit to liqunl/openj9 that referenced this issue Jan 26, 2021
This commit addresses problem described in eclipse-openj9#11584 to get prex arg info
computation and propagation into a better shape. It does the following

- Move prex arg info computation into inliner util `computePrexInfo`.
`computePrexInfo` will not store the result into `_prexArgInfo` of a
call target such that it can be used more broadly.
- There is also a small improvement to arg info computation, where we
walk the trees backwards to find the value of an auto if the auto is
used as a call argument.
- Move `enhance` and `stronger` from `TR_PrexArgInfo` into OMR as OMR
uses them.
- Implement `TR_PrexArgInfo::getCallTree`, which is to be used to
update call site call tree which is needed in prex arg computation.

These changes will allow uniformed way of prex arg info compuation and
propagation in different stages of inliner.

Signed-off-by: Liqun Liu <liqunl@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants