📄 verifierutil.h
字号:
#endif /* INCLUDEDEBUGCODE *//* ------------------------------------------------------------------------ *\ * Class Accessor Methods *\* ------------------------------------------------------------------------ *//* * Return TRUE is the class is java.lang.Object * * @param vClass The CLASS to be accessed * @return TRUE if the the class is java.lang.Object */#define Cls_isJavaLangObject(vClass) ((INSTANCE_CLASS)vClass == JavaLangObject)/* * Return the superclass of the class * * @param vClass The CLASS to be accessed * @return The CLASS of its superclass */#define Cls_getSuper(vClass) ((CLASS)(((INSTANCE_CLASS)vClass)->superClass))/* * Return the constant pool for the class * * @param vClass The CLASS to be accessed * @return Its CONSTANTPOOL */#define Cls_getPool(vClass) (((INSTANCE_CLASS)vClass)->constPool)/* * Lookup a method * * @param vClassContext The CLASS of the lookup context (e.g. calling class) * @param vClassTarget The CLASS to be accessed (e.g. called class) * @param vMethod The METHOD who's name should be used to do the lookup * @return The METHOD if it exists else NULL */#define Cls_lookupMethod(vClassContext, vClassTarget, vMethod) \ lookupMethod(vClassTarget, vMethod->nameTypeKey, (INSTANCE_CLASS)vClassContext)/* * Lookup a field * * @param vClass The CLASS of the lookup context (e.g. calling class) * @param vNameTypeKey The nameTypeKey which is being searched in field table * @return The FIELD if it exists else NULL */#define Cls_lookupField(vClass, vNameTypeKey) \ lookupField(vClass, vNameTypeKey)/* * Get a class's key * * @param vClass The CLASS to be accessed * @return Its CLASSKEY */#define Cls_getKey(vClass) (vClass->key)/* ------------------------------------------------------------------------ *\ * Pool Accessor Methods *\* ------------------------------------------------------------------------ *//* * Get the tag of the pool entry at index. * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return Its POOLTAG * @throw If index out of bounds */#define Pol_getTag(vPool, index) \ (index >= CONSTANTPOOL_LENGTH(vPool)) ? \ (Vfy_throw(120), 0) \ : \ (CONSTANTPOOL_TAG(vPool, index) & CP_CACHEMASK) \/* * Check the tag at index is the same as "tag". * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @param tag The POOLTAG that should be there * @param errorcode The error to throw if it is not * @throw If tag is wrong */#define Pol_checkTagIs(vPool, index, tag, errorcode) { \ if (Pol_getTag(vPool, index) != tag) { \ Vfy_throw(errorcode); \ } \}/* * Check the tag at index is the same as "tag"or "tag2". * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @param tag The POOLTAG that should be there * @param tag2 The POOLTAG that should be there * @param errorcode The error to throw if it is not * @throw If both tags are wrong */#define Pol_checkTag2Is(vPool, index, tag, tag2, errorcode) { \ POOLTAG t = Pol_getTag(vPool, index); \ if (t != tag && t != tag2) { \ Vfy_throw(errorcode); \ } \}/* * Check the tag at index is CONSTANT_Class. * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @throw If the pool tag is not CONSTANT_Class */#define Pol_checkTagIsClass(vPool, index) \ Pol_checkTagIs(vPool, index, CONSTANT_Class, VE_EXPECT_CLASS)/* * Get the CLASSKEY for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return The CLASS of the CONSTANT_Class at that index */#define Pol_getClassKey(vPool, index) \ Cls_getKey(vPool->entries[index].clazz)/* For CONSTANT_FieldRef_info, CONSTANT_MethodRef_info, CONSTANT_InterfaceMethodRef_info *//* * Get the class index for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return The POOLINDEX in the class_index field */#define Pol_getClassIndex(vPool, index) \ (vPool->entries[index].method.classIndex)/* * Get the class for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return The POOLINDEX in the name_and_type_index field */#define Pol_getClass(vPool, fieldClassIndex) \ (vPool->entries[fieldClassIndex].clazz)/* * Get the Name-and-type index for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return The POOLINDEX in the name_and_type_index field */#define Pol_getNameAndTypeIndex(vPool, index) \ (vPool->entries[index].method.nameTypeIndex)/* * Get the Name-and-type key for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param index The index to be accessed * @return The nameTypeKey */#define Pol_getNameTypeKey(vPool, index) \ (vPool->entries[index].nameTypeKey)/* For CONSTANT_NameAndType_info, *//* * Get the type key of a Name-and-type for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param nameAndTypeIndex The index to be accessed * @return The METHODTYPEKEY of that entry */#define Pol_getTypeKey(vPool, nameAndTypeIndex) \ (vPool->entries[nameAndTypeIndex].nameTypeKey.nt.typeKey)/* * Get the descriptor key of a Name-and-type for the pool entry at index * * @param vPool The CONSTANTPOOL to be accessed * @param nameAndTypeIndex The index to be accessed * @return The METHODNAMEKEY of that entry */#define Pol_getDescriptorKey(vPool, nameAndTypeIndex) \ (vPool->entries[nameAndTypeIndex].nameTypeKey.nt.nameKey)/* ------------------------------------------------------------------------ *\ * Method Accessor Methods *\* ------------------------------------------------------------------------ *//* * Get the CLASS of a METHOD * * @param vMethod The METHOD to be accessed * @return The CLASS of the method */#define Mth_getClass(vMethod) ((CLASS)vMethod->ofClass)/* * Get the address of the bytecode array * * @param vMethod The METHOD to be accessed * @return The address of the bytecodes */#define Mth_getBytecodes(vMethod) (vMethod->u.java.code)/* * Get the length of the bytecode array * * @param vMethod The METHOD to be accessed * @return The length of the bytecodes */#define Mth_getBytecodeLength(vMethod) (vMethod->u.java.codeLength)/* * Return TRUE if it is a static method * * @param vMethod The METHOD to be accessed * @return TRUE if it is a static method */#define Mth_isStatic(vMethod) (vMethod->accessFlags & ACC_STATIC)/* * Return TRUE if it is a final method * * @param vMethod The METHOD to be accessed * @return TRUE if it is a final method */#define Mth_isFinal(vMethod) (vMethod->accessFlags & ACC_FINAL)/* * Return the number of locals in used by the method * * @param vMethod The METHOD to be accessed * @return The number of local variable slots */#define Mth_frameSize(vMethod) (vMethod->frameSize)/* * Get the start ip address for the i-th exception table entry * * @param vMethod The METHOD to be accessed * @param i The exception table index * @return The startPC */#define Mth_getExceptionTableStartPC(vMethod, i) \ ((vMethod->u.java.handlers)->handlers[i].startPC)/* * Get the end ip address for the i-th exception table entry * * @param vMethod The METHOD to be accessed * @param i The exception table index * @return The endPC */#define Mth_getExceptionTableEndPC(vMethod, i) \ ((vMethod->u.java.handlers)->handlers[i].endPC)/* * Get the handler ip address for the i-th exception table entry * * @param vMethod The METHOD to be accessed * @param i The exception table index * @return The handlerPC */#define Mth_getExceptionTableHandlerPC(vMethod, i) \ ((vMethod->u.java.handlers)->handlers[i].handlerPC)/* * Get the exception class for the i-th exception table entry * * @param vMethod The METHOD to be accessed * @param i The exception table index * @return The CLASSKEY of the exception */#define Mth_getExceptionTableCatchType(vMethod,i) \ ((vMethod->u.java.handlers)->handlers[i].exception)/* * Get the ip address for the i-th entry in the stack map table * * @param vMethod The METHOD to be accessed * @param i The index into the stack map table * @return The IP address for that entry */extern int Mth_getStackMapEntryIP(METHOD vMethod, int i);/* * Check the stackmap offset for the ith entry in the stack map table * * @param vMethod The METHOD to be accessed * @param stackmapIndex The index into the stack map table * @return true if ok, false if not valid. */extern bool_t Mth_checkStackMapOffset(METHOD vMethod, int stackmapIndex);/* * Get the length of the stack map table * * @param vMethod The METHOD to be accessed * @return The number of entries in the stack map table */extern int Mth_getExceptionTableLength(METHOD vMethod);/* * The following are not a part of this interface, but defined the * other variables and routines used from verifier.c */#define IS_NTH_BIT(var, bit) (var[(bit) >> 5] & (1 << ((bit) & 0x1F)))#define SET_NTH_BIT(var, bit) (var[(bit) >> 5] |= (1 << ((bit) & 0x1F)))#define callocNewBitmap(size) \ ((unsigned long *) callocObject((size + 31) >> 5, GCT_NOPOINTERS))extern unsigned short* vStack;extern unsigned short* vLocals;extern unsigned long *NEWInstructions;extern unsigned short vSP;extern bool_t vNeedInitialization;extern bool_t vIsAssignable(CLASSKEY fromKey, CLASSKEY toKey, CLASSKEY *mergedKeyP);extern bool_t matchStackMap(METHOD thisMethod, IPINDEX target_ip, int flags);extern bool_t checkNewObject(IPINDEX this_ip, IPINDEX target_ip);extern bool_t vIsProtectedAccess(INSTANCE_CLASS thisClass, POOLINDEX index, bool_t isMethod);extern int change_Field_to_StackType(CLASSKEY fieldType, CLASSKEY* stackTypeP);extern int change_Arg_to_StackType(unsigned char** sigP, CLASSKEY* typeP);#if CACHE_VERIFICATION_RESULT bool_t checkVerifiedClassList(INSTANCE_CLASS); void appendVerifiedClassList(INSTANCE_CLASS);#else # define checkVerifiedClassList(class) FALSE# define appendVerifiedClassList(class)#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -