837 assert entryKind.getStackKind() == otherKind.getStackKind() || (entryKind == JavaKind.Int && otherKind == JavaKind.Illegal) ||
838 entryKind.getBitCount() >= otherKind.getBitCount() : entryKind + " vs " + otherKind;
839 }
840 valueIndex++;
841 }
842 }
843 if (compatible && twoSlotKinds != null) {
844 // if there are two-slot values then make sure the incoming states can be merged
845 outer: for (int valueIndex = 0; valueIndex < entryCount; valueIndex++) {
846 if (twoSlotKinds[valueIndex] != null) {
847 assert valueIndex < virtual.entryCount() - 1 && virtual.entryKind(valueIndex) == JavaKind.Int && virtual.entryKind(valueIndex + 1) == JavaKind.Int;
848 for (int i = 0; i < states.length; i++) {
849 int object = getObject.applyAsInt(i);
850 ObjectState objectState = states[i].getObjectState(object);
851 ValueNode value = objectState.getEntry(valueIndex);
852 JavaKind valueKind = value.getStackKind();
853 if (valueKind != twoSlotKinds[valueIndex]) {
854 ValueNode nextValue = objectState.getEntry(valueIndex + 1);
855 if (value.isConstant() && value.asConstant().equals(JavaConstant.INT_0) && nextValue.isConstant() && nextValue.asConstant().equals(JavaConstant.INT_0)) {
856 // rewrite to a zero constant of the larger kind
857 states[i].setEntry(object, valueIndex, ConstantNode.defaultForKind(twoSlotKinds[valueIndex], graph()));
858 states[i].setEntry(object, valueIndex + 1, ConstantNode.forConstant(JavaConstant.forIllegal(), tool.getMetaAccessProvider(), graph()));
859 } else {
860 compatible = false;
861 break outer;
862 }
863 }
864 }
865 }
866 }
867 }
868
869 if (compatible) {
870 // virtual objects are compatible: create phis for all entries that need them
871 ValueNode[] values = states[0].getObjectState(getObject.applyAsInt(0)).getEntries().clone();
872 PhiNode[] phis = getValuePhis(virtual, virtual.entryCount());
873 int valueIndex = 0;
874 while (valueIndex < values.length) {
875 for (int i = 1; i < states.length; i++) {
876 if (phis[valueIndex] == null) {
|
837 assert entryKind.getStackKind() == otherKind.getStackKind() || (entryKind == JavaKind.Int && otherKind == JavaKind.Illegal) ||
838 entryKind.getBitCount() >= otherKind.getBitCount() : entryKind + " vs " + otherKind;
839 }
840 valueIndex++;
841 }
842 }
843 if (compatible && twoSlotKinds != null) {
844 // if there are two-slot values then make sure the incoming states can be merged
845 outer: for (int valueIndex = 0; valueIndex < entryCount; valueIndex++) {
846 if (twoSlotKinds[valueIndex] != null) {
847 assert valueIndex < virtual.entryCount() - 1 && virtual.entryKind(valueIndex) == JavaKind.Int && virtual.entryKind(valueIndex + 1) == JavaKind.Int;
848 for (int i = 0; i < states.length; i++) {
849 int object = getObject.applyAsInt(i);
850 ObjectState objectState = states[i].getObjectState(object);
851 ValueNode value = objectState.getEntry(valueIndex);
852 JavaKind valueKind = value.getStackKind();
853 if (valueKind != twoSlotKinds[valueIndex]) {
854 ValueNode nextValue = objectState.getEntry(valueIndex + 1);
855 if (value.isConstant() && value.asConstant().equals(JavaConstant.INT_0) && nextValue.isConstant() && nextValue.asConstant().equals(JavaConstant.INT_0)) {
856 // rewrite to a zero constant of the larger kind
857 debug.log("Rewriting entry %s to constant of larger size", valueIndex);
858 states[i].setEntry(object, valueIndex, ConstantNode.defaultForKind(twoSlotKinds[valueIndex], graph()));
859 states[i].setEntry(object, valueIndex + 1, ConstantNode.forConstant(JavaConstant.forIllegal(), tool.getMetaAccessProvider(), graph()));
860 } else {
861 compatible = false;
862 break outer;
863 }
864 }
865 }
866 }
867 }
868 }
869
870 if (compatible) {
871 // virtual objects are compatible: create phis for all entries that need them
872 ValueNode[] values = states[0].getObjectState(getObject.applyAsInt(0)).getEntries().clone();
873 PhiNode[] phis = getValuePhis(virtual, virtual.entryCount());
874 int valueIndex = 0;
875 while (valueIndex < values.length) {
876 for (int i = 1; i < states.length; i++) {
877 if (phis[valueIndex] == null) {
|