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

Implement copy propagation #25

Closed
retronym opened this issue Aug 5, 2015 · 1 comment
Closed

Implement copy propagation #25

retronym opened this issue Aug 5, 2015 · 1 comment

Comments

@retronym
Copy link
Member

retronym commented Aug 5, 2015

Miguel's code: https://github.com/lrytz/scala/blob/opt/rebaseWip/src/compiler/scala/tools/nsc/backend/bcode/CopyPropagator.java

creates stale local variables that can be eliminated (#7)

lrytz added a commit to lrytz/scala that referenced this issue Nov 6, 2015
Copy propagation uses an AliasingAnalyzer: it replaces a `LOAD n`
instruction by `LOAD m` where m is the smallest alias of n. This
leads to stale STORE instructions.

Stale STOREs are identified using a ProdCons analyzer and replaced by
POPs.

Values that are pushed on the stack by a side-effect free instruction
and consumed by a POP are then removed by `eliminatePushPop`. This
includes elimination of unused closure allocations and unused boxes
and  tuple allocations (*).

A final cleanup eliminates `STORE x; LOADx` pairs where the stored
value is not otherwise used.

Fixes
  - scala/scala-dev#25
  - scala/scala-dev#7
  - scala/scala-dev#14
  - scala/scala-dev#12

(*) We don't yet rewrite reads of boxes and tuples yet. For example,
`val x = (1, 2); x._1` remains a method invocation and the tuple
cannot be eliminated (scala/scala-dev#11).

Inspired in many ways by Miguel's work!
lrytz added a commit to lrytz/scala that referenced this issue Nov 10, 2015
Copy propagation uses an AliasingAnalyzer: it replaces a `LOAD n`
instruction by `LOAD m` where m is the smallest alias of n. This
leads to stale STORE instructions.

Stale STOREs are identified using a ProdCons analyzer and replaced by
POPs.

Values that are pushed on the stack by a side-effect free instruction
and consumed by a POP are then removed by `eliminatePushPop`. This
includes elimination of unused closure allocations and unused boxes
and  tuple allocations (*).

A final cleanup eliminates `STORE x; LOADx` pairs where the stored
value is not otherwise used.

Fixes
  - scala/scala-dev#25
  - scala/scala-dev#7
  - scala/scala-dev#14
  - scala/scala-dev#12

(*) We don't yet rewrite reads of boxes and tuples yet. For example,
`val x = (1, 2); x._1` remains a method invocation and the tuple
cannot be eliminated (scala/scala-dev#11).

Inspired in many ways by Miguel's work!
lrytz added a commit to lrytz/scala that referenced this issue Nov 10, 2015
Copy propagation uses an AliasingAnalyzer: it replaces a `LOAD n`
instruction by `LOAD m` where m is the smallest alias of n. This
leads to stale STORE instructions.

Stale STOREs are identified using a ProdCons analyzer and replaced by
POPs.

Values that are pushed on the stack by a side-effect free instruction
and consumed by a POP are then removed by `eliminatePushPop`. This
includes elimination of unused closure allocations and unused boxes
and  tuple allocations (*).

A final cleanup eliminates `STORE x; LOADx` pairs where the stored
value is not otherwise used.

Fixes
  - scala/scala-dev#25
  - scala/scala-dev#7
  - scala/scala-dev#14
  - scala/scala-dev#12

(*) We don't yet rewrite reads of boxes and tuples yet. For example,
`val x = (1, 2); x._1` remains a method invocation and the tuple
cannot be eliminated (scala/scala-dev#11).

Inspired in many ways by Miguel's work!
@lrytz
Copy link
Member

lrytz commented Jan 25, 2016

@lrytz lrytz closed this as completed Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants