return type.merge(this);
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
return type.merge(this);
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
return type.merge(this);
/** * Merges all types on the stack and local variable table of this frame with that of the specified * type. * * @param frame the frame to merge with * @return true if any changes to this frame where made by this merge */ public boolean merge(Frame frame) { boolean changed = false; // Local variable table for (int i = 0; i < locals.length; i++) { if (locals[i] != null) { Type prev = locals[i]; Type merged = prev.merge(frame.locals[i]); // always replace the instance in case a multi-interface type changes to a normal Type locals[i] = merged; if (! merged.equals(prev) || merged.popChanged()) { changed = true; } } else if (frame.locals[i] != null) { locals[i] = frame.locals[i]; changed = true; } } changed |= mergeStack(frame); return changed; }
/** * Merges all types on the stack and local variable table of this frame with that of the specified * type. * * @param frame the frame to merge with * @return true if any changes to this frame where made by this merge */ public boolean merge(Frame frame) { boolean changed = false; // Local variable table for (int i = 0; i < locals.length; i++) { if (locals[i] != null) { Type prev = locals[i]; Type merged = prev.merge(frame.locals[i]); // always replace the instance in case a multi-interface type changes to a normal Type locals[i] = merged; if (! merged.equals(prev) || merged.popChanged()) { changed = true; } } else if (frame.locals[i] != null) { locals[i] = frame.locals[i]; changed = true; } } changed |= mergeStack(frame); return changed; }
private Type mergeArray(Type type) { Type typeRoot = getRootComponent(type); Type thisRoot = getRootComponent(this); int typeDims = type.getDimensions(); int thisDims = this.getDimensions(); // Array commponents can be merged when the dimensions are equal if (typeDims == thisDims) { Type mergedComponent = thisRoot.merge(typeRoot); // If the components can not be merged (a primitive component mixed with a different type) // then Object is the common type. if (mergedComponent == Type.BOGUS) return Type.OBJECT; return createArray(mergedComponent, thisDims); } Type targetRoot; int targetDims; if (typeDims < thisDims) { targetRoot = typeRoot; targetDims = typeDims; } else { targetRoot = thisRoot; targetDims = thisDims; } // Special case, arrays are cloneable and serializable, so prefer them when dimensions differ if (eq(CLONEABLE.clazz, targetRoot.clazz) || eq(SERIALIZABLE.clazz, targetRoot.clazz)) return createArray(targetRoot, targetDims); return createArray(OBJECT, targetDims); }
private Type mergeArray(Type type) { Type typeRoot = getRootComponent(type); Type thisRoot = getRootComponent(this); int typeDims = type.getDimensions(); int thisDims = this.getDimensions(); // Array commponents can be merged when the dimensions are equal if (typeDims == thisDims) { Type mergedComponent = thisRoot.merge(typeRoot); // If the components can not be merged (a primitive component mixed with a different type) // then Object is the common type. if (mergedComponent == Type.BOGUS) return Type.OBJECT; return createArray(mergedComponent, thisDims); } Type targetRoot; int targetDims; if (typeDims < thisDims) { targetRoot = typeRoot; targetDims = typeDims; } else { targetRoot = thisRoot; targetDims = thisDims; } // Special case, arrays are cloneable and serializable, so prefer them when dimensions differ if (eq(CLONEABLE.clazz, targetRoot.clazz) || eq(SERIALIZABLE.clazz, targetRoot.clazz)) return createArray(targetRoot, targetDims); return createArray(OBJECT, targetDims); }
newType = oldType.merge(newType);
newType = oldType.merge(newType);
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
/** * Merges all types on the stack of this frame instance with that of the specified frame. * The local variable table is left untouched. * * @param frame the frame to merge the stack from * @return true if any changes where made */ public boolean mergeStack(Frame frame) { boolean changed = false; if (top != frame.top) throw new RuntimeException("Operand stacks could not be merged, they are different sizes!"); for (int i = 0; i < top; i++) { if (stack[i] != null) { Type prev = stack[i]; Type merged = prev.merge(frame.stack[i]); if (merged == Type.BOGUS) throw new RuntimeException("Operand stacks could not be merged due to differing primitive types: pos = " + i); stack[i] = merged; // always replace the instance in case a multi-interface type changes to a normal Type if ((! merged.equals(prev)) || merged.popChanged()) { changed = true; } } } return changed; }
/** * Merges all types on the stack and local variable table of this frame with that of the specified * type. * * @param frame the frame to merge with * @return true if any changes to this frame where made by this merge */ public boolean merge(Frame frame) { boolean changed = false; // Local variable table for (int i = 0; i < locals.length; i++) { if (locals[i] != null) { Type prev = locals[i]; Type merged = prev.merge(frame.locals[i]); // always replace the instance in case a multi-interface type changes to a normal Type locals[i] = merged; if (! merged.equals(prev) || merged.popChanged()) { changed = true; } } else if (frame.locals[i] != null) { locals[i] = frame.locals[i]; changed = true; } } changed |= mergeStack(frame); return changed; }
/** * Merges all types on the stack and local variable table of this frame with that of the specified * type. * * @param frame the frame to merge with * @return true if any changes to this frame where made by this merge */ public boolean merge(Frame frame) { boolean changed = false; // Local variable table for (int i = 0; i < locals.length; i++) { if (locals[i] != null) { Type prev = locals[i]; Type merged = prev.merge(frame.locals[i]); // always replace the instance in case a multi-interface type changes to a normal Type locals[i] = merged; if (! merged.equals(prev) || merged.popChanged()) { changed = true; } } else if (frame.locals[i] != null) { locals[i] = frame.locals[i]; changed = true; } } changed |= mergeStack(frame); return changed; }
private Type mergeArray(Type type) { Type typeRoot = getRootComponent(type); Type thisRoot = getRootComponent(this); int typeDims = type.getDimensions(); int thisDims = this.getDimensions(); // Array commponents can be merged when the dimensions are equal if (typeDims == thisDims) { Type mergedComponent = thisRoot.merge(typeRoot); // If the components can not be merged (a primitive component mixed with a different type) // then Object is the common type. if (mergedComponent == Type.BOGUS) return Type.OBJECT; return createArray(mergedComponent, thisDims); } Type targetRoot; int targetDims; if (typeDims < thisDims) { targetRoot = typeRoot; targetDims = typeDims; } else { targetRoot = thisRoot; targetDims = thisDims; } // Special case, arrays are cloneable and serializable, so prefer them when dimensions differ if (eq(CLONEABLE.clazz, targetRoot.clazz) || eq(SERIALIZABLE.clazz, targetRoot.clazz)) return createArray(targetRoot, targetDims); return createArray(OBJECT, targetDims); }