private void tryEliminateConstantArgs ( ArrayList < Node > refs ) { List < Parameter > parameters = findFixedArguments ( refs ) ; if ( parameters == null ) { return ; } ImmutableListMultimap < Node , Node > fns = ReferenceMap . getFunctionNodes ( refs ) ; if ( fns . size ( ) > 1 ) { // TODO(johnlenz): support moving simple constants. // This requires cloning the tree and avoiding adding additional calls/definitions that will // invalidate the reference map return ; } // Only one definition is currently supported. Node fn = Iterables . getOnlyElement ( fns . values ( ) ) ; boolean continueLooking = adjustForConstraints ( fn , parameters ) ; if ( ! continueLooking ) { return ; } // Found something to do, move the values from the call sites to the function definitions. for ( Node n : refs ) { if ( ReferenceMap . isCallOrNewTarget ( n ) && ! alreadyRemoved ( n ) ) { optimizeCallSite ( parameters , n ) ; } } optimizeFunctionDefinition ( parameters , fn ) ; }
Eliminate parameters if they are always constant .