Skip to content
Permalink
Browse files
8266586: [lworld] [lw3] Remove experimental support for primitive cla…
…sses in JPDA

Reviewed-by: dsimms
  • Loading branch information
fparain committed May 6, 2021
1 parent 65578e1 commit ab997be25794f650e4a22fc9b5499f18bb0b61cb
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 245 deletions.
@@ -3248,7 +3248,6 @@ JDWP "Java(tm) Debug Wire Protocol"
(Constant BYTE = 'B' "'B' - a byte value (1 byte).")
(Constant CHAR = 'C' "'C' - a character value (2 bytes).")
(Constant OBJECT = 'L' "'L' - an object (objectID size).")
(Constant INLINE_OBJECT = 'Q' "'Q' - an inline object (objectID size).")
(Constant FLOAT = 'F' "'F' - a float value (4 bytes).")
(Constant DOUBLE = 'D' "'D' - a double value (8 bytes).")
(Constant INT = 'I' "'I' - an int value (4 bytes).")
@@ -142,8 +142,7 @@ boolean isBoolean() {
boolean isReference() {
byte tag = jdwpTag();
return tag == JDWP.Tag.ARRAY ||
tag == JDWP.Tag.OBJECT ||
tag == JDWP.Tag.INLINE_OBJECT;
tag == JDWP.Tag.OBJECT;
}

boolean isPrimitive() {
@@ -223,7 +222,6 @@ private String nextSignature() {
return key + nextSignature();

case (JDWP.Tag.OBJECT):
case (JDWP.Tag.INLINE_OBJECT):
int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
currentIndex);
String retVal = signature.substring(currentIndex - 1,
@@ -267,7 +265,6 @@ private String nextTypeName() {
return "char";

case (JDWP.Tag.OBJECT):
case (JDWP.Tag.INLINE_OBJECT):
int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
currentIndex);
String retVal = signature.substring(currentIndex,
@@ -76,10 +76,6 @@ private void enableCache() {
}
}

private boolean isInlineType() {
return referenceType().signature().startsWith("Q");
}

// Override in subclasses
protected Cache newCache() {
return new Cache();
@@ -149,34 +145,11 @@ public boolean vmNotSuspended(VMAction action) {
}
}

// The isSubstitutable() method must perform the same comparison on
// remote inline objects as the one performed ValueBootstrapMethods.isSubstitutable()
// on local instances.
private boolean isSubstitutable(ObjectReferenceImpl other) {
if (referenceType() != other.referenceType()) return false;
List<Field> fields = referenceType().fields();
for (Field f : fields) {
if (f.isStatic()) {
fields.remove(f);
}
}
Map<Field,Value> thisFields = getValues(fields);
Map<Field,Value> otherFields = other.getValues(fields);
for (Field f : fields) {
if (!thisFields.get(f).equals(otherFields.get(f))) return false;
}
return true;
}

public boolean equals(Object obj) {
if ((obj != null) && (obj instanceof ObjectReferenceImpl)) {
ObjectReferenceImpl other = (ObjectReferenceImpl) obj;
if (isInlineType()) {
return isSubstitutable(other);
} else {
return (ref() == other.ref()) &&
super.equals(obj);
}
return (ref() == other.ref()) &&
super.equals(obj);
} else {
return false;
}
@@ -497,9 +470,6 @@ public boolean isCollected() {
}

public long uniqueID() {
if (isInlineType()) {
throw new UnsupportedOperationException("Inline types cannot have unique IDs");
}
return ref();
}

@@ -642,19 +612,11 @@ void validateAssignment(ValueContainer destination)
}

public String toString() {
if (isInlineType()) {
return "instance of " + referenceType().name();
} else {
return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")";
}
return "instance of " + referenceType().name() + "(id=" + uniqueID() + ")";
}

byte typeValueKey() {
if (isInlineType()) {
return JDWP.Tag.INLINE_OBJECT;
} else {
return JDWP.Tag.OBJECT;
}
return JDWP.Tag.OBJECT;
}

private static boolean isNonVirtual(int options) {
@@ -650,7 +650,6 @@ byte command() {

static boolean isObjectTag(byte tag) {
return (tag == JDWP.Tag.OBJECT) ||
(tag == JDWP.Tag.INLINE_OBJECT) ||
(tag == JDWP.Tag.ARRAY) ||
(tag == JDWP.Tag.STRING) ||
(tag == JDWP.Tag.THREAD) ||
@@ -44,9 +44,6 @@ static ValueImpl prepareForAssignment(Value value,
if (sig.isPrimitive()) {
throw new InvalidTypeException("Can't set a primitive type to null");
}
if (destination.signature().charAt(0) == 'Q') {
throw new InvalidTypeException("Can't set an inline type to null");
}
return null; // no further checking or conversion necessary
} else {
return ((ValueImpl)value).prepareForAssignmentTo(destination);
@@ -315,14 +315,6 @@ public List<ModuleReference> allModules() {
return Collections.unmodifiableList(modules);
}

private static boolean isReferenceArray(String signature) {
int i = signature.lastIndexOf('[');
if (i > -1 && signature.charAt(i+1) == 'L') {
return true;
}
return false;
}

public List<ReferenceType> classesByName(String className) {
validateVM();
return classesBySignature(JNITypeParser.typeNameToSignature(className));
@@ -336,24 +328,6 @@ List<ReferenceType> classesBySignature(String signature) {
} else {
list = retrieveClassesBySignature(signature);
}
// HACK: add second request to cover the case where className
// is the name of an inline type. This is done only if the
// first signature is either a reference type or an array
// of a reference type.
if (signature.length() > 1 &&
(signature.charAt(0) == 'L' || isReferenceArray((signature)))) {
List<ReferenceType> listInlineTypes;
signature = signature.replaceFirst("L", "Q");
if (retrievedAllTypes) {
listInlineTypes = findReferenceTypes(signature);
} else {
listInlineTypes = retrieveClassesBySignature(signature);
}
if (!listInlineTypes.isEmpty()) {
list.addAll(listInlineTypes);
}
}

return Collections.unmodifiableList(list);
}

@@ -1426,7 +1400,6 @@ synchronized ObjectReferenceImpl objectMirror(long id, int tag) {
if (object == null) {
switch (tag) {
case JDWP.Tag.OBJECT:
case JDWP.Tag.INLINE_OBJECT:
object = new ObjectReferenceImpl(vm, id);
break;
case JDWP.Tag.STRING:
@@ -335,7 +335,7 @@ jdwpError
outStream_writeValue(JNIEnv *env, PacketOutputStream *out,
jbyte typeKey, jvalue value)
{
if (typeKey == JDWP_TAG(OBJECT) || typeKey == JDWP_TAG(INLINE_OBJECT)) {
if (typeKey == JDWP_TAG(OBJECT)) {
(void)outStream_writeByte(out, specificTypeKey(env, value.l));
} else {
(void)outStream_writeByte(out, typeKey);
@@ -29,7 +29,6 @@
#define JVM_TYPE_ASSERT(typeKey)\
JDI_ASSERT_MSG(JDWP_Tag_OBJECT == typeKey || \
JDWP_Tag_ARRAY == typeKey || \
JDWP_Tag_INLINE_OBJECT == typeKey || \
JDWP_Tag_BOOLEAN == typeKey || \
JDWP_Tag_BYTE == typeKey || \
JDWP_Tag_CHAR == typeKey || \
@@ -48,7 +47,7 @@ static inline jbyte jdwpTag(const char *signature) {

static inline jboolean isReferenceTag(jbyte typeKey) {
JVM_TYPE_ASSERT(typeKey);
return (typeKey == JDWP_TAG(OBJECT)) || (typeKey == JDWP_TAG(ARRAY)) || (typeKey == JDWP_TAG(INLINE_OBJECT));
return (typeKey == JDWP_TAG(OBJECT)) || (typeKey == JDWP_TAG(ARRAY));
}

static inline jboolean isArrayTag(jbyte typeKey) {
@@ -297,7 +297,6 @@ util_reset(void)
jboolean
isObjectTag(jbyte tag) {
return (tag == JDWP_TAG(OBJECT)) ||
(tag == JDWP_TAG(INLINE_OBJECT)) ||
(tag == JDWP_TAG(STRING)) ||
(tag == JDWP_TAG(THREAD)) ||
(tag == JDWP_TAG(THREAD_GROUP)) ||
@@ -106,8 +106,8 @@ jdk_lang = \
# valhalla lworld tests
jdk_valhalla = \
java/lang/invoke \
valhalla \
com/sun/jdi/JdbInlineTypesTest.java
valhalla


# All of the java.util package
jdk_util = \

This file was deleted.

0 comments on commit ab997be

Please sign in to comment.