private void handleArrayStore(ArrayInstruction ins) { try { // If the resource instance is stored in an array, then we consider // it as having escaped. This is conservative; ideally we would // check whether this array is a field or gets passed out of the // method. ResourceValueFrame frame = getFrame(); ResourceValue topValue = frame.getTopValue(); if (topValue.equals(ResourceValue.instance())) { frame.setStatus(ResourceValueFrame.ESCAPED); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Stack underflow", e); } handleNormalInstruction(ins); }
boolean isArrayStore(InstructionHandle ins) { if (ins == null) { return false; } Instruction i = ins.getInstruction(); return (i instanceof ArrayInstruction && i instanceof StackConsumer); }
/** * This is the default instruction modeling method. */ @Override public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) { int flags = 0; if (ins instanceof InvokeInstruction) flags = ValueNumber.RETURN_VALUE; else if (ins instanceof ArrayInstruction) flags = ValueNumber.ARRAY_VALUE; else if (ins instanceof ConstantPushInstruction) flags = ValueNumber.CONSTANT_VALUE; // Get the input operands to this instruction. ValueNumber[] inputValueList = popInputValues(numWordsConsumed); // See if we have the output operands in the cache. // If not, push default (fresh) values for the output, // and add them to the cache. ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags); if (VERIFY_INTEGRITY) { checkConsumedAndProducedValues(ins, inputValueList, outputValueList); } // Push output operands on stack. pushOutputValues(outputValueList); }
public void visitArrayInstruction( ArrayInstruction i ) { short opcode = i.getOpcode(); Type type = i.getType(_cp); String kind = (opcode < Constants.IASTORE) ? "Load" : "Store"; _out.println("il.append(_factory.createArray" + kind + "(" + BCELifier.printType(type) + "));"); }