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

Method addDep

chapter20/src/main/java/com/seaofnodes/simple/node/Node.java:549–560  ·  view source on GitHub ↗

Add a node to the list of dependencies. Only add it if its not an input or output of this node, that is, it is at least one step away. The node being added must benefit from this node being peepholed.

( Node dep )

Source from the content-addressed store, hash-verified

547 // If the _hash is set, then the Node is in the GVN table; remove it.
548 void unlock() {
549 if( _hash==0 ) return;
550 Node old = CODE._gvn.remove(this); // Pull from table
551 assert old==this;
552 _hash=0; // Out of table now
553 }
554
555 // Hash of opcode and inputs
556 @Override public final int hashCode() {
557 if( _hash != 0 ) return _hash;
558 int hash = hash();
559 for( Node n : _inputs )
560 if( n != null )
561 hash = hash ^ (hash<<17) ^ (hash>>13) ^ n._nid;
562 if( hash==0 ) hash = 0xDEADBEEF; // Bad hash, so use some junky thing
563 return (_hash=hash);

Callers 15

idealizeMethod · 0.95
profitMethod · 0.95
computeMethod · 0.45
computeMethod · 0.45
idealizeMethod · 0.45
singleUniqueInputMethod · 0.45
allConsMethod · 0.45
checkOnlyUseMethod · 0.45
allConsMethod · 0.45
_idomMethod · 0.45
idealizeMethod · 0.45
idealizeMethod · 0.45

Calls 2

findMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected