MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / popN

Method popN

chapter09/src/main/java/com/seaofnodes/simple/node/Node.java:249–257  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

247 }
248
249 /**
250 * Try to peephole at this node and return a better replacement Node if
251 * possible. We compute a {@link Type} and then check and replace:
252 * <ul>
253 * <li>if the Type {@link Type#isConstant}, we replace with a {@link ConstantNode}</li>
254 * <li>in a future chapter we will look for a
255 * <a href="https://en.wikipedia.org/wiki/Common_subexpression_elimination">Common Subexpression</a>
256 * to eliminate.</li>
257 * <li>we ask the Node for a better replacement. The "better replacement"
258 * is things like {@code (1+2)} becomes {@code 3} and {@code (1+(x+2))} becomes
259 * {@code (x+(1+2))}. By canonicalizing expressions we fold common addressing
260 * math constants, remove algebraic identities and generally simplify the

Callers 1

popMethod · 0.45

Calls 4

unlockMethod · 0.95
delUseMethod · 0.95
killMethod · 0.95
removeLastMethod · 0.45

Tested by

no test coverage detected