public void simulate(Stack stack) {
if(!this.op.as(ArrayOpcode.class).isLoad) {
StackElementLength[] pops = Arrays.copyOf(getPops(), getPops().length - 1);
StackElement subject = stack.getFromTop(StackElementLength.add(pops));
if(subject instanceof TrackableArray) {
TrackableArray array = (TrackableArray) subject;
StackElement i = stack.getFromTop(StackElementLength.add(array.componentLength));
if(i instanceof IntegerConstant) {
StackElement value = stack.peek(array.componentLength);
array.set(((IntegerConstant) i).getValue(), value);
} else {
array.isDirty = true;
}
}
}