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

Method kill

chapter06/src/main/java/com/seaofnodes/simple/node/Node.java:218–223  ·  view source on GitHub ↗

Kill a Node with no uses , by setting all of its defs to null. This may recursively kill more Nodes and is basically dead code elimination. This function is co-recursive with #popN.

( )

Source from the content-addressed store, hash-verified

216 Node rez = n == null ? this : n;
217 if( obs != null ) obs.after(this, n == null && old == _type ? null : rez, false);
218 return rez;
219 }
220
221 private Node peepholeOpt() {
222 // Compute initial or improved Type
223 Type type = _type = compute();
224
225 // Replace constant computations from non-constants with a constant node
226 if (!(this instanceof ConstantNode) && type.isConstant())

Callers 5

setDefMethod · 0.95
delDefMethod · 0.95
popNMethod · 0.95
deadCodeElimMethod · 0.95
mergeScopesMethod · 0.45

Calls 4

isUnusedMethod · 0.95
popNMethod · 0.95
nInsMethod · 0.95
isDeadMethod · 0.95

Tested by

no test coverage detected