", 7 ) == 0;
+ }
+
/**
* Verifier context destructor
*/
~vf_Context ()
{
+ if( m_pool ) {
+ vf_delete_pool( m_pool );
+ }
+ if( m_type ) {
+ delete m_type;
+ }
}
/**
- * Function clears context.
+ * Clears context.
*/
void ClearContext()
{
m_method = NULL;
m_is_constructor = false;
m_graph = NULL;
- m_code = NULL;
+ m_instr = NULL;
m_bc = NULL;
- m_codeNum = 0;
- m_nodeNum = 0;
- m_edgeNum = 0;
- vf_clean_pool_memory( m_pool );
+ m_last_instr = NULL;
+ m_retnum = 0;
+ vf_clean_pool( m_pool );
} // vf_ClearContext
- public:
- vf_TypePool * m_type; ///< context type constraint collection
+public:
+ vf_TypePool *m_type; ///< context type constraint collection
char *m_error; ///< context error message
- vf_Graph *m_graph; ///< context control flow graph
- vf_VerifyPool_t *m_pool; ///< context memory pool
- vf_Code_t *m_code; ///< context code instruction of method
- vf_BCode_t *m_bc; ///< bytecode to code mapping
+ vf_Graph *m_graph; ///< control flow graph
+ vf_Pool *m_pool; ///< memory pool
+ vf_InstrHandle m_instr; ///< method instructions
+ vf_InstrHandle m_last_instr; ///< the pointer follows
+ ///< the last instruction at m_instr
+ vf_BCode *m_bc; ///< bytecode to instr mapping
+ unsigned m_retnum; ///< a number of rets
+
+ /**
+ * Cached method info.
+ */
class_handler m_class; ///< context class
method_handler m_method; ///< context method
- unsigned m_codeNum; ///< code instruction number
- unsigned m_nodeNum; ///< graph node number
- unsigned m_edgeNum; ///< graph edge number
- bool m_is_constructor; ///< true if the
+ unsigned m_len; ///< bytecode length
+ unsigned char *m_bytes; ///< bytecode location
+ unsigned short m_maxstack; ///< max stack length
+ unsigned short m_maxlocal; ///< max local number
+ bool m_is_constructor; ///< true if the
///< method is a constructor
/**
- * Structure contains useful valid types
+ * Contains useful valid types.
*/
struct vf_ContextVType
{
- vf_ValidType_t *m_class; ///< context a given class valid type
- vf_ValidType_t *m_throwable; ///< context java/lang/Throwable valid type
- vf_ValidType_t *m_object; ///< context java/lang/Object valid type
- vf_ValidType_t *m_array; ///< context [Ljava/lang/Object; valid type
- vf_ValidType_t *m_clone; ///< context java/lang/Cloneable valid type
- vf_ValidType_t *m_serialize; ///< context java/io/Serializable valid type
+ vf_ValidType *m_class; ///< context a given class valid type
+ vf_ValidType *m_throwable; ///< context java/lang/Throwable valid type
+ vf_ValidType *m_object; ///< context java/lang/Object valid type
+ vf_ValidType *m_array; ///< context [Ljava/lang/Object; valid type
+ vf_ValidType *m_clone; ///< context java/lang/Cloneable valid type
+ vf_ValidType *m_serialize; ///< context java/io/Serializable valid type
} m_vtype;
/**
- * Structure contains debug dump flags
+ * Contains debug dump flags.
*/
struct vf_ContextDump
{
unsigned m_verify:1; ///< verify all flag
- unsigned m_with_subroutine:1; ///< verified method has subroutine
unsigned m_constraint:1; ///< dump type constraints for class
- unsigned m_code:1; ///< print code array in stream
+ unsigned m_instr:1; ///< print instr array in stream
unsigned m_graph:1; ///< print original control flow graph
unsigned m_mod_graph:1; ///< print modified control flow graph
- unsigned m_dot_graph:1; ///< dump original control flow graph in file in DOT format
- unsigned m_dot_mod_graph:1; ///< dump modified control flow graph in file in DOT format
+ unsigned m_dot_graph:1; ///< dump original control flow graph in a file in DOT format
+ unsigned m_dot_mod_graph:1; ///< dump modified control flow graph in a file in DOT format
unsigned m_node_vector:1; ///< print data flow node vectors
- unsigned m_code_vector:1; ///< print data flow node code instruction vectors
+ unsigned m_instr_vector:1; ///< print data flow node code instruction vectors
unsigned m_merge_vector:1; ///< print result of merge data flow vectors
} m_dump;
+ vf_SubContext *m_sub_ctx; ///< aggregate subroutine info
+
+ vf_MapVector *m_map; ///< a stack map for control flow analysis,
+ ///< vectors themselves are allocated from the graph pool.
+ vf_MapEntry *m_buf; ///< used to store intermediate stack states
+ ///< during data flow analysis
}; // struct vf_Context
//===========================================================
@@ -834,36 +895,15 @@ struct vf_Context
//===========================================================
/**
- * Head structure of memory pool.
- */
-struct vf_VerifyPool
-{
- vf_VerifyPoolInternal_t *m_pool; ///< pool entry
- size_t m_memory; ///< allocated memory size
- size_t m_used; ///< used memory size
- size_t m_maxuse; ///< max used memory size
-};
-
-/**
- * Internal structure of memory pool.
- */
-struct vf_VerifyPoolInternal
-{
- void *m_memory; ///< pool entry memory
- char *m_free; ///< free space in pool entry
- vf_VerifyPoolInternal_t *m_next; ///< next pool entry
- size_t m_freesize; ///< size of free space in pool entry
-};
-
-/**
* Structure of class loader constraint data.
*/
struct vf_ClassLoaderData
{
- vf_VerifyPool_t *pool; ///< constraint memory pool
- vf_Hash_t *string; ///< string pool hash table
+ vf_Pool *pool; ///< constraint memory pool
+ vf_Hash *string; ///< string pool hash table
};
+
//===========================================================
// Verifier debug data
//===========================================================
@@ -871,9 +911,9 @@ struct vf_ClassLoaderData
/**
* Array of opcode names. Available in debug mode.
*/
-#if _VERIFY_DEBUG
+#if _VF_DEBUG
extern const char *vf_opcode_names[];
-#endif // _VERIFY_DEBUG
+#endif // _VF_DEBUG
//===========================================================
// Verifier functions.
@@ -881,12 +921,12 @@ extern const char *vf_opcode_names[];
/**
* Function creates bytecode control flow graph.
- * @param context - verifier context
+ * @param ctx - verifier context
* @return Result of graph creation.
- * @see vf_Context_t
- * @see Verifier_Result
+ * @see vf_Context
+ * @see vf_Result
*/
-Verifier_Result vf_create_graph( vf_Context_t * context );
+vf_Result vf_create_graph( vf_Context *ctx );
/**
* Checks control flow and data flow of graph.
@@ -895,16 +935,16 @@ Verifier_Result vf_create_graph( vf_Cont
*
* @return a result of graph checks
*/
-Verifier_Result vf_check_graph( vf_Context_t * context );
+vf_Result vf_check_graph( vf_Context *ctx );
/**
* Function provides data flow checks of verifier graph structure.
- * @param context - verifier context
+ * @param ctx - verifier context
* @return Check result.
- * @see vf_Context_t
- * @see Verifier_Result
+ * @see vf_Context
+ * @see vf_Result
*/
-Verifier_Result vf_check_graph_data_flow( vf_Context_t * context );
+vf_Result vf_check_graph_data_flow( vf_Context *ctx );
/**
* Function parses method, class or field descriptors.
@@ -917,30 +957,27 @@ Verifier_Result vf_check_graph_data_flow
void vf_parse_description( const char *descr, int *inlen, int *outlen );
/**
- * Function parses descriptor and sets input and output data flow vectors.
- * @param descr - descriptor of method, class or field
- * @param inlen - number of entries for IN data flow vector
- * @param add - additional number of entries to IN data flow vector
- * @param outlen - number of entries for OUT data flow vector (for method)
- * @param invector - pointer to IN data flow vector
- * @param outvector - pointer to OUT data flow vector
- * @param context - verifier context
+ * Parses a descriptor and sets input and output data flow vectors.
+ * @param descr a descriptor of method, class or field
+ * @param inlen a number of entries for IN data flow vector
+ * @param add an additional number of entries to IN data flow vector
+ * @param outlen a number of entries for OUT data flow vector (for method)
+ * @param invector a pointer to IN data flow vector
+ * @param outvector a pointer to OUT data flow vector
+ * @param ctx a verifier context
* @note Assertion is raised if descr is equal to null.
* @note Parameter invector may be equal to null
* if sum of parameters inlen + add is equal to zero.
* @note Parameter outvector may be equal to null
* if parameter outlen is equal to zero.
- * @see vf_MapEntry_t
- * @see vf_Context_t
*/
void
vf_set_description_vector( const char *descr,
int inlen,
int add,
int outlen,
- vf_MapEntry_t ** invector,
- vf_MapEntry_t ** outvector,
- vf_Context_t * context );
+ vf_MapEntry **invector,
+ vf_MapEntry **outvector, vf_ContextHandle ctx );
/**
* Gets a class name from a constant pool.
@@ -960,35 +997,33 @@ vf_get_cp_class_name( class_handler klas
} // vf_get_cp_class_name
/**
- * Function creates valid type by given class name.
- * @param class_name - class name
- * @param context - verifier context
- * @return Valid type structure corresponding to given class name.
- * @see vf_ValidType_t
- * @see vf_Context_t
+ * Creates a valid type from a given class name.
+ * @param class_name a class name
+ * @param ctx a verifier context
+ * @return a valid type structure corresponding to the given class name
*/
-vf_ValidType_t *vf_create_class_valid_type( const char *class_name,
- vf_Context_t * context );
+vf_ValidType *vf_create_class_valid_type( const char *class_name,
+ vf_ContextHandle ctx );
/**
* Function provides constraint checks for current class.
- * @param context - verifier context
+ * @param ctx - verifier context
* @return Check result.
* @note Provides only checks with loaded classes.
* @note All unchecked constraints are saved to class loader verify data.
- * @see vf_Context_t
- * @see Verifier_Result
+ * @see vf_Context
+ * @see vf_Result
*/
-Verifier_Result vf_check_class_constraints( vf_Context_t * context );
+vf_Result vf_check_class_constraints( vf_Context *ctx );
/**
* Function compares two valid types.
* @param type1 - first checked type
* @param type2 - second checked type
- * @return If types are equal returns true, else returns false.
- * @see vf_ValidType_t
+ * @return If types are equal returns true, else returns false.
+ * @see vf_ValidType
*/
-bool vf_is_types_equal( vf_ValidType_t * type1, vf_ValidType_t * type2 );
+bool vf_is_types_equal( vf_ValidType *type1, vf_ValidType *type2 );
/**
* Function checks access to protected field/method.
@@ -999,42 +1034,41 @@ bool vf_is_types_equal( vf_ValidType_t *
* @param instance_name - name of instance class
* @param index - constant pool index
* @param check_type - access check type
- * @param ctex - verifier context
+ * @param ctx - verifier context
* @return Check result.
* @note Provides only checks with loaded classes.
- * @see vf_CheckConstraint_t
- * @see vf_Context_t
- * @see Verifier_Result
- */
-Verifier_Result vf_check_access_constraint( const char *super_name, // name of super class
- const char *instance_name, // name of instance class
- unsigned short index, // constant pool index
- vf_CheckConstraint_t check_type, // access check type
- vf_Context_t * ctex ); // verifier context
+ * @see vf_CheckConstraint
+ * @see vf_Context
+ * @see vf_Result
+ */
+vf_Result vf_check_access_constraint( const char *super_name, // name of super class
+ const char *instance_name, // name of instance class
+ unsigned short index, // constant pool index
+ vf_CheckConstraint check_type, // access check type
+ vf_Context *ctx ); // verification context
/**
- * Sets error message of verifier.
+ * Sets error message of a verifier.
*
* @param[in] stream stringstream object with a message
- * @param[in] ctex a verifier context
+ * @param[in] ctx a verifier context
*/
static inline void
-vf_set_error_message( stringstream & stream, vf_Context_t * ctex )
+vf_set_error_message( stringstream & stream, vf_Context *ctx )
{
- if( ctex->m_error ) {
+ if( ctx->m_error ) {
// free old message
- vf_free( ctex->m_error );
+ vf_free( ctx->m_error );
}
// create message
size_t len = stream.str().length();
if( len ) {
- ctex->m_error = (char*)vf_malloc( len + 1 );
- memcpy( ctex->m_error, stream.str().c_str(), len );
- ctex->m_error[len] = '\0';
+ ctx->m_error = (char*)vf_malloc( len + 1 );
+ memcpy( ctx->m_error, stream.str().c_str(), len );
+ ctx->m_error[len] = '\0';
} else {
- ctex->m_error = NULL;
+ ctx->m_error = NULL;
}
- return;
} // vf_set_error_message
/**
@@ -1042,28 +1076,28 @@ vf_set_error_message( stringstream & str
*
* @param[in] context a verifier context
*
- * @return true if a class version is less than 1.4
+ * @return true if a class version is less than 1.4
*/
static inline bool
-vf_is_class_version_14( vf_Context_t * context )
+vf_is_class_version_14( vf_ContextHandle ctx )
{
- return ( class_get_version( context->m_class ) < 49 ) ? true : false;
+ return ( class_get_version( ctx->m_class ) < 49 ) ? true : false;
} // vf_is_class_version_14
/**
* Returns branch target for a given branch number.
*
- * @param[in] code a reference to instruction
+ * @param[in] instr a reference to instruction
* @param[in] branch_num a branch number
*
* @return an absolute bytecode position to which the executuion
* branches
*/
static inline int
-vf_get_code_branch( vf_Code_t * code, unsigned branch_num )
+vf_get_instr_branch( vf_InstrHandle instr, unsigned branch_num )
{
- assert( branch_num < code->m_offcount );
- return code->m_off[branch_num];
+ assert( branch_num < instr->m_offcount );
+ return instr->m_off[branch_num];
} // vf_get_instruction_branch
/**
@@ -1074,14 +1108,11 @@ vf_get_code_branch( vf_Code_t * code, un
* @param[in] pool memory pool
*/
static inline void
-vf_new_vector( vf_MapEntry_t ** vector, unsigned len, vf_VerifyPool_t * pool )
+vf_new_vector( vf_MapEntry **vector, unsigned len, vf_Pool *pool )
{
// create new vector
- ( *vector ) = (vf_MapEntry_t*) vf_alloc_pool_memory( pool,
- len *
- sizeof
- ( vf_MapEntry_t ) );
- return;
+ ( *vector ) = (vf_MapEntry*)vf_palloc( pool,
+ len * sizeof( vf_MapEntry ) );
} // vf_new_vector
/**
@@ -1092,8 +1123,8 @@ vf_new_vector( vf_MapEntry_t ** vector,
* @param[in] type reference type
*/
static inline void
-vf_set_vector_stack_entry_ref( vf_MapEntry_t * vector,
- unsigned num, vf_ValidType_t * type )
+vf_set_vector_stack_entry_ref( vf_MapEntry *vector,
+ unsigned num, vf_ValidType *type )
{
// set a stack map vector entry by ref
vector[num].m_type = SM_REF;
@@ -1101,14 +1132,44 @@ vf_set_vector_stack_entry_ref( vf_MapEnt
} // vf_set_vector_stack_entry_ref
/**
+ * Calculates an index of instruction.
+ * @param[in] pc a bytecode index at instruction start
+ * @param[in] ctx a verification context
+ * @return an instruction index
+ */
+static inline unsigned
+vf_bc_to_instr_index( unsigned short pc, vf_ContextHandle ctx )
+{
+ vf_InstrHandle instr = ctx->m_bc[pc].m_instr;
+ assert( instr );
+ return instr - ctx->m_instr;
+}
+
+/**
+ * For a given instruction gets a start pointer of the next instruction or the
+ * pointer which follows the last bytecode of the method for the last instruction.
+ * @param instr an instruction handle
+ * @param ctx a verification context
+ * @return a pointer which follows a given instruction
+ */
+static inline const unsigned char *
+vf_get_instr_end( vf_InstrHandle instr, vf_ContextHandle ctx )
+{
+ if( instr + 1 == ctx->m_last_instr ) {
+ return ctx->m_bytes + ctx->m_len;
+ }
+ return ( instr + 1 )->m_addr;
+}
+
+/**
* Calls destructor of graph, if any.
*
* @param[in] context a context of verifier
*/
-void vf_free_graph( vf_Context_t * context );
+void vf_free_graph( vf_Context *context );
/**
- * Inline subroutines in the call graph.
+ * Mark subroutine instr.
*
* Here is the algorithm sketch: we define subroutine boundaries with
* simplified data flow analysis and duplicate subroutine nodes
@@ -1116,10 +1177,19 @@ void vf_free_graph( vf_Context_t * conte
* wiki
* page.
*
- * @param[in] context a verifier context
+ * @param ctx a verifier context
+ * @return VER_OK if no graph structure inconsistencies were detected during marking,
+ * an error instr otherwise
+ */
+vf_Result vf_mark_subroutines( vf_Context *ctx );
+
+/**
+ * Inline subroutines in the call graph.
+ *
+ * @param ctx a verifier context
* @return VER_OK if subroutines were inlined successfully,
- * an error code otherwise
+ * an error instr otherwise
*/
-Verifier_Result vf_inline_subroutines( vf_ContextHandle context );
+vf_Result vf_inline_subroutines( vf_Context *ctx );
#endif // _VERIFIER_REAL_H_
diff -pu 9/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.cpp 8/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.cpp
--- 9/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.cpp 2007-03-20 18:34:51.400298600 +0300
+++ 8/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.cpp 2007-03-20 18:29:30.058619700 +0300
@@ -16,24 +16,566 @@
*/
#include "ver_subroutine.h"
-static vf_Result MarkTopcode(vf_ContextHandle context, vf_NodeHandle nh)
+#ifdef _VF_DEBUG
+/**
+ * Gets a subroutine number for debugging purposes.
+ */
+unsigned vf_get_sub_num(vf_NodeHandle node, vf_ContextHandle ctx)
+{
+ unsigned num = node->m_sub - ctx->m_sub_ctx->m_subs;
+ assert(num < ctx->m_sub_ctx->m_subnum);
+ return num;
+}
+#endif // _VF_DEBUG
+
+
+/**
+ * Allocates memory for subroutine context.
+ * @param count a number of subroutines
+ */
+static void CreateSubs(vf_Context *ctx)
{
+ vf_Pool *pool = ctx->m_pool;
+
+ vf_SubContext *csub = (vf_SubContext *) vf_palloc(pool,
+ sizeof(vf_SubContext));
+ ctx->m_sub_ctx = csub;
+ csub->m_pool = pool;
+ csub->m_subs = (vf_Sub *) vf_palloc(pool, ctx->m_retnum * sizeof(vf_Sub));
+ csub->m_path =
+ (vf_NodeHandle *) vf_palloc(pool,
+ ctx->m_graph->GetNodeCount() * sizeof(vf_NodeHandle));
+} // CreateSubs
+
+
+/**
+ * Adds a new subroutine into subroutine array.
+ * @param ret_node a node containing a corresponding ret
+ * @return a sub handle
+ */
+static vf_Sub *AddSub(vf_NodeHandle ret_node, vf_SubContext * csub)
+{
+ vf_Sub *sub = &csub->m_subs[csub->m_subnum++];
+ sub->m_ret = ret_node;
+ return sub;
+} // AddSub
+
+
+#ifdef _VF_DEBUG
+void vf_Graph::DumpSub(vf_SubHandle sub)
+{
+ if (sub) {
+ VF_DEBUG("Subroutine:");
+ if (sub->m_entry) {
+ VF_DEBUG(" Entry node: " << vf_Graph::
+ GetNodeNum(sub->m_entry));
+ } else {
+ VF_DEBUG(" Entry node undefined");
+ }
+ if (sub->m_ret) {
+ VF_DEBUG(" Return node: " << vf_Graph::GetNodeNum(sub->m_ret));
+ } else {
+ VF_DEBUG(" Return node undefined");
+ }
+ }
+} // vf_Graph::DumpSub
+#endif // _VF_DEBUG
+
+static vf_Result
+ResolveSubroutineEntryPoint(vf_Sub *sub, unsigned pathlen, vf_Context *ctx)
+{
+ // a pointer to the first node in the path
+ vf_NodeHandle *p_node;
+
+ //initialize vector
+ vf_MapVector *map = ctx->m_map;
+
+ if (ctx->m_sub_ctx->m_pathfork) {
+ // continue with previous map vector
+ p_node = ctx->m_sub_ctx->m_path + ctx->m_sub_ctx->m_pathfork;
+ } else {
+ p_node = ctx->m_sub_ctx->m_path;
+ map->m_number = ctx->m_maxlocal;
+ for (unsigned index = 0; index < map->m_number; index++) {
+ map->m_local[index].m_type = SM_ANY;
+ }
+
+ map->m_depth = (*p_node)->m_inmap.m_depth;
+ for (unsigned index = 0; index + 1 < map->m_depth; index++) {
+ map->m_stack[index].m_type = SM_ANY;
+ }
+ map->m_stack[index].m_type = SM_RETURN_ADDR;
+ map->m_stack[index].m_pc = (*p_node)->m_start->m_addr - ctx->m_bytes;
+ }
+
+ for (unsigned index = ctx->m_sub_ctx->m_pathfork;
+ index < pathlen; index++, p_node++) {
+ vf_Result result = vf_set_node_out_vector(*p_node, map, ctx);
+ if (result != VER_OK) {
+ return result;
+ }
+ }
+
+ sub->m_entry = ctx->m_graph->GetNodeFromBytecodeIndex(ctx->m_buf->m_pc);
return VER_OK;
-} // MarkTopcode
+} // ResolveSubroutineEntryPoint
-static vf_Result InlineMarkedSubNodes(vf_ContextHandle context)
+static vf_Result
+MarkCode(vf_Node *node, unsigned pathlen, unsigned stack_depth,
+ vf_Context *ctx);
+
+static vf_Result
+MergeSubMarks(vf_Node *node, vf_NodeHandle next_node, vf_Context *ctx)
{
+ if (next_node->m_sub) {
+ VF_TRACE("sub.mark", "sub[" << ctx->m_graph->GetNodeNum(node)
+ << "] := sub[" << ctx->m_graph->GetNodeNum(next_node->
+ m_sub->m_ret)
+ << "] (" << vf_get_sub_num(next_node, ctx) << ")");
+ if (node->m_sub == NULL) {
+ node->m_sub = next_node->m_sub;
+ } else if (node->m_sub != next_node->m_sub) {
+ VF_REPORT_METHOD(ctx,
+ "A subroutine splits execution into "
+ "several ret instructions");
+ return VER_ErrorJsrMultipleRet;
+ }
+ }
return VER_OK;
-} // InlineMarkedSubNodes
+} // MergeSubMarks
-vf_Result vf_inline_subroutines(vf_ContextHandle context)
+
+static vf_Result
+FollowEdge(vf_Node *node, vf_Node *next_node, unsigned pathlen,
+ unsigned stack_depth, vf_Context *ctx)
+{
+ vf_Result r = MarkCode((vf_Node *) next_node, pathlen, stack_depth, ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+
+ return MergeSubMarks(node, next_node, ctx);
+} // FollowEdge
+
+static vf_Result
+FollowJsrEdge(vf_Node *node, vf_Node *next_node,
+ unsigned pathlen, unsigned stack_depth, vf_Context *ctx)
{
+ unsigned pathfork = (TOP_MARK == pathlen) ? 0 : pathlen;
+ vf_Result r = MarkCode(next_node, pathfork, stack_depth, ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+
+ if (next_node->m_sub) {
+ if (next_node->m_sub->m_entry != next_node) {
+ VF_REPORT_METHOD(ctx, "Subroutines merge their execution");
+ return VER_ErrorDataFlow;
+ }
+
+ stack_depth = next_node->m_sub->m_ret->m_outmap.m_depth;
+ ctx->m_sub_ctx->m_pathfork = pathfork;
+
+ // select and check a next node
+ next_node = node + 1;
+ if (VF_NODE_END_ENTRY == next_node->m_type) {
+ VF_REPORT_METHOD(ctx, "Falling off the end of the instr");
+ return VER_ErrorBranch;
+ }
+ assert(VF_NODE_CODE_RANGE == next_node->m_type);
- vf_Result r = MarkTopcode(context, context->m_graph->GetFirstNode());
+ r = MarkCode(next_node, pathlen, stack_depth, ctx);
+ ctx->m_sub_ctx->m_pathfork = 0;
+ if (VER_OK != r) {
+ return r;
+ }
+ }
+
+ return MergeSubMarks(node, next_node, ctx);
if (VER_OK != r) {
return r;
}
+} // FollowJsrEdge
+
+
+static vf_Result
+MarkCode(vf_Node *node, unsigned pathlen, unsigned stack_depth,
+ vf_Context *ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+ vf_EdgeHandle outedge = node->m_outedge;
+ vf_Result r;
+
+ vf_Result result = vf_check_node_stack_depth(node, stack_depth, ctx);
+ if (result != VER_Continue) {
+ return result;
+ }
+ VF_TRACE("sub.mark", "Processing node " << graph->GetNodeNum(node));
+
+ if (pathlen != TOP_MARK) {
+ assert(pathlen < graph->GetNodeCount());
+ ctx->m_sub_ctx->m_path[pathlen++] = node;
+ }
+
+ if (VF_NODE_CODE_RANGE == node->m_type) {
+ vf_InstrType last_instr_type =
+ vf_get_last_instruction_type(node, ctx);
+
+ if (VF_INSTR_RET == last_instr_type) {
+ vf_Sub *sub = AddSub(node, ctx->m_sub_ctx);
+ node->m_sub = sub;
+ r = ResolveSubroutineEntryPoint(sub, pathlen, ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+ } else if (VF_INSTR_JSR == last_instr_type) {
+ vf_NodeHandle next_node;
+ for (; outedge; outedge = outedge->m_outnext) {
+ next_node = outedge->m_end;
+ if (VF_NODE_HANDLER == next_node->m_type) {
+ r = FollowEdge(node, (vf_Node *) outedge->m_end, pathlen,
+ stack_depth, ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+ } else {
+ break;
+ }
+ }
+ assert(VF_NODE_CODE_RANGE == next_node->m_type);
+ assert(!outedge->m_outnext);
+ return FollowJsrEdge(node, (vf_Node *) outedge->m_end, pathlen,
+ stack_depth, ctx);
+ }
+ }
- r = InlineMarkedSubNodes(context);
+ for (; outedge; outedge = outedge->m_outnext) {
+ r = FollowEdge(node, (vf_Node *) outedge->m_end, pathlen, stack_depth,
+ ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+ }
+
+ return VER_OK;
+} // MarkCode
+
+
+vf_Result vf_mark_subroutines(vf_Context *ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+ CreateSubs(ctx);
+
+ vf_Result r =
+ MarkCode((vf_Node *) ctx->m_graph->GetStartNode(), TOP_MARK, 0, ctx);
+#if _VF_DEBUG
+ if (VER_OK != r) {
+ ctx->m_graph->DumpGraph();
+ ctx->m_graph->DumpDotGraph();
+ }
+#endif // _VF_DEBUG
return r;
-} // InlineSubroutines
+} // vf_mark_subroutines
+
+
+static vf_Result CalculateSubNums(vf_ContextHandle ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+ graph->ResetNodeIterator();
+ while (graph->HasMoreElements()) {
+ vf_NodeHandle node = graph->GetNextNode();
+
+ if (node->m_sub) {
+ vf_Sub *sub = (vf_Sub *) node->m_sub;
+ sub->m_nodenum++;
+ sub->m_out_edgenum += node->m_outnum;
+ }
+ }
+ return VER_OK;
+}
+
+static vf_Result AddDupCount(vf_Sub *sub, unsigned &count, vf_Context *ctx)
+{
+ if (TOP_MARK == sub->m_dupcount) {
+ VF_REPORT_METHOD(ctx, "Found a recursive subroutine call sequence");
+ return VER_ErrorJsrRecursive;
+ }
+
+ if (!sub->m_dupcount) {
+ sub->m_dupcount = TOP_MARK;
+
+ unsigned sum = 0;
+ for (vf_EdgeHandle inedge = sub->m_entry->m_inedge;
+ inedge; inedge = inedge->m_innext) {
+ vf_NodeHandle node = inedge->m_start;
+
+ if (vf_is_jsr_branch(inedge, ctx)) {
+ assert(!inedge->m_outnext);
+ if (node->m_sub == NULL) {
+ sum++;
+ } else if (node->m_sub != sub) {
+ AddDupCount((vf_Sub *) node->m_sub, sum, ctx);
+ } // else this call served as unconditional internal branch
+ } else if (node->m_sub != sub) {
+ VF_REPORT_METHOD(ctx,
+ "A subroutine splits execution into "
+ "several ret instructions");
+ return VER_ErrorJsrMultipleRet;
+ }
+ }
+ sub->m_dupcount = sum;
+ }
+
+ count += sub->m_dupcount;
+ return VER_OK;
+} // AddSubDupCount
+
+static void InlineSubNodes(vf_ContextHandle ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+ vf_Sub *sub;
+ unsigned sub_index;
+
+ for (sub_index = 0, sub = ctx->m_sub_ctx->m_subs;
+ sub_index < ctx->m_sub_ctx->m_subnum; sub_index++, sub++) {
+ sub->m_nodes =
+ (vf_NodeHandle *) vf_palloc(ctx->m_sub_ctx->m_pool,
+ sub->m_nodenum * sizeof(vf_NodeHandle));
+ }
+
+ // populate subroutine node get the next node after the start node
+ vf_Node *node = (vf_Node *) graph->GetStartNode() + 1;
+ for (; VF_NODE_END_ENTRY != node->m_type; node++) {
+ if (node->m_sub) {
+ vf_Sub *sub = (vf_Sub *) node->m_sub;
+ node->m_nodecount = sub->m_index;
+ sub->m_nodes[sub->m_index++] = node;
+ }
+ }
+
+ // clear sub indices
+ for (sub_index = 0, sub = ctx->m_sub_ctx->m_subs;
+ sub_index < ctx->m_sub_ctx->m_subnum; sub_index++, sub++) {
+ assert(sub->m_nodenum == sub->m_index);
+ sub->m_index = 0;
+ }
+
+ // duplicate subroutine nodes
+ for (sub_index = 0, sub = ctx->m_sub_ctx->m_subs;
+ sub_index < ctx->m_sub_ctx->m_subnum; sub_index++, sub++) {
+
+ vf_NodeHandle *p_node = sub->m_nodes;
+ vf_NodeHandle new_node;
+ for (unsigned node_index = 0; node_index < sub->m_nodenum;
+ node_index++, p_node++) {
+
+ for (unsigned index = 1; index < sub->m_dupcount; index++) {
+ new_node = ctx->m_graph->NewNode(*p_node);
+ VF_TRACE("sub.inline",
+ "Copied node " << graph->GetNodeNum(*p_node)
+ << " to " << graph->GetNodeNum(new_node));
+ }
+
+ }
+ if (sub->m_dupcount > 1) {
+ sub->m_copies =
+ (vf_Node *) new_node - (sub->m_dupcount -
+ 1) * sub->m_nodenum + 1;
+ }
+ }
+ assert(0 == ctx->m_graph->HasMoreNodeSpace());
+
+} // InlineSubNodes
+
+/**
+ * Redirects subroutine calls to separate subroutine copies.
+ */
+static void InlineInEdges(vf_ContextHandle ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+
+ vf_Sub *sub = ctx->m_sub_ctx->m_subs;
+ for (unsigned sub_index = 0; sub_index < ctx->m_sub_ctx->m_subnum;
+ sub_index++, sub++) {
+
+ sub->m_nexts = (vf_Node **) vf_palloc(ctx->m_sub_ctx->m_pool,
+ sub->m_dupcount * sizeof(vf_Node *));
+ vf_NodeHandle sub_entry_copy =
+ sub->m_copies + sub->m_entry->m_nodecount * (sub->m_dupcount -
+ 1) - 1;
+ vf_EdgeHandle *p_next_edge =
+ (vf_EdgeHandle *) & sub->m_entry->m_inedge;
+ vf_Edge *inedge = (vf_Edge *) sub->m_entry->m_inedge;
+ while (inedge) {
+ if (vf_is_jsr_branch(inedge, ctx)) {
+ if (sub->m_index) {
+ assert(sub->m_copies);
+ assert(sub->m_dupcount);
+ // remove the edge from the list
+ *p_next_edge = inedge->m_innext;
+ // redirect jsr edge to correspondent subroutine copy
+ inedge->m_end = sub_entry_copy + sub->m_index;
+ }
+ // store return point
+ vf_Node *next_node = (vf_Node *) inedge->m_start + 1;
+ assert(VF_NODE_CODE_RANGE == next_node->m_type);
+ sub->m_nexts[sub->m_index++] = next_node;
+ }
+ p_next_edge = &inedge->m_innext;
+ inedge = (vf_Edge *) inedge->m_innext;
+ }
+ assert(sub->m_index); // there was at least one branch
+ }
+} // InlineInEdges
+
+/**
+ * Subroutine calls are redirected to correspondent subroutine copies,
+ * other edges are just duplicated.
+ */
+static void InlineOutEdges(vf_ContextHandle ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+
+ vf_Sub *sub = ctx->m_sub_ctx->m_subs;
+ for (unsigned sub_index = 0; sub_index < ctx->m_sub_ctx->m_subnum;
+ sub_index++, sub++) {
+
+ if (!sub->m_copies) {
+ continue;
+ }
+
+ vf_Node *copy = sub->m_copies;
+ for (unsigned node_index = 0; node_index < sub->m_nodenum;
+ node_index++, copy += sub->m_dupcount - 1) {
+ vf_NodeHandle node = sub->m_nodes[node_index];
+
+ for (vf_EdgeHandle outedge = node->m_outedge; outedge;
+ outedge = outedge->m_outnext) {
+ vf_NodeHandle end_node = outedge->m_end;
+ vf_SubHandle end_sub = end_node->m_sub;
+
+ vf_Node *c = copy;
+ if (NULL == end_sub) {
+ for (unsigned index = 1; index < sub->m_dupcount; index++) {
+ graph->NewEdge(c++, (vf_Node *) end_node);
+ }
+ } else if (node->m_sub == end_sub) {
+ vf_Node *e = sub->m_copies +
+ end_node->m_nodecount * (sub->m_dupcount - 1);
+ for (unsigned index = 1; index < sub->m_dupcount; index++) {
+ graph->NewEdge(c++, e++);
+ }
+ } else {
+ assert(vf_is_jsr_branch(outedge, ctx));
+ assert(!outedge->m_outnext);
+ // an end node
+ vf_Node *e = end_sub->m_copies +
+ end_sub->m_entry->m_nodecount *
+ (end_sub->m_dupcount - 1) - 1;
+ // a node next to the start node
+ vf_Node *n = c + (sub->m_dupcount - 1);
+ for (unsigned index = 1; index < node->m_sub->m_dupcount;
+ index++) {
+ // direct jsr edge to correspondent subroutine copy
+ graph->NewEdge(c++, e + end_sub->m_index);
+ // store return point
+ assert(VF_NODE_CODE_RANGE == n->m_type);
+ end_sub->m_nexts[((vf_Sub *) end_sub)->m_index++] =
+ n++;
+ }
+ }
+ }
+ }
+ }
+} // InlineOutEdges
+
+/**
+ * Adds a back branch from ret nodes to a node
+ * which follows the correspondent jsr call node.
+ */
+static void InlineRetEdges(vf_ContextHandle ctx)
+{
+ vf_Graph *graph = ctx->m_graph;
+ vf_Sub *sub = ctx->m_sub_ctx->m_subs;
+ for (unsigned sub_index = 0; sub_index < ctx->m_sub_ctx->m_subnum;
+ sub_index++, sub++) {
+
+ vf_Node *ret_node = (vf_Node *) sub->m_ret;
+ vf_Node **next_node = sub->m_nexts;
+ graph->NewEdge(ret_node, *(next_node++));
+
+ vf_Node *ret_node_copy =
+ sub->m_copies + ret_node->m_nodecount * (sub->m_dupcount - 1);
+ for (unsigned index = 1; index < sub->m_dupcount; index++) {
+ // direct ret entry to the return point
+ graph->NewEdge(ret_node_copy++, *(next_node++));
+ }
+ }
+ assert(0 == ctx->m_graph->HasMoreEdgeSpace());
+} // InlineRetEdges
+
+/**
+ * Checks that every subroutine copy gets its call and
+ * all edges are created.
+ */
+static void CheckDupCounts(vf_ContextHandle ctx)
+{
+#if _VF_DEBUG
+ vf_Sub *sub = ctx->m_sub_ctx->m_subs;
+ for (unsigned sub_index = 0; sub_index < ctx->m_sub_ctx->m_subnum;
+ sub_index++, sub++) {
+ assert(sub->m_dupcount == sub->m_index);
+ }
+#endif // _VF_DEBUG
+}
+
+/**
+ * Calculates a number of additional nodes and edges and adds them
+ * to the graph.
+ */
+static vf_Result DoInlining(vf_Context *ctx)
+{
+ unsigned count;
+ unsigned nodes = 0, edges = 0;
+ vf_Sub *sub = ctx->m_sub_ctx->m_subs;
+ for (unsigned sub_index = 0; sub_index < ctx->m_sub_ctx->m_subnum;
+ sub_index++, sub++) {
+ vf_Result r = AddDupCount(sub, count, ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+ // one copy already present in the graph
+ nodes += (sub->m_dupcount - 1) * sub->m_nodenum;
+ edges += (sub->m_dupcount - 1) * sub->m_out_edgenum;
+ // there is an additional edge from every ret
+ edges += sub->m_dupcount;
+ }
+ ctx->m_graph->CreateEdges(edges);
+
+ if (nodes) {
+ ctx->m_graph->CreateNodes(nodes);
+ InlineSubNodes(ctx);
+ }
+ InlineInEdges(ctx);
+
+ if (nodes) {
+ InlineOutEdges(ctx);
+ }
+
+ CheckDupCounts(ctx);
+ InlineRetEdges(ctx);
+ return VER_OK;
+}
+
+vf_Result vf_inline_subroutines(vf_Context *ctx)
+{
+ vf_Result r = CalculateSubNums(ctx);
+ assert(VER_OK == r);
+
+ r = DoInlining(ctx);
+ if (VER_OK != r) {
+ return r;
+ }
+
+ return VER_OK;
+} // vf_inline_subroutines
diff -pu 9/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.h 8/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.h
--- 9/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.h 2007-03-20 18:34:50.929607700 +0300
+++ 8/trunk/working_vm/vm/vmcore/src/verifier/ver_subroutine.h 2007-03-20 18:29:29.728134600 +0300
@@ -16,8 +16,87 @@
*/
#include "ver_graph.h"
+/**
+ * @ingroup Handles
+ * A handle of subroutine verification context.
+ */
+typedef const struct vf_SubContext *vf_SubContextHandle;
+
+/**
+ * Subroutine info.
+ */
+struct vf_Sub
+{
+ /**
+ * A node which starts with subroutine entry point.
+ */
+ vf_NodeHandle m_entry;
+ /**
+ * A node which ends with ret instruction.
+ */
+ vf_NodeHandle m_ret;
+ /**
+ * A number of different jsr sequences to access
+ * this subroutine.
+ */
+ unsigned m_dupcount;
+ /**
+ * A number of nodes for this subroutine.
+ */
+ unsigned m_nodenum;
+ /**
+ * Subroutine nodes.
+ */
+ vf_NodeHandle *m_nodes;
+ /**
+ * Subroutine node copies. For each of m_nodenum nodes
+ * from m_nodes the (m_dupcount - 1) node copies follow
+ * one by one starting from this pointer.
+ * NULL when m_dupcount == 1.
+ */
+ vf_Node *m_copies;
+ /**
+ * For each of m_dupcount subroutine copies contain a return node for
+ * this copy.
+ */
+ vf_Node **m_nexts;
+ /**
+ * A number of edges between subroutine nodes.
+ */
+ unsigned m_out_edgenum;
+ /**
+ * A current duplication index.
+ */
+ unsigned m_index;
+};
/**
- * Verifier error codes.
+ * Aggregated subroutine data.
*/
-typedef Verifier_Result vf_Result;
+struct vf_SubContext
+{
+ /**
+ * Dedicated memory pool.
+ */
+ vf_Pool *m_pool;
+ /**
+ * Descriptors.
+ */
+ vf_Sub *m_subs;
+ /**
+ * An number of reachable subroutines, it doesn't include
+ * unreachable rets.
+ */
+ unsigned m_subnum;
+ /**
+ * Path to the current ret.
+ */
+ vf_NodeHandle *m_path;
+ /**
+ * After the ret is resolved a ctx->m_map contains a
+ * correct input map for a node which follows jsr call. This is
+ * the index of the node in m_path. When this index is 0 we may start
+ * ret data flow analysis for from the empty map.
+ */
+ unsigned m_pathfork;
+};
diff -pu 9/trunk/working_vm/vm/vmcore/src/verifier/ver_utils.cpp 8/trunk/working_vm/vm/vmcore/src/verifier/ver_utils.cpp
--- 9/trunk/working_vm/vm/vmcore/src/verifier/ver_utils.cpp 2007-03-20 18:34:53.473341500 +0300
+++ 8/trunk/working_vm/vm/vmcore/src/verifier/ver_utils.cpp 2007-03-20 18:29:32.612368200 +0300
@@ -26,7 +26,7 @@
* Debug flag macros
*/
// Macro enable verifier memory trace
-#define VERIFY_TRACE_MEMORY 0
+#define VF_TRACE_MEMORY 0
/************************************************************
*********************** Hash class *************************
@@ -39,25 +39,21 @@ vf_Hash::vf_Hash ():HASH_SIZE( 127 ),
m_free( true )
{
m_pool = vf_create_pool();
- m_hash = (vf_HashEntry_t**) vf_alloc_pool_memory( m_pool,
- HASH_SIZE *
- sizeof
- ( vf_HashEntry_t
- * ) );
+ m_hash = (vf_HashEntry**)vf_palloc( m_pool,
+ HASH_SIZE *
+ sizeof(vf_HashEntry*) );
} // vf_Hash::vf_Hash
/**
* Hash table constructor.
*/
-vf_Hash::vf_Hash ( vf_VerifyPool_t * pool ):HASH_SIZE( 127 ),
+vf_Hash::vf_Hash ( vf_Pool *pool ):HASH_SIZE( 127 ),
m_free( false )
{
m_pool = pool;
- m_hash = (vf_HashEntry_t**) vf_alloc_pool_memory( m_pool,
- HASH_SIZE *
- sizeof
- ( vf_HashEntry_t
- * ) );
+ m_hash = (vf_HashEntry**)vf_palloc( m_pool,
+ HASH_SIZE *
+ sizeof(vf_HashEntry*) );
} // vf_Hash::vf_Hash
/**
@@ -73,7 +69,7 @@ vf_Hash::~vf_Hash ()
/**
* Function checks key identity.
*/
-inline bool vf_Hash::CheckKey( vf_HashEntry_t * hash_entry, // checked hash entry
+inline bool vf_Hash::CheckKey( vf_HashEntry *hash_entry, // checked hash entry
const char *key ) // checked key
{
if( !strcmp( hash_entry->key, key ) ) {
@@ -85,7 +81,7 @@ inline bool vf_Hash::CheckKey( vf_HashEn
/**
* Function checks key identity.
*/
-inline bool vf_Hash::CheckKey( vf_HashEntry_t * hash_entry, // checked hash entry
+inline bool vf_Hash::CheckKey( vf_HashEntry *hash_entry, // checked hash entry
const char *key, // checked key
size_t len ) // key length
{
@@ -127,12 +123,12 @@ inline unsigned vf_Hash::HashFunc( const
/**
* Function looks up hash entry which is identical to current key.
*/
-inline vf_HashEntry_t *vf_Hash::Lookup( const char *key ) // hash key
+inline vf_HashEntry *vf_Hash::Lookup( const char *key ) // hash key
{
assert( key );
unsigned hash_index = HashFunc( key );
hash_index = hash_index % HASH_SIZE;
- vf_HashEntry_t *hash_entry = m_hash[hash_index];
+ vf_HashEntry *hash_entry = m_hash[hash_index];
while( hash_entry != NULL ) {
if( CheckKey( hash_entry, key ) ) {
return hash_entry;
@@ -145,14 +141,14 @@ inline vf_HashEntry_t *vf_Hash::Lookup(
/**
* Function looks up hash entry which is identical to current key.
*/
-inline vf_HashEntry_t *vf_Hash::Lookup( const char *key, // hash key
- unsigned len ) // key length
+inline vf_HashEntry *vf_Hash::Lookup( const char *key, // hash key
+ unsigned len ) // key length
{
assert( key );
assert( len );
unsigned hash_index = HashFunc( key, len );
hash_index = hash_index % HASH_SIZE;
- vf_HashEntry_t *hash_entry = m_hash[hash_index];
+ vf_HashEntry *hash_entry = m_hash[hash_index];
while( hash_entry != NULL ) {
if( CheckKey( hash_entry, key, len ) ) {
return hash_entry;
@@ -165,13 +161,13 @@ inline vf_HashEntry_t *vf_Hash::Lookup(
/**
* Function creates hash entry which is identical to current key.
*/
-inline vf_HashEntry_t *vf_Hash::NewHashEntry( const char *key ) // hash key
+inline vf_HashEntry *vf_Hash::NewHashEntry( const char *key ) // hash key
{
// lookup type in hash
assert( key );
unsigned hash_index = HashFunc( key );
hash_index = hash_index % HASH_SIZE;
- vf_HashEntry_t *hash_entry = m_hash[hash_index];
+ vf_HashEntry *hash_entry = m_hash[hash_index];
while( hash_entry != NULL ) {
if( CheckKey( hash_entry, key ) ) {
return hash_entry;
@@ -181,13 +177,12 @@ inline vf_HashEntry_t *vf_Hash::NewHashE
// create key string
size_t len = strlen( key );
- char *hash_key = (char*)vf_alloc_pool_memory( m_pool, len + 1 );
+ char *hash_key = (char*)vf_palloc( m_pool, len + 1 );
memcpy( hash_key, key, len );
// create hash entry
hash_entry =
- (vf_HashEntry_t*) vf_alloc_pool_memory( m_pool,
- sizeof( vf_HashEntry_t ) );
+ (vf_HashEntry*)vf_palloc( m_pool, sizeof( vf_HashEntry ) );
hash_entry->key = hash_key;
hash_entry->next = m_hash[hash_index];
m_hash[hash_index] = hash_entry;
@@ -198,15 +193,15 @@ inline vf_HashEntry_t *vf_Hash::NewHashE
/**
* Function creates hash entry which is identical to current key.
*/
-inline vf_HashEntry_t *vf_Hash::NewHashEntry( const char *key, // hash key
- size_t len ) // key length
+inline vf_HashEntry *vf_Hash::NewHashEntry( const char *key, // hash key
+ size_t len ) // key length
{
// lookup type in hash
assert( key );
assert( len );
unsigned hash_index = HashFunc( key, len );
hash_index = hash_index % HASH_SIZE;
- vf_HashEntry_t *hash_entry = m_hash[hash_index];
+ vf_HashEntry *hash_entry = m_hash[hash_index];
while( hash_entry != NULL ) {
if( CheckKey( hash_entry, key, len ) ) {
return hash_entry;
@@ -215,13 +210,12 @@ inline vf_HashEntry_t *vf_Hash::NewHashE
}
// create key string
- char *hash_key = (char*)vf_alloc_pool_memory( m_pool, len + 1 );
+ char *hash_key = (char*)vf_palloc( m_pool, len + 1 );
memcpy( hash_key, key, len );
// create hash entry
hash_entry =
- (vf_HashEntry_t*) vf_alloc_pool_memory( m_pool,
- sizeof( vf_HashEntry_t ) );
+ (vf_HashEntry*)vf_palloc( m_pool, sizeof( vf_HashEntry ) );
hash_entry->key = hash_key;
hash_entry->next = m_hash[hash_index];
m_hash[hash_index] = hash_entry;
@@ -240,7 +234,6 @@ vf_TypePool::vf_TypePool():m_method( NUL
{
m_pool = vf_create_pool();
m_Hash = new vf_Hash ( m_pool );
- return;
} // vf_TypePool::vf_TypePool
/**
@@ -255,23 +248,21 @@ vf_TypePool::~vf_TypePool()
/**
* Function creates valid type which is identical to current class.
*/
-vf_ValidType_t *
+vf_ValidType *
vf_TypePool::NewType( const char *type, // class name
size_t len ) // name length
{
- vf_ValidType_t *result;
- vf_HashEntry_t *hash;
+ vf_ValidType *result;
+ vf_HashEntry *hash;
// find type in hash
hash = m_Hash->NewHashEntry( type, len );
if( hash->data ) {
- assert( ( (vf_ValidType_t*) hash->data )->number == 1 );
- return (vf_ValidType_t*) hash->data;
+ assert( ( (vf_ValidType*)hash->data )->number == 1 );
+ return (vf_ValidType*)hash->data;
}
// create and set type
- result =
- (vf_ValidType_t*) vf_alloc_pool_memory( m_pool,
- sizeof( vf_ValidType_t ) );
+ result = (vf_ValidType*)vf_palloc( m_pool, sizeof( vf_ValidType ) );
result->number = 1;
result->string[0] = hash->key;
// set type in hash
@@ -296,26 +287,23 @@ vf_type_string_compare( const void *type
/**
* Function creates valid type which is identical to an element of a given array type.
*/
-vf_ValidType_t *
-vf_TypePool::NewArrayElemType( vf_ValidType_t * array ) // array type
+vf_ValidType *
+vf_TypePool::NewArrayElemType( vf_ValidType *array ) // array type
{
- vf_ValidType_t *result;
- vf_HashEntry_t *hash;
+ vf_ValidType *result;
+ vf_HashEntry *hash;
// lookup type in hash
hash = m_Hash->NewHashEntry( &array->string[0][1] );
if( array->number == 1 && hash->data ) {
- assert( ( (vf_ValidType_t*) hash->data )->number == 1 );
- return (vf_ValidType_t*) hash->data;
+ assert( ( (vf_ValidType*)hash->data )->number == 1 );
+ return (vf_ValidType*)hash->data;
}
// create and set type
- result = (vf_ValidType_t*) vf_alloc_pool_memory( m_pool,
- sizeof
- ( vf_ValidType_t ) +
- ( array->number -
- 1 ) *
- sizeof( const char
- * ) );
+ result = (vf_ValidType*)vf_palloc( m_pool,
+ sizeof( vf_ValidType ) +
+ ( array->number -
+ 1 ) * sizeof( const char * ) );
result->number = array->number;
// set sting type
result->string[0] = hash->key;
@@ -345,7 +333,7 @@ vf_TypePool::DumpTypeConstraints( ostrea
if( out == NULL ) {
out = &cerr;
}
- for( vf_TypeConstraint_t * constraint = m_restriction;
+ for( vf_TypeConstraint *constraint = m_restriction;
constraint; constraint = constraint->next ) {
*out << "CONSTRAINT: have \""
<< constraint->source << "\" need \"" << constraint->
@@ -354,13 +342,12 @@ vf_TypePool::DumpTypeConstraints( ostrea
method_get_name( m_method ) << method_get_descriptor( m_method )
<< endl;
}
- return;
} // vf_TypePool::DumpTypeConstraints
/**
* Function returns the methods constraints array.
*/
-inline vf_TypeConstraint_t *
+inline vf_TypeConstraint *
vf_TypePool::GetClassConstraint()
{
return m_restriction;
@@ -374,7 +361,6 @@ vf_TypePool::SetMethod( method_handler m
{
// set method
m_method = method;
- return;
} // vf_TypePool::SetMethod
/**
@@ -384,9 +370,9 @@ void
vf_TypePool::SetRestriction( const char *target, // target class name
const char *source, // source class name
unsigned short index, // constant pool index
- vf_CheckConstraint_t check_type ) // constraint check type
+ vf_CheckConstraint check_type ) // constraint check type
{
- vf_TypeConstraint_t *restriction;
+ vf_TypeConstraint *restriction;
// lookup restriction
for( restriction = m_restriction;
@@ -401,9 +387,9 @@ vf_TypePool::SetRestriction( const char
}
// set restriction
- restriction = (vf_TypeConstraint_t*) vf_alloc_pool_memory( m_pool,
- sizeof
- ( vf_TypeConstraint_t ) );
+ restriction = (vf_TypeConstraint*)vf_palloc( m_pool,
+ sizeof
+ ( vf_TypeConstraint ) );
restriction->target = target;
restriction->source = source;
restriction->index = index;
@@ -414,31 +400,30 @@ vf_TypePool::SetRestriction( const char
// trace restriction
if( index ) {
- VERIFY_TRACE( "constraint", "CONSTRAINT: for class \""
- << class_get_name( method_get_class( m_method ) ) <<
- "\" CP index #" << index << " check access: have \"" <<
- source << "\" need \"" << target << "\" for method " <<
- class_get_name( method_get_class( m_method ) ) << "." <<
- method_get_name( m_method ) <<
- method_get_descriptor( m_method ) );
+ VF_TRACE( "constraint", "CONSTRAINT: for class \""
+ << class_get_name( method_get_class( m_method ) ) <<
+ "\" CP index #" << index << " check access: have \"" <<
+ source << "\" need \"" << target << "\" for method " <<
+ class_get_name( method_get_class( m_method ) ) << "." <<
+ method_get_name( m_method ) <<
+ method_get_descriptor( m_method ) );
} else {
- VERIFY_TRACE( "constraint", "CONSTRAINT: have \""
- << source << "\" need \"" << target << "\" for method "
- << class_get_name( method_get_class( m_method ) ) << "."
- << method_get_name( m_method ) <<
- method_get_descriptor( m_method ) );
+ VF_TRACE( "constraint", "CONSTRAINT: have \""
+ << source << "\" need \"" << target << "\" for method "
+ << class_get_name( method_get_class( m_method ) ) << "."
+ << method_get_name( m_method ) <<
+ method_get_descriptor( m_method ) );
}
- return;
} // vf_TypePool::SetRestriction
/**
* Function checks types and create constraints if it's necessarily.
*/
bool
-vf_TypePool::CheckTypes( vf_ValidType_t * required, // required type
- vf_ValidType_t * available, // available type
+vf_TypePool::CheckTypes( vf_ValidType *required, // required type
+ vf_ValidType *available, // available type
unsigned short index, // constant pool index
- vf_CheckConstraint_t check_type ) // constraint check type
+ vf_CheckConstraint check_type ) // constraint check type
{
unsigned index1, index2;
@@ -537,7 +522,7 @@ vf_TypePool::CheckTypes( vf_ValidType_t
LDIE( 39, "Verifier: CompareTypes: unknown check type in switch" );
return true;
}
- // unreachable code
+ // unreachable instr
assert( 0 );
} // vf_TypePool::CheckTypes
@@ -545,9 +530,9 @@ vf_TypePool::CheckTypes( vf_ValidType_t
* Function merges two valid types.
* Function returns NULL if vector wasn't merged.
*/
-vf_ValidType_t *
-vf_TypePool::MergeTypes( vf_ValidType_t * first, // first merged type
- vf_ValidType_t * second ) // second merged type
+vf_ValidType *
+vf_TypePool::MergeTypes( vf_ValidType *first, // first merged type
+ vf_ValidType *second ) // second merged type
{
// check null reference
if( first == NULL ) {
@@ -578,17 +563,12 @@ vf_TypePool::MergeTypes( vf_ValidType_t
return NULL;
}
// create merged type
- vf_ValidType_t *type = (vf_ValidType_t*) vf_alloc_pool_memory( m_pool,
- sizeof
- ( vf_ValidType_t )
- +
- ( count
- -
- 1 ) *
- sizeof
- ( const
- char
- * ) );
+ vf_ValidType *type = (vf_ValidType*)vf_palloc( m_pool,
+ sizeof( vf_ValidType )
+ + ( count -
+ 1 ) *
+ sizeof
+ ( const char * ) );
type->number = count;
// set type in ascending order of types string
@@ -618,44 +598,41 @@ vf_TypePool::MergeTypes( vf_ValidType_t
* Function sets constraint for method in class loader verify data.
*/
static void
-vf_set_class_constraint( vf_TypeConstraint_t * collection, // constraint for the class
- vf_Context_t * ctex ) // verifier context
+vf_set_class_constraint( vf_TypeConstraint *collection, // constraint for the class
+ vf_ContextHandle ctx ) // verification context
{
// get class loader of current class
- classloader_handler class_loader =
- class_get_class_loader( ctex->m_class );
+ classloader_handler class_loader = class_get_class_loader( ctx->m_class );
// lock data modification
cl_acquire_lock( class_loader );
- vf_ClassLoaderData_t *cl_data =
- (vf_ClassLoaderData_t*) cl_get_verify_data_ptr( class_loader );
+ vf_ClassLoaderData *cl_data =
+ (vf_ClassLoaderData*) cl_get_verify_data_ptr( class_loader );
// create class loader data
if( cl_data == NULL ) {
- vf_VerifyPool_t *new_pool = vf_create_pool();
- cl_data = (vf_ClassLoaderData_t*) vf_alloc_pool_memory( new_pool,
- sizeof
- ( vf_ClassLoaderData_t ) );
+ vf_Pool *new_pool = vf_create_pool();
+ cl_data = (vf_ClassLoaderData*) vf_palloc( new_pool,
+ sizeof
+ ( vf_ClassLoaderData ) );
cl_data->pool = new_pool;
cl_data->string = new vf_Hash ( new_pool );
// set verify data for class loader
cl_set_verify_data_ptr( class_loader, cl_data );
}
- vf_VerifyPool_t *pool = cl_data->pool;
- vf_Hash_t *hash = cl_data->string;
+ vf_Pool *pool = cl_data->pool;
+ vf_Hash *hash = cl_data->string;
// create class constraints collection
- vf_TypeConstraint_t *save_collection = NULL;
- for( vf_TypeConstraint_t * restriction = collection;
+ vf_TypeConstraint *save_collection = NULL;
+ for( vf_TypeConstraint *restriction = collection;
restriction; restriction = restriction->next ) {
// create constraint
- vf_TypeConstraint_t *constraint =
- (vf_TypeConstraint_t*) vf_alloc_pool_memory( pool,
- sizeof
- ( vf_TypeConstraint_t ) );
+ vf_TypeConstraint *constraint =
+ (vf_TypeConstraint*)vf_palloc( pool,
+ sizeof( vf_TypeConstraint ) );
// create entry in string pool for target class
- vf_HashEntry_t *hash_entry =
- hash->NewHashEntry( restriction->target );
+ vf_HashEntry *hash_entry = hash->NewHashEntry( restriction->target );
constraint->target = hash_entry->key;
// create entry in string pool for checked class
hash_entry = hash->NewHashEntry( restriction->source );
@@ -668,12 +645,11 @@ vf_set_class_constraint( vf_TypeConstrai
assert( save_collection );
// save method verify data
- assert( class_get_verify_data_ptr( ctex->m_class ) == NULL );
- class_set_verify_data_ptr( ctex->m_class, save_collection );
+ assert( class_get_verify_data_ptr( ctx->m_class ) == NULL );
+ class_set_verify_data_ptr( ctx->m_class, save_collection );
// unlock data modification
cl_release_lock( class_loader );
- return;
} // vf_set_class_constraint
/**
@@ -682,7 +658,7 @@ vf_set_class_constraint( vf_TypeConstrai
static class_handler
vf_resolve_class( const char *name, // resolved class name
bool need_load, // load flag
- vf_Context_t * ctex ) // verifier context
+ vf_ContextHandle ctx ) // verification context
{
// get class name
if( name[0] == 'L' ) {
@@ -706,14 +682,13 @@ vf_resolve_class( const char *name,
}
// get class loader
- classloader_handler class_loader =
- class_get_class_loader( ctex->m_class );
+ classloader_handler class_loader = class_get_class_loader( ctx->m_class );
// receive class
class_handler result;
if( need_load ) {
// trace verifier loads
- VERIFY_TRACE( "load", "verify load: class " << name );
+ VF_TRACE( "load", "verify load: class " << name );
result = cl_load_class( class_loader, name );
} else {
result = cl_get_class( class_loader, name );
@@ -755,8 +730,8 @@ vf_is_super_interface( class_handler sou
for( unsigned index = 0;
index < class_get_superinterface_number( source ); index++ ) {
if( vf_is_super_interface
- ( class_get_superinterface( source, ( unsigned short )index ),
- target ) ) {
+ ( class_get_superinterface
+ ( source, ( unsigned short )index ), target ) ) {
return true;
}
}
@@ -1038,40 +1013,35 @@ vf_is_valid( class_handler source,
* Sets verifier error.
*/
static inline void
-vf_set_error( method_handler method, // failed method
- unsigned check, // failed check
- vf_Context_t * ctex ) // verifier context
+vf_set_error( unsigned check, // failed check
+ vf_Context *ctx ) // verification context
{
switch ( check ) {
case VF_CHECK_PARAM:
- VERIFY_REPORT_CLASS( ctex, method,
- "Incompatible argument for function" );
+ VF_REPORT_METHOD( ctx, "Incompatible argument for function" );
return;
case VF_CHECK_ASSIGN:
- VERIFY_REPORT_CLASS( ctex, method,
- "Incompatible types for field assignment" );
+ VF_REPORT_METHOD( ctx, "Incompatible types for field assignment" );
return;
case VF_CHECK_ASSIGN_WEAK:
- VERIFY_REPORT_CLASS( ctex, method,
- "Incompatible types for array assignment" );
+ VF_REPORT_METHOD( ctx, "Incompatible types for array assignment" );
return;
case VF_CHECK_SUPER:
- VERIFY_REPORT_CLASS( ctex, method,
- "Exception class not a subclass of Throwable" );
+ VF_REPORT_METHOD( ctx,
+ "Exception class not a subclass of Throwable" );
return;
case VF_CHECK_ACCESS_FIELD:
- VERIFY_REPORT_CLASS( ctex, method, "Bad access to protected field" );
+ VF_REPORT_METHOD( ctx, "Bad access to protected field" );
return;
case VF_CHECK_ACCESS_METHOD:
- VERIFY_REPORT_CLASS( ctex, method, "Bad access to protected method" );
+ VF_REPORT_METHOD( ctx, "Bad access to protected method" );
return;
case VF_CHECK_DIRECT_SUPER:
- VERIFY_REPORT_CLASS( ctex, method,
- "Call to wrong initialization method" );
+ VF_REPORT_METHOD( ctx, "Call to wrong initialization method" );
return;
case VF_CHECK_INVOKESPECIAL:
- VERIFY_REPORT_CLASS( ctex, method,
- "Incompatible object argument for invokespecial" );
+ VF_REPORT_METHOD( ctx,
+ "Incompatible object argument for invokespecial" );
return;
}
LDIE( 41, "Verifier: vf_set_error: unknown check type" );
@@ -1080,9 +1050,9 @@ vf_set_error( method_handler method,
/**
* Checks some constraints without loading of needed classes.
*/
-static inline Verifier_Result
-vf_check_without_loading( vf_TypeConstraint_t * restriction, // checked constraint
- vf_Context_t * ctex ) // verifier context
+static inline vf_Result
+vf_check_without_loading( vf_TypeConstraint *restriction, // checked constraint
+ vf_Context *ctx ) // verification context
{
switch ( restriction->check_type ) {
case VF_CHECK_SUPER:
@@ -1090,7 +1060,7 @@ vf_check_without_loading( vf_TypeConstra
* Extension for class java/lang/Object doesn't check
* because it's expected all references extend it.
*/
- if( restriction->target == ctex->m_vtype.m_object->string[0] ) {
+ if( restriction->target == ctx->m_vtype.m_object->string[0] ) {
// no need to check
return VER_OK;
}
@@ -1101,7 +1071,7 @@ vf_check_without_loading( vf_TypeConstra
* Extension for class java/lang/Object doesn't check
* because it's expected all references extend it.
*/
- if( restriction->target == ctex->m_vtype.m_object->string[0] ) {
+ if( restriction->target == ctx->m_vtype.m_object->string[0] ) {
// no need to check
return VER_OK;
}
@@ -1111,7 +1081,7 @@ vf_check_without_loading( vf_TypeConstra
* because it's expected all arrays extend it.
* Just check is source array.
*/
- if( restriction->target == ctex->m_vtype.m_array->string[0]
+ if( restriction->target == ctx->m_vtype.m_array->string[0]
&& restriction->source[0] == '['
&& ( restriction->source[1] == '['
|| restriction->source[1] == 'L' ) ) {
@@ -1124,8 +1094,8 @@ vf_check_without_loading( vf_TypeConstra
* interfaces doesn't check because it's expected all arrays extend it.
* Just check is source array.
*/
- if( ( restriction->target == ctex->m_vtype.m_clone->string[0]
- || restriction->target == ctex->m_vtype.m_serialize->string[0] )
+ if( ( restriction->target == ctx->m_vtype.m_clone->string[0]
+ || restriction->target == ctx->m_vtype.m_serialize->string[0] )
&& restriction->source[0] == '[' ) {
// no need to check
return VER_OK;
@@ -1138,7 +1108,7 @@ vf_check_without_loading( vf_TypeConstra
if( ( restriction->target[0] != '[' && restriction->source[0] == '[' )
|| ( restriction->target[0] != '['
&& restriction->source[0] == '[' ) ) {
- vf_set_error( ctex->m_method, VF_CHECK_PARAM, ctex );
+ vf_set_error( VF_CHECK_PARAM, ctx );
return VER_ErrorIncompatibleArgument;
}
break;
@@ -1161,12 +1131,12 @@ vf_check_without_loading( vf_TypeConstra
// or java/lang/Serializable interface
return VER_OK;
} else if( restriction->target ==
- ctex->m_vtype.m_object->string[0] ) {
+ ctx->m_vtype.m_object->string[0] ) {
// target class is java/lang/Object
return VER_OK;
} else if( restriction->target[0] != '[' ) {
// target class isn't array class
- vf_set_error( ctex->m_method, restriction->check_type, ctex );
+ vf_set_error( restriction->check_type, ctx );
return VER_ErrorIncompatibleArgument;
}
}
@@ -1184,16 +1154,15 @@ vf_check_without_loading( vf_TypeConstra
* If any class isn't loaded, function returns unloaded error
* to store restriction to the class for future constraint check.
*/
-static inline Verifier_Result
-vf_check_constraint( vf_TypeConstraint_t * restriction, // checked constraint
- vf_Context_t * ctex ) // verifier context
+static inline vf_Result
+vf_check_constraint( vf_TypeConstraint *restriction, // checked constraint
+ vf_Context *ctx ) // verification context
{
/**
* Try to provide some checks without classes loading
*/
- if( !ctex->m_dump.m_verify ) {
- Verifier_Result result =
- vf_check_without_loading( restriction, ctex );
+ if( !ctx->m_dump.m_verify ) {
+ vf_Result result = vf_check_without_loading( restriction, ctx );
if( result != VER_ClassNotLoaded ) {
// no need to check
return result;
@@ -1201,10 +1170,10 @@ vf_check_constraint( vf_TypeConstraint_t
}
// get target class handler
class_handler target =
- vf_resolve_class( restriction->target, false, ctex );
+ vf_resolve_class( restriction->target, false, ctx );
// get checked class
class_handler source =
- vf_resolve_class( restriction->source, false, ctex );
+ vf_resolve_class( restriction->source, false, ctx );
// check classes are loaded?
if( !target || !source ) {
return VER_ClassNotLoaded;
@@ -1217,15 +1186,15 @@ vf_check_constraint( vf_TypeConstraint_t
* To be compatible with those applications we should do full constraint
* checks only if -Xverify:all option is present in command line.
*/
- if( !ctex->m_dump.m_verify && class_is_interface_( target ) ) {
+ if( !ctx->m_dump.m_verify && class_is_interface_( target ) ) {
// skip constraint check
return VER_OK;
}
// check restriction
if( !vf_is_valid
- ( source, target, ctex->m_class, restriction->check_type ) ) {
+ ( source, target, ctx->m_class, restriction->check_type ) ) {
// return error
- vf_set_error( ctex->m_method, restriction->check_type, ctex );
+ vf_set_error( restriction->check_type, ctx );
return VER_ErrorIncompatibleArgument;
}
return VER_OK;
@@ -1237,21 +1206,21 @@ vf_check_constraint( vf_TypeConstraint_t
* function return unloaded error to store restriction to the class
* for future constraint check.
*/
-Verifier_Result
+vf_Result
vf_check_access_constraint( const char *super_name, // name of super class
const char *instance_name, // name of instance class
unsigned short index, // constant pool index
- vf_CheckConstraint_t check_type, // access check type
- vf_Context_t * ctex ) // verifier context
+ vf_CheckConstraint check_type, // access check type
+ vf_Context *ctx ) // verification context
{
// get class handler of super class
- class_handler super_class = vf_resolve_class( super_name, false, ctex );
- if( !super_class || !vf_is_super_class( ctex->m_class, super_class ) ) {
+ class_handler super_class = vf_resolve_class( super_name, false, ctx );
+ if( !super_class || !vf_is_super_class( ctx->m_class, super_class ) ) {
// obtained class isn't super class of a given class, no need to check
return VER_OK;
}
// check if a class and a parent class is in the same package
- if( class_is_same_package( ctex->m_class, super_class ) ) {
+ if( class_is_same_package( ctx->m_class, super_class ) ) {
// class and parent class is in the same package,
// no need check access to protect members
return VER_OK;
@@ -1260,32 +1229,30 @@ vf_check_access_constraint( const char *
bool need_check = false;
if( check_type == VF_CHECK_ACCESS_FIELD ) {
field_handler field =
- class_resolve_nonstatic_field( ctex->m_class, index );
+ class_resolve_nonstatic_field( ctx->m_class, index );
if( !field ) {
// NoSuchFieldError or IllegalAccessError - nothing to check
- VERIFY_DEBUG( "verifying class " <<
- class_get_name( ctex->m_class )
- << " (method " << method_get_name( ctex->m_method )
- << method_get_descriptor( ctex->m_method )
- <<
- ") couldn't resolve field with constant pool index #"
- << index );
+ VF_DEBUG( "verifying class " << class_get_name( ctx->m_class )
+ << " (method " << method_get_name( ctx->m_method )
+ << method_get_descriptor( ctx->m_method )
+ <<
+ ") couldn't resolve field with constant pool index #"
+ << index );
return VER_OK;
}
if( field_is_protected( field ) ) {
need_check = true;
}
} else {
- method_handler method = class_resolve_method( ctex->m_class, index );
+ method_handler method = class_resolve_method( ctx->m_class, index );
if( !method || method_is_static( method ) ) {
// NoSuchMethodError or IllegalAccessError - nothing to check
- VERIFY_DEBUG( "verifying class " <<
- class_get_name( ctex->m_class )
- << " (method " << method_get_name( ctex->m_method )
- << method_get_descriptor( ctex->m_method )
- <<
- ") couldn't resolve method with constant pool index #"
- << index );
+ VF_DEBUG( "verifying class " << class_get_name( ctx->m_class )
+ << " (method " << method_get_name( ctx->m_method )
+ << method_get_descriptor( ctx->m_method )
+ <<
+ ") couldn't resolve method with constant pool index #"
+ << index );
return VER_OK;
}
if( method_is_protected( method ) ) {
@@ -1302,15 +1269,15 @@ vf_check_access_constraint( const char *
return VER_OK;
}
// get instance class
- class_handler instance = vf_resolve_class( instance_name, false, ctex );
+ class_handler instance = vf_resolve_class( instance_name, false, ctx );
if( !instance ) {
// instance class isn't loaded
return VER_ClassNotLoaded;
}
// check access constraint
- if( !vf_is_valid( instance, NULL, ctex->m_class, check_type ) ) {
+ if( !vf_is_valid( instance, NULL, ctx->m_class, check_type ) ) {
// return error
- vf_set_error( ctex->m_method, check_type, ctex );
+ vf_set_error( check_type, ctx );
return VER_ErrorIncompatibleArgument;
}
return VER_OK;
@@ -1320,21 +1287,21 @@ vf_check_access_constraint( const char *
* Function provides initial constraint checks for current class.
* Function checks only loaded classes, and stores restriction for unloaded ones.
*/
-Verifier_Result
-vf_check_class_constraints( vf_Context_t * ctex ) // verifier context
+vf_Result
+vf_check_class_constraints( vf_Context *ctx ) // verification context
{
// set class restriction collection
- vf_TypeConstraint_t *last = NULL;
- vf_TypeConstraint_t *collection = ctex->m_type->GetClassConstraint();
+ vf_TypeConstraint *last = NULL;
+ vf_TypeConstraint *collection = ctx->m_type->GetClassConstraint();
// check constraints
- for( vf_TypeConstraint_t * constraint = collection;
+ for( vf_TypeConstraint *constraint = collection;
constraint; constraint = constraint->next ) {
// set context method
- ctex->m_method = constraint->method;
+ ctx->m_method = constraint->method;
// check constraint
- Verifier_Result result = vf_check_constraint( constraint, ctex );
+ vf_Result result = vf_check_constraint( constraint, ctx );
if( result == VER_OK ) {
// constraint checked, remove constraint from the collection
if( !last ) {
@@ -1352,7 +1319,7 @@ vf_check_class_constraints( vf_Context_t
}
if( collection ) {
// set constraint for further checking
- vf_set_class_constraint( collection, ctex );
+ vf_set_class_constraint( collection, ctx );
}
return VER_OK;
@@ -1362,44 +1329,44 @@ vf_check_class_constraints( vf_Context_t
* Function checks constraint for given class.
* Function loads classes if it's needed.
*/
-static inline Verifier_Result
-vf_force_check_constraint( vf_TypeConstraint_t * constraint, // class constraint
- vf_Context_t * ctex ) // verifier context
+static inline vf_Result
+vf_force_check_constraint( vf_TypeConstraint *constraint, // class constraint
+ vf_Context *ctx ) // verification context
{
// check if constraint is already verified
if( constraint->check_type == VF_CHECK_NONE ) {
// already verified
- VERIFY_TRACE( "constraint.checked", "verify constraint: have \""
- << constraint->source << "\" need \"" << constraint->
- target << "\" already done (check #1) for class " <<
- class_get_name( ctex->m_class ) );
+ VF_TRACE( "constraint.checked", "verify constraint: have \""
+ << constraint->source << "\" need \"" << constraint->
+ target << "\" already done (check #1) for class " <<
+ class_get_name( ctx->m_class ) );
return VER_OK;
}
// get target class
- class_handler target = vf_resolve_class( constraint->target, true, ctex );
+ class_handler target = vf_resolve_class( constraint->target, true, ctx );
if( !target ) {
- VERIFY_DEBUG( "verifying class " << class_get_name( ctex->m_class )
- << " (method " << method_get_name( constraint->method )
- << method_get_descriptor( constraint->method )
- << ") couldn't load class \""
- << ( ( constraint->target[0] == 'L' )
- ? &( constraint->target[1] ) : constraint->target )
- << "\"" );
+ VF_DEBUG( "verifying class " << class_get_name( ctx->m_class )
+ << " (method " << method_get_name( constraint->method )
+ << method_get_descriptor( constraint->method )
+ << ") couldn't load class \""
+ << ( ( constraint->target[0] == 'L' )
+ ? &( constraint->target[1] ) : constraint->target )
+ << "\"" );
unsigned index = 0;
while( constraint->target[index++] != 'L' ) {
assert( constraint->target[index] != '\0' );
}
- VERIFY_REPORT( ctex, "Couldn't load class: "
- << &( constraint->target[index] ) );
+ VF_REPORT( ctx, "Couldn't load class: "
+ << &( constraint->target[index] ) );
return VER_ErrorLoadClass;
}
// check if constraint is already verified
if( constraint->check_type == VF_CHECK_NONE ) {
// already verified
- VERIFY_TRACE( "constraint.checked", "verify constraint: have \""
- << constraint->source << "\" need \"" << constraint->
- target << "\" already done (check #2) for class " <<
- class_get_name( ctex->m_class ) );
+ VF_TRACE( "constraint.checked", "verify constraint: have \""
+ << constraint->source << "\" need \"" << constraint->
+ target << "\" already done (check #2) for class " <<
+ class_get_name( ctx->m_class ) );
return VER_OK;
}
@@ -1410,7 +1377,7 @@ vf_force_check_constraint( vf_TypeConstr
* To be compatible with those applications we should do full constraint
* checks only if -Xverify:all option is present in command line.
*/
- if( !ctex->m_dump.m_verify && class_is_interface_( target ) ) {
+ if( !ctx->m_dump.m_verify && class_is_interface_( target ) ) {
// skip constraint check
// reset constraint to successful
constraint->check_type = VF_CHECK_NONE;
@@ -1419,47 +1386,47 @@ vf_force_check_constraint( vf_TypeConstr
// check if constraint is already verified
if( constraint->check_type == VF_CHECK_NONE ) {
// already verified
- VERIFY_TRACE( "constraint.checked", "verify constraint: have \""
- << constraint->source << "\" need \"" << constraint->
- target << "\" already done (check #3) for class " <<
- class_get_name( ctex->m_class ) );
+ VF_TRACE( "constraint.checked", "verify constraint: have \""
+ << constraint->source << "\" need \"" << constraint->
+ target << "\" already done (check #3) for class " <<
+ class_get_name( ctx->m_class ) );
return VER_OK;
}
// get stack reference class
- class_handler source = vf_resolve_class( constraint->source, true, ctex );
+ class_handler source = vf_resolve_class( constraint->source, true, ctx );
if( !source ) {
- VERIFY_DEBUG( "verifying class " << class_get_name( ctex->m_class )
- << " (method " << method_get_name( constraint->method )
- << method_get_descriptor( constraint->method )
- << ") couldn't load class \""
- << ( ( constraint->source[0] == 'L' )
- ? &( constraint->source[1] ) : constraint->source )
- << "\"" );
+ VF_DEBUG( "verifying class " << class_get_name( ctx->m_class )
+ << " (method " << method_get_name( constraint->method )
+ << method_get_descriptor( constraint->method )
+ << ") couldn't load class \""
+ << ( ( constraint->source[0] == 'L' )
+ ? &( constraint->source[1] ) : constraint->source )
+ << "\"" );
unsigned index = 0;
while( constraint->source[index++] != 'L' ) {
assert( constraint->source[index] != '\0' );
}
- VERIFY_REPORT( ctex, "Couldn't load class: "
- << &( constraint->source[index] ) );
+ VF_REPORT( ctx, "Couldn't load class: "
+ << &( constraint->source[index] ) );
return VER_ErrorLoadClass;
}
// store constraint check type (it could be changed during validation check)
- vf_CheckConstraint_t check =
- ( vf_CheckConstraint_t ) constraint->check_type;
+ vf_CheckConstraint check = ( vf_CheckConstraint ) constraint->check_type;
// check if constraint is already verified
if( check == VF_CHECK_NONE ) {
// already verified
- VERIFY_TRACE( "constraint.checked", "verify constraint: have \""
- << constraint->source << "\" need \"" << constraint->
- target << "\" already done (check #4) for class " <<
- class_get_name( ctex->m_class ) );
+ VF_TRACE( "constraint.checked", "verify constraint: have \""
+ << constraint->source << "\" need \"" << constraint->
+ target << "\" already done (check #4) for class " <<
+ class_get_name( ctx->m_class ) );
return VER_OK;
}
// check restriction
- if( !vf_is_valid( source, target, ctex->m_class, check ) ) {
+ if( !vf_is_valid( source, target, ctx->m_class, check ) ) {
// return error
- vf_set_error( constraint->method, check, ctex );
+ ctx->m_method = constraint->method;
+ vf_set_error( check, ctx );
return VER_ErrorIncompatibleArgument;
}
// reset constraint to successful
@@ -1470,23 +1437,23 @@ vf_force_check_constraint( vf_TypeConstr
/**
* Function verifies class constraints.
*/
-static Verifier_Result
-vf_verify_class_constraints( vf_Context_t * ctex ) // verifier context
+static vf_Result
+vf_verify_class_constraints( vf_Context *ctx ) // verification context
{
// get method verify data
- vf_TypeConstraint_t *constraint =
- (vf_TypeConstraint_t*) class_get_verify_data_ptr( ctex->m_class );
+ vf_TypeConstraint *constraint =
+ (vf_TypeConstraint*)class_get_verify_data_ptr( ctx->m_class );
if( constraint == NULL ) {
return VER_OK;
}
// trace verified class
- VERIFY_TRACE( "class.constraint",
- "verify constraints: " << class_get_name( ctex->m_class ) );
+ VF_TRACE( "class.constraint",
+ "verify constraints: " << class_get_name( ctx->m_class ) );
// check method constraints
- Verifier_Result result = VER_OK;
+ vf_Result result = VER_OK;
for( ; constraint; constraint = constraint->next ) {
- result = vf_force_check_constraint( constraint, ctex );
+ result = vf_force_check_constraint( constraint, ctx );
if( result != VER_OK ) {
break;
}
@@ -1502,9 +1469,9 @@ vf_verify_class_constraints( vf_Context_
* Function performs abend exit from VM.
*/
void
-vf_error_func( VERIFY_SOURCE_PARAMS )
+vf_error_func( VF_SOURCE_PARAMS )
{
- LDIE( 42, "{0} Verifier: abort!" << VERIFY_REPORT_SOURCE );
+ LDIE( 42, "{0} Verifier: abort!" << VF_REPORT_SOURCE );
exit( 1 );
} // vf_error_func
@@ -1514,7 +1481,7 @@ vf_error_func( VERIFY_SOURCE_PARAMS )
void *
vf_calloc_func( unsigned num, // number of elements
size_t size, // size of element
- VERIFY_SOURCE_PARAMS ) // debug info
+ VF_SOURCE_PARAMS ) // debug info
{
assert( num );
assert( size );
@@ -1524,13 +1491,13 @@ vf_calloc_func( unsigned num, // numbe
LECHO( 41, "Verifier: {0}: out of memory" << "vf_calloc_func" );
vf_error();
}
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory", VERIFY_REPORT_SOURCE
- << "(calloc) allocate memory addr: " << result
- << ", size: " << size *
- num << " (" << num << " by " << size << ")" );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory", VF_REPORT_SOURCE
+ << "(calloc) allocate memory addr: " << result
+ << ", size: " << size *
+ num << " (" << num << " by " << size << ")" );
+#endif // VF_TRACE_MEMORY
return result;
} // vf_calloc_func
@@ -1540,7 +1507,7 @@ vf_calloc_func( unsigned num, // numbe
*/
void *
vf_malloc_func( size_t size, // size of memory block
- VERIFY_SOURCE_PARAMS ) // debug info
+ VF_SOURCE_PARAMS ) // debug info
{
assert( size );
void *result = STD_MALLOC( size );
@@ -1549,12 +1516,12 @@ vf_malloc_func( size_t size, // size
LECHO( 41, "Verifier: {0}: out of memory" << "vf_malloc_func" );
vf_error();
}
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory", VERIFY_REPORT_SOURCE
- << "(malloc) allocate memory addr: " << result
- << ", size: " << size );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory", VF_REPORT_SOURCE
+ << "(malloc) allocate memory addr: " << result
+ << ", size: " << size );
+#endif // VF_TRACE_MEMORY
return result;
} // vf_malloc_func
@@ -1565,7 +1532,7 @@ vf_malloc_func( size_t size, // size
void *
vf_realloc_func( void *pointer, // old pointer
size_t size, // size of memory block
- VERIFY_SOURCE_PARAMS ) // debug info
+ VF_SOURCE_PARAMS ) // debug info
{
assert( size );
void *result = STD_REALLOC( pointer, size );
@@ -1574,12 +1541,12 @@ vf_realloc_func( void *pointer, // old p
LECHO( 41, "Verifier: {0}: out of memory" << "vf_realloc_func" );
vf_error();
}
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory", VERIFY_REPORT_SOURCE
- << "(realloc) reallocate memory from addr: " << pointer
- << " to addr: " << result << ", size: " << size );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory", VF_REPORT_SOURCE
+ << "(realloc) reallocate memory from addr: " << pointer
+ << " to addr: " << result << ", size: " << size );
+#endif // VF_TRACE_MEMORY
return result;
} // vf_realloc_func
@@ -1589,7 +1556,7 @@ vf_realloc_func( void *pointer, // old p
*/
void
vf_free_func( void *pointer, // free pointer
- VERIFY_SOURCE_PARAMS ) // debug info
+ VF_SOURCE_PARAMS ) // debug info
{
if( pointer ) {
STD_FREE( pointer );
@@ -1598,41 +1565,39 @@ vf_free_func( void *pointer, // free
vf_error();
}
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory", VERIFY_REPORT_SOURCE
- << "(free) free memory addr: " << ( void * )pointer );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory", VF_REPORT_SOURCE
+ << "(free) free memory addr: " << ( void * )pointer );
+#endif // VF_TRACE_MEMORY
- return;
} // vf_free_func
/**
* Function creates wide memory pool structure.
*/
-static inline vf_VerifyPoolInternal_t *
+static inline vf_PoolInternal *
vf_create_pool_element( size_t size, // initial pool size
- VERIFY_SOURCE_PARAMS ) // debug info
+ VF_SOURCE_PARAMS ) // debug info
{
- vf_VerifyPoolInternal_t *result;
+ vf_PoolInternal *result;
// create pool new entry and allocate memory for it
- result = (vf_VerifyPoolInternal_t*)
- vf_malloc_func( sizeof( vf_VerifyPoolInternal_t ) + size,
- VERIFY_SOURCE_ARGS1 );
- result->m_memory = (char*)result + sizeof( vf_VerifyPoolInternal_t );
+ result = (vf_PoolInternal*)
+ vf_malloc_func( sizeof( vf_PoolInternal ) + size, VF_SOURCE_ARGS1 );
+ result->m_memory = (char*)result + sizeof( vf_PoolInternal );
result->m_free = (char*)result->m_memory;
result->m_freesize = size;
result->m_next = NULL;
memset( result->m_memory, 0, size );
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool.element", VERIFY_REPORT_SOURCE
- << "(pool) create pool element: " << result
- << ", memory: " << result->
- m_memory << ", size: " << result->m_freesize );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool.element", VF_REPORT_SOURCE
+ << "(pool) create pool element: " << result
+ << ", memory: " << result->
+ m_memory << ", size: " << result->m_freesize );
+#endif // VF_TRACE_MEMORY
return result;
} // vf_create_pool_element
@@ -1640,31 +1605,29 @@ vf_create_pool_element( size_t size,
/**
* Function creates memory pool structure.
*/
-vf_VerifyPool_t *
-vf_create_pool_func( VERIFY_SOURCE_PARAMS )
+vf_Pool *
+vf_create_pool_func( VF_SOURCE_PARAMS )
{
// create new pool element
- vf_VerifyPoolInternal_t *pool =
- vf_create_pool_element( sizeof( vf_VerifyPool_t ) +
- VERIFY_POOL_ENTRY_SIZE,
- VERIFY_SOURCE_ARGS1 );
+ vf_PoolInternal *pool =
+ vf_create_pool_element( sizeof( vf_Pool ) + VF_POOL_ENTRY_SIZE,
+ VF_SOURCE_ARGS1 );
// set head pool
- vf_VerifyPool_t *result = (vf_VerifyPool_t*) pool->m_free;
- pool->m_memory = pool->m_free + sizeof( vf_VerifyPool_t );
+ vf_Pool *result = (vf_Pool*)pool->m_free;
+ pool->m_memory = pool->m_free + sizeof( vf_Pool );
pool->m_free = (char*)pool->m_memory;
- pool->m_freesize = VERIFY_POOL_ENTRY_SIZE;
+ pool->m_freesize = VF_POOL_ENTRY_SIZE;
result->m_pool = pool;
- result->m_memory =
- sizeof( vf_VerifyPoolInternal_t ) + sizeof( vf_VerifyPool_t )
- + VERIFY_POOL_ENTRY_SIZE;
+ result->m_memory = sizeof( vf_PoolInternal ) + sizeof( vf_Pool )
+ + VF_POOL_ENTRY_SIZE;
result->m_used = 0;
result->m_maxuse = 0;
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool", VERIFY_REPORT_SOURCE
- << "(pool) create pool: " << result );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool", VF_REPORT_SOURCE
+ << "(pool) create pool: " << result );
+#endif // VF_TRACE_MEMORY
return result;
} // vf_create_pool_func
@@ -1673,26 +1636,26 @@ vf_create_pool_func( VERIFY_SOURCE_PARAM
* Function allocates memory block in current pool.
*/
void *
-vf_alloc_pool_memory_func( vf_VerifyPool_t * hpool, // a given pool
- size_t size, // memory size
- VERIFY_SOURCE_PARAMS ) // debug info
+vf_palloc_func( vf_Pool *hpool, // a given pool
+ size_t size, // memory size
+ VF_SOURCE_PARAMS ) // debug info
{
const unsigned align = sizeof( void * ) - 1;
void *result = NULL;
- vf_VerifyPoolInternal_t *pool = hpool->m_pool;
+ vf_PoolInternal *pool = hpool->m_pool;
// align allocate size
size = ( size + align ) & ( ~align );
// find free space
- if( size > VERIFY_POOL_ENTRY_SIZE ) {
+ if( size > VF_POOL_ENTRY_SIZE ) {
// create new wide pool entry
- pool = vf_create_pool_element( size, VERIFY_SOURCE_ARGS1 );
+ pool = vf_create_pool_element( size, VF_SOURCE_ARGS1 );
pool->m_next = hpool->m_pool;
hpool->m_pool = pool;
- hpool->m_memory += sizeof( vf_VerifyPoolInternal_t ) + size;
+ hpool->m_memory += sizeof( vf_PoolInternal ) + size;
} else if( pool->m_freesize < size ) {
- vf_VerifyPoolInternal_t *last = NULL;
- vf_VerifyPoolInternal_t *entry = pool->m_next;
+ vf_PoolInternal *last = NULL;
+ vf_PoolInternal *entry = pool->m_next;
while( entry ) {
last = pool;
pool = entry;
@@ -1705,12 +1668,10 @@ vf_alloc_pool_memory_func( vf_VerifyPool
if( !entry ) {
// create new pool element
pool =
- vf_create_pool_element( VERIFY_POOL_ENTRY_SIZE,
- VERIFY_SOURCE_ARGS1 );
+ vf_create_pool_element( VF_POOL_ENTRY_SIZE, VF_SOURCE_ARGS1 );
pool->m_next = hpool->m_pool;
hpool->m_pool = pool;
- hpool->m_memory +=
- sizeof( vf_VerifyPoolInternal_t ) + VERIFY_POOL_ENTRY_SIZE;
+ hpool->m_memory += sizeof( vf_PoolInternal ) + VF_POOL_ENTRY_SIZE;
} else {
assert( last != NULL );
last->m_next = pool->m_next;
@@ -1724,38 +1685,37 @@ vf_alloc_pool_memory_func( vf_VerifyPool
pool->m_freesize -= size;
hpool->m_used += size;
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool", VERIFY_REPORT_SOURCE
- << "(pool) allocate memory in pool: " << hpool
- << ", memory: " << result << ", size: " << size
- << ", element: " << pool << ", free: " << pool->
- m_freesize );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool", VF_REPORT_SOURCE
+ << "(pool) allocate memory in pool: " << hpool
+ << ", memory: " << result << ", size: " << size
+ << ", element: " << pool << ", free: " << pool->m_freesize );
+#endif // VF_TRACE_MEMORY
return result;
-} // vf_alloc_pool_memory_func
+} // vf_palloc_func
/**
* Function cleans given pool.
*/
void
-vf_clean_pool_memory_func( vf_VerifyPool_t * hpool, // memory pool
- VERIFY_SOURCE_PARAMS ) // debug info
+vf_clean_pool_func( vf_Pool *hpool, // memory pool
+ VF_SOURCE_PARAMS ) // debug info
{
// set max used value
if( hpool->m_used > hpool->m_maxuse ) {
hpool->m_maxuse = hpool->m_used;
}
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool", VERIFY_REPORT_SOURCE
- << "(pool) clean pool: " << hpool
- << ", allocated: " << hpool->
- m_memory << ", used: " << hpool->m_used );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool", VF_REPORT_SOURCE
+ << "(pool) clean pool: " << hpool
+ << ", allocated: " << hpool->
+ m_memory << ", used: " << hpool->m_used );
+#endif // VF_TRACE_MEMORY
- vf_VerifyPoolInternal_t *pool = hpool->m_pool;
+ vf_PoolInternal *pool = hpool->m_pool;
while( pool ) {
// clean pool element space
unsigned used_size =
@@ -1765,58 +1725,56 @@ vf_clean_pool_memory_func( vf_VerifyPool
pool->m_freesize += used_size;
hpool->m_used -= used_size;
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool.element", VERIFY_REPORT_SOURCE
- << "(pool) clean pool element: " << pool
- << ", size: " << used_size );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool.element", VF_REPORT_SOURCE
+ << "(pool) clean pool element: " << pool
+ << ", size: " << used_size );
+#endif // VF_TRACE_MEMORY
// get next pool entry
pool = pool->m_next;
}
- return;
-} // vf_clean_pool_memory_func
+} // vf_clean_pool_func
/**
* Function releases memory from given pool.
*/
void
-vf_delete_pool_func( vf_VerifyPool_t * hpool, // memory pool
- VERIFY_SOURCE_PARAMS ) // debug info
+vf_delete_pool_func( vf_Pool *hpool, // memory pool
+ VF_SOURCE_PARAMS ) // debug info
{
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool", VERIFY_REPORT_SOURCE
- << "(pool) delete pool: " << hpool
- << ", allocated: " << hpool->m_memory
- << ", used: "
- << ( hpool->m_used >
- hpool->m_maxuse ? hpool->m_used : hpool->m_maxuse ) );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool", VF_REPORT_SOURCE
+ << "(pool) delete pool: " << hpool
+ << ", allocated: " << hpool->m_memory
+ << ", used: "
+ << ( hpool->m_used >
+ hpool->m_maxuse ? hpool->m_used : hpool->m_maxuse ) );
+#endif // VF_TRACE_MEMORY
- vf_VerifyPoolInternal_t *pool = hpool->m_pool;
+ vf_PoolInternal *pool = hpool->m_pool;
while( pool ) {
-#if VERIFY_TRACE_MEMORY
+#if VF_TRACE_MEMORY
// trace memory
- VERIFY_TRACE( "memory.pool.element", VERIFY_REPORT_SOURCE
- << "(pool) delete pool element: " << pool );
-#endif // VERIFY_TRACE_MEMORY
+ VF_TRACE( "memory.pool.element", VF_REPORT_SOURCE
+ << "(pool) delete pool element: " << pool );
+#endif // VF_TRACE_MEMORY
// store pool element
- vf_VerifyPoolInternal_t *entry = pool;
+ vf_PoolInternal *entry = pool;
// get next pool element
pool = pool->m_next;
// free pool element
- vf_free_func( entry, VERIFY_SOURCE_ARGS1 );
+ vf_free_func( entry, VF_SOURCE_ARGS1 );
}
- return;
} // vf_delete_pool_func
/**
* Function provides final constraint checks for a given class.
*/
-Verifier_Result
+vf_Result
vf_verify_class_constraints( class_handler klass, // a given class
unsigned verifyAll, // verification level flag
char **message ) // verifier error message
@@ -1825,19 +1783,19 @@ vf_verify_class_constraints( class_handl
assert( message );
// create context
- vf_Context_t context;
+ vf_Context context;
context.m_class = klass;
context.m_dump.m_verify = verifyAll ? 1 : 0;
// verified constraint for a given method
- Verifier_Result result = vf_verify_class_constraints( &context );
+ vf_Result result = vf_verify_class_constraints( &context );
*message = context.m_error;
-#if _VERIFY_DEBUG
+#if _VF_DEBUG
if( result != VER_OK ) {
- VERIFY_DEBUG( "VerifyError: " << context.m_error );
+ VF_DEBUG( "VerifyError: " << context.m_error );
}
-#endif // _VERIFY_DEBUG
+#endif // _VF_DEBUG
return result;
} // vf_verify_class_constraints
@@ -1848,9 +1806,8 @@ vf_verify_class_constraints( class_handl
void
vf_release_verify_data( void *data )
{
- vf_ClassLoaderData_t *cl_data = (vf_ClassLoaderData_t*) data;
+ vf_ClassLoaderData *cl_data = (vf_ClassLoaderData*) data;
delete cl_data->string;
vf_delete_pool( cl_data->pool );
- return;
} // vf_release_verify_data