boolean propagate ( AmbiguatedFunctionSummary callee , AmbiguatedFunctionSummary caller ) { int initialCallerFlags = caller . bitmask ; if ( callerIsAlias ) { caller . setMask ( callee . bitmask ) ; return caller . bitmask != initialCallerFlags ; } if ( callee . mutatesGlobalState ( ) ) { // If the callee modifies global state then so does that caller. caller . setMutatesGlobalState ( ) ; } if ( callee . functionThrows ( ) ) { // If the callee throws an exception then so does the caller. caller . setFunctionThrows ( ) ; } if ( callee . mutatesArguments ( ) && ! allArgsUnescapedLocal ) { // If the callee mutates its input arguments and the arguments escape the caller then it has // unbounded side effects. caller . setMutatesGlobalState ( ) ; } if ( callee . mutatesThis ( ) ) { if ( invocation . isNew ( ) ) { // NEWing a constructor provide a unescaped "this" making side-effects impossible. } else if ( calleeThisEqualsCallerThis ) { caller . setMutatesThis ( ) ; } else { caller . setMutatesGlobalState ( ) ; } } return caller . bitmask != initialCallerFlags ; }
Propagate the side effects from the callee to the caller .