You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by dl...@apache.org on 2007/08/13 00:19:10 UTC
svn commit: r565179 -
/harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h
Author: dlydick
Date: Sun Aug 12 15:19:09 2007
New Revision: 565179
URL: http://svn.apache.org/viewvc?view=rev&rev=565179
Log:
Added CALCULATE_METHOD_INFO_FROM_METHOD_REFERENCE() macro.
Consider OPCODE_B9_INVOKEINTERFACE explicitly in
the SYNCHRONIZE_METHOD_INVOCATION macro.
Correct thrown error in CHECK_INSTANCE_METHOD macro.
Added CHECK_INTERFACE_CLASS macro.
Remove special consideration of OPCODE_B7_INVOKESPECIAL opcode
from CHECK_OBJECT_CLASS_STRUCTURE() macro.
Added CHECK_PROTECTED_FIELD_IS_ACCESSIBLE macro
and CHECK_PROTECTED_MACRO_IS_ACCESSIBLE macro.
Modified:
harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h
Modified: harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h?view=diff&rev=565179&r1=565178&r2=565179
==============================================================================
--- harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h (original)
+++ harmony/enhanced/sandbox/bootjvm/bootJVM/jvm/src/opmacros.h Sun Aug 12 15:19:09 2007
@@ -1323,6 +1323,8 @@
* </li>
* </ul>
*
+ * @see CALCULATE_FIELD_INFO_FROM_FIELD_REFERENCE()
+ * @see CALCULATE_METHOD_INFO_FROM_METHOD_REFERENCE()
*
*/
#define CALCULATE_CLASS_INFO_FROM_CLASS_REFERENCE(clsnameidx) \
@@ -1347,7 +1349,7 @@
/* Now try to load it again if resolution failed to locate it*/\
if (jvm_class_index_null == clsidxmisc) \
{ \
- /* Need local var to avoid possible expansion confusion */ \
+ /* Need local var to avoid macro expansion confusion */ \
jvm_constant_pool_index cpidxOLD = clsnameidx; \
\
/* If class is not loaded, retrieve it by UTF8 class name*/\
@@ -1368,7 +1370,7 @@
*
* @param Fieldref @c @b constant_pool index into class file of current
* class (as indicated in the program counter) that
- * is a method reference entry.
+ * is a field reference entry.
*
*
* <b>Local variables read:</b>
@@ -1413,6 +1415,9 @@
* @link #JVMCLASS_JAVA_LANG_NOSUCHFIELDERROR
if requested field is not found in the class@endlink.
*
+ * @see CALCULATE_CLASS_INFO_FROM_CLASS_REFERENCE()
+ * @see CALCULATE_METHOD_INFO_FROM_METHOD_REFERENCE()
+ *
*/
#define CALCULATE_FIELD_INFO_FROM_FIELD_REFERENCE(Fieldref) \
pcpma = pcfs->constant_pool[Fieldref]; \
@@ -1451,7 +1456,7 @@
} \
} \
\
- fluidxmisc = pcpma_Fieldref->LOCAL_Fieldref_binding.fluidxJVM; \
+ fluidxmisc = pcpma_Fieldref->LOCAL_Fieldref_binding.fluidxJVM; \
if (jvm_field_index_bad == fluidxmisc) \
{ \
thread_throw_exception(thridx, \
@@ -1460,10 +1465,9 @@
/*NOTREACHED*/ \
} \
\
- pcfsmisc = CLASS_OBJECT_LINKAGE(clsidxmisc)->pcfs; \
- fluidxmisc = pcpma_Fieldref->LOCAL_Fieldref_binding.fluidxJVM; \
+ pcfsmisc = CLASS_OBJECT_LINKAGE(clsidxmisc)->pcfs; \
\
- if (rtrue == pcpma_Fieldref->LOCAL_Fieldref_binding.fluidxJVM) \
+ if (rtrue == pcpma_Fieldref->LOCAL_Fieldref_binding.oiflagJVM) \
{ \
pfld = pcfsmisc->fields[CLASS(clsidxmisc) \
.object_instance_field_lookup \
@@ -1478,6 +1482,196 @@
/*!
+ * @brief Calculate method_info pointer from a method reference.
+ *
+ * During the calculation, various scratch variables are
+ * loaded and used to simplify the code. Two final results
+ * include a (method_info *) stored the local variable @b pmth
+ * and a (CONSTANT_Methodref_info *) stored in the local variable
+ * @b pcpma_Methodref
+ *
+ * @param Methodref @c @b constant_pool index into class file of
+ * current class (as indicated in the program
+ * counter) that is a method reference entry.
+ *
+ * @param MethodrefType Name of either a @c @b CONSTANT_Methodref_info
+ * pointer or a
+ * @c @b CONSTANT_InterfaceMethodref_info pointer,
+ * depending on opcode. Use the former for
+ * @b INVOKESTATIC , @b INVOKESPECIAL , and
+ * @b INVOKEVIRTUAL . Use the latter only
+ * for @b INVOKEINTERFACE .
+ *
+ *
+ * <b>Local variables read:</b>
+ * <ul>
+ * <li> @c @e thridx Thread table index of current thread
+ * (input parameter to
+ * @link #opcode_run opcode_run()@endlink)
+ * </li>
+ * <li> @c @e macro_expansion_of(Methodref)
+ * Any expression resolving to a
+ * @c @b constant_pool index
+ * </li>
+ * <li> @c @e macro_expansion_of(MethodrefType)
+ * Any expression resolving to a
+ * CONSTANT_Methodref_info pointer or a
+ * CONSTANT_InterfaceMethodref_info
+ * pointer.
+ * </li>
+ * </ul>
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink.
+ *
+ *
+ * <b>Local variables written:</b>
+ * <ul>
+ * <li> @c @e pcpma pointer to a @c @b constant_pool entry
+ * </li>
+ * <li> @c @e macro_expansion_of(MethodrefType)
+ * Typically either @c @e pcpma_Methodref ,
+ * being @c @b pcpma cast as a
+ * CONSTANT_Methodref_info pointer or to
+ * pcpma_InterfaceMethodref , being
+ * @c @b pcpma cast as a
+ * CONSTANT_InterfaceMethodref_info pointer.
+ * </li>
+ * <li> @c @e clsidxmisc Class index of fully bound class referenced
+ * by @c @b pcpma_Methodref
+ * </li>
+ * <li> @c @e pcfsmisc @c @b pcfs class file field from class
+ * referenced by @c @b clsidxmisc
+ * </li>
+ * <li> @c @e pmth method_info table entry referenced by
+ * @c @b pcpma_Methodref
+ * or @c @b pcpma_InterfaceMethodref
+ * </li>
+ * <li> @c @e mthidxmisc Method index of method from class
+ * referenced by @c @b clsidxmisc
+ * </li>
+ * </ul>
+ *
+ *
+ * @throws JVMCLASS_JAVA_LANG_ABSTRACTMETHODERROR
+ * @link #JVMCLASS_JAVA_LANG_ABSTRACTMETHODERROR
+ if class containing requested method cannot be found@endlink.
+ *
+ * @throws JVMCLASS_JAVA_LANG_NOSUCHFIELDERROR
+ * @link #JVMCLASS_JAVA_LANG_NOSUCHFIELDERROR
+ if requested method is not found in the class@endlink.
+ *
+ *
+ * @see CALCULATE_CLASS_INFO_FROM_CLASS_REFERENCE()
+ * @see CALCULATE_FIELD_INFO_FROM_FIELD_REFERENCE()
+ *
+ */
+#define \
+ CALCULATE_METHOD_INFO_FROM_METHOD_REFERENCE(Methodref,MethodrefType)\
+ /* \
+ * Calc clsidxmisc and pcpma and either pcpma_Methodref or \
+ * pcpma_InterfaceMethodref. If class has not yet been loaded, \
+ * do so now. The spec says to do it following the check for \
+ * an abstract method, but in this implementation, the loading \
+ * has to be done before the testing in case the method is not \
+ * in this class but in a superclass or superinterface. \
+ */ \
+ pcpma = pcfs->constant_pool[Methodref]; \
+ pcpma_##MethodrefType = PTR_THIS_CP_##MethodrefType(pcpma); \
+ clsidxmisc = pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding \
+ .clsidxJVM; \
+ \
+ /* \
+ * Try to resolve this class before attempting to load. \
+ * It could be that it has been loaded but is not yet \
+ * resolved enough. \
+ */ \
+ if (jvm_class_index_null == clsidxmisc) \
+ { \
+ (rvoid) linkage_resolve_class(GET_PC_FIELD_IMMEDIATE(thridx, \
+ clsidx), \
+ rfalse); \
+ \
+ clsidxmisc = pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.clsidxJVM; \
+ \
+ if (jvm_class_index_null == clsidxmisc) \
+ { \
+ /* If class is not loaded, retrieve it by UTF8 class name*/\
+ LATE_CLASS_LOAD(pcpma_##MethodrefType->class_index); \
+ \
+ /* Check if method exists in loaded class */ \
+ clsidxmisc = pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.clsidxJVM;\
+ \
+ if (jvm_class_index_null == clsidxmisc) \
+ { \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_NOSUCHMETHODERROR);\
+/*NOTREACHED*/ \
+ } \
+ } \
+ } \
+ \
+ /* \
+ * Load four key variables for processing methods \
+ */ \
+ mthidxmisc = pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.mthidxJVM; \
+ \
+ /* If method not found in loaded class, try again, then complain */\
+ if (jvm_method_index_bad == mthidxmisc) \
+ { \
+ (rvoid) linkage_resolve_class(clsidxmisc, rfalse); \
+ \
+ mthidxmisc = pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.mthidxJVM; \
+ \
+ if (jvm_method_index_bad == mthidxmisc) \
+ { \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_NOSUCHMETHODERROR); \
+/*NOTREACHED*/ \
+ } \
+ } \
+ \
+ pcfsmisc = CLASS_OBJECT_LINKAGE(clsidxmisc)->pcfs; \
+ pmth = pcfsmisc->methods[mthidxmisc]; \
+ \
+ /* Must be a valid reference to a method */ \
+ if (jvm_attribute_index_bad == \
+ pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.codeatridxJVM) \
+ { \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_NOSUCHMETHODERROR); \
+/*NOTREACHED*/ \
+ } \
+ else \
+ /* if (jvm_attribute_index_native == \
+ pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.codeatridxJVM) \
+ { \
+ ... This is okay, it will be handled later in the opcode ... \
+ } \
+ else \
+ */ \
+ if (jvm_attribute_index_abstract == \
+ pcpma_##MethodrefType \
+ ->LOCAL_##MethodrefType##_binding.codeatridxJVM) \
+ { \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_ABSTRACTMETHODERROR);\
+/*NOTREACHED*/ \
+ }
+
+
+/*!
* @brief Report whether a method is an \<init\> method or not.
*
*
@@ -1831,6 +2025,13 @@
/* size of opcode + size of operand */ \
pc->offset -= ( sizeof(u1) + sizeof(u2) ); \
\
+ /* The @b INVOKEINTERFACE opcode has two more fields */ \
+ if (OPCODE_B9_INVOKEINTERFACE == opcode) \
+ { \
+ /* sizeof(count) + sizeof(reserved byte)*/\
+ pc->offset -= ( sizeof(u1) + sizeof(u1) );\
+ } \
+ \
break; \
} \
}
@@ -1901,6 +2102,13 @@
}
+#warning Write a SUPER_CLASS_OF(clsidx) macro to get clsidx superclass:
+/*
+ * Namely: SUPER_CLASS_OF(clsidx) \
+ OBJECT_CLASS_LINKAGE(OBJECT(CLASS(clsidx).class_objhash) \
+ .objhash_super_class)->clsidx
+ */
+
/*!
* @brief Check if this field is a final field in the current class.
*
@@ -1985,6 +2193,8 @@
* @link #JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
if requested method is a static field@endlink.
*
+ * @see CHECK_STATIC_FIELD
+ *
*/
#define CHECK_INSTANCE_FIELD \
\
@@ -2026,9 +2236,13 @@
* </ul>
*
*
- * @throws JVMCLASS_JAVA_LANG_VERIFYERROR
- * @link #JVMCLASS_JAVA_LANG_VERIFYERROR
- if requested method is a static method@endlink.
+ * @throws JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
+ * @link #JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
+ if requested method is a class static method@endlink.
+ * Presumably the compiler did its job properly, so there is
+ * no need to invoke a @b VerifyError instead.
+ *
+ * @see CHECK_STATIC_METHOD
*
*/
#define CHECK_INSTANCE_METHOD \
@@ -2038,7 +2252,7 @@
{ \
thread_throw_exception(thridx, \
THREAD_STATUS_THREW_ERROR, \
- JVMCLASS_JAVA_LANG_VERIFYERROR); \
+ JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR); \
/*NOTREACHED*/ \
}
@@ -2137,7 +2351,7 @@
/*!
- * @brief Check if this object is a scalar, that is, not an array.
+ * @brief Check if this object is not an array, that is, it is a scalar.
*
*
* @b Parameters: @link #rvoid rvoid@endlink
@@ -2217,6 +2431,8 @@
* @link #JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
if requested method is an array object@endlink.
*
+ * @see CHECK_NOT_INIT_METHOD
+ *
*/
#define CHECK_NOT_CLINIT_METHOD \
\
@@ -2268,6 +2484,8 @@
* @link #JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
if requested method is an array object@endlink.
*
+ * @see CHECK_NOT_CLINIT_METHOD
+ *
*/
#define CHECK_NOT_INIT_METHOD \
\
@@ -2285,8 +2503,7 @@
/*!
- * @brief Check if this object is from a normal class, that is,
- * not from an interface class.
+ * @brief Check if this object is from an interface class.
*
*
* @b Parameters: @link #rvoid rvoid@endlink
@@ -2313,26 +2530,32 @@
* </ul>
*
*
- * @throws JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
- * @link #JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
- if requested object is from an interface class@endlink.
+ * @throws JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
+ * @link #JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
+ if requested object is not from an interface class@endlink.
+ *
+ * @see CHECK_NOT_INTERFACE_CLASS
+ *
+ * @deprecated Was to be used with @b INVOKEINTERFACE
+ * but the compiler discovers this situation first.
*
*/
-#define CHECK_NOT_INTERFACE_CLASS \
+#define CHECK_INTERFACE_CLASS \
\
- /* Must not be from an interface class */ \
- if (ACC_INTERFACE & \
- OBJECT_CLASS_LINKAGE(objhashmisc)->pcfs->access_flags) \
+ /* Must be from an interface class */ \
+ if (!(ACC_INTERFACE & \
+ OBJECT_CLASS_LINKAGE(objhashmisc)->pcfs->access_flags)) \
{ \
thread_throw_exception(thridx, \
THREAD_STATUS_THREW_ERROR, \
- JVMCLASS_JAVA_LANG_INSTANTIATIONERROR); \
+ JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR); \
/*NOTREACHED*/ \
}
/*!
- * @brief Check if this object hash is not a null object hash.
+ * @brief Check if this object is from a normal class, that is,
+ * not from an interface class.
*
*
* @b Parameters: @link #rvoid rvoid@endlink
@@ -2359,38 +2582,34 @@
* </ul>
*
*
- * @throws JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
- * @link #JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
- if object hash is to a null object@endlink.
+ * @throws JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
+ * @link #JVMCLASS_JAVA_LANG_INSTANTIATIONERROR
+ if requested object is from an interface class@endlink.
+ *
+ * @see CHECK_INTERFACE_CLASS
+ *
+ * @deprecated Was to be used with @b INVOKEVIRTUAL and @b INVOKESPECIAL
+ * but the compiler discovers this situation first.
*
*/
-#define CHECK_NOT_NULL_OBJECT_HASH(objhash) \
+#define CHECK_NOT_INTERFACE_CLASS \
\
- /* Must not be a null object hash */ \
- if (jvm_object_hash_null == objhash) \
+ /* Must not be from an interface class */ \
+ if (ACC_INTERFACE & \
+ OBJECT_CLASS_LINKAGE(objhashmisc)->pcfs->access_flags) \
{ \
thread_throw_exception(thridx, \
- THREAD_STATUS_THREW_EXCEPTION, \
- JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION); \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_INSTANTIATIONERROR); \
/*NOTREACHED*/ \
}
/*!
- * @brief Check if the class hierarchy is followed, per opcode.
- *
- *
- * This macro is used where @b INVOKESPECIAL is being processed,
- * once for normal virtual methods, once for native methods.
- * It implements a passage of the JVM spec for this opcode.
- *
- * @param _clsidx Class index containing class where
- * resolved method is defined.
+ * @brief Check if this object hash is not a null object hash.
*
- * @param _objhash Object to examine
*
- * @param _isinitmethod @link #rtrue rtrue@endlink if invoked method is
- * the \<init\> method.
+ * @b Parameters: @link #rvoid rvoid@endlink
*
*
* <b>Local variables read:</b>
@@ -2399,17 +2618,7 @@
* (input parameter to
* @link #opcode_run opcode_run()@endlink)
* </li>
- * <li> @c @e macro_expansion_of(_clsidx)
- * Any expression that resolves to a
- * class index
- * </li>
- * <li> @c @e macro_expansion_of(_objhash)
- * Any @link #jvm_object_hash
- jvm_object_hash@endlink variable.
- * </li>
- * <li> @c @e macro_expansion_of(_isinitmethod)
- * Any expression that resolves to a
- * @link #rboolean rboolean@endlink
+ * <li> @c @e objhashmisc Object table hash of current object
* </li>
* </ul>
*
@@ -2423,44 +2632,21 @@
* </li>
* </ul>
*
+ *
+ * @throws JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
+ * @link #JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION
+ if object hash is to a null object@endlink.
+ *
*/
-#define CHECK_OBJECT_CLASS_STRUCTURE(_clsidx, _objhash, _isinitmethod) \
- switch(opcode) \
- { \
- case OPCODE_B9_INVOKEINTERFACE: \
- /* This logic @e should follow next bit, per spec */ \
- if (rfalse == \
- classutil_class_implements_interface( \
- OBJECT_CLASS_LINKAGE(_objhash)->clsidx, \
- _clsidx)) \
- { \
- thread_throw_exception(thridx, \
- THREAD_STATUS_THREW_ERROR, \
- JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR);\
-/*NOTREACHED*/ \
- } \
- /*! @warning NO @c @b break statement here! Continue... */ \
+#define CHECK_NOT_NULL_OBJECT_HASH(objhash) \
\
- case OPCODE_B6_INVOKEVIRTUAL: \
- if (rfalse == \
- classutil_class_is_a( \
- GET_PC_FIELD_IMMEDIATE(thridx, clsidx), \
- OBJECT_CLASS_LINKAGE(_objhash)->clsidx)) \
- { \
- thread_throw_exception(thridx, \
- THREAD_STATUS_THREW_ERROR, \
- JVMCLASS_JAVA_LANG_ABSTRACTMETHODERROR);\
+ /* Must not be a null object hash */ \
+ if (jvm_object_hash_null == objhash) \
+ { \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_EXCEPTION, \
+ JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION); \
/*NOTREACHED*/ \
- } \
- break; \
- \
- case OPCODE_B7_INVOKESPECIAL: \
- CHECK_SUPERCLASS_VALID_METHOD_FOUND(_clsidx, \
- _isinitmethod); \
- break; \
- \
- /* case OPCODE_B8_INVOKESTATIC: \
- break; */ \
}
@@ -2541,6 +2727,8 @@
* @link #JVMCLASS_JAVA_LANG_INCOMPATIBLECLASSCHANGEERROR
if requested field is an object instance field@endlink.
*
+ * @see CHECK_INSTANCE_FIELD
+ *
*/
#define CHECK_STATIC_FIELD \
\
@@ -2590,6 +2778,8 @@
* Presumably the compiler did its job properly, so there is
* no need to invoke a @b VerifyError instead.
*
+ * @see CHECK_INSTANCE_METHOD
+ *
*/
#define CHECK_STATIC_METHOD \
\
@@ -2604,19 +2794,19 @@
/*!
- * @brief Check if the superclass of the current class contains a
- * matching method.
- *
+ * @brief If the requested field is protected, check if it is accessible
+ * to the current object.
*
- * This macro is used where @b INVOKESPECIAL is being processed,
- * once for normal virtual methods, once for native methods.
- * It implements a passage of the JVM spec for this opcode.
+ * This macro is used where @b GETFIELD and @b PUTFIELD is being
+ * processed when the class hierarchy relationship between the
+ * requested field, the current class, and the current object is
+ * being examined. If the requested field is a protected field,
+ * and is a member of the current class or one of its superclasses,
+ * then the current object referencing that field must be a member
+ * of the current class or one of its subclasses. This is the
+ * implementation of a passage of the JVM spec for these opcodes.
*
- * @param _clsidx Class index containing class where
- * resolved method is defined.
- *
- * @param _isinitmethod @link #rtrue rtrue@endlink if invoked method is
- * the \<init\> method.
+ * @b Parameters: @link #rvoid rvoid@endlink
*
*
* <b>Local variables read:</b>
@@ -2625,13 +2815,17 @@
* (input parameter to
* @link #opcode_run opcode_run()@endlink)
* </li>
- * <li> @c @e macro_expansion_of(_clsidx)
- * Any expression that resolves to a
- * class index
+ * <li> @c @e pcpma_Fieldref CONSTANT_Fieldref_info pointer to current
+ * field
* </li>
- * <li> @c @e macro_expansion_of(_isinitmethod)
- * Any expression that resolves to a
- * @link #rboolean rboolean@endlink
+ * <li> @c @e pfld field_info table entry of current field
+ * </li>
+ * <li> @c @e clsidxmisc Class index of fully bound class referenced
+ * by @c @b pcpma_Fieldref
+ * </li>
+ * <li> @c @e clsidxmisc2 Class index of current class (from PC)
+ * </li>
+ * <li> @c @e objhashmisc Object table hash of current object
* </li>
* </ul>
*
@@ -2645,38 +2839,29 @@
* </li>
* </ul>
*
+ * @see CHECK_PROTECTED_METHOD_IS_ACCESSIBLE
+ *
+ * @todo HARMONY-6-jvm-opmacros.h-16 Which is the correct parm order
+ * to classutil_class_is_a() that implements the spec requirement?
+ * A is a B, or B is a A ? It is probably correct as is, but need
+ * to @e carefully examine this.
+ *
*/
-#define CHECK_SUPERCLASS_VALID_METHOD_FOUND(_clsidx, _isinitmethod) \
- if ((ACC_SUPER & \
- CLASS(GET_PC_FIELD_IMMEDIATE(thridx, \
- clsidx)).status) && \
- \
- /* "is a" tests for subclasses _and_ parent class */ \
- ((GET_PC_FIELD_IMMEDIATE(thridx, clsidx) != \
- _clsidx) && \
- (rtrue == \
- classutil_class_is_a( \
- GET_PC_FIELD_IMMEDIATE(thridx, clsidx), \
- _clsidx))) && \
- \
- (rfalse == (_isinitmethod))) \
- { \
- /* \
- * Proceed unless superclass of current class \
- * does not contain the resolved method. \
- */ \
- if (rfalse == \
- classutil_class_is_a( \
- CLASS_OBJECT_LINKAGE( \
- GET_PC_FIELD_IMMEDIATE(thridx, clsidx)) \
- ->pcfs \
- ->super_class, \
- _clsidx)) \
- { \
- exit_throw_exception(EXIT_JVM_OBJECT, \
- JVMCLASS_JAVA_LANG_ABSTRACTMETHODERROR); \
-/*NOTREACHED*/ \
- } \
+#define CHECK_PROTECTED_FIELD_IS_ACCESSIBLE \
+ if ((ACC_PROTECTED & pfld->access_flags) && \
+ (rtrue == classutil_class_is_a(clsidxmisc2,clsidxmisc))) \
+ { \
+ if (rfalse == \
+ classutil_class_is_a( \
+ OBJECT_CLASS_LINKAGE(objhashmisc)->clsidx, \
+ clsidxmisc2)) \
+ { \
+ /* Somebody goofed */ \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_ILLEGALACCESSERROR); \
+/*NOTREACHED*/ \
+ } \
}
@@ -2725,11 +2910,91 @@
}
+/*!
+ * @brief If the requested method is protected, check if it is
+ * accessible to the current object.
+ *
+ * This macro is used where @b GETFIELD and @b PUTFIELD is being
+ * processed when the class hierarchy relationship between the
+ * requested field, the current class, and the current object is
+ * being examined. If the requested field is a protected field,
+ * and is a member of the current class or one of its superclasses,
+ * then the current object referencing that field must be a member
+ * of the current class or one of its subclasses. This is the
+ * implementation of a passage of the JVM spec for these opcodes.
+ *
+ * @b Parameters: @link #rvoid rvoid@endlink
+ *
+ *
+ * <b>Local variables read:</b>
+ * <ul>
+ * <li> @c @e thridx Thread table index of current thread
+ * (input parameter to
+ * @link #opcode_run opcode_run()@endlink)
+ * </li>
+ * <li> @c @e pcpma_Methodref CONSTANT_Methodref_info pointer to current
+ * method
+ * </li>
+ * <li> @c @e pmth method_info table entry of current method
+ * </li>
+ * <li> @c @e clsidxmisc Class index of fully bound class referenced
+ * by @c @b pcpma_Methodref
+ * </li>
+ * <li> @c @e clsidxmisc2 Class index of current class (from PC)
+ * </li>
+ * <li> @c @e objhashmisc Object table hash of current object
+ * </li>
+ * </ul>
+ *
+ *
+ * @returns @link #rvoid rvoid@endlink
+ *
+ *
+ * <b>Local variables written:</b>
+ * <ul>
+ * <li> @c @e none
+ * </li>
+ * </ul>
+ *
+ * @see CHECK_PROTECTED_FIELD_IS_ACCESSIBLE
+ * @see jvm/src/native.c#POP_THIS_OBJHASH
+ *
+ * @todo HARMONY-6-jvm-opmacros.h-17 Which is the correct parm order
+ * to classutil_class_is_a() that implements the spec requirement?
+ * A is a B, or B is a A ? It is probably correct as is, but need
+ * to @e carefully examine this.
+ *
+ */
+#warning needs checkout
+#define CHECK_PROTECTED_METHOD_IS_ACCESSIBLE \
+ if ((ACC_PROTECTED & pmth->access_flags) && \
+ (rtrue == classutil_class_is_a(clsidxmisc2,clsidxmisc))) \
+ { \
+ if (rfalse == \
+ classutil_class_is_a( \
+ OBJECT_CLASS_LINKAGE(objhashmisc)->clsidx, \
+ clsidxmisc2)) \
+ { \
+ /* Somebody goofed */ \
+ thread_throw_exception(thridx, \
+ THREAD_STATUS_THREW_ERROR, \
+ JVMCLASS_JAVA_LANG_VERIFYERROR); \
+/*NOTREACHED*/ \
+ } \
+ }
+
+
/*@} */ /* End of grouped definitions */
#ifdef I_AM_OPCODE_C
/*!
+ * @name Information about each opcode
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
* @brief Java Virtual Machine operation code name strings
*
* This array is used when displaying the program counter and opcode
@@ -3117,9 +3382,19 @@
} /* End of operand_bytecount() */
+/*@} */ /* End of grouped definitions */
+
+
#include "util.h" /* For definition of sysDbgMsg() */
/*!
+ * @name Opcode debug utilities
+ *
+ */
+
+/*@{ */ /* Begin grouped definitions */
+
+/*!
* @brief Opcode execution context, without operands
*/
#define OPCODE_MSG_FORMAT "thr=%04.4x " \
@@ -3281,6 +3556,8 @@
/*NOTREACHED*/
} /* END of opcode_disassemble() */
+
+/*@} */ /* End of grouped definitions */
#endif /* I_AM_OPCODE_C */