Skip to content

Commit

Permalink
Remove Class.isPrimitiveClass and outdated vt methods
Browse files Browse the repository at this point in the history
Signed-off-by: Theresa Mammarella <[email protected]>
  • Loading branch information
theresa-m committed Jun 20, 2024
1 parent 45bf250 commit c97a6e0
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 94 deletions.
28 changes: 0 additions & 28 deletions jcl/src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -2631,14 +2631,6 @@ public boolean isInterface() {
public native boolean isPrimitive();

/*[IF INLINE-TYPES]*/
/**
* Answers true if the receiver represents a primitive class type. Array classes
* return false.
*
* @return true if receiver is primitive class type, and false otherwise.
*/
native boolean isPrimitiveClass();

/**
* Answers true if the receiver represents a value class type. Array classes
* return false.
Expand Down Expand Up @@ -2676,26 +2668,6 @@ int getClassFileVersion() {
return thisObject.getClassFileVersion0();
}
private native int getClassFileVersion0();

/**
* ToDo: add comments for public methods - https://github.com/eclipse-openj9/openj9/issues/13615
*/
Class<?> asPrimaryType() {
// ToDo: this is a temporary implementation - https://github.com/eclipse-openj9/openj9/issues/13615
return this;
}
Class<?> asValueType() {
// ToDo: this is a temporary implementation - https://github.com/eclipse-openj9/openj9/issues/13615
return this;
}
boolean isPrimaryType() {
// ToDo: this is a temporary implementation - https://github.com/eclipse-openj9/openj9/issues/13615
return true;
}
boolean isPrimitiveValueType() {
// ToDo: this is a temporary implementation - https://github.com/eclipse-openj9/openj9/issues/13615
return isPrimitiveClass();
}
/*[ENDIF] INLINE-TYPES */

/**
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/codegen/J9RecognizedMethodsEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
java_lang_Class_isArray,
java_lang_Class_isPrimitive,
java_lang_Class_isValue,
java_lang_Class_isPrimitiveClass,
java_lang_Class_isIdentity,
java_lang_Class_getComponentType,
java_lang_Class_getModifiersImpl,
Expand Down
6 changes: 0 additions & 6 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2889,12 +2889,6 @@ TR_J9VMBase::testIsClassValueType(TR::Node *j9ClassRefNode)
return testAreSomeClassFlagsSet(j9ClassRefNode, J9ClassIsValueType);
}

TR::Node *
TR_J9VMBase::testIsClassPrimitiveValueType(TR::Node *j9ClassRefNode)
{
return testAreSomeClassFlagsSet(j9ClassRefNode, J9ClassIsPrimitiveValueType);
}

TR::Node *
TR_J9VMBase::testIsClassIdentityType(TR::Node *j9ClassRefNode)
{
Expand Down
9 changes: 0 additions & 9 deletions runtime/compiler/env/VMJ9.h
Original file line number Diff line number Diff line change
Expand Up @@ -1261,15 +1261,6 @@ class TR_J9VMBase : public TR_FrontEnd
*/
TR::Node * testIsClassValueType(TR::Node *j9ClassRefNode);

/**
* \brief Load class flags field of the specified class and test whether the primitive value type
* flag is set.
* \param j9ClassRefNode A node representing a reference to a \ref J9Class
* \return \ref TR::Node that evaluates to a non-zero integer if the class is a primitive value type,
* or zero otherwise
*/
TR::Node * testIsClassPrimitiveValueType(TR::Node *j9ClassRefNode);

/**
* \brief Load class flags field of the specified class and test whether the hasIdentity
* flag is set.
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,6 @@ void TR_ResolvedJ9Method::construct()
{x(TR::java_lang_Class_isArray, "isArray", "()Z")},
{x(TR::java_lang_Class_isPrimitive, "isPrimitive", "()Z")},
{x(TR::java_lang_Class_isValue, "isValue", "()Z")},
{x(TR::java_lang_Class_isPrimitiveClass, "isPrimitiveClass", "()Z")},
{x(TR::java_lang_Class_isIdentity, "isIdentity", "()Z")},
{x(TR::java_lang_Class_getComponentType, "getComponentType", "()Ljava/lang/Class;")},
{x(TR::java_lang_Class_getModifiersImpl, "getModifiersImpl", "()I")},
Expand Down
9 changes: 1 addition & 8 deletions runtime/compiler/optimizer/J9ValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,14 +1675,13 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
break;
}
case TR::java_lang_Class_isValue:
case TR::java_lang_Class_isPrimitiveClass:
case TR::java_lang_Class_isIdentity:
{
TR::Node *classChild = node->getLastChild();
bool classChildGlobal;
TR::VPConstraint *classChildConstraint = getConstraint(classChild, classChildGlobal);

// If the class is known for a call to Class.isValue, Class.isPrimitiveClass or
// If the class is known for a call to Class.isValue or
// Class.isIdentity, fold it at compile-time. Otherwise, inline a test of the
// class flags
//
Expand All @@ -1695,7 +1694,6 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
TR_OpaqueClassBlock *thisClass = classChildConstraint->getClass();

const int queryResult = ((rm == TR::java_lang_Class_isValue) && TR::Compiler->cls.isValueTypeClass(thisClass))
|| ((rm == TR::java_lang_Class_isPrimitiveClass) && TR::Compiler->cls.isPrimitiveValueTypeClass(thisClass))
|| ((rm == TR::java_lang_Class_isIdentity) && TR::Compiler->cls.classHasIdentity(thisClass));
transformCallToIconstInPlaceOrInDelayedTransformations(_curTree, queryResult, classChildGlobal, true, false);
TR::DebugCounter::incStaticDebugCounter(comp(), TR::DebugCounter::debugCounterName(comp(), "constrainCall/(%s)", signature));
Expand Down Expand Up @@ -1736,11 +1734,6 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
testFlagsNode = comp()->fej9()->testIsClassValueType(classOperand);
break;
}
case TR::java_lang_Class_isPrimitiveClass:
{
testFlagsNode = comp()->fej9()->testIsClassPrimitiveValueType(classOperand);
break;
}
case TR::java_lang_Class_isIdentity:
{
testFlagsNode = comp()->fej9()->testIsClassIdentityType(classOperand);
Expand Down
3 changes: 0 additions & 3 deletions runtime/oti/VMHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ typedef enum {
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ASSIGNABLE_FROM,
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ARRAY,
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE,
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE_CLASS,
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_VALUE,
J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_IDENTITY,
Expand Down
19 changes: 0 additions & 19 deletions runtime/vm/BytecodeInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2886,18 +2886,6 @@ class INTERPRETER_CLASS
return EXECUTE_BYTECODE;
}

#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
/* java.lang.Class: public native boolean isPrimitiveClass(); */
VMINLINE VM_BytecodeAction
inlClassIsPrimitiveClass(REGISTER_ARGS_LIST)
{
J9Class *receiverClazz = J9VM_J9CLASS_FROM_HEAPCLASS(_currentThread, *(j9object_t*)_sp);
bool isPrimitiveClass = J9_IS_J9CLASS_PRIMITIVE_VALUETYPE(receiverClazz);
returnSingleFromINL(REGISTER_ARGS, (isPrimitiveClass ? 1 : 0), 1);
return EXECUTE_BYTECODE;
}
#endif /* J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES */

#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
/* java.lang.Class: public native boolean isValue(); */
VMINLINE VM_BytecodeAction
Expand Down Expand Up @@ -10336,9 +10324,6 @@ class INTERPRETER_CLASS
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ASSIGNABLE_FROM),
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ARRAY),
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE),
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE_CLASS),
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_VALUE),
JUMP_TABLE_ENTRY(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_IDENTITY),
Expand Down Expand Up @@ -10871,10 +10856,6 @@ runMethod: {
PERFORM_ACTION(inlClassIsArray(REGISTER_ARGS));
JUMP_TARGET(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE):
PERFORM_ACTION(inlClassIsPrimitive(REGISTER_ARGS));
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
JUMP_TARGET(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE_CLASS):
PERFORM_ACTION(inlClassIsPrimitiveClass(REGISTER_ARGS));
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
JUMP_TARGET(J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_VALUE):
PERFORM_ACTION(inlClassIsValue(REGISTER_ARGS));
Expand Down
16 changes: 0 additions & 16 deletions runtime/vm/FastJNI_java_lang_Class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,6 @@ Fast_java_lang_Class_isPrimitive(J9VMThread *currentThread, j9object_t classObje
return J9ROMCLASS_IS_PRIMITIVE_TYPE(receiverClazz->romClass) ? JNI_TRUE : JNI_FALSE;
}

#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
/* java.lang.Class: private native boolean isPrimitiveClass(); */
jboolean JNICALL
Fast_java_lang_Class_isPrimitiveClass(J9VMThread *currentThread, j9object_t classObject)
{
J9Class *receiverClazz = J9VM_J9CLASS_FROM_HEAPCLASS(currentThread, classObject);
bool isPrimitiveClass = J9_IS_J9CLASS_PRIMITIVE_VALUETYPE(receiverClazz);
return isPrimitiveClass ? JNI_TRUE : JNI_FALSE;
}
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */

#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
/* java.lang.Class: private native boolean isIdentity(); */
jboolean JNICALL
Expand Down Expand Up @@ -262,11 +251,6 @@ J9_FAST_JNI_METHOD_TABLE(java_lang_Class)
J9_FAST_JNI_METHOD("isPrimitive", "()Z", Fast_java_lang_Class_isPrimitive,
J9_FAST_JNI_RETAIN_VM_ACCESS | J9_FAST_JNI_NOT_GC_POINT | J9_FAST_JNI_NO_NATIVE_METHOD_FRAME | J9_FAST_JNI_NO_EXCEPTION_THROW |
J9_FAST_JNI_NO_SPECIAL_TEAR_DOWN | J9_FAST_JNI_DO_NOT_WRAP_OBJECTS)
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
J9_FAST_JNI_METHOD("isPrimitiveClass", "()Z", Fast_java_lang_Class_isPrimitiveClass,
J9_FAST_JNI_RETAIN_VM_ACCESS | J9_FAST_JNI_NOT_GC_POINT | J9_FAST_JNI_NO_NATIVE_METHOD_FRAME | J9_FAST_JNI_NO_EXCEPTION_THROW |
J9_FAST_JNI_NO_SPECIAL_TEAR_DOWN | J9_FAST_JNI_DO_NOT_WRAP_OBJECTS)
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
J9_FAST_JNI_METHOD("isIdentity", "()Z", Fast_java_lang_Class_isIdentity,
J9_FAST_JNI_RETAIN_VM_ACCESS | J9_FAST_JNI_NOT_GC_POINT | J9_FAST_JNI_NO_NATIVE_METHOD_FRAME | J9_FAST_JNI_NO_EXCEPTION_THROW |
Expand Down
3 changes: 0 additions & 3 deletions runtime/vm/bindnatv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ static inlMapping mappings[] = {
{ "Java_java_lang_Class_isAssignableFrom__Ljava_lang_Class_2", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ASSIGNABLE_FROM },
{ "Java_java_lang_Class_isArray__", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_ARRAY },
{ "Java_java_lang_Class_isPrimitive__", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE },
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
{ "Java_java_lang_Class_isPrimitiveClass__", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_PRIMITIVE_CLASS },
#endif /* J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES */
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
{ "Java_java_lang_Class_isValue__", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_VALUE },
{ "Java_java_lang_Class_isIdentity__", J9_BCLOOP_SEND_TARGET_INL_CLASS_IS_IDENTITY },
Expand Down

0 comments on commit c97a6e0

Please sign in to comment.