public void visitParameter(Clazz clazz, Member member, int parameterIndex, int parameterCount, int parameterOffset, int parameterSize, String parameterType, Clazz referencedClass) { if (!ClassUtil.isInternalPrimitiveType(parameterType.charAt(0))) { Method method = (Method)member; // Is the parameter escaping from the method, // or is it returned and then escaping? if (isParameterEscaping(method, parameterIndex) || (isParameterReturned(method, parameterIndex) && isReturnValueEscaping)) { markEscapingParameters(referencingMethod, referencingOffset, parameterSize - parameterOffset - 1); } // Is the parameter being modified in the method. // or is it returned and then modified? if (isParameterModified(method, parameterIndex) || (isParameterReturned(method, parameterIndex) && isReturnValueModified)) { markModifiedParameters(referencingMethod, referencingOffset, parameterSize - parameterOffset - 1); } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { int accessFlags = programMethod.getAccessFlags(); // Is it a native method? if ((accessFlags & ClassConstants.ACC_NATIVE) != 0) { // Mark all parameters. markModifiedParameters(programMethod, -1L); markEscapingParameters(programMethod, -1L); markReturnedParameters(programMethod, -1L); markAnythingModified(programMethod); } }
markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1); markEscapingParameters(method, offset, 0); break; case InstructionConstants.OP_SASTORE: markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1); markReturnedParameters(clazz, method, offset, 0); break; markEscapingParameters(method, offset, 0); break;
/** * Marks the producing parameters of the given reference value. */ private void markModifiedParameters(Method method, ReferenceValue referenceValue) { TracedReferenceValue tracedReferenceValue = (TracedReferenceValue)referenceValue; InstructionOffsetValue producers = tracedReferenceValue.getTraceValue().instructionOffsetValue(); int producerCount = producers.instructionOffsetCount(); for (int index = 0; index < producerCount; index++) { if (producers.isMethodParameter(index)) { // We know exactly which parameter is being modified. markParameterModified(method, producers.methodParameter(index)); } else if (!producers.isNewinstance(index) && !producers.isExceptionHandler(index)) { // If some unknown instance is modified, any escaping parameters // may be modified. markModifiedParameters(method, getEscapingParameters(method)); markAnythingModified(method); } } }
modifiesAnything(referencedMethod) || SideEffectClassChecker.mayHaveSideEffects(clazz, refConstant.referencedClass, referencedMethod)) markAnythingModified(referencingMethod); markEscapingParameters(referencingMethod, referencingOffset, stackEntryIndex); markModifiedParameters(referencingMethod, referencingOffset, stackEntryIndex);
ParameterEscapeMarker.isParameterEscaping(referencedMethod, index)) ParameterEscapeMarker.isParameterModified(referencedMethod, index)) ((ClassUtil.isInternalClassType(returnType) || ClassUtil.isInternalArrayType(returnType)) && ParameterEscapeMarker.returnsExternalValues(referencedMethod)))
markAnythingModified(method); markEscapingParameters(method, offset, 0); break; markModifiedParameters(method, offset, constantInstruction.stackPopCount(clazz) - 1); markEscapingParameters(method, offset, 0); break;
ParameterEscapeMarker.returnsExternalValues(referencedMethod) ? new InstructionOffsetValue(offset | InstructionOffsetValue.FIELD_VALUE) : ParameterEscapeMarker.returnsNewInstances(referencedMethod) ? new InstructionOffsetValue(offset | InstructionOffsetValue.NEW_INSTANCE) : null; ParameterEscapeMarker.getReturnedParameters(referencedMethod);
ParameterEscapeMarker.getEscapingParameters(referencedMethod) != 0L || ParameterEscapeMarker.modifiesAnything(referencedMethod) || SideEffectClassChecker.mayHaveSideEffects(clazz, refConstant.referencedClass,
public void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant) { markAnythingModified(referencingMethod); }
new ParameterEscapeMarker(repeatTrigger, partialEvaluator, false);
/** * Marks the producing parameters (and the classes) of the given * reference value. */ private void markEscapingParameters(Method method, ReferenceValue referenceValue) { TracedReferenceValue tracedReferenceValue = (TracedReferenceValue)referenceValue; InstructionOffsetValue producers = tracedReferenceValue.getTraceValue().instructionOffsetValue(); int producerCount = producers.instructionOffsetCount(); for (int index = 0; index < producerCount; index++) { if (producers.isMethodParameter(index)) { // We know exactly which parameter is escaping. markParameterEscaping(method, producers.methodParameter(index)); } } }
/** * Marks the producing reference parameters of the specified stack entry at * the given instruction offset. */ private void markModifiedParameters(Method method, int offset, int stackEntryIndex) { TracedStack stackBefore = partialEvaluator.getStackBefore(offset); Value stackEntry = stackBefore.getTop(stackEntryIndex); if (stackEntry.computationalType() == Value.TYPE_REFERENCE) { ReferenceValue referenceValue = stackEntry.referenceValue(); // The null reference value may not have a trace value. if (referenceValue.isNull() != Value.ALWAYS) { markModifiedParameters(method, referenceValue); } } }
public void visitParameter(Clazz clazz, Member member, int parameterIndex, int parameterCount, int parameterOffset, int parameterSize, String parameterType, Clazz referencedClass) { Method method = (Method)member; if (DEBUG) { System.out.println(" P"+parameterIndex+ ": escaping = "+ParameterEscapeMarker.isParameterEscaping(method, parameterIndex)+ ", modified = "+ParameterEscapeMarker.isParameterModified(method, parameterIndex)+ ", returned = "+ParameterEscapeMarker.isParameterReturned(method, parameterIndex)); } // Create a reverse dependency if the reference parameter is // modified. if (ParameterEscapeMarker.isParameterModified(method, parameterIndex)) { createReverseDependencies(referencingOffset, parameterSize - parameterOffset - 1); } }
/** * Marks the producing reference parameters (and the classes) of the * specified stack entry at the given instruction offset. */ private void markEscapingParameters(Method method, int consumerOffset, int stackEntryIndex) { TracedStack stackBefore = partialEvaluator.getStackBefore(consumerOffset); Value stackEntry = stackBefore.getTop(stackEntryIndex); if (stackEntry.computationalType() == Value.TYPE_REFERENCE) { ReferenceValue referenceValue = stackEntry.referenceValue(); // The null reference value may not have a trace value. if (referenceValue.isNull() != Value.ALWAYS) { markEscapingParameters(method, referenceValue); } } }
/** * Marks the producing parameters of the given reference value. */ private void markModifiedParameters(Method method, ReferenceValue referenceValue) { TracedReferenceValue tracedReferenceValue = (TracedReferenceValue)referenceValue; InstructionOffsetValue producers = tracedReferenceValue.getTraceValue().instructionOffsetValue(); int producerCount = producers.instructionOffsetCount(); for (int index = 0; index < producerCount; index++) { if (producers.isMethodParameter(index)) { // We know exactly which parameter is being modified. markParameterModified(method, producers.methodParameter(index)); } else if (!producers.isNewinstance(index) && !producers.isExceptionHandler(index)) { // If some unknown instance is modified, any escaping parameters // may be modified. markModifiedParameters(method, getEscapingParameters(method)); markAnythingModified(method); } } }
modifiesAnything(referencedMethod) || SideEffectClassChecker.mayHaveSideEffects(clazz, refConstant.referencedClass, referencedMethod)) markAnythingModified(referencingMethod); markEscapingParameters(referencingMethod, referencingOffset, stackEntryIndex); markModifiedParameters(referencingMethod, referencingOffset, stackEntryIndex);
markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1); markEscapingParameters(method, offset, 0); break; case InstructionConstants.OP_SASTORE: markModifiedParameters(method, offset, simpleInstruction.stackPopCount(clazz) - 1); markReturnedParameters(clazz, method, offset, 0); break; markEscapingParameters(method, offset, 0); break;
ParameterEscapeMarker.isParameterEscaping(referencedMethod, index)) ParameterEscapeMarker.isParameterModified(referencedMethod, index)) ((ClassUtil.isInternalClassType(returnType) || ClassUtil.isInternalArrayType(returnType)) && ParameterEscapeMarker.returnsExternalValues(referencedMethod)))
markAnythingModified(method); markEscapingParameters(method, offset, 0); break; markModifiedParameters(method, offset, constantInstruction.stackPopCount(clazz) - 1); markEscapingParameters(method, offset, 0); break;