variablesBefore[index].reset(codeAttribute.u2maxLocals); variablesAfter[index].reset(codeAttribute.u2maxLocals); TracedVariables parameters = new TracedVariables(codeAttribute.u2maxLocals); parameters.setProducerValue(storeValue); variables.initialize(parameters); for (int index = 0; index < parameters.size(); index++) variables.setProducerValue(index, atMethodEntry);
generalizedVariables.initialize(tracedVariables); generalizedVariables.generalize(tracedVariables, false); generalizedVariables.initialize(tracedVariables); generalizedVariables.generalize(tracedVariables, false); generalizedVariables.reset(generalizedVariables.size());
TracedVariables variables) int maximumVariablesSize = variables.size(); int typeCount = 0; int typeIndex = 0; Value value = variables.getValue(index); Value value = variables.getValue(index); Value producerValue = variables.getProducerValue(index);
variablesBefore[instructionOffset] = new TracedVariables(variables); stacksBefore[instructionOffset] = new TracedStack(stack); variablesBefore[instructionOffset].initialize(variables); stacksBefore[instructionOffset].copy(stack); boolean variablesChanged = variablesBefore[instructionOffset].generalize(variables, true); boolean stackChanged = stacksBefore[instructionOffset].generalize(stack); variables.generalize(variablesBefore[instructionOffset], false); stack.generalize(stacksBefore[instructionOffset]); variables.setProducerValue(storeValue); stack.setProducerValue(storeValue); variablesAfter[instructionOffset] = new TracedVariables(variables); stacksAfter[instructionOffset] = new TracedStack(stack); variablesAfter[instructionOffset].initialize(variables); stacksAfter[instructionOffset].copy(stack); variablesAfter[instructionOffset].generalize(variables, true); stacksAfter[instructionOffset].generalize(stack); pushInstructionBlock(new TracedVariables(variables), new TracedStack(stack), branchTargets.instructionOffset(index)); pushCallingInstructionBlock(new TracedVariables(variables),
variablesBefore[instructionOffset] = new TracedVariables(variables); stacksBefore[instructionOffset] = new TracedStack(stack); variablesBefore[instructionOffset].initialize(variables); stacksBefore[instructionOffset].copy(stack); boolean variablesChanged = variablesBefore[instructionOffset].generalize(variables, true); boolean stackChanged = stacksBefore[instructionOffset].generalize(stack); variables.generalize(variablesBefore[instructionOffset], false); stack.generalize(stacksBefore[instructionOffset]); variables.setProducerValue(storeValue); stack.setProducerValue(storeValue); variables.resetInitialization(); initializedVariables[instructionOffset] = variables.getInitializationIndex(); variablesAfter[instructionOffset] = new TracedVariables(variables); stacksAfter[instructionOffset] = new TracedStack(stack); variablesAfter[instructionOffset].initialize(variables); stacksAfter[instructionOffset].copy(stack); variablesAfter[instructionOffset].generalize(variables, true); stacksAfter[instructionOffset].generalize(stack); pushInstructionBlock(new TracedVariables(variables),
Value valueBefore = simplePartialEvaluator.getVariablesBefore(instructionOffset).getValue(variableIndex); if (valueBefore == null) Value valueAfter = simplePartialEvaluator.getVariablesAfter(instructionOffset).getValue(variableIndex); if (valueAfter.computationalType() != valueBefore.computationalType()) InstructionOffsetValue producersBefore = simplePartialEvaluator.getVariablesBefore(instructionOffset).getProducerValue(variableIndex).instructionOffsetValue(); return producersBefore.instructionOffsetCount() == 1 && producersBefore.isMethodParameter(0);
public String toString() { StringBuffer buffer = new StringBuffer(); for (int index = 0; index < this.size(); index++) { Value value = this.values[index]; Value producerValue = producerVariables.getValue(index); buffer = buffer.append('[') .append(producerValue == null ? "empty:" : producerValue.toString()) .append(value == null ? "empty" : value.toString()) .append(']'); } return buffer.toString(); } }
TracedVariables variables = new TracedVariables(codeAttribute.u2maxLocals); TracedStack stack = new TracedStack(codeAttribute.u2maxStack); variables.setProducerValue(storeValue); stack.setProducerValue(storeValue);
/** * Returns whether the specified variable is alive after the instruction * at the given offset. */ public boolean isAliveAfter(int instructionOffset, int variableIndex) { return variableIndex >= MAX_VARIABLES_SIZE ? partialEvaluator.getVariablesAfter(instructionOffset).getValue(variableIndex) != null : (isAliveAfter[instructionOffset] & (1L << variableIndex)) != 0; }
/** * Marks the variable and the corresponding producing instructions * of the consumer at the given offset. * @param consumerOffset the offset of the consumer. * @param variableIndex the index of the variable to be marked. */ private void markVariableProducers(int consumerOffset, int variableIndex) { TracedVariables tracedVariables = partialEvaluator.getVariablesBefore(consumerOffset); // Mark the producer of the loaded value. markVariableProducers(tracedVariables.getProducerValue(variableIndex).instructionOffsetValue(), variableIndex); }
variables.initialize(parameters); new InstructionOffsetValue(index | InstructionOffsetValue.METHOD_PARAMETER); variables.setProducerValue(index, producerValue);
variablesBefore[offset].generalize(other.variablesBefore[offset], false); stacksBefore[offset] .generalize(other.stacksBefore[offset]); variablesAfter[offset] .generalize(other.variablesAfter[offset], false); stacksAfter[offset] .generalize(other.stacksAfter[offset]);
TracedVariables variables = new TracedVariables(codeAttribute.u2maxLocals); TracedStack stack = new TracedStack(codeAttribute.u2maxStack);
variablesBefore[instructionOffset] = new TracedVariables(variables); stacksBefore[instructionOffset] = new TracedStack(stack); variablesBefore[instructionOffset].initialize(variables); stacksBefore[instructionOffset].copy(stack); boolean variablesChanged = variablesBefore[instructionOffset].generalize(variables, true); boolean stackChanged = stacksBefore[instructionOffset].generalize(stack); variables.generalize(variablesBefore[instructionOffset], false); stack.generalize(stacksBefore[instructionOffset]); variables.setProducerValue(storeValue); stack.setProducerValue(storeValue); variablesAfter[instructionOffset] = new TracedVariables(variables); stacksAfter[instructionOffset] = new TracedStack(stack); variablesAfter[instructionOffset].initialize(variables); stacksAfter[instructionOffset].copy(stack); variablesAfter[instructionOffset].generalize(variables, true); stacksAfter[instructionOffset].generalize(stack); pushInstructionBlock(new TracedVariables(variables), new TracedStack(stack), branchTargets.instructionOffset(index)); pushCallingInstructionBlock(new TracedVariables(variables),
Value valueBefore = simplePartialEvaluator.getVariablesBefore(instructionOffset).getValue(variableIndex); if (valueBefore == null) Value valueAfter = simplePartialEvaluator.getVariablesAfter(instructionOffset).getValue(variableIndex); if (valueAfter.computationalType() != valueBefore.computationalType()) InstructionOffsetValue producersBefore = simplePartialEvaluator.getVariablesBefore(instructionOffset).getProducerValue(variableIndex).instructionOffsetValue(); return producersBefore.instructionOffsetCount() == 1 && producersBefore.isMethodParameter(0);
public String toString() { StringBuffer buffer = new StringBuffer(); for (int index = 0; index < this.size(); index++) { Value value = this.values[index]; Value producerValue = producerVariables.getValue(index); buffer = buffer.append('[') .append(producerValue == null ? "empty:" : producerValue.toString()) .append(value == null ? "empty" : value.toString()) .append(']'); } return buffer.toString(); } }
TracedVariables variables = new TracedVariables(codeAttribute.u2maxLocals); TracedStack stack = new TracedStack(codeAttribute.u2maxStack); variables.setProducerValue(storeValue); stack.setProducerValue(storeValue);