You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/04/13 20:26:28 UTC
svn commit: r528575 [2/6] - in /harmony/enhanced/drlvm/trunk:
src/test/regression/H3225/ vm/vmcore/include/ vm/vmcore/src/verifier/
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp?view=diff&rev=528575&r1=528574&r2=528575
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/Verifier.cpp Fri Apr 13 11:26:27 2007
@@ -17,7 +17,7 @@
/**
* @author Pavel Rebriy
* @version $Revision: 1.1.2.3.4.4 $
- */
+ */
#include <limits.h>
#include "ver_real.h"
@@ -26,23 +26,21 @@
* Debug flag macros
*/
// Macro sets verification only for defined class
-#define VERIFY_CLASS 0
+#define VF_CLASS 0
// Macro sets verification only for defined method
-#define VERIFY_METHOD 0
+#define VF_METHOD 0
/**
- * Function parse bytecode, determines code instructions, fills code array and
+ * Parses bytecode, determines instruction boundaries and
* provides checks of simple verifications.
*/
-static Verifier_Result
-vf_parse_bytecode( vf_Context_t *context ); // verifier context
+static vf_Result vf_parse_bytecode( vf_Context *ctx ); // verification context
-#if _VERIFY_DEBUG
+#if _VF_DEBUG
/**
- * Function prints code instruction array in stream.
+ * Prints code instruction array in stream.
*/
-void
-vf_dump_bytecode( vf_Context_t *context ); // verifier context
+void vf_dump_bytecode( vf_ContextHandle ); // verification context
/**
* Array of opcode names. Available in debug mode.
@@ -52,15 +50,19 @@
"ICONST_3", "ICONST_4", "ICONST_5", "LCONST_0", "LCONST_1", "FCONST_0",
"FCONST_1", "FCONST_2", "DCONST_0", "DCONST_1", "BIPUSH", "SIPUSH",
"LDC", "LDC_W", "LDC2_W", "ILOAD", "LLOAD", "FLOAD", "DLOAD", "ALOAD",
- "ILOAD_0", "ILOAD_1", "ILOAD_2", "ILOAD_3", "LLOAD_0", "LLOAD_1", "LLOAD_2",
- "LLOAD_3", "FLOAD_0", "FLOAD_1", "FLOAD_2", "FLOAD_3", "DLOAD_0", "DLOAD_1",
- "DLOAD_2", "DLOAD_3", "ALOAD_0", "ALOAD_1", "ALOAD_2", "ALOAD_3", "IALOAD",
+ "ILOAD_0", "ILOAD_1", "ILOAD_2", "ILOAD_3", "LLOAD_0", "LLOAD_1",
+ "LLOAD_2",
+ "LLOAD_3", "FLOAD_0", "FLOAD_1", "FLOAD_2", "FLOAD_3", "DLOAD_0",
+ "DLOAD_1",
+ "DLOAD_2", "DLOAD_3", "ALOAD_0", "ALOAD_1", "ALOAD_2", "ALOAD_3",
+ "IALOAD",
"LALOAD", "FALOAD", "DALOAD", "AALOAD", "BALOAD", "CALOAD", "SALOAD",
"ISTORE", "LSTORE", "FSTORE", "DSTORE", "ASTORE", "ISTORE_0", "ISTORE_1",
"ISTORE_2", "ISTORE_3", "LSTORE_0", "LSTORE_1", "LSTORE_2", "LSTORE_3",
"FSTORE_0", "FSTORE_1", "FSTORE_2", "FSTORE_3", "DSTORE_0", "DSTORE_1",
"DSTORE_2", "DSTORE_3", "ASTORE_0", "ASTORE_1", "ASTORE_2", "ASTORE_3",
- "IASTORE", "LASTORE", "FASTORE", "DASTORE", "AASTORE", "BASTORE", "CASTORE",
+ "IASTORE", "LASTORE", "FASTORE", "DASTORE", "AASTORE", "BASTORE",
+ "CASTORE",
"SASTORE", "POP", "POP2", "DUP", "DUP_X1", "DUP_X2", "DUP2", "DUP2_X1",
"DUP2_X2", "SWAP", "IADD", "LADD", "FADD", "DADD", "ISUB", "LSUB", "FSUB",
"DSUB", "IMUL", "LMUL", "FMUL", "DMUL", "IDIV", "LDIV", "FDIV", "DDIV",
@@ -70,381 +72,377 @@
"F2L", "F2D", "D2I", "D2L", "D2F", "I2B", "I2C", "I2S", "LCMP", "FCMPL",
"FCMPG", "DCMPL", "DCMPG", "IFEQ", "IFNE", "IFLT", "IFGE", "IFGT", "IFLE",
"IF_ICMPEQ", "IF_ICMPNE", "IF_ICMPLT", "IF_ICMPGE", "IF_ICMPGT",
- "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE", "GOTO", "JSR", "RET", "TABLESWITCH",
+ "IF_ICMPLE", "IF_ACMPEQ", "IF_ACMPNE", "GOTO", "JSR", "RET",
+ "TABLESWITCH",
"LOOKUPSWITCH", "IRETURN", "LRETURN", "FRETURN", "DRETURN", "ARETURN",
- "RETURN", "GETSTATIC", "PUTSTATIC", "GETFIELD", "PUTFIELD", "INVOKEVIRTUAL",
+ "RETURN", "GETSTATIC", "PUTSTATIC", "GETFIELD", "PUTFIELD",
+ "INVOKEVIRTUAL",
"INVOKESPECIAL", "INVOKESTATIC", "INVOKEINTERFACE", "_OPCODE_UNDEFINED",
"NEW", "NEWARRAY", "ANEWARRAY", "ARRAYLENGTH", "ATHROW", "CHECKCAST",
"INSTANCEOF", "MONITORENTER", "MONITOREXIT", "WIDE", "MULTIANEWARRAY",
"IFNULL", "IFNONNULL", "GOTO_W", "JSR_W",
};
-#endif // _VERIFY_DEBUG
+#endif // _VF_DEBUG
/**
- * Function provides method bytecode verifications.
+ * Provides method bytecode verifications.
*/
-static Verifier_Result
-vf_verify_method_bytecode( vf_Context_t *ctex ) // verifier context
+static vf_Result
+vf_verify_method_bytecode( vf_Context *ctx ) // verification context
{
- unsigned len;
- Verifier_Result result = VER_OK;
-
- VERIFY_TRACE( "method", "verify method: " << class_get_name( ctex->m_class )
- << "." << method_get_name( ctex->m_method ) << method_get_descriptor( ctex->m_method ) );
+ vf_Result result = VER_OK;
- /**
- * Getting bytecode array and its length
- */
- if( !( len = method_get_code_length( ctex->m_method ) ) ) {
- return VER_OK;
- }
+ VF_TRACE( "method", VF_REPORT_CTX( ctx ) << "verifying method" );
/**
* Set method for type pool
*/
- ctex->m_type->SetMethod( ctex->m_method );
+ ctx->m_type->SetMethod( ctx->m_method );
- /**
- * Allocate memory for code and bytecode annotations.
- */
- ctex->m_code = (vf_Code_t*)vf_alloc_pool_memory( ctex->m_pool,
- len * sizeof( vf_Code_t ) );
- ctex->m_bc = (vf_BCode_t*)vf_alloc_pool_memory( ctex->m_pool,
- len * sizeof( vf_BCode_t ) );
+ // get method signature
+ const char *descr = method_get_descriptor( ctx->m_method );
- /**
- * Parse bytecode, fill instruction code.
- */
- result = vf_parse_bytecode( ctex );
- if( result != VER_OK ) {
+ // parse method signature
+ vf_parse_description( descr, &ctx->m_method_inlen,
+ &ctx->m_method_outlen );
+ vf_set_description_vector( descr, ctx->m_method_inlen, 0,
+ ctx->m_method_outlen, &ctx->m_method_invector,
+ &ctx->m_method_outvector, ctx );
+
+ // parse bytecode, fill instruction instr
+ result = vf_parse_bytecode( ctx );
+ if( VER_OK != result ) {
goto labelEnd_verifyClassBytecode;
}
- /**
- * Build bytecode graph
- */
- result = vf_create_graph( ctex );
- if( ctex->m_dump.m_with_subroutine ) {
- result = VER_NoSupportJSR;
+ // build a control flow graph
+ result = vf_create_graph( ctx );
+ if( VER_OK != result ) {
goto labelEnd_verifyClassBytecode;
- result = vf_inline_subroutines( ctex );
- if ( VER_OK != result ) {
- goto labelEnd_verifyClassBytecode;
- }
}
- // check control and data flow
- result = vf_check_graph( ctex );
- if( result != VER_OK ) {
+ result = vf_check_graph( ctx );
+ if( VER_OK != result ) {
goto labelEnd_verifyClassBytecode;
}
-labelEnd_verifyClassBytecode:
- vf_free_graph( ctex );
+ labelEnd_verifyClassBytecode:
+ VF_TRACE( "method", VF_REPORT_CTX( ctx ) << "method statistics: "
+ << " rets: " << ctx->m_retnum
+ << ", length: " << ctx->m_len
+ << ", handlers: " << ctx->m_handlers
+ << ", max stack: " << ctx->m_maxstack
+ << ", max locals: " << ctx->m_maxlocal );
+ vf_free_graph( ctx );
return result;
-} // vf_verify_method_bytecode
+} // vf_verify_method_bytecode
/************************************************************
******************** Offset functions **********************
************************************************************/
/**
- * Function creates array of instruction branch offsets.
+ * Creates array of instruction branch offsets.
*/
static inline void
-vf_create_code_offset( vf_Code_t *code, // given instruction
- unsigned offcount, // number of offets
- vf_VerifyPool_t *pool) // memory pool
+vf_create_instr_offset( vf_Instr *instr, // given instruction
+ unsigned offcount, // number of offets
+ vf_Pool *pool ) // memory pool
{
- assert( !code->m_off );
- code->m_off = (unsigned*)vf_alloc_pool_memory( pool, offcount * sizeof( unsigned ) );
- code->m_offcount = offcount;
- return;
-} // vf_create_instruction_offset
+ assert( !instr->m_off );
+ instr->m_off =
+ ( unsigned * )vf_palloc( pool, offcount * sizeof( unsigned ) );
+ instr->m_offcount = offcount;
+} // vf_create_instruction_offset
/**
- * Function sets code branch offset.
+ * Sets instruction branch offset.
*/
static inline void
-vf_set_code_offset( vf_Code_t *code, // given instruction
- unsigned offnum, // offset index in array
- unsigned value) // offset value
+vf_set_instr_offset( vf_InstrHandle instr, // given instruction
+ unsigned offnum, // offset index in array
+ unsigned value ) // offset value
{
- assert( code->m_off && offnum < code->m_offcount );
- code->m_off[offnum] = value;
- return;
-} // vf_set_instruction_offset
+ assert( instr->m_off && offnum < instr->m_offcount );
+ instr->m_off[offnum] = value;
+} // vf_set_instruction_offset
/**
* Function creates a single branch.
*/
static inline void
-vf_set_single_branch_offset( vf_Code_t *code, // given instruction
- unsigned value, // offset value
- vf_VerifyPool_t *pool) // memory pool
-{
- vf_create_code_offset( code, 1, pool );
- vf_set_code_offset( code, 0, value );
- return;
-} // vf_set_single_instruction_offset
+vf_set_single_branch_offset( vf_Instr *instr, // given instruction
+ unsigned value, // offset value
+ vf_Pool *pool ) // memory pool
+{
+ vf_create_instr_offset( instr, 1, pool );
+ vf_set_instr_offset( instr, 0, value );
+} // vf_set_single_instruction_offset
/************************************************************
****************** Modifier functions **********************
************************************************************/
/**
- * Function sets stack modifier attribute for given code instruction.
+ * Sets stack modifier attribute for given code instruction.
*/
static inline void
-vf_set_stack_modifier( vf_Code_t *code, // code instruction
- int modify) // stack modifier value
+vf_set_stack_modifier( vf_Instr *instr, // code instruction
+ int modify ) // stack modifier value
{
// set stack modifier for instruction
- code->m_stack = (short)modify;
- return;
-} // vf_set_stack_modifier
+ instr->m_stack = ( short )modify;
+} // vf_set_stack_modifier
/**
- * Function sets minimal stack attribute for given code instruction.
+ * Sets minimal stack attribute for given code instruction.
*/
static inline void
-vf_set_min_stack( vf_Code_t *code, // code instruction
- unsigned min_stack) // minimal stack value
+vf_set_min_stack( vf_Instr *instr, // code instruction
+ unsigned min_stack ) // minimal stack value
{
// set minimal stack for instruction
- code->m_minstack = (unsigned short)min_stack;
- return;
-} // vf_set_min_stack
+ instr->m_minstack = ( unsigned short )min_stack;
+} // vf_set_min_stack
/**
- * Function sets basic block attribute for instruction.
+ * The length of the longest instruction except switches.
+ */
+const unsigned GOTO_W_LEN = 5;
+/**
+ * Sets basic block attribute for instruction.
*/
static inline void
-vf_set_basic_block_flag( vf_BCode_t *code ) // instruction
+vf_set_basic_block_flag( unsigned short pc, vf_ContextHandle ctx )
{
+ assert( pc < ctx->m_len + GOTO_W_LEN );
// set begin of basic block for instruction
- code->m_mark = 1;
- return;
-} // vf_set_basic_block_flag
+ ctx->m_bc[pc].m_is_bb_start = true;
+} // vf_set_basic_block_flag
+
/**
* Sets flags for the instruction.
*/
static inline void
-vf_set_code_type( vf_Code_t *code, // instruction
- vf_CodeType type) // given flags
+vf_set_instr_type( vf_Instr *instr, // instruction
+ vf_InstrType type ) // given flags
{
// set flag for instruction
- code->m_type = type;
- return;
-} // vf_set_code_type
+ instr->m_type = type;
+} // vf_set_instr_type
/**
- * Function checks local number.
+ * Checks local number.
*/
-static inline Verifier_Result
+static inline vf_Result
vf_check_local_var_number( unsigned local, // local number
- unsigned maxlocal, // max local
- vf_Context_t *ctex) // verifier context
+ vf_Context *ctx ) // verification context
{
// check local variable number
- if( local >= maxlocal ) {
- VERIFY_REPORT_METHOD( ctex, "Incorrect usage of local variable" );
+ if( local >= ctx->m_maxlocal ) {
+ VF_REPORT( ctx, "Incorrect usage of local variable" );
return VER_ErrorLocals;
}
return VER_OK;
-} // vf_check_local_var_number
+} // vf_check_local_var_number
/**
- * Function checks branch offset.
+ * Checks branch offset.
*/
-static inline Verifier_Result
-vf_check_branch_offset( int offset, // given instruction offset
- unsigned maxlen, // bytecode length
- vf_Context_t *ctex) // verifier context
-
+static inline vf_Result
+vf_check_branch_offset( int offset, // given instruction offset
+ vf_Context *ctx ) // verification context
{
- if( offset < 0 || (unsigned)offset >= maxlen ) {
- VERIFY_REPORT_METHOD( ctex, "Instruction branch offset is out of range" );
+ if( offset < 0 || ( unsigned )offset >= ctx->m_len ) {
+ VF_REPORT( ctx, "Instruction branch offset is out of range" );
return VER_ErrorBranch;
}
+ ctx->m_bc[offset].m_is_bb_start = true;
return VER_OK;
-} // vf_check_branch_offset
+} // vf_check_branch_offset
/**
* Function parses local variable number from instruction bytecode.
*/
-static inline unsigned
-vf_get_local_var_number( vf_Code_t *code, // code instruction
- unsigned char *bytecode, // method bytecode
- unsigned *index_p, // index in bytecode array
- bool wide_flag) // if this is a wide instruction
+static inline unsigned short
+vf_get_local_var_number( vf_InstrHandle instr, // code instruction
+ unsigned char *bytecode, // method bytecode
+ unsigned *index_p, // index in bytecode array
+ bool wide_flag ) // if this is a wide instruction
{
- unsigned local;
+ unsigned short local;
- if( (wide_flag) ) {
+ if( ( wide_flag ) ) {
// get number of local variable
- local = (unsigned)( (bytecode[(*index_p)] << 8)|(bytecode[(*index_p)+ 1]) );
+ local =
+ ( unsigned short )( ( bytecode[( *index_p )] << 8 ) |
+ ( bytecode[( *index_p ) + 1] ) );
// skip parameter (u2)
- (*index_p) += 2;
+ ( *index_p ) += 2;
} else {
// get number of local variable
- local = (unsigned)bytecode[(*index_p)];
+ local = ( unsigned short )bytecode[( *index_p )];
// skip parameter (u1)
- (*index_p)++;
+ ( *index_p )++;
}
return local;
-} // vf_get_local_var_number
+} // vf_get_local_var_number
/**
- * Function receives half word (2 bytes) instruction branch offset
+ * Receives half word (2 bytes) instruction branch offset
* value from bytecode array.
*/
static inline int
-vf_get_hword_offset( unsigned code_pc, // instruction offset in bytecode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p) // offset index in bytecode array
+vf_get_hword_offset( unsigned code_pc, // instruction offset in bytecode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p ) // offset index in bytecode array
{
// get first branch offset
- int offset = (int)code_pc
- + (short)( (bytecode[(*index_p)] << 8)|(bytecode[(*index_p) + 1]) );
+ int offset = ( int )code_pc
+ +
+ ( short )( ( bytecode[( *index_p )] << 8 ) |
+ ( bytecode[( *index_p ) + 1] ) );
// skip parameter (s2)
- (*index_p) += 2;
+ ( *index_p ) += 2;
return offset;
-} // vf_get_hword_offset
+} // vf_get_hword_offset
/**
- * Function receives word (4 bytes) instruction branch offset value from bytecode array.
+ * Receives word (4 bytes) instruction branch offset value from bytecode array.
*/
static inline int
-vf_get_word_offset( unsigned code_pc, // instruction offset in bytecode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p) // offset index in bytecode array
+vf_get_word_offset( unsigned code_pc, // instruction offset in bytecode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p ) // offset index in bytecode array
{
// get switch branch offset
- int offset = (int)code_pc
- + (int)( (bytecode[(*index_p)] << 24)|(bytecode[(*index_p) + 1] << 16)
- |(bytecode[(*index_p) + 2] << 8)|(bytecode[(*index_p) + 3] ) );
+ int offset = ( int )code_pc
+ +
+ ( int )( ( bytecode[( *index_p )] << 24 ) |
+ ( bytecode[( *index_p ) + 1] << 16 )
+ | ( bytecode[( *index_p ) + 2] << 8 ) |
+ ( bytecode[( *index_p ) + 3] ) );
// skip parameter (s4)
- (*index_p) += 4;
+ ( *index_p ) += 4;
return offset;
-} // vf_get_word_offset
+} // vf_get_word_offset
/**
- * Function receives half word (2 bytes) branch offset from bytecode array,
+ * Receives half word (2 bytes) branch offset from bytecode array,
* sets into instruction and returns it.
*/
static inline int
-vf_get_single_hword_branch_offset( vf_Code_t *code, // instruction
- unsigned code_pc, // offset in bytecode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p, // offset index in bytecode array
- vf_VerifyPool_t * pool) // memory pool
+vf_get_single_hword_branch_offset( vf_Instr *instr, // instruction
+ unsigned code_pc, // offset in bytecode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p, // offset index in bytecode array
+ vf_Pool *pool ) // memory pool
{
// get first branch offset
int offset = vf_get_hword_offset( code_pc, bytecode, index_p );
// create and set edge branch for instruction
- vf_set_single_branch_offset( code, offset, pool );
+ vf_set_single_branch_offset( instr, offset, pool );
return offset;
-} // vf_get_single_hword_branch_offset
+} // vf_get_single_hword_branch_offset
/**
- * Function receives word (4 bytes) branch offset from bytecode array,
+ * Receives word (4 bytes) branch offset from bytecode array,
* sets into instruction and returns it.
*/
static inline int
-vf_get_single_word_branch_offset( vf_Code_t *code, // instruction
- unsigned code_pc, // offset in bytecode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p, // offset index in bytecode array
- vf_VerifyPool_t * pool) // memory pool
+vf_get_single_word_branch_offset( vf_Instr *instr, // instruction
+ unsigned code_pc, // offset in bytecode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p, // offset index in bytecode array
+ vf_Pool *pool ) // memory pool
{
// get first branch offset
int offset = vf_get_word_offset( code_pc, bytecode, index_p );
// create and set edge branch for instruction
- vf_set_single_branch_offset( code, offset, pool );
+ vf_set_single_branch_offset( instr, offset, pool );
return offset;
-} // vf_get_single_word_branch_offset
+} // vf_get_single_word_branch_offset
/**
- * Function receives half word (2 bytes) branch offset from bytecode array and
+ * Receives half word (2 bytes) branch offset from bytecode array and
* sets received offset and next instruction offset into instruction.
* Function returns received offset.
*/
static inline int
-vf_get_double_hword_branch_offset( vf_Code_t *code, // instruction
- unsigned code_pc, // instruction offset in bytcode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p, // offset index in bytecode array
- vf_VerifyPool_t *pool) // memory pool
+vf_get_double_hword_branch_offset( vf_Instr *instr, // instruction
+ unsigned code_pc, // instruction offset in bytcode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p, // offset index in bytecode array
+ vf_Pool *pool ) // memory pool
{
// get first branch offset
int offset = vf_get_hword_offset( code_pc, bytecode, index_p );
// create and set edge branches for instruction
- vf_create_code_offset( code, 2, pool );
+ vf_create_instr_offset( instr, 2, pool );
// set first edge branch for instruction
- vf_set_code_offset( code, 0, offset );
+ vf_set_instr_offset( instr, 0, offset );
// set second edge branch for instruction
- vf_set_code_offset( code, 1, (*index_p) );
+ vf_set_instr_offset( instr, 1, ( *index_p ) );
return offset;
-} // vf_get_double_hword_branch_offset
+} // vf_get_double_hword_branch_offset
/**
- * Function receives word (4 bytes) branch offset from bytecode array and
+ * Receives word (4 bytes) branch offset from bytecode array and
* sets received offset and next instruction offset into instruction.
* Function returns received offset.
*/
static inline int
-vf_get_double_word_branch_offset( vf_Code_t *code, // instruction
- unsigned code_pc, // instruction offset in bytcode array
- unsigned char *bytecode, // bytecode array
- unsigned *index_p, // offset index in bytecode array
- vf_VerifyPool_t *pool) // memory pool
+vf_get_double_word_branch_offset( vf_Instr *instr, // instruction
+ unsigned code_pc, // instruction offset in bytcode array
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p, // offset index in bytecode array
+ vf_Pool *pool ) // memory pool
{
// get first branch offset
int offset = vf_get_word_offset( code_pc, bytecode, index_p );
// create and set edge branches for instruction
- vf_create_code_offset( code, 2, pool );
+ vf_create_instr_offset( instr, 2, pool );
// set first edge branch for instruction
- vf_set_code_offset( code, 0, offset );
+ vf_set_instr_offset( instr, 0, offset );
// set second edge branch for instruction
- vf_set_code_offset( code, 1, (*index_p) );
+ vf_set_instr_offset( instr, 1, ( *index_p ) );
return offset;
-} // vf_get_double_word_branch_offset
+} // vf_get_double_word_branch_offset
/**
- * Function receives tableswitch branch from bytecode array and
+ * Receives tableswitch branch from bytecode array and
* sets received offset into instruction.
* Function returns received branch.
*/
static inline int
-vf_get_tableswitch_alternative( vf_Code_t *code, // instruction
- unsigned code_pc, // offset in bytcode array
- unsigned alternative, // number of tableswitch branch
- unsigned char *bytecode, // bytecode array
- unsigned *index_p) // offset index in bytecode array
+vf_get_tableswitch_alternative( vf_InstrHandle instr, // instruction
+ unsigned code_pc, // offset in bytcode array
+ unsigned alternative, // number of tableswitch branch
+ unsigned char *bytecode, // bytecode array
+ unsigned *index_p ) // offset index in bytecode array
{
// get first branch offset
int offset = vf_get_word_offset( code_pc, bytecode, index_p );
// set first edge branch for instruction
- vf_set_code_offset( code, alternative, offset );
+ vf_set_instr_offset( instr, alternative, offset );
return offset;
-} // vf_get_tableswitch_alternative
+} // vf_get_tableswitch_alternative
/**
- * Function receives tableswitch alternatives from bytecode array and
+ * Receives tableswitch alternatives from bytecode array and
* sets them into instruction.
* Function returns number of alternatives.
*/
static inline int
-vf_set_tableswitch_offsets( vf_Code_t *code, // instruction
- unsigned code_pc, // instruction offset in bytecode array
- unsigned *index_p, // offset index in bytecode array
+vf_set_tableswitch_offsets( vf_Instr *instr, // instruction
+ unsigned code_pc, // instruction offset in bytecode array
+ unsigned *index_p, // offset index in bytecode array
unsigned char *bytecode, // bytecode array
- vf_VerifyPool_t *pool) // memory pool
+ vf_Pool *pool ) // memory pool
{
// skip padding
- unsigned default_off = ((*index_p) + 0x3)&(~0x3U);
+ unsigned default_off = ( ( *index_p ) + 0x3 ) & ( ~0x3U );
unsigned index = default_off;
// skip default offset
index += 4;
@@ -453,34 +451,35 @@
int high = vf_get_word_offset( code_pc, bytecode, &index );
int number = high - low + 2;
// create tableswitch branches
- vf_create_code_offset( code, number, pool );
+ vf_create_instr_offset( instr, number, pool );
// set default offset
- vf_get_tableswitch_alternative( code, code_pc, 0, bytecode, &default_off );
+ vf_get_tableswitch_alternative( instr, code_pc, 0, bytecode,
+ &default_off );
// set another instruction offsets
for( int count = 1; count < number; count++ ) {
- vf_get_tableswitch_alternative( code, code_pc, count, bytecode,
+ vf_get_tableswitch_alternative( instr, code_pc, count, bytecode,
&index );
}
// set index next instruction
- (*index_p) = index;
+ ( *index_p ) = index;
return number;
-} // vf_set_tableswitch_offsets
+} // vf_set_tableswitch_offsets
/**
- * Function receives lookupswitch alternatives from bytecode array and
+ * Receives lookupswitch alternatives from bytecode array and
* sets them into instruction.
* Function returns number of alternatives.
*/
-static inline Verifier_Result
-vf_set_lookupswitch_offsets( vf_Code_t *code, // instruction
- unsigned code_pc, // instruction offset in bytecode
- unsigned *index_p, // offset index in bytecode array
+static inline vf_Result
+vf_set_lookupswitch_offsets( vf_Instr *instr, // instruction
+ unsigned code_pc, // instruction offset in bytecode
+ unsigned *index_p, // offset index in bytecode array
unsigned char *bytecode, // array of bytecode
unsigned *branch_p, // number of alternatives
- vf_Context_t *ctex) // verifier context
+ vf_Context *ctx ) // verification context
{
// skip padding
- unsigned default_off = ((*index_p) + 0x3)&(~0x3U);
+ unsigned default_off = ( ( *index_p ) + 0x3 ) & ( ~0x3U );
unsigned index = default_off;
// skip default offset
index += 4;
@@ -488,9 +487,10 @@
int number = vf_get_word_offset( 0, bytecode, &index ) + 1;
*branch_p = number;
// create and tableswitch branches
- vf_create_code_offset( code, number, ctex->m_pool );
+ vf_create_instr_offset( instr, number, ctx->m_pool );
// set default offset
- vf_get_tableswitch_alternative( code, code_pc, 0, bytecode, &default_off );
+ vf_get_tableswitch_alternative( instr, code_pc, 0, bytecode,
+ &default_off );
// set another instruction offsets
int old_key = INT_MIN;
for( int count = 1; count < number; count++ ) {
@@ -499,276 +499,261 @@
if( old_key < key ) {
old_key = key;
} else if( key != INT_MIN ) {
- VERIFY_REPORT_METHOD( ctex,
- "Instruction lookupswitch has unsorted key values" );
+ VF_REPORT( ctx,
+ "Instruction lookupswitch has unsorted key values" );
return VER_ErrorInstruction;
}
// get lookupswitch alternative and set offset to instruction
- vf_get_tableswitch_alternative( code, code_pc, count, bytecode,
+ vf_get_tableswitch_alternative( instr, code_pc, count, bytecode,
&index );
}
// set index next instruction
- (*index_p) = index;
+ ( *index_p ) = index;
return VER_OK;
-} // vf_set_lookupswitch_offsets
+} // vf_set_lookupswitch_offsets
/************************************************************
********************* Vector functions *********************
************************************************************/
/**
- * Function sets check type for a given stack map vector entry.
+ * Sets check type for a given stack map vector entry.
*/
static inline void
-vf_set_vector_check( vf_MapEntry_t *vector, // stack map vector
- unsigned num, // vector entry number
- vf_CheckConstraint_t check) // constraint check type
+vf_set_vector_check( vf_MapEntry *vector, // stack map vector
+ unsigned num, // vector entry number
+ vf_CheckConstraint check ) // constraint check type
{
// set check for map vector entry
assert( check < VF_CHECK_NUM );
vector[num].m_ctype = check;
- return;
-} // vf_set_vector_check
+} // vf_set_vector_check
/**
- * Function sets constraint pool index for a given stack map vector entry.
+ * Sets constraint pool index for a given stack map vector entry.
*/
static inline void
-vf_set_vector_check_index( vf_MapEntry_t *vector, // stack map vector
- unsigned num, // vector entry number
- unsigned short index) // constraint pool index
+vf_set_vector_check_index( vf_MapEntry *vector, // stack map vector
+ unsigned num, // vector entry number
+ unsigned short index ) // constraint pool index
{
// set index for a map vector entry
vector[num].m_index = index;
- return;
-} // vf_set_vector_check_index
+} // vf_set_vector_check_index
/**
- * Function sets a given data type to stack map vector entry.
+ * Sets a given data type to stack map vector entry.
*/
static inline void
-vf_set_vector_type( vf_MapEntry_t *vector, // stack map vector
- unsigned num, // vector entry number
- vf_MapType_t type) // stack map entry type
+vf_set_vector_type( vf_MapEntry *vector, // stack map vector
+ unsigned num, // vector entry number
+ vf_MapType type ) // stack map entry type
{
assert( type < SM_NUMBER );
vector[num].m_type = type;
-} // vf_set_vector_type
+} // vf_set_vector_type
/**
- * Function sets null data type for given stack map vector entry.
+ * Sets null data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_null( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_null( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by null
vector[num].m_type = SM_NULL;
- return;
-} // vf_set_vector_stack_entry_null
+} // vf_set_vector_stack_entry_null
/**
- * Function sets int data type for given stack map vector entry.
+ * Sets int data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_int( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_int( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by int
vector[num].m_type = SM_INT;
- return;
-} // vf_set_vector_stack_entry_int
+} // vf_set_vector_stack_entry_int
/**
- * Function sets float data type for given stack map vector entry.
+ * Sets float data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_float( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_float( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by float
vector[num].m_type = SM_FLOAT;
- return;
-} // vf_set_vector_stack_entry_float
+} // vf_set_vector_stack_entry_float
/**
- * Function sets long data type for given stack map vector entry.
+ * Sets long data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_long( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_long( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by long
vector[num].m_type = SM_LONG_HI;
vector[num + 1].m_type = SM_LONG_LO;
- return;
-} // vf_set_vector_stack_entry_long
+} // vf_set_vector_stack_entry_long
/**
- * Function sets double data type for given stack map vector entry.
+ * Sets double data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_double( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_double( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by double
vector[num].m_type = SM_DOUBLE_HI;
vector[num + 1].m_type = SM_DOUBLE_LO;
- return;
-} // vf_set_vector_stack_entry_double
+} // vf_set_vector_stack_entry_double
/**
- * Function sets return address data type for given stack map vector entry.
+ * Sets return address data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_addr( vf_MapEntry_t *vector, // stack map vector
- unsigned num, // vector entry number
- unsigned count) // program count
+vf_set_vector_stack_entry_addr( vf_MapEntry *vector, // stack map vector
+ unsigned num, // vector entry number
+ unsigned count ) // program count
{
// set stack map vector entry by return address
vector[num].m_type = SM_RETURN_ADDR;
vector[num].m_pc = count;
-} // vf_set_vector_stack_entry_addr
+} // vf_set_vector_stack_entry_addr
/**
- * Function sets single word data type for given stack map vector entry.
+ * Sets single word data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_word( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_word( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by word
vector[num].m_type = SM_WORD;
- return;
-} // vf_set_vector_stack_entry_word
+} // vf_set_vector_stack_entry_word
/**
- * Function sets double word data type for given stack map vector entry.
+ * Sets double word data type for given stack map vector entry.
*/
static inline void
-vf_set_vector_stack_entry_word2( vf_MapEntry_t *vector, // stack map vector
- unsigned num) // vector entry number
+vf_set_vector_stack_entry_word2( vf_MapEntry *vector, // stack map vector
+ unsigned num ) // vector entry number
{
// set stack map vector entry by double word
vector[num].m_type = SM_WORD2_HI;
vector[num + 1].m_type = SM_WORD2_LO;
- return;
-} // vf_set_vector_stack_entry_word2
+} // vf_set_vector_stack_entry_word2
/**
- * Function sets int data type for given local variable vector entry.
+ * Sets int data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_int( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- unsigned local) // number of local variable
+vf_set_vector_local_var_int( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ unsigned local ) // number of local variable
{
// set local variable vector entry by int
vector[num].m_type = SM_INT;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
- return;
-} // vf_set_vector_local_var_int
+ vector[num].m_local = ( unsigned short )local;
+} // vf_set_vector_local_var_int
/**
- * Function sets float data type for given local variable vector entry.
+ * Sets float data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_float( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- unsigned local) // number of local variable
+vf_set_vector_local_var_float( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ unsigned local ) // number of local variable
{
// set local variable vector entry by float
vector[num].m_type = SM_FLOAT;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
- return;
-} // vf_set_vector_local_var_float
+ vector[num].m_local = ( unsigned short )local;
+} // vf_set_vector_local_var_float
/**
- * Function sets long data type for given local variable vector entry.
+ * Sets long data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_long( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- unsigned local) // number of local variable
+vf_set_vector_local_var_long( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ unsigned local ) // number of local variable
{
// set local variable vector entry by long
vector[num].m_type = SM_LONG_HI;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
+ vector[num].m_local = ( unsigned short )local;
vector[num + 1].m_type = SM_LONG_LO;
vector[num + 1].m_is_local = true;
- vector[num + 1].m_local = (unsigned short)(local + 1);
- return;
-} // vf_set_vector_local_var_long
+ vector[num + 1].m_local = ( unsigned short )( local + 1 );
+} // vf_set_vector_local_var_long
/**
- * Function sets double data type for given local variable vector entry.
+ * Sets double data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_double( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- unsigned local) // number of local variable
+vf_set_vector_local_var_double( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ unsigned local ) // number of local variable
{
// set local variable vector entry by double
vector[num].m_type = SM_DOUBLE_HI;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
+ vector[num].m_local = ( unsigned short )local;
vector[num + 1].m_type = SM_DOUBLE_LO;
vector[num + 1].m_is_local = true;
- vector[num + 1].m_local = (unsigned short)(local + 1);
- return;
-} // vf_set_vector_local_var_double
+ vector[num + 1].m_local = ( unsigned short )( local + 1 );
+} // vf_set_vector_local_var_double
/**
- * Function sets reference data type for given local variable vector entry.
+ * Sets reference data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_ref( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- vf_ValidType_t *type, // reference type
- unsigned local) // number of local variable
+vf_set_vector_local_var_ref( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ vf_ValidType *type, // reference type
+ unsigned local ) // number of local variable
{
// set stack map vector entry by reference
vector[num].m_type = SM_REF;
vector[num].m_vtype = type;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
- return;
-} // vf_set_vector_local_var_ref
+ vector[num].m_local = ( unsigned short )local;
+} // vf_set_vector_local_var_ref
/**
- * Function sets return address data type for given local variable vector entry.
+ * Sets return address data type for given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_addr( vf_MapEntry_t *vector, // stack map vector
- unsigned num, // vector entry number
- unsigned count, // program count
- unsigned local) // number of local variable
+vf_set_vector_local_var_addr( vf_MapEntry *vector, // stack map vector
+ unsigned num, // vector entry number
+ unsigned count, // program count
+ unsigned local ) // number of local variable
{
// set local variable vector entry to return address
vector[num].m_type = SM_RETURN_ADDR;
vector[num].m_pc = count;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
-} // vf_set_vector_local_var_addr
+ vector[num].m_local = ( unsigned short )local;
+} // vf_set_vector_local_var_addr
/**
- * Function sets a given data type for a given local variable vector entry.
+ * Sets a given data type for a given local variable vector entry.
*/
static inline void
-vf_set_vector_local_var_type( vf_MapEntry_t *vector, // local variable vector
- unsigned num, // vector entry number
- vf_MapType_t type, // stack map entry type
- unsigned local) // number of local variable
+vf_set_vector_local_var_type( vf_MapEntry *vector, // local variable vector
+ unsigned num, // vector entry number
+ vf_MapType type, // stack map entry type
+ unsigned local ) // number of local variable
{
// set stack map vector entry by reference
vector[num].m_type = type;
vector[num].m_is_local = true;
- vector[num].m_local = (unsigned short)local;
- return;
-} // vf_set_vector_local_var_type
+ vector[num].m_local = ( unsigned short )local;
+} // vf_set_vector_local_var_type
/************************************************************
****************** IN Vector functions *********************
@@ -777,230 +762,176 @@
/**
* Allocates memory for new code instruction in the IN stack map vector.
*/
-static inline void
-vf_new_in_vector( vf_Code_t *code, // code instruction
- unsigned len, // vector length
- vf_VerifyPool_t *pool) // memory pool
+static inline void
+vf_new_in_vector( vf_Instr *instr, // code instruction
+ unsigned len, // vector length
+ vf_Pool *pool ) // memory pool
{
// create IN vector
- code->m_inlen = (unsigned short)len;
- code->m_invector =
- (vf_MapEntry_t*)vf_alloc_pool_memory( pool,
- len * sizeof( vf_MapEntry_t) );
- return;
-} // vf_new_in_vector
+ instr->m_inlen = ( unsigned short )len;
+ instr->m_invector =
+ (vf_MapEntry*)vf_palloc( pool, len * sizeof( vf_MapEntry ) );
+} // vf_new_in_vector
/**
* Sets check attribute for a code instruction in the IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_check( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- vf_CheckConstraint_t check) // constraint check type
+vf_set_in_vector_check( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ vf_CheckConstraint check ) // constraint check type
{
- vf_set_vector_check( code->m_invector, num, check );
- return;
-} // vf_set_in_vector_check
+ vf_set_vector_check( instr->m_invector, num, check );
+} // vf_set_in_vector_check
/**
- * Function sets constant pool index for a code instruction IN stack map vector entry.
+ * Sets constant pool index for a code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_check_index( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- unsigned short index) // constraint pool index
+vf_set_in_vector_check_index( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ unsigned short index ) // constraint pool index
{
- vf_set_vector_check_index( code->m_invector, num, index );
- return;
-} // vf_set_in_vector_check_index
+ vf_set_vector_check_index( instr->m_invector, num, index );
+} // vf_set_in_vector_check_index
/**
- * Function sets a given data type to stack map vector entry.
+ * Sets a given data type to stack map vector entry.
*/
static inline void
-vf_set_in_vector_type( vf_Code_t *code, // code instruction
- unsigned num, // vector entry number
- vf_MapType_t type) // stack map entry type
-{
- vf_set_vector_type( code->m_invector, num, type );
- return;
-} // vf_set_in_vector_type
-
-/**
- * Function sets null data type for code instruction IN stack map vector entry.
- */
-static inline void UNUSED
-vf_set_in_vector_stack_entry_null( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_type( vf_InstrHandle instr, // code instruction
+ unsigned num, // vector entry number
+ vf_MapType type ) // stack map entry type
{
- vf_set_vector_stack_entry_null( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_null
+ vf_set_vector_type( instr->m_invector, num, type );
+} // vf_set_in_vector_type
/**
- * Function sets int data type for code instruction IN stack map vector entry.
+ * Sets int data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_int( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_int( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_int( code->m_invector, num );
- return;
-} // vf_set_vector_stack_entry_int
+ vf_set_vector_stack_entry_int( instr->m_invector, num );
+} // vf_set_vector_stack_entry_int
/**
- * Function sets float data type for code instruction IN stack map vector entry.
+ * Sets float data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_float( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_float( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_float( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_float
+ vf_set_vector_stack_entry_float( instr->m_invector, num );
+} // vf_set_in_vector_stack_entry_float
/**
- * Function sets long data type for code instruction IN stack map vector entry.
+ * Sets long data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_long( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_long( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_long( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_long
+ vf_set_vector_stack_entry_long( instr->m_invector, num );
+} // vf_set_in_vector_stack_entry_long
/**
- * Function sets double data type for code instruction IN stack map vector entry.
+ * Sets double data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_double( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_double( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_double( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_double
+ vf_set_vector_stack_entry_double( instr->m_invector, num );
+} // vf_set_in_vector_stack_entry_double
/**
- * Function sets reference data type for code instruction IN stack map vector entry.
+ * Sets reference data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_ref( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- vf_ValidType_t *type) // reference type
+vf_set_in_vector_stack_entry_ref( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ vf_ValidType *type ) // reference type
{
- vf_set_vector_stack_entry_ref( code->m_invector, num, type );
- return;
-} // vf_set_in_vector_stack_entry_ref
+ vf_set_vector_stack_entry_ref( instr->m_invector, num, type );
+} // vf_set_in_vector_stack_entry_ref
/**
- * Function sets single word data type for code instruction IN stack map vector entry.
+ * Sets single word data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_word( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_word( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_word( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_word
+ vf_set_vector_stack_entry_word( instr->m_invector, num );
+} // vf_set_in_vector_stack_entry_word
/**
- * Function sets double word data type for code instruction IN stack map vector entry.
+ * Sets double word data type for code instruction IN stack map vector entry.
*/
static inline void
-vf_set_in_vector_stack_entry_word2( vf_Code_t *code, // code instruction
- unsigned num) // IN vector entry number
+vf_set_in_vector_stack_entry_word2( vf_InstrHandle instr, // code instruction
+ unsigned num ) // IN vector entry number
{
- vf_set_vector_stack_entry_word2( code->m_invector, num );
- return;
-} // vf_set_in_vector_stack_entry_word2
+ vf_set_vector_stack_entry_word2( instr->m_invector, num );
+} // vf_set_in_vector_stack_entry_word2
/**
- * Function sets int data type for code instruction IN local variable vector entry.
+ * Sets int data type for code instruction IN local variable vector entry.
*/
static inline void
-vf_set_in_vector_local_var_int( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- unsigned local) // local variable number
+vf_set_in_vector_local_var_int( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_int( code->m_invector, num, local );
- return;
-} // vf_set_in_vector_local_var_int
+ vf_set_vector_local_var_int( instr->m_invector, num, local );
+} // vf_set_in_vector_local_var_int
/**
- * Function sets float data type for code instruction IN local variable vector entry.
+ * Sets float data type for code instruction IN local variable vector entry.
*/
static inline void
-vf_set_in_vector_local_var_float( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- unsigned local) // local variable number
+vf_set_in_vector_local_var_float( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_float( code->m_invector, num, local );
- return;
-} // vf_set_in_vector_local_var_float
+ vf_set_vector_local_var_float( instr->m_invector, num, local );
+} // vf_set_in_vector_local_var_float
/**
- * Function sets long data type for code instruction IN local variable vector entry.
+ * Sets long data type for code instruction IN local variable vector entry.
*/
static inline void
-vf_set_in_vector_local_var_long( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- unsigned local) // local variable number
+vf_set_in_vector_local_var_long( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_long( code->m_invector, num, local );
- return;
-} // vf_set_in_vector_local_var_long
+ vf_set_vector_local_var_long( instr->m_invector, num, local );
+} // vf_set_in_vector_local_var_long
/**
- * Function sets double data type for code instruction IN local variable vector entry.
+ * Sets double data type for code instruction IN local variable vector entry.
*/
static inline void
-vf_set_in_vector_local_var_double( vf_Code_t *code, // code instruction
+vf_set_in_vector_local_var_double( vf_InstrHandle instr, // code instruction
unsigned num, // IN vector entry number
- unsigned local) // local variable number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_double( code->m_invector, num, local );
- return;
-} // vf_set_in_vector_local_var_double
+ vf_set_vector_local_var_double( instr->m_invector, num, local );
+} // vf_set_in_vector_local_var_double
/**
- * Function sets reference data type for code instruction IN local variable vector entry.
+ * Sets reference data type for code instruction IN local variable vector entry.
*/
static inline void
-vf_set_in_vector_local_var_ref( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- vf_ValidType_t *type, // reference type
- unsigned local) // local variable number
+vf_set_in_vector_local_var_ref( vf_InstrHandle instr, // code instruction
+ unsigned num, // IN vector entry number
+ vf_ValidType *type, // reference type
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_ref( code->m_invector, num, type, local );
- return;
-} // vf_set_in_vector_local_var_ref
-
-/**
- * Function sets return address data type for code instruction IN local variable vector entry.
- */
-static inline void
-vf_set_in_vector_local_var_addr( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- unsigned count, // program count
- unsigned local) // local variable number
-{
- vf_set_vector_local_var_addr( code->m_invector, num, count, local );
- return;
-} // vf_set_in_vector_local_var_addr
-
-/**
- * Function sets a given data type for code instruction IN local variable vector entry.
- */
-static inline void UNUSED
-vf_set_in_vector_local_var_type( vf_Code_t *code, // code instruction
- unsigned num, // IN vector entry number
- vf_MapType_t type, // stack map entry
- unsigned local) // local variable number
-{
- vf_set_vector_local_var_type( code->m_invector, num, type, local );
- return;
-} // vf_set_in_vector_local_var_type
+ vf_set_vector_local_var_ref( instr->m_invector, num, type, local );
+} // vf_set_in_vector_local_var_ref
/************************************************************
***************** OUT Vector functions *********************
@@ -1009,235 +940,158 @@
/**
* Function allocates memory for new code instruction OUT stack map vector.
*/
-static inline void
-vf_new_out_vector( vf_Code_t *code, // code instruction
- unsigned len, // vector length
- vf_VerifyPool_t *pool) // memory pool
+static inline void
+vf_new_out_vector( vf_Instr *instr, // code instruction
+ unsigned len, // vector length
+ vf_Pool *pool ) // memory pool
{
// create stack map OUT vector
- code->m_outlen = (unsigned short)len;
- code->m_outvector =
- (vf_MapEntry_t*)vf_alloc_pool_memory( pool,
- len * sizeof( vf_MapEntry_t ) );
- return;
-} // vf_new_out_vector
+ instr->m_outlen = ( unsigned short )len;
+ instr->m_outvector =
+ (vf_MapEntry*)vf_palloc( pool, len * sizeof( vf_MapEntry ) );
+} // vf_new_out_vector
/**
- * Function sets check attribute for a code instruction OUT stack map vector entry.
- */
-static inline void UNUSED
-vf_set_out_vector_check( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- vf_CheckConstraint_t check) // constraint check type
-{
- vf_set_vector_check( code->m_outvector, num, check );
- return;
-} // vf_set_out_vector_check
-
-/**
- * Function sets check attribute for code instruction OUT stack map vector entry.
- */
-static inline void UNUSED
-vf_set_out_vector_check_index( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- unsigned short index) // constraint pool index
-{
- vf_set_vector_check_index( code->m_outvector, num, index );
- return;
-} // vf_set_out_vector_check_index
-
-/**
- * Function sets a given data type to stack map OUT vector entry.
+ * Sets a given data type to stack map OUT vector entry.
*/
static inline void
-vf_set_out_vector_type( vf_Code_t *code, // code instruction
- unsigned num, // vector entry number
- vf_MapType_t type) // stack map entry type
+vf_set_out_vector_type( vf_InstrHandle instr, // code instruction
+ unsigned num, // vector entry number
+ vf_MapType type ) // stack map entry type
{
- vf_set_vector_type( code->m_outvector, num, type );
- return;
-} // vf_set_out_vector_type
+ vf_set_vector_type( instr->m_outvector, num, type );
+} // vf_set_out_vector_type
/**
- * Function sets a given program counter to stack map OUT vector entry.
+ * Sets a given program counter to stack map OUT vector entry.
*/
static inline void
-vf_set_out_vector_opcode_new( vf_Code_t *code, // code instruction
- unsigned num, // vector entry number
- unsigned opcode_new) // new opcode
+vf_set_out_vector_opcode_new( vf_InstrHandle instr, // code instruction
+ unsigned num, // vector entry number
+ unsigned opcode_new ) // new opcode
{
- code->m_outvector[num].m_new = opcode_new;
- return;
-} // vf_set_out_vector_opcode_new
+ instr->m_outvector[num].m_new = opcode_new;
+} // vf_set_out_vector_opcode_new
/**
- * Function sets null data type for code instruction OUT stack map vector entry.
- */
-static inline void UNUSED
-vf_set_out_vector_stack_entry_null( vf_Code_t *code, // code instruction
- unsigned num) // OUT vector entry number
-{
- vf_set_vector_stack_entry_null( code->m_outvector, num );
- return;
-} // vf_set_out_vector_stack_entry_null
-
-/**
- * Function sets int data type for code instruction OUT stack map vector entry.
+ * Sets int data type for code instruction OUT stack map vector entry.
*/
static inline void
-vf_set_out_vector_stack_entry_int( vf_Code_t *code, // code instruction
- unsigned num) // OUT vector entry number
+vf_set_out_vector_stack_entry_int( vf_InstrHandle instr, // code instruction
+ unsigned num ) // OUT vector entry number
{
- vf_set_vector_stack_entry_int( code->m_outvector, num );
- return;
-} // vf_set_vector_stack_entry_int
+ vf_set_vector_stack_entry_int( instr->m_outvector, num );
+} // vf_set_vector_stack_entry_int
/**
- * Function sets float data type for code instruction OUT stack map vector entry.
+ * Sets float data type for code instruction OUT stack map vector entry.
*/
static inline void
-vf_set_out_vector_stack_entry_float( vf_Code_t *code, // code instruction
- unsigned num) // OUT vector entry number
+vf_set_out_vector_stack_entry_float( vf_InstrHandle instr, // code instruction
+ unsigned num ) // OUT vector entry number
{
- vf_set_vector_stack_entry_float( code->m_outvector, num );
- return;
-} // vf_set_out_vector_stack_entry_float
+ vf_set_vector_stack_entry_float( instr->m_outvector, num );
+} // vf_set_out_vector_stack_entry_float
/**
- * Function sets long data type for code instruction OUT stack map vector entry.
+ * Sets long data type for code instruction OUT stack map vector entry.
*/
static inline void
-vf_set_out_vector_stack_entry_long( vf_Code_t *code, // code instruction
- unsigned num) // OUT vector entry number
+vf_set_out_vector_stack_entry_long( vf_InstrHandle instr, // code instruction
+ unsigned num ) // OUT vector entry number
{
- vf_set_vector_stack_entry_long( code->m_outvector, num );
- return;
-} // vf_set_out_vector_stack_entry_long
+ vf_set_vector_stack_entry_long( instr->m_outvector, num );
+} // vf_set_out_vector_stack_entry_long
/**
- * Function sets double data type for code instruction OUT stack map vector entry.
+ * Sets double data type for code instruction OUT stack map vector entry.
*/
static inline void
-vf_set_out_vector_stack_entry_double( vf_Code_t *code, // code instruction
- unsigned num) // OUT vector entry number
+vf_set_out_vector_stack_entry_double( vf_InstrHandle instr, // code instruction
+ unsigned num ) // OUT vector entry number
{
- vf_set_vector_stack_entry_double( code->m_outvector, num );
- return;
-} // vf_set_out_vector_stack_entry_double
+ vf_set_vector_stack_entry_double( instr->m_outvector, num );
+} // vf_set_out_vector_stack_entry_double
/**
- * Function sets reference data type for code instruction OUT stack map vector entry.
+ * Sets reference data type for code instruction OUT stack map vector entry.
*/
static inline void
-vf_set_out_vector_stack_entry_ref( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- vf_ValidType_t *type) // reference type
-{
- vf_set_vector_stack_entry_ref( code->m_outvector, num, type );
- return;
-} // vf_set_out_vector_stack_entry_ref
-
-/**
- * Function sets return address data type for code instruction OUT stack map vector entry.
- */
-static inline void
-vf_set_out_vector_stack_entry_addr( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- unsigned count) // program count
+vf_set_out_vector_stack_entry_ref( vf_InstrHandle instr, // code instruction
+ unsigned num, // OUT vector entry number
+ vf_ValidType *type ) // reference type
{
- vf_set_vector_stack_entry_addr( code->m_outvector, num, count );
- return;
-} // vf_set_out_vector_stack_entry_addr
+ vf_set_vector_stack_entry_ref( instr->m_outvector, num, type );
+} // vf_set_out_vector_stack_entry_ref
/**
- * Function sets int data type for code instruction OUT local variable vector entry.
+ * Sets int data type for code instruction OUT local variable vector entry.
*/
static inline void
-vf_set_out_vector_local_var_int( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- unsigned local) // local variable number
+vf_set_out_vector_local_var_int( vf_InstrHandle instr, // code instruction
+ unsigned num, // OUT vector entry number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_int( code->m_outvector, num, local );
- return;
-} // vf_set_out_vector_local_var_int
+ vf_set_vector_local_var_int( instr->m_outvector, num, local );
+} // vf_set_out_vector_local_var_int
/**
- * Function sets float data type for code instruction OUT local variable vector entry.
+ * Sets float data type for code instruction OUT local variable vector entry.
*/
static inline void
-vf_set_out_vector_local_var_float( vf_Code_t *code, // code instruction
+vf_set_out_vector_local_var_float( vf_InstrHandle instr, // code instruction
unsigned num, // OUT vector entry number
- unsigned local) // local variable number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_float( code->m_outvector, num, local );
- return;
-} // vf_set_out_vector_local_var_float
+ vf_set_vector_local_var_float( instr->m_outvector, num, local );
+} // vf_set_out_vector_local_var_float
/**
- * Function sets long data type for code instruction OUT local variable vector entry.
+ * Sets long data type for code instruction OUT local variable vector entry.
*/
static inline void
-vf_set_out_vector_local_var_long( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- unsigned local) // local variable number
+vf_set_out_vector_local_var_long( vf_InstrHandle instr, // code instruction
+ unsigned num, // OUT vector entry number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_long( code->m_outvector, num, local );
- return;
-} // vf_set_out_vector_local_var_long
+ vf_set_vector_local_var_long( instr->m_outvector, num, local );
+} // vf_set_out_vector_local_var_long
/**
- * Function sets double data type for code instruction OUT local variable vector entry.
+ * Sets double data type for code instruction OUT local variable vector entry.
*/
static inline void
-vf_set_out_vector_local_var_double( vf_Code_t *code, // code instruction
+vf_set_out_vector_local_var_double( vf_InstrHandle instr, // code instruction
unsigned num, // OUT vector entry number
- unsigned local) // local variable number
-{
- vf_set_vector_local_var_double( code->m_outvector, num, local );
- return;
-} // vf_set_out_vector_local_var_double
-
-/**
- * Function sets reference data type for code instruction OUT local variable vector entry.
- */
-static inline void UNUSED
-vf_set_out_vector_local_var_ref( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- vf_ValidType_t *type, // reference type
- unsigned local) // local variable number
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_ref( code->m_outvector, num, type, local );
- return;
-} // vf_set_out_vector_local_var_ref
+ vf_set_vector_local_var_double( instr->m_outvector, num, local );
+} // vf_set_out_vector_local_var_double
/**
- * Function sets a given data type for code instruction OUT local variable vector entry.
+ * Sets a given data type for code instruction OUT local variable vector entry.
*/
static inline void
-vf_set_out_vector_local_var_type( vf_Code_t *code, // code instruction
- unsigned num, // OUT vector entry number
- vf_MapType_t type, // stack map entry
- unsigned local) // local variable number
+vf_set_out_vector_local_var_type( vf_InstrHandle instr, // code instruction
+ unsigned num, // OUT vector entry number
+ vf_MapType type, // stack map entry
+ unsigned local ) // local variable number
{
- vf_set_vector_local_var_type( code->m_outvector, num, type, local );
- return;
-} // vf_set_in_vector_local_var_type
+ vf_set_vector_local_var_type( instr->m_outvector, num, type, local );
+} // vf_set_out_vector_local_var_type
/************************************************************
************** Parse description functions *****************
************************************************************/
/**
- * Function parses method, class or field descriptions.
+ * Parses method, class or field descriptions.
*/
void
-vf_parse_description( const char *descr, // descriptor of method, class or field
- int *inlen, // returned number of IN descriptor parameters
- int *outlen) // returned number of OUT descriptor
+vf_parse_description( const char *descr, // descriptor of method, class or field
+ unsigned short *inlen, // returned number of IN descriptor parameters
+ unsigned short *outlen ) // returned number of OUT descriptor
// parameters (for method)
{
- int *count;
- unsigned index;
-
/**
* Check parameters
*/
@@ -1252,19 +1106,21 @@
*outlen = 0;
}
bool array = false;
- for( index = 0, count = inlen; descr[index]; index++ ) {
- switch( descr[index] )
- {
+
+ // start parsing input parameters
+ unsigned short *count = inlen;
+ for( unsigned short index = 0; descr[index]; index++ ) {
+ switch ( descr[index] ) {
case 'L':
- // skip method name
+ // skip class name
do {
index++;
-#if _VERIFY_DEBUG
+#if _VF_DEBUG
if( !descr[index] ) {
- VERIFY_DEBUG( "vf_parse_description: incorrect structure of constant pool" );
- vf_error();
+ VF_DIE
+ ( "vf_parse_description: incorrect structure of constant pool" );
}
-#endif // _VERIFY_DEBUG
+#endif // _VF_DEBUG
} while( descr[index] != ';' );
case 'B':
case 'C':
@@ -1273,7 +1129,7 @@
case 'S':
case 'Z':
if( !array ) {
- (*count)++; // increase stack value
+ ( *count )++; // increase stack value
} else {
array = false; // reset array structure
}
@@ -1282,9 +1138,9 @@
case 'D':
case 'J':
if( !array ) {
- (*count) += 2; // increase stack value
+ ( *count ) += 2; // increase stack value
} else {
- array = false; // reset array structure
+ array = false; // reset array structure
}
break;
case '[':
@@ -1292,15 +1148,15 @@
// skip array structure
do {
index++;
-#if _VERIFY_DEBUG
+#if _VF_DEBUG
if( !descr[index] ) {
- VERIFY_DEBUG( "vf_parse_description: incorrect structure of constant pool" );
- vf_error();
+ VF_DIE
+ ( "vf_parse_description: incorrect structure of constant pool" );
}
-#endif // _VERIFY_DEBUG
+#endif // _VF_DEBUG
} while( descr[index] == '[' );
index--;
- (*count)++; // increase stack value
+ ( *count )++; // increase stack value
break;
case '(':
// parse arguments
@@ -1311,47 +1167,42 @@
count = outlen;
break;
default:
- LDIE(37, "Verifier: vf_parse_description: incorrect structure of constant pool" );
+ VF_DIE
+ ( "vf_parse_description: incorrect structure of constant pool" );
break;
}
}
- return;
-} // vf_parse_description
+} // vf_parse_description
static inline void
vf_set_array_ref( const char *type,
unsigned len,
- vf_MapEntry_t *vector,
- unsigned *index,
- vf_Context_t *ctex)
+ vf_MapEntry *vector, unsigned *index, vf_ContextHandle ctx )
{
// set array reference entry
- vf_ValidType_t *valid = ctex->m_type->NewType( type, len );
+ vf_ValidType *valid = ctx->m_type->NewType( type, len );
vf_set_vector_stack_entry_ref( vector, *index, valid );
- (*index)++;
- return;
-} // vf_set_array_ref
+ ( *index )++;
+} // vf_set_array_ref
/**
* Function parses descriptor and sets input and output data flow vectors.
*/
void
-vf_set_description_vector( const char *descr, // descriptor
- int inlen, // number of entries for IN vector
- int add, // additional number of entries
- // to IN data flow vector
- int outlen, // number of entries for OUT vector
- vf_MapEntry_t **invector, // pointer to IN vector
- vf_MapEntry_t **outvector, // pointer to OUT vector
- vf_Context_t *ctex) // verifier context
+vf_set_description_vector( const char *descr, // descriptor
+ unsigned short inlen, // number of entries for IN vector
+ unsigned short add, // additional number of entries
+ // to IN data flow vector
+ unsigned short outlen, // number of entries for OUT vector
+ vf_MapEntry **invector, // pointer to IN vector
+ vf_MapEntry **outvector, // pointer to OUT vector
+ vf_ContextHandle ctx ) // verification context
{
const char *type = 0;
- unsigned index,
- count = 0,
- vector_index;
- vf_MapEntry_t **vector;
- vf_ValidType_t *valid;
- vf_VerifyPool_t *pool = ctex->m_pool;
+ unsigned index, count = 0, vector_index;
+ vf_MapEntry **vector;
+ vf_ValidType *valid;
+ vf_Pool *pool = ctx->m_pool;
/**
* Check parameters
@@ -1376,8 +1227,7 @@
bool array = false;
vector_index = add;
for( index = 0, vector = invector; descr[index]; index++ ) {
- switch( descr[index] )
- {
+ switch ( descr[index] ) {
case 'L':
// skip method name
if( !array ) {
@@ -1389,11 +1239,12 @@
} while( descr[index] != ';' );
if( !array ) {
// set vector reference entry
- valid = ctex->m_type->NewType( type, index - count );
+ valid = ctx->m_type->NewType( type, index - count );
vf_set_vector_stack_entry_ref( *vector, vector_index, valid );
vector_index++;
} else {
- vf_set_array_ref( type, index - count, *vector, &vector_index, ctex );
+ vf_set_array_ref( type, index - count, *vector, &vector_index,
+ ctx );
// reset array structure
array = false;
}
@@ -1407,12 +1258,13 @@
// set integer array type
unsigned iter;
unsigned len = index - count + 1;
- char *int_array = (char*)vf_alloc_pool_memory( pool, len );
+ char *int_array = (char*)vf_palloc( pool, len );
for( iter = 0; iter < len - 1; iter++ ) {
int_array[iter] = '[';
}
int_array[iter] = 'B';
- vf_set_array_ref( int_array, len, *vector, &vector_index, ctex );
+ vf_set_array_ref( int_array, len, *vector, &vector_index,
+ ctx );
// reset array structure
array = false;
}
@@ -1426,7 +1278,8 @@
vf_set_vector_stack_entry_int( *vector, vector_index );
vector_index++;
} else {
- vf_set_array_ref( type, index - count + 1, *vector, &vector_index, ctex );
+ vf_set_array_ref( type, index - count + 1, *vector,
+ &vector_index, ctx );
// reset array structure
array = false;
}
@@ -1437,7 +1290,8 @@
vf_set_vector_stack_entry_float( *vector, vector_index );
vector_index++;
} else {
- vf_set_array_ref( type, index - count + 1, *vector, &vector_index, ctex );
+ vf_set_array_ref( type, index - count + 1, *vector,
+ &vector_index, ctx );
// reset array structure
array = false;
}
@@ -1448,7 +1302,8 @@
vf_set_vector_stack_entry_double( *vector, vector_index );
vector_index += 2;
} else {
- vf_set_array_ref( type, index - count + 1, *vector, &vector_index, ctex );
+ vf_set_array_ref( type, index - count + 1, *vector,
+ &vector_index, ctx );
// reset array structure
array = false;
}
@@ -1459,7 +1314,8 @@
vf_set_vector_stack_entry_long( *vector, vector_index );
vector_index += 2;
} else {
- vf_set_array_ref( type, index - count + 1, *vector, &vector_index, ctex );
+ vf_set_array_ref( type, index - count + 1, *vector,
+ &vector_index, ctx );
// reset array structure
array = false;
}
@@ -1490,8 +1346,7 @@
break;
}
}
- return;
-} // vf_set_description_vector
+} // vf_set_description_vector
/************************************************************
**************** Constant pool functions *******************
@@ -1502,41 +1357,42 @@
*/
static inline const char *
vf_get_name_from_cp_nameandtype( unsigned short index, // constant pool entry index
- vf_Context_t *ctex) // verifier context
+ vf_ContextHandle ctx ) // verification context
{
// get name constant pool index
- unsigned short name_cp_index =
- class_get_cp_name_index( ctex->m_class, index );
+ unsigned short name_cp_index =
+ class_get_cp_name_index( ctx->m_class, index );
// get name string from NameAndType constant pool entry
- const char* name = class_get_cp_utf8_bytes( ctex->m_class, name_cp_index );
+ const char *name = class_get_cp_utf8_bytes( ctx->m_class, name_cp_index );
return name;
-} // vf_get_name_from_cp_nameandtype
+} // vf_get_name_from_cp_nameandtype
/**
* Function returns descriptor string from NameAndType constant pool entry.
*/
static inline const char *
-vf_get_decriptor_from_cp_nameandtype( unsigned short index, // constant pool entry index
- vf_Context_t *ctex) // verifier context
+vf_get_decriptor_from_cp_nameandtype( unsigned short index, // constant pool entry index
+ vf_ContextHandle ctx ) // verification context
{
// get description constant pool index
- unsigned short descr_cp_index =
- class_get_cp_descriptor_index( ctex->m_class, index );
+ unsigned short descr_cp_index =
+ class_get_cp_descriptor_index( ctx->m_class, index );
// get descriptor from NameAndType constant pool entry
- const char* descr = class_get_cp_utf8_bytes( ctex->m_class, descr_cp_index );
-
+ const char *descr =
+ class_get_cp_utf8_bytes( ctx->m_class, descr_cp_index );
+
return descr;
-} // vf_get_cp_nameandtype
+} // vf_get_cp_nameandtype
/**
* Function returns valid type string by given class name.
*/
static inline const char *
-vf_get_class_valid_type( const char *class_name, // class name
- size_t name_len, // class name length
- size_t *len, // length of created string
- vf_VerifyPool_t *pool) // memory pool
+vf_get_class_valid_type( const char *class_name, // class name
+ size_t name_len, // class name length
+ size_t * len, // length of created string
+ vf_Pool *pool ) // memory pool
{
char *result;
@@ -1551,11 +1407,10 @@
// primitive type array
*len = name_len;
result = (char*)class_name;
- switch( class_name[name_len - 1] )
- {
[... 5758 lines stripped ...]