Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 28088 invoked from network); 18 Apr 2008 15:30:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2008 15:30:27 -0000 Received: (qmail 70061 invoked by uid 500); 18 Apr 2008 15:30:27 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 69952 invoked by uid 500); 18 Apr 2008 15:30:27 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 69820 invoked by uid 99); 18 Apr 2008 15:30:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 08:30:26 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 15:29:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5F22A1A983E; Fri, 18 Apr 2008 08:30:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r649574 [1/6] - in /harmony/enhanced/drlvm/trunk: ./ make/vm/ vm/include/open/ vm/vmcore/include/ vm/vmcore/src/verifier-3363/base/ vm/vmcore/src/verifier-3363/java5/ vm/vmcore/src/verifier-3363/java6/ vm/vmcore/src/verifier-3363/x_verifier/ Date: Fri, 18 Apr 2008 15:29:41 -0000 To: commits@harmony.apache.org From: mcfirst@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080418153001.5F22A1A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mcfirst Date: Fri Apr 18 08:29:36 2008 New Revision: 649574 URL: http://svn.apache.org/viewvc?rev=649574&view=rev Log: Applying the patch from HARMONY-5750 [drlvm][verifier-ext] compiled verifier extension with VC6 and bundled with headers Modified: harmony/enhanced/drlvm/trunk/build.xml harmony/enhanced/drlvm/trunk/make/vm/verifier-ext.xml harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/instr_props.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/stackmap.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/stackmap_x.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/tpool.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/tpool.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/ver_utils.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/vf_resolve.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java5/context_5.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java5/context_5.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java5/instr_props_5.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java5/stackmap_5.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/context_6.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/java6/stackmap_6.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h Modified: harmony/enhanced/drlvm/trunk/build.xml URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build.xml?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/build.xml (original) +++ harmony/enhanced/drlvm/trunk/build.xml Fri Apr 18 08:29:36 2008 @@ -90,7 +90,6 @@ vmi, jitrino, gc_gen, - verifier-ext, deploy, deploy-relocate, deploy-canonical" @@ -135,8 +134,12 @@ - + + + + + Modified: harmony/enhanced/drlvm/trunk/make/vm/verifier-ext.xml URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/make/vm/verifier-ext.xml?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/make/vm/verifier-ext.xml (original) +++ harmony/enhanced/drlvm/trunk/make/vm/verifier-ext.xml Fri Apr 18 08:29:36 2008 @@ -19,28 +19,55 @@ + + + + + + + + + + + + + + + + + + + + + + + - - + + + + todir="${drlvm.deploy.dir}/lib" /> + + Modified: harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h (original) +++ harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h Fri Apr 18 08:29:36 2008 @@ -34,17 +34,22 @@ #else // !PLATFORM_POSIX -#if defined(BUILDING_VM) && !defined(STATIC_BUILD) +#if defined(STATIC_BUILD) +#define VMEXPORT +#define JITEXPORT +#define EMEXPORT +#define VMIMPORT +#elif defined(BUILDING_VM) #define VMEXPORT __declspec(dllexport) #define JITEXPORT __declspec(dllimport) #define EMEXPORT __declspec(dllimport) #define VMIMPORT __declspec(dllimport) -#else // !BUILDING_VM +#else // !BUILDING_VM & !STATIC_BUILD #define VMEXPORT __declspec(dllimport) #define JITEXPORT __declspec(dllexport) #define EMEXPORT __declspec(dllexport) #define VMIMPORT __declspec(dllexport) -#endif // !BUILDING_VM +#endif // !BUILDING_VM & !STATIC_BUILD #endif // !PLATFORM_POSIX Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_interface.h Fri Apr 18 08:29:36 2008 @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef __CLASS_INTERFACE_H__ -#define __CLASS_INTERFACE_H__ +#ifndef _CLASS_INTERFACE_H +#define _CLASS_INTERFACE_H /** - * Enum of constant pool tags + * Constant pool tags. */ typedef enum { _CONSTANT_Unknown = 0, @@ -35,4 +35,5 @@ _CONSTANT_NameAndType = 12 } ClassConstantPoolTags; -#endif +#endif /* _CLASS_INTERFACE_H */ + Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.cpp Fri Apr 18 08:29:36 2008 @@ -14,377 +14,368 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Mikhail Loenko, Vladimir Molotkov - */ - #include "open/vm_class_loading.h" #include "verifier.h" #include "context_base.h" -namespace CPVerifier { +/** + * Data for parsing for each instruction (length and flags). + */ +ParseInfo vf_Context_Base::parseTable[255] = { + + /* 0x00 OP_NOP */ { 1, 0 }, + + /* 0x01 OP_ACONST_NULL */ { 1, 0 }, + /* 0x02 OP_ICONST_M1 */ { 1, 0 }, + /* 0x03 OP_ICONST_0 */ { 1, 0 }, + /* 0x04 OP_ICONST_1 */ { 1, 0 }, + /* 0x05 OP_ICONST_2 */ { 1, 0 }, + /* 0x06 OP_ICONST_3 */ { 1, 0 }, + /* 0x07 OP_ICONST_4 */ { 1, 0 }, + /* 0x08 OP_ICONST_5 */ { 1, 0 }, + /* 0x09 OP_LCONST_0 */ { 1, 0 }, + /* 0x0a OP_LCONST_1 */ { 1, 0 }, + /* 0x0b OP_FCONST_0 */ { 1, 0 }, + /* 0x0c OP_FCONST_1 */ { 1, 0 }, + /* 0x0d OP_FCONST_2 */ { 1, 0 }, + /* 0x0e OP_DCONST_0 */ { 1, 0 }, + /* 0x0f OP_DCONST_1 */ { 1, 0 }, + + /* 0x10 OP_BIPUSH */ { 2, 0 }, + /* 0x11 OP_SIPUSH */ { 3, 0 }, + + /* 0x12 OP_LDC */ { 2, 0 }, + /* 0x13 OP_LDC_W */ { 3, 0 }, + /* 0x14 OP_LDC2_W */ { 3, 0 }, + + /* 0x15 OP_ILOAD */ { 2, PI_CANWIDE }, + /* 0x16 OP_LLOAD */ { 2, PI_CANWIDE }, + /* 0x17 OP_FLOAD */ { 2, PI_CANWIDE }, + /* 0x18 OP_DLOAD */ { 2, PI_CANWIDE }, + /* 0x19 OP_ALOAD */ { 2, PI_CANWIDE }, + + /* 0x1a OP_ILOAD_0 */ { 1, 0 }, + /* 0x1b OP_ILOAD_1 */ { 1, 0 }, + /* 0x1c OP_ILOAD_2 */ { 1, 0 }, + /* 0x1d OP_ILOAD_3 */ { 1, 0 }, + /* 0x1e OP_LLOAD_0 */ { 1, 0 }, + /* 0x1f OP_LLOAD_1 */ { 1, 0 }, + /* 0x20 OP_LLOAD_2 */ { 1, 0 }, + /* 0x21 OP_LLOAD_3 */ { 1, 0 }, + /* 0x22 OP_FLOAD_0 */ { 1, 0 }, + /* 0x23 OP_FLOAD_1 */ { 1, 0 }, + /* 0x24 OP_FLOAD_2 */ { 1, 0 }, + /* 0x25 OP_FLOAD_3 */ { 1, 0 }, + /* 0x26 OP_DLOAD_0 */ { 1, 0 }, + /* 0x27 OP_DLOAD_1 */ { 1, 0 }, + /* 0x28 OP_DLOAD_2 */ { 1, 0 }, + /* 0x29 OP_DLOAD_3 */ { 1, 0 }, + /* 0x2a OP_ALOAD_0 */ { 1, 0 }, + /* 0x2b OP_ALOAD_1 */ { 1, 0 }, + /* 0x2c OP_ALOAD_2 */ { 1, 0 }, + /* 0x2d OP_ALOAD_3 */ { 1, 0 }, + + /* 0x2e OP_IALOAD */ { 1, 0 }, + /* 0x2f OP_LALOAD */ { 1, 0 }, + /* 0x30 OP_FALOAD */ { 1, 0 }, + /* 0x31 OP_DALOAD */ { 1, 0 }, + /* 0x32 OP_AALOAD */ { 1, 0 }, + /* 0x33 OP_BALOAD */ { 1, 0 }, + /* 0x34 OP_CALOAD */ { 1, 0 }, + /* 0x35 OP_SALOAD */ { 1, 0 }, + + /* 0x36 OP_ISTORE */ { 2, PI_CANWIDE }, + /* 0x37 OP_LSTORE */ { 2, PI_CANWIDE }, + /* 0x38 OP_FSTORE */ { 2, PI_CANWIDE }, + /* 0x39 OP_DSTORE */ { 2, PI_CANWIDE }, + /* 0x3a OP_ASTORE */ { 2, PI_CANWIDE }, + + /* 0x3b OP_ISTORE_0 */ { 1, 0 }, + /* 0x3c OP_ISTORE_1 */ { 1, 0 }, + /* 0x3d OP_ISTORE_2 */ { 1, 0 }, + /* 0x3e OP_ISTORE_3 */ { 1, 0 }, + /* 0x3f OP_LSTORE_0 */ { 1, 0 }, + /* 0x40 OP_LSTORE_1 */ { 1, 0 }, + /* 0x41 OP_LSTORE_2 */ { 1, 0 }, + /* 0x42 OP_LSTORE_3 */ { 1, 0 }, + /* 0x43 OP_FSTORE_0 */ { 1, 0 }, + /* 0x44 OP_FSTORE_1 */ { 1, 0 }, + /* 0x45 OP_FSTORE_2 */ { 1, 0 }, + /* 0x46 OP_FSTORE_3 */ { 1, 0 }, + /* 0x47 OP_DSTORE_0 */ { 1, 0 }, + /* 0x48 OP_DSTORE_1 */ { 1, 0 }, + /* 0x49 OP_DSTORE_2 */ { 1, 0 }, + /* 0x4a OP_DSTORE_3 */ { 1, 0 }, + /* 0x4b OP_ASTORE_0 */ { 1, 0 }, + /* 0x4c OP_ASTORE_1 */ { 1, 0 }, + /* 0x4d OP_ASTORE_2 */ { 1, 0 }, + /* 0x4e OP_ASTORE_3 */ { 1, 0 }, + + /* 0x4f OP_IASTORE */ { 1, 0 }, + /* 0x50 OP_LASTORE */ { 1, 0 }, + /* 0x51 OP_FASTORE */ { 1, 0 }, + /* 0x52 OP_DASTORE */ { 1, 0 }, + /* 0x53 OP_AASTORE */ { 1, 0 }, + /* 0x54 OP_BASTORE */ { 1, 0 }, + /* 0x55 OP_CASTORE */ { 1, 0 }, + /* 0x56 OP_SASTORE */ { 1, 0 }, + + /* 0x57 OP_POP */ { 1, 0 }, + /* 0x58 OP_POP2 */ { 1, 0 }, + + /* 0x59 OP_DUP */ { 1, 0 }, + /* 0x5a OP_DUP_X1 */ { 1, 0 }, + /* 0x5b OP_DUP_X2 */ { 1, 0 }, + /* 0x5c OP_DUP2 */ { 1, 0 }, + /* 0x5d OP_DUP2_X1 */ { 1, 0 }, + /* 0x5e OP_DUP2_X2 */ { 1, 0 }, + + /* 0x5f OP_SWAP */ { 1, 0 }, + + /* 0x60 OP_IADD */ { 1, 0 }, + /* 0x61 OP_LADD */ { 1, 0 }, + /* 0x62 OP_FADD */ { 1, 0 }, + /* 0x63 OP_DADD */ { 1, 0 }, + /* 0x64 OP_ISUB */ { 1, 0 }, + /* 0x65 OP_LSUB */ { 1, 0 }, + /* 0x66 OP_FSUB */ { 1, 0 }, + /* 0x67 OP_DSUB */ { 1, 0 }, + /* 0x68 OP_IMUL */ { 1, 0 }, + /* 0x69 OP_LMUL */ { 1, 0 }, + /* 0x6a OP_FMUL */ { 1, 0 }, + /* 0x6b OP_DMUL */ { 1, 0 }, + /* 0x6c OP_IDIV */ { 1, 0 }, + /* 0x6d OP_LDIV */ { 1, 0 }, + /* 0x6e OP_FDIV */ { 1, 0 }, + /* 0x6f OP_DDIV */ { 1, 0 }, + /* 0x70 OP_IREM */ { 1, 0 }, + /* 0x71 OP_LREM */ { 1, 0 }, + /* 0x72 OP_FREM */ { 1, 0 }, + /* 0x73 OP_DREM */ { 1, 0 }, + /* 0x74 OP_INEG */ { 1, 0 }, + /* 0x75 OP_LNEG */ { 1, 0 }, + /* 0x76 OP_FNEG */ { 1, 0 }, + /* 0x77 OP_DNEG */ { 1, 0 }, + /* 0x78 OP_ISHL */ { 1, 0 }, + /* 0x79 OP_LSHL */ { 1, 0 }, + /* 0x7a OP_ISHR */ { 1, 0 }, + /* 0x7b OP_LSHR */ { 1, 0 }, + /* 0x7c OP_IUSHR */ { 1, 0 }, + /* 0x7d OP_LUSHR */ { 1, 0 }, + /* 0x7e OP_IAND */ { 1, 0 }, + /* 0x7f OP_LAND */ { 1, 0 }, + /* 0x80 OP_IOR */ { 1, 0 }, + /* 0x81 OP_LOR */ { 1, 0 }, + /* 0x82 OP_IXOR */ { 1, 0 }, + /* 0x83 OP_LXOR */ { 1, 0 }, + + /* 0x84 OP_IINC */ { 3, PI_CANWIDE }, + + /* 0x85 OP_I2L */ { 1, 0 }, + /* 0x86 OP_I2F */ { 1, 0 }, + /* 0x87 OP_I2D */ { 1, 0 }, + /* 0x88 OP_L2I */ { 1, 0 }, + /* 0x89 OP_L2F */ { 1, 0 }, + /* 0x8a OP_L2D */ { 1, 0 }, + /* 0x8b OP_F2I */ { 1, 0 }, + /* 0x8c OP_F2L */ { 1, 0 }, + /* 0x8d OP_F2D */ { 1, 0 }, + /* 0x8e OP_D2I */ { 1, 0 }, + /* 0x8f OP_D2L */ { 1, 0 }, + /* 0x90 OP_D2F */ { 1, 0 }, + /* 0x91 OP_I2B */ { 1, 0 }, + /* 0x92 OP_I2C */ { 1, 0 }, + /* 0x93 OP_I2S */ { 1, 0 }, + + /* 0x94 OP_LCMP */ { 1, 0 }, + /* 0x95 OP_FCMPL */ { 1, 0 }, + /* 0x96 OP_FCMPG */ { 1, 0 }, + /* 0x97 OP_DCMPL */ { 1, 0 }, + /* 0x98 OP_DCMPG */ { 1, 0 }, + + /* 0x99 OP_IFEQ */ { 3, PI_JUMP }, + /* 0x9a OP_IFNE */ { 3, PI_JUMP }, + /* 0x9b OP_IFLT */ { 3, PI_JUMP }, + /* 0x9c OP_IFGE */ { 3, PI_JUMP }, + /* 0x9d OP_IFGT */ { 3, PI_JUMP }, + /* 0x9e OP_IFLE */ { 3, PI_JUMP }, + /* 0x9f OP_IF_ICMPEQ */ { 3, PI_JUMP }, + /* 0xa0 OP_IF_ICMPNE */ { 3, PI_JUMP }, + /* 0xa1 OP_IF_ICMPLT */ { 3, PI_JUMP }, + /* 0xa2 OP_IF_ICMPGE */ { 3, PI_JUMP }, + /* 0xa3 OP_IF_ICMPGT */ { 3, PI_JUMP }, + /* 0xa4 OP_IF_ICMPLE */ { 3, PI_JUMP }, + /* 0xa5 OP_IF_ACMPEQ */ { 3, PI_JUMP }, + /* 0xa6 OP_IF_ACMPNE */ { 3, PI_JUMP }, + + /* 0xa7 OP_GOTO */ { 3, PI_JUMP | PI_DIRECT }, + + /* 0xa8 OP_JSR */ { 3, PI_JUMP}, + /* 0xa9 OP_RET */ { 2, PI_DIRECT | PI_CANWIDE }, + + /* 0xaa OP_TABLESWITCH */ { 16, PI_SWITCH }, + /* 0xab OP_LOOKUPSWITCH */ { 9, PI_SWITCH }, + + /* 0xac OP_IRETURN */ { 1, PI_DIRECT }, + /* 0xad OP_LRETURN */ { 1, PI_DIRECT }, + /* 0xae OP_FRETURN */ { 1, PI_DIRECT }, + /* 0xaf OP_DRETURN */ { 1, PI_DIRECT }, + /* 0xb0 OP_ARETURN */ { 1, PI_DIRECT }, + /* 0xb1 OP_RETURN */ { 1, PI_DIRECT }, + + /* 0xb2 OP_GETSTATIC */ { 3, 0 }, + /* 0xb3 OP_PUTSTATIC */ { 3, 0 }, + /* 0xb4 OP_GETFIELD */ { 3, 0 }, + /* 0xb5 OP_PUTFIELD */ { 3, 0 }, + + /* 0xb6 OP_INVOKEVIRTUAL */ { 3, 0 }, + /* 0xb7 OP_INVOKESPECIAL */ { 3, 0 }, + /* 0xb8 OP_INVOKESTATIC */ { 3, 0 }, + + /* 0xb9 OP_INVOKEINTERFACE */ { 5, 0 }, + + /* oxba XXX_UNUSED_XXX */ {0, 0}, + + /* 0xbb OP_NEW */ { 3, 0 }, + /* 0xbc OP_NEWARRAY */ { 2, 0 }, + /* 0xbd OP_ANEWARRAY */ { 3, 0 }, + + /* 0xbe OP_ARRAYLENGTH */ { 1, 0 }, + + /* 0xbf OP_ATHROW */ { 1, PI_DIRECT }, + + /* 0xc0 OP_CHECKCAST */ { 3, 0 }, + /* 0xc1 OP_INSTANCEOF */ { 3, 0 }, + + /* 0xc2 OP_MONITORENTER */ { 1, 0 }, + /* 0xc3 OP_MONITOREXIT */ { 1, 0 }, + + /* 0xc4 OP_WIDE */ { 2, 0 }, + + /* 0xc5 OP_MULTIANEWARRAY */{ 4, 0 }, + + /* 0xc6 OP_IFNULL */ { 3, PI_JUMP }, + /* 0xc7 OP_IFNONNULL */ { 3, PI_JUMP }, + + /* 0xc8 OP_GOTO_W */ { 5, PI_JUMP | PI_DIRECT | PI_WIDEJUMP }, + /* 0xc9 OP_JSR_W */ { 5, PI_JUMP | PI_WIDEJUMP }, +}; + +/** + * Obtains the length of a compound instruction. + */ +int vf_Context_Base::instr_get_len_compound(Address instr, OpCode opcode) { + if( opcode == OP_WIDE ) { + ParseInfo &pi = instr_get_parse_info( (OpCode)m_bytecode[instr+1] ); + + if( !(pi.flags & PI_CANWIDE) ) { + // return some big value - error will occur later + return 0x20000123; + } + return 2*pi.instr_min_len; + } - /** - * data for parsing for each instruction (length and flags) - */ - ParseInfo vf_Context_Base::parseTable[255] = { - - /* 0x00 OP_NOP */ { 1, 0 }, - - /* 0x01 OP_ACONST_NULL */ { 1, 0 }, - /* 0x02 OP_ICONST_M1 */ { 1, 0 }, - /* 0x03 OP_ICONST_0 */ { 1, 0 }, - /* 0x04 OP_ICONST_1 */ { 1, 0 }, - /* 0x05 OP_ICONST_2 */ { 1, 0 }, - /* 0x06 OP_ICONST_3 */ { 1, 0 }, - /* 0x07 OP_ICONST_4 */ { 1, 0 }, - /* 0x08 OP_ICONST_5 */ { 1, 0 }, - /* 0x09 OP_LCONST_0 */ { 1, 0 }, - /* 0x0a OP_LCONST_1 */ { 1, 0 }, - /* 0x0b OP_FCONST_0 */ { 1, 0 }, - /* 0x0c OP_FCONST_1 */ { 1, 0 }, - /* 0x0d OP_FCONST_2 */ { 1, 0 }, - /* 0x0e OP_DCONST_0 */ { 1, 0 }, - /* 0x0f OP_DCONST_1 */ { 1, 0 }, - - /* 0x10 OP_BIPUSH */ { 2, 0 }, - /* 0x11 OP_SIPUSH */ { 3, 0 }, - - /* 0x12 OP_LDC */ { 2, 0 }, - /* 0x13 OP_LDC_W */ { 3, 0 }, - /* 0x14 OP_LDC2_W */ { 3, 0 }, - - /* 0x15 OP_ILOAD */ { 2, PI_CANWIDE }, - /* 0x16 OP_LLOAD */ { 2, PI_CANWIDE }, - /* 0x17 OP_FLOAD */ { 2, PI_CANWIDE }, - /* 0x18 OP_DLOAD */ { 2, PI_CANWIDE }, - /* 0x19 OP_ALOAD */ { 2, PI_CANWIDE }, - - /* 0x1a OP_ILOAD_0 */ { 1, 0 }, - /* 0x1b OP_ILOAD_1 */ { 1, 0 }, - /* 0x1c OP_ILOAD_2 */ { 1, 0 }, - /* 0x1d OP_ILOAD_3 */ { 1, 0 }, - /* 0x1e OP_LLOAD_0 */ { 1, 0 }, - /* 0x1f OP_LLOAD_1 */ { 1, 0 }, - /* 0x20 OP_LLOAD_2 */ { 1, 0 }, - /* 0x21 OP_LLOAD_3 */ { 1, 0 }, - /* 0x22 OP_FLOAD_0 */ { 1, 0 }, - /* 0x23 OP_FLOAD_1 */ { 1, 0 }, - /* 0x24 OP_FLOAD_2 */ { 1, 0 }, - /* 0x25 OP_FLOAD_3 */ { 1, 0 }, - /* 0x26 OP_DLOAD_0 */ { 1, 0 }, - /* 0x27 OP_DLOAD_1 */ { 1, 0 }, - /* 0x28 OP_DLOAD_2 */ { 1, 0 }, - /* 0x29 OP_DLOAD_3 */ { 1, 0 }, - /* 0x2a OP_ALOAD_0 */ { 1, 0 }, - /* 0x2b OP_ALOAD_1 */ { 1, 0 }, - /* 0x2c OP_ALOAD_2 */ { 1, 0 }, - /* 0x2d OP_ALOAD_3 */ { 1, 0 }, - - /* 0x2e OP_IALOAD */ { 1, 0 }, - /* 0x2f OP_LALOAD */ { 1, 0 }, - /* 0x30 OP_FALOAD */ { 1, 0 }, - /* 0x31 OP_DALOAD */ { 1, 0 }, - /* 0x32 OP_AALOAD */ { 1, 0 }, - /* 0x33 OP_BALOAD */ { 1, 0 }, - /* 0x34 OP_CALOAD */ { 1, 0 }, - /* 0x35 OP_SALOAD */ { 1, 0 }, - - /* 0x36 OP_ISTORE */ { 2, PI_CANWIDE }, - /* 0x37 OP_LSTORE */ { 2, PI_CANWIDE }, - /* 0x38 OP_FSTORE */ { 2, PI_CANWIDE }, - /* 0x39 OP_DSTORE */ { 2, PI_CANWIDE }, - /* 0x3a OP_ASTORE */ { 2, PI_CANWIDE }, - - /* 0x3b OP_ISTORE_0 */ { 1, 0 }, - /* 0x3c OP_ISTORE_1 */ { 1, 0 }, - /* 0x3d OP_ISTORE_2 */ { 1, 0 }, - /* 0x3e OP_ISTORE_3 */ { 1, 0 }, - /* 0x3f OP_LSTORE_0 */ { 1, 0 }, - /* 0x40 OP_LSTORE_1 */ { 1, 0 }, - /* 0x41 OP_LSTORE_2 */ { 1, 0 }, - /* 0x42 OP_LSTORE_3 */ { 1, 0 }, - /* 0x43 OP_FSTORE_0 */ { 1, 0 }, - /* 0x44 OP_FSTORE_1 */ { 1, 0 }, - /* 0x45 OP_FSTORE_2 */ { 1, 0 }, - /* 0x46 OP_FSTORE_3 */ { 1, 0 }, - /* 0x47 OP_DSTORE_0 */ { 1, 0 }, - /* 0x48 OP_DSTORE_1 */ { 1, 0 }, - /* 0x49 OP_DSTORE_2 */ { 1, 0 }, - /* 0x4a OP_DSTORE_3 */ { 1, 0 }, - /* 0x4b OP_ASTORE_0 */ { 1, 0 }, - /* 0x4c OP_ASTORE_1 */ { 1, 0 }, - /* 0x4d OP_ASTORE_2 */ { 1, 0 }, - /* 0x4e OP_ASTORE_3 */ { 1, 0 }, - - /* 0x4f OP_IASTORE */ { 1, 0 }, - /* 0x50 OP_LASTORE */ { 1, 0 }, - /* 0x51 OP_FASTORE */ { 1, 0 }, - /* 0x52 OP_DASTORE */ { 1, 0 }, - /* 0x53 OP_AASTORE */ { 1, 0 }, - /* 0x54 OP_BASTORE */ { 1, 0 }, - /* 0x55 OP_CASTORE */ { 1, 0 }, - /* 0x56 OP_SASTORE */ { 1, 0 }, - - /* 0x57 OP_POP */ { 1, 0 }, - /* 0x58 OP_POP2 */ { 1, 0 }, - - /* 0x59 OP_DUP */ { 1, 0 }, - /* 0x5a OP_DUP_X1 */ { 1, 0 }, - /* 0x5b OP_DUP_X2 */ { 1, 0 }, - /* 0x5c OP_DUP2 */ { 1, 0 }, - /* 0x5d OP_DUP2_X1 */ { 1, 0 }, - /* 0x5e OP_DUP2_X2 */ { 1, 0 }, - - /* 0x5f OP_SWAP */ { 1, 0 }, - - /* 0x60 OP_IADD */ { 1, 0 }, - /* 0x61 OP_LADD */ { 1, 0 }, - /* 0x62 OP_FADD */ { 1, 0 }, - /* 0x63 OP_DADD */ { 1, 0 }, - /* 0x64 OP_ISUB */ { 1, 0 }, - /* 0x65 OP_LSUB */ { 1, 0 }, - /* 0x66 OP_FSUB */ { 1, 0 }, - /* 0x67 OP_DSUB */ { 1, 0 }, - /* 0x68 OP_IMUL */ { 1, 0 }, - /* 0x69 OP_LMUL */ { 1, 0 }, - /* 0x6a OP_FMUL */ { 1, 0 }, - /* 0x6b OP_DMUL */ { 1, 0 }, - /* 0x6c OP_IDIV */ { 1, 0 }, - /* 0x6d OP_LDIV */ { 1, 0 }, - /* 0x6e OP_FDIV */ { 1, 0 }, - /* 0x6f OP_DDIV */ { 1, 0 }, - /* 0x70 OP_IREM */ { 1, 0 }, - /* 0x71 OP_LREM */ { 1, 0 }, - /* 0x72 OP_FREM */ { 1, 0 }, - /* 0x73 OP_DREM */ { 1, 0 }, - /* 0x74 OP_INEG */ { 1, 0 }, - /* 0x75 OP_LNEG */ { 1, 0 }, - /* 0x76 OP_FNEG */ { 1, 0 }, - /* 0x77 OP_DNEG */ { 1, 0 }, - /* 0x78 OP_ISHL */ { 1, 0 }, - /* 0x79 OP_LSHL */ { 1, 0 }, - /* 0x7a OP_ISHR */ { 1, 0 }, - /* 0x7b OP_LSHR */ { 1, 0 }, - /* 0x7c OP_IUSHR */ { 1, 0 }, - /* 0x7d OP_LUSHR */ { 1, 0 }, - /* 0x7e OP_IAND */ { 1, 0 }, - /* 0x7f OP_LAND */ { 1, 0 }, - /* 0x80 OP_IOR */ { 1, 0 }, - /* 0x81 OP_LOR */ { 1, 0 }, - /* 0x82 OP_IXOR */ { 1, 0 }, - /* 0x83 OP_LXOR */ { 1, 0 }, - - /* 0x84 OP_IINC */ { 3, PI_CANWIDE }, - - /* 0x85 OP_I2L */ { 1, 0 }, - /* 0x86 OP_I2F */ { 1, 0 }, - /* 0x87 OP_I2D */ { 1, 0 }, - /* 0x88 OP_L2I */ { 1, 0 }, - /* 0x89 OP_L2F */ { 1, 0 }, - /* 0x8a OP_L2D */ { 1, 0 }, - /* 0x8b OP_F2I */ { 1, 0 }, - /* 0x8c OP_F2L */ { 1, 0 }, - /* 0x8d OP_F2D */ { 1, 0 }, - /* 0x8e OP_D2I */ { 1, 0 }, - /* 0x8f OP_D2L */ { 1, 0 }, - /* 0x90 OP_D2F */ { 1, 0 }, - /* 0x91 OP_I2B */ { 1, 0 }, - /* 0x92 OP_I2C */ { 1, 0 }, - /* 0x93 OP_I2S */ { 1, 0 }, - - /* 0x94 OP_LCMP */ { 1, 0 }, - /* 0x95 OP_FCMPL */ { 1, 0 }, - /* 0x96 OP_FCMPG */ { 1, 0 }, - /* 0x97 OP_DCMPL */ { 1, 0 }, - /* 0x98 OP_DCMPG */ { 1, 0 }, - - /* 0x99 OP_IFEQ */ { 3, PI_JUMP }, - /* 0x9a OP_IFNE */ { 3, PI_JUMP }, - /* 0x9b OP_IFLT */ { 3, PI_JUMP }, - /* 0x9c OP_IFGE */ { 3, PI_JUMP }, - /* 0x9d OP_IFGT */ { 3, PI_JUMP }, - /* 0x9e OP_IFLE */ { 3, PI_JUMP }, - /* 0x9f OP_IF_ICMPEQ */ { 3, PI_JUMP }, - /* 0xa0 OP_IF_ICMPNE */ { 3, PI_JUMP }, - /* 0xa1 OP_IF_ICMPLT */ { 3, PI_JUMP }, - /* 0xa2 OP_IF_ICMPGE */ { 3, PI_JUMP }, - /* 0xa3 OP_IF_ICMPGT */ { 3, PI_JUMP }, - /* 0xa4 OP_IF_ICMPLE */ { 3, PI_JUMP }, - /* 0xa5 OP_IF_ACMPEQ */ { 3, PI_JUMP }, - /* 0xa6 OP_IF_ACMPNE */ { 3, PI_JUMP }, - - /* 0xa7 OP_GOTO */ { 3, PI_JUMP | PI_DIRECT }, - - /* 0xa8 OP_JSR */ { 3, PI_JUMP}, - /* 0xa9 OP_RET */ { 2, PI_DIRECT | PI_CANWIDE }, - - /* 0xaa OP_TABLESWITCH */ { 16, PI_SWITCH }, - /* 0xab OP_LOOKUPSWITCH */ { 9, PI_SWITCH }, - - /* 0xac OP_IRETURN */ { 1, PI_DIRECT }, - /* 0xad OP_LRETURN */ { 1, PI_DIRECT }, - /* 0xae OP_FRETURN */ { 1, PI_DIRECT }, - /* 0xaf OP_DRETURN */ { 1, PI_DIRECT }, - /* 0xb0 OP_ARETURN */ { 1, PI_DIRECT }, - /* 0xb1 OP_RETURN */ { 1, PI_DIRECT }, - - /* 0xb2 OP_GETSTATIC */ { 3, 0 }, - /* 0xb3 OP_PUTSTATIC */ { 3, 0 }, - /* 0xb4 OP_GETFIELD */ { 3, 0 }, - /* 0xb5 OP_PUTFIELD */ { 3, 0 }, - - /* 0xb6 OP_INVOKEVIRTUAL */ { 3, 0 }, - /* 0xb7 OP_INVOKESPECIAL */ { 3, 0 }, - /* 0xb8 OP_INVOKESTATIC */ { 3, 0 }, - - /* 0xb9 OP_INVOKEINTERFACE */ { 5, 0 }, - - /* oxba XXX_UNUSED_XXX */ {0, 0}, - - /* 0xbb OP_NEW */ { 3, 0 }, - /* 0xbc OP_NEWARRAY */ { 2, 0 }, - /* 0xbd OP_ANEWARRAY */ { 3, 0 }, - - /* 0xbe OP_ARRAYLENGTH */ { 1, 0 }, - - /* 0xbf OP_ATHROW */ { 1, PI_DIRECT }, - - /* 0xc0 OP_CHECKCAST */ { 3, 0 }, - /* 0xc1 OP_INSTANCEOF */ { 3, 0 }, - - /* 0xc2 OP_MONITORENTER */ { 1, 0 }, - /* 0xc3 OP_MONITOREXIT */ { 1, 0 }, - - /* 0xc4 OP_WIDE */ { 2, 0 }, - - /* 0xc5 OP_MULTIANEWARRAY */{ 4, 0 }, - - /* 0xc6 OP_IFNULL */ { 3, PI_JUMP }, - /* 0xc7 OP_IFNONNULL */ { 3, PI_JUMP }, - - /* 0xc8 OP_GOTO_W */ { 5, PI_JUMP | PI_DIRECT | PI_WIDEJUMP }, - /* 0xc9 OP_JSR_W */ { 5, PI_JUMP | PI_WIDEJUMP }, - }; - - /* - * Obtain the length of a compound instruction - */ - int vf_Context_Base::instr_get_len_compound(Address instr, OpCode opcode) { - if( opcode == OP_WIDE ) { - ParseInfo &pi = instr_get_parse_info( (OpCode)m_bytecode[instr+1] ); - - if( !(pi.flags & PI_CANWIDE) ) { - // return some big value - error will occur later - return 0x20000123; - } - return 2*pi.instr_min_len; + Address def_adr = (instr & (~3) ) + 4; + if( opcode == OP_TABLESWITCH) { + int lowbyte = read_int32(m_bytecode + def_adr + 4); + int hibyte = read_int32(m_bytecode + def_adr + 8); + + // protect from integer overflow + if( hibyte < lowbyte || hibyte - lowbyte > 0x20000000) { + // return some big value - error will occur later + return 0x20000123; } + return def_adr + 12 + (hibyte - lowbyte + 1) * 4 - instr; + } else { + assert( opcode == OP_LOOKUPSWITCH ); + + //minimal length of OP_LOOKUPSWITCH is 9 bytes, while its required value may exceed 9 bytes, have to check bounds + if( (unsigned)def_adr + 8 > m_code_length ) { + // return some big value - error will occur later + return 0x20000123; + } - Address def_adr = (instr & (~3) ) + 4; - if( opcode == OP_TABLESWITCH) { - int lowbyte = read_int32(m_bytecode + def_adr + 4); - int hibyte = read_int32(m_bytecode + def_adr + 8); - - // protect from integer overflow - if( hibyte < lowbyte || hibyte - lowbyte > 0x20000000) { - // return some big value - error will occur later - return 0x20000123; - } - - return def_adr + 12 + (hibyte - lowbyte + 1) * 4 - instr; - } else { - assert( opcode == OP_LOOKUPSWITCH ); - - //minimal length of OP_LOOKUPSWITCH is 9 bytes, while its required value may exceed 9 bytes, have to check bounds - if( (unsigned)def_adr + 8 > m_code_length ) { - // return some big value - error will occur later - return 0x20000123; - } - - unsigned npairs = read_int32(m_bytecode + def_adr + 4); + unsigned npairs = read_int32(m_bytecode + def_adr + 4); - // protect from integer overflow - if( npairs > 0x20000000) { - // return some big value - error will occur later - return 0x20000123; - } + // protect from integer overflow + if( npairs > 0x20000000) { + // return some big value - error will occur later + return 0x20000123; + } - int next = def_adr + 8; + int next = def_adr + 8; - if (npairs) { - int old_value = read_int32(m_bytecode + next); + if (npairs) { + int old_value = read_int32(m_bytecode + next); + next += 8; + // integer values must be sorted - verify + for( unsigned i = 1; i < npairs; i++) { + int new_value = read_int32(m_bytecode + next); next += 8; - // integer values must be sorted - verify - for( unsigned i = 1; i < npairs; i++) { - int new_value = read_int32(m_bytecode + next); - next += 8; - if( old_value >= new_value ) { - // return some big value - error will occur later - return 0x20000123; - } - old_value = new_value; + if( old_value >= new_value ) { + // return some big value - error will occur later + return 0x20000123; } + old_value = new_value; } - - return next - instr; } - } - /* - * Set method constraints - */ - void vf_Context_Base::set_class_constraints() { - if( !class_constraints ) return; - - vf_ClassLoaderData_t *cl_data; - ClassLoaderHandle currentClassLoader = class_get_class_loader(k_class); - - // lock data modification - class_loader_lock( currentClassLoader ); - cl_data = - (vf_ClassLoaderData_t*)class_loader_get_verifier_data_ptr( currentClassLoader ); - - // create class loader data - if( cl_data == NULL ) { - Memory *new_pool = new Memory; - cl_data = (vf_ClassLoaderData_t*)new_pool->malloc(sizeof(vf_ClassLoaderData_t)); - cl_data->pool = new_pool; - cl_data->hash = new vf_Hash(); - cl_data->string = new vf_Hash(); - } - Memory **pool = &cl_data->pool; - vf_Hash *hash = cl_data->hash; - vf_Hash *string = cl_data->string; - - // create class hash entry - vf_HashEntry_t *hash_entry = hash->NewHashEntry( class_get_name( k_class ) ); - - for( vf_TypeConstraint *constraint = class_constraints; - constraint; - constraint = constraint->next ) - { - // create new constraint - vf_TypeConstraint *cc = (vf_TypeConstraint*)(*pool)->malloc(sizeof(vf_TypeConstraint)); - - // set class constraint - // create hash entry for target class - cc->target = string->NewHashEntry( constraint->target )->key; - // create hash entry for checked class - cc->source = string->NewHashEntry( constraint->source )->key; + return next - instr; + } +} - cc->next = (CPVerifier::vf_TypeConstraint*)hash_entry->data_ptr; - hash_entry->data_ptr = cc; - } +/* +* Set method constraints +*/ +void vf_Context_Base::set_class_constraints() { + if( !class_constraints ) return; + + vf_ClassLoaderData_t *cl_data; + ClassLoaderHandle currentClassLoader = class_get_class_loader(k_class); + + // lock data modification + class_loader_lock( currentClassLoader ); + cl_data = + (vf_ClassLoaderData_t*)class_loader_get_verifier_data_ptr( currentClassLoader ); + + // create class loader data + if( cl_data == NULL ) { + Memory *new_pool = new Memory; + cl_data = (vf_ClassLoaderData_t*)new_pool->malloc(sizeof(vf_ClassLoaderData_t)); + cl_data->pool = new_pool; + cl_data->hash = new vf_Hash(); + cl_data->string = new vf_Hash(); + } + Memory **pool = &cl_data->pool; + vf_Hash *hash = cl_data->hash; + vf_Hash *string = cl_data->string; + + // create class hash entry + vf_HashEntry_t *hash_entry = hash->NewHashEntry( class_get_name( k_class ) ); + + for( vf_TypeConstraint *constraint = class_constraints; + constraint; + constraint = constraint->next ) + { + // create new constraint + vf_TypeConstraint *cc = (vf_TypeConstraint*)(*pool)->malloc(sizeof(vf_TypeConstraint)); + + // set class constraint + // create hash entry for target class + cc->target = string->NewHashEntry( constraint->target )->key; + // create hash entry for checked class + cc->source = string->NewHashEntry( constraint->source )->key; - // unlock data modification - class_loader_set_verifier_data_ptr( currentClassLoader, cl_data ); - class_loader_unlock( currentClassLoader ); - return; + cc->next = (vf_TypeConstraint*)hash_entry->data_ptr; + hash_entry->data_ptr = cc; } -} // namespace CPVerifier + // unlock data modification + class_loader_set_verifier_data_ptr( currentClassLoader, cl_data ); + class_loader_unlock( currentClassLoader ); + return; +} Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_base.h Fri Apr 18 08:29:36 2008 @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Mikhail Loenko, Vladimir Molotkov - */ - #ifndef __CONTEXT_BASE_H__ #define __CONTEXT_BASE_H__ @@ -32,260 +28,255 @@ #include "instr_props.h" #include "tpool.h" -namespace CPVerifier { - - - class SharedClasswideData { - public: - SharedClasswideData(Class_Handle _klass) : - class_constraints(0), - k_class(_klass), - k_major(class_get_version(_klass)), +class SharedClasswideData { +public: + SharedClasswideData(Class_Handle _klass) : + class_constraints(0), + k_class(_klass), + k_major(class_get_version(_klass)), #pragma warning( push ) #pragma warning( disable : 4355 ) - tpool(this, _klass, 256) + tpool(this, _klass, 256) #pragma warning( pop ) - {} - - //basic storage for class-wide data, like mapping from Java classes to SmConstant types - vf_TypePool tpool; + {} - //stores constraints in the classloader for reuse in vf_verify_class_constraints() - vf_TypeConstraint *class_constraints; + //basic storage for class-wide data, like mapping from Java classes to SmConstant types + vf_TypePool tpool; - //storage for these constraints. class-wide - Memory constraintPool; + //stores constraints in the classloader for reuse in vf_verify_class_constraints() + vf_TypeConstraint *class_constraints; - //class handler for the current class - Class_Handle k_class; + //storage for these constraints. class-wide + Memory constraintPool; - //major version of current class - unsigned short k_major; + //class handler for the current class + Class_Handle k_class; - //below are actually not shared between differetn methods, - //we define large-size variables here to save stack footprint + //major version of current class + unsigned short k_major; - // basic storage for most of the method-wide data - Memory mem; - }; + //below are actually not shared between differetn methods, + //we define large-size variables here to save stack footprint + // basic storage for most of the method-wide data + Memory mem; +}; - // - // Context - main class of Type Checker - // - class vf_Context_Base { - public: - vf_Context_Base(SharedClasswideData &_classwide) : +// +// Context - main class of Type Checker +// - classwide(_classwide), class_constraints(_classwide.class_constraints), - mem(_classwide.mem), constraintPool(_classwide.constraintPool), tpool(_classwide.tpool), - k_class(_classwide.k_class), k_major(classwide.k_major) - {} +class vf_Context_Base { +public: + vf_Context_Base(SharedClasswideData &_classwide) : - //current instruction - used for error message creation - Address processed_instruction; + classwide(_classwide), class_constraints(_classwide.class_constraints), + mem(_classwide.mem), constraintPool(_classwide.constraintPool), tpool(_classwide.tpool), + k_class(_classwide.k_class), k_major(classwide.k_major) + {} - //pass (in case if Java5 verification) - used for error message creation - int pass; + //current instruction - used for error message creation + Address processed_instruction; - //error message in case of unsuccessful verification - const char *error_message; + //pass (in case if Java5 verification) - used for error message creation + int pass; - //store ref to classwide data - SharedClasswideData &classwide; + //error message in case of unsuccessful verification + const char *error_message; - //store constraints on unloaded classes for later verification - void set_class_constraints(); - protected: - friend class vf_TypePool; + //store ref to classwide data + SharedClasswideData &classwide; - //class handler for the current class - Class_Handle k_class; + //store constraints on unloaded classes for later verification + void set_class_constraints(); +protected: + friend class vf_TypePool; - //major version of current class - unsigned short k_major; + //class handler for the current class + Class_Handle k_class; - //method handler for the method being verified - Method_Handle m_method; + //major version of current class + unsigned short k_major; - //method's bytecode - Byte* m_bytecode; + //method handler for the method being verified + Method_Handle m_method; - //legth of the code in the method being verified - unsigned m_code_length; + //method's bytecode + Byte* m_bytecode; - //max number of locals for the method being verified (as recorded in the classfile) - unsigned m_max_locals; + //legth of the code in the method being verified + unsigned m_code_length; - //is the current method construcor (and current class in not a j.l.Object)? - bool m_is_constructor; + //max number of locals for the method being verified (as recorded in the classfile) + unsigned m_max_locals; - //m_max_locals or m_max_locals+1 if it's a constructor - unsigned m_stack_start; + //is the current method construcor (and current class in not a j.l.Object)? + bool m_is_constructor; - //max stack size for the method being verified (as recorded in the classfile) - unsigned m_max_stack; + //m_max_locals or m_max_locals+1 if it's a constructor + unsigned m_stack_start; - //number of exception handlers for the being verified (as recorded in the classfile) - unsigned short m_handlecount; + //max stack size for the method being verified (as recorded in the classfile) + unsigned m_max_stack; - //stores constraints in the classloader for reuse in vf_verify_class_constraints() - vf_TypeConstraint_p &class_constraints; + //number of exception handlers for the being verified (as recorded in the classfile) + unsigned short m_handlecount; - //storage for these constraints. class-wide - //TODO: makes sense to unite it with tpool containing other class-wide data? - Memory &constraintPool; + //stores constraints in the classloader for reuse in vf_verify_class_constraints() + vf_TypeConstraint_p &class_constraints; - // basic storage for most of the method-wide data - Memory &mem; + //storage for these constraints. class-wide + //TODO: makes sense to unite it with tpool containing other class-wide data? + Memory &constraintPool; - // table used to get various info (type, length, etc) about possible bytecode instructions - static ParseInfo parseTable[255]; + // basic storage for most of the method-wide data + Memory &mem; - // method's return type - SmConstant return_type; + // table used to get various info (type, length, etc) about possible bytecode instructions + static ParseInfo parseTable[255]; - //basic storage for class-wide data, like mapping from Java classes to SmConstant types - vf_TypePool &tpool; + // method's return type + SmConstant return_type; - /******* exception handling **********/ + //basic storage for class-wide data, like mapping from Java classes to SmConstant types + vf_TypePool &tpool; - //flag array. if a local var i was changed by the previous instruction ==> changed_locals[i]=1, otherwise it's 0 - uint8 *changed_locals; + /******* exception handling **********/ - //if there is at least one local changed - int locals_changed; + //flag array. if a local var i was changed by the previous instruction ==> changed_locals[i]=1, otherwise it's 0 + uint8 *changed_locals; - //if we don't know whether previous instruction changed locals (like if we are at the branch target) - int no_locals_info; + //if there is at least one local changed + int locals_changed; - //number of the first handler valid for the given instruction - int loop_start; + //if we don't know whether previous instruction changed locals (like if we are at the branch target) + int no_locals_info; - // + 1 - int loop_finish; + //number of the first handler valid for the given instruction + int loop_start; - //start of the nearest next try block. 0 means "don't know" - Address next_start_pc; + // + 1 + int loop_finish; - /*****************/ + //start of the nearest next try block. 0 means "don't know" + Address next_start_pc; - //report verify error and store a message if any - vf_Result error(vf_Result result, const char* message) { - //PUT BREAKPOINT HERE!!! - error_message = message ? message : ""; - //assert(0); - return result; - } + /*****************/ - //init method-wide data - void init(Method_Handle _m_method) { - //store method's parameters - //TODO: it might be mot slower not to store them - m_method = _m_method; - m_max_locals = method_get_max_locals(m_method); - m_max_stack = method_get_max_stack(m_method); - m_code_length = method_get_bytecode_length(m_method); - m_handlecount = method_get_exc_handler_number(m_method); - m_bytecode = const_cast(method_get_bytecode(m_method)); + //report verify error and store a message if any + vf_Result error(vf_Result result, const char* message) { + //PUT BREAKPOINT HERE!!! + error_message = message ? message : ""; + //assert(0); + return result; + } - m_is_constructor = !strcmp(method_get_name(m_method), "") - && class_get_super_class(k_class); + //init method-wide data + void init(Method_Handle _m_method) { + //store method's parameters + //TODO: it might be mot slower not to store them + m_method = _m_method; + m_max_locals = method_get_max_locals(m_method); + m_max_stack = method_get_max_stack(m_method); + m_code_length = method_get_bytecode_length(m_method); + m_handlecount = method_get_exc_handler_number(m_method); + m_bytecode = const_cast(method_get_bytecode(m_method)); - m_stack_start = m_max_locals + (m_is_constructor ? 1 : 0); + m_is_constructor = !strcmp(method_get_name(m_method), "") + && class_get_super_class(k_class); - // initialize own parameters - mem.init(); + m_stack_start = m_max_locals + (m_is_constructor ? 1 : 0); - changed_locals = (uint8*)mem.malloc((m_stack_start & ~3) + 4); + // initialize own parameters + mem.init(); - //to correct it later - return_type = SM_NONE; - } + changed_locals = (uint8*)mem.malloc((m_stack_start & ~3) + 4); + //to correct it later + return_type = SM_NONE; + } - /////////////////////// convinient methods ////////////////////////////////////////// - //get length of variable size instruction (WIDE, *SWITCH) - int instr_get_len_compound(Address instr, OpCode opcode); + /////////////////////// convinient methods ////////////////////////////////////////// - //read two-byte value - static uint16 read_int16(uint8* ptr) { - return (ptr[0] << 8) | ptr[1]; - } + //get length of variable size instruction (WIDE, *SWITCH) + int instr_get_len_compound(Address instr, OpCode opcode); - //read four-byte value - static uint32 read_int32(uint8* ptr) { - return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]; - } + //read two-byte value + static Address read_int16(Byte* ptr) { + return (ptr[0] << 8) | ptr[1]; + } - //get properties specific for the given opcode - static ParseInfo &instr_get_parse_info(OpCode opcode) { - return parseTable[opcode]; - } + //read four-byte value + static Address read_int32(Byte* ptr) { + return (ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]; + } - //get the length of the given instruction or minimal length if unknown - static uint8 instr_get_minlen(ParseInfo &pi) { - return pi.instr_min_len; - } + //get properties specific for the given opcode + static ParseInfo &instr_get_parse_info(OpCode opcode) { + return parseTable[opcode]; + } - //whether this instruction GOTO, IF*, or JSR - static int instr_is_jump(ParseInfo &pi) { - return pi.flags & PI_JUMP; - } + //get the length of the given instruction or minimal length if unknown + static uint8 instr_get_minlen(ParseInfo &pi) { + return pi.instr_min_len; + } - //whether this instruction GOTO, RETURN, ATHROW, or RET - static int instr_direct(ParseInfo &pi, OpCode opcode, uint8* code, Address instr) { - return (pi.flags & PI_DIRECT) || (opcode == OP_WIDE && code[instr + 1] == OP_RET); - } + //whether this instruction GOTO, IF*, or JSR + static int instr_is_jump(ParseInfo &pi) { + return pi.flags & PI_JUMP; + } - //whether this instruction a *SWITCH - static int instr_is_switch(ParseInfo &pi) { - return pi.flags & PI_SWITCH; - } + //whether this instruction GOTO, RETURN, ATHROW, or RET + static int instr_direct(ParseInfo &pi, OpCode opcode, Byte* code, Address instr) { + return (pi.flags & PI_DIRECT) || (opcode == OP_WIDE && code[instr + 1] == OP_RET); + } - //other types of instructions - static int instr_is_regular(ParseInfo &pi) { - return !(pi.flags & (PI_SWITCH|PI_JUMP|PI_DIRECT)); - } + //whether this instruction a *SWITCH + static int instr_is_switch(ParseInfo &pi) { + return pi.flags & PI_SWITCH; + } - //whether instruction length is unknown - static int instr_is_compound(OpCode opcode, ParseInfo &pi) { - return (pi.flags & PI_SWITCH) || opcode == OP_WIDE; - } + //other types of instructions + static int instr_is_regular(ParseInfo &pi) { + return !(pi.flags & (PI_SWITCH|PI_JUMP|PI_DIRECT)); + } - //JSR ? - static int instr_is_jsr(OpCode opcode) { - return opcode == OP_JSR || opcode == OP_JSR_W; - } + //whether instruction length is unknown + static int instr_is_compound(OpCode opcode, ParseInfo &pi) { + return (pi.flags & PI_SWITCH) || opcode == OP_WIDE; + } - //RET ? - static int instr_is_ret(OpCode opcode, uint8* code, Address instr) { - return opcode == OP_RET || opcode == OP_WIDE && code[instr + 1] == OP_RET; - } + //JSR ? + static int instr_is_jsr(OpCode opcode) { + return opcode == OP_JSR || opcode == OP_JSR_W; + } - //return the jump target for the given instruction - static Address instr_get_jump_target(ParseInfo &pi, uint8* code, Address instr) { - if( pi.flags & PI_WIDEJUMP ) { - return instr + read_int32(code + instr + 1); - } else { - return instr + read_int16(code + instr + 1); - } - } + //RET ? + static int instr_is_ret(OpCode opcode, uint8* code, Address instr) { + return opcode == OP_RET || opcode == OP_WIDE && code[instr + 1] == OP_RET; + } - //is this opcode valid? - static int instr_is_valid_bytecode(OpCode opcode) { - return opcode <= OP_MAXCODE && opcode != OP_XXX_UNUSED_XXX; - } + //return the jump target for the given instruction + static Address instr_get_jump_target(ParseInfo &pi, Byte* code, Address instr) { + if( pi.flags & PI_WIDEJUMP ) { + return instr + read_int32(code + instr + 1); + } else { + return instr + read_int16(code + instr + 1); + } + } - }; + //is this opcode valid? + static int instr_is_valid_bytecode(OpCode opcode) { + return opcode <= OP_MAXCODE && opcode != OP_XXX_UNUSED_XXX; + } +}; - //check conatraints stored in the classloader data. force loading if necessary - vf_Result vf_force_check_constraint(Class_Handle klass, - vf_TypeConstraint *constraint); -} // namespace CPVerifier +//check conatraints stored in the classloader data. force loading if necessary +vf_Result vf_force_check_constraint(Class_Handle klass, + vf_TypeConstraint *constraint); #endif Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp?rev=649574&r1=649573&r2=649574&view=diff ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/base/context_x.cpp Fri Apr 18 08:29:36 2008 @@ -14,18 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * @author Mikhail Loenko, Vladimir Molotkov - */ - #include "verifier.h" #include "context_x.h" #include "../java5/context_5.h" #include "../java6/context_6.h" -namespace CPVerifier { - - // "virtual" methods #define workmap_expect (((ActualClass*)this)->workmap_expect) @@ -45,7 +38,7 @@ #define POP_x( TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -53,7 +46,7 @@ \ /* check INs */ \ if( !workmap_expect_strict(value, TYPE) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ @@ -62,7 +55,7 @@ \ #define POP_x_x( TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -73,7 +66,7 @@ if( !workmap_expect_strict(value1, TYPE) || \ !workmap_expect_strict(value2, TYPE) ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ @@ -81,18 +74,18 @@ #define POP_xx( TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ - WorkmapElement hi_word = workmap_pop(); \ - WorkmapElement low_word = workmap_pop(); \ + WorkmapElement hi_word = workmap_pop(); \ + WorkmapElement low_word = workmap_pop(); \ \ /* check INs */ \ if( !workmap_expect_strict(hi_word, SM_HIGH_WORD) || \ !workmap_expect_strict(low_word, TYPE) ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ @@ -100,14 +93,14 @@ #define POP_xx_xx( TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(4) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(4) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ - WorkmapElement hi_word1 = workmap_pop(); \ - WorkmapElement low_word1 = workmap_pop(); \ - WorkmapElement hi_word2 = workmap_pop(); \ - WorkmapElement low_word2 = workmap_pop(); \ + WorkmapElement hi_word1 = workmap_pop(); \ + WorkmapElement low_word1 = workmap_pop(); \ + WorkmapElement hi_word2 = workmap_pop(); \ + WorkmapElement low_word2 = workmap_pop(); \ \ /* check INs */ \ if( !workmap_expect_strict(hi_word1, SM_HIGH_WORD) || \ @@ -115,7 +108,7 @@ !workmap_expect_strict(hi_word2, SM_HIGH_WORD) || \ !workmap_expect_strict(low_word2, TYPE) ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ @@ -123,7 +116,7 @@ #define POP_ref( TYPE ) { \ /* check stack */ \ - if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -131,7 +124,7 @@ \ /* check INs */ \ if( !workmap_expect(object_ref, TYPE) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ } @@ -141,7 +134,7 @@ POP_xx(TYPE); \ } else { \ /* check stack */ \ - if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -149,7 +142,7 @@ \ /* check INs */ \ if( !workmap_expect(value, TYPE) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ } \ @@ -160,7 +153,7 @@ \ /* check INs */ \ if( !workmap_expect(value, TYPE) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ @@ -170,7 +163,7 @@ \ /* check INs */ \ if( !workmap_expect(value, SM_HIGH_WORD) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ } \ @@ -179,12 +172,12 @@ #define PUSH_z( TYPE ) \ if( TYPE.isLongOrDouble() ) { \ if( !workmap_can_push(2) ) { \ - return error(VF_ErrorStackOverflow, "stack overflow"); \ + return error(VF_ErrorStackOverflow, "stack overflow"); \ } \ workmap_2w_push_const(TYPE); \ } else { \ if( !workmap_can_push(1) ) { \ - return error(VF_ErrorStackOverflow, "stack overflow"); \ + return error(VF_ErrorStackOverflow, "stack overflow"); \ } \ workmap_push_const(TYPE); \ } \ @@ -192,15 +185,15 @@ #define CHECK_xLOAD( idx, TYPE ) \ if( !workmap_valid_local(idx) ) { \ - return error(VF_ErrorLocals, "invalid local index"); \ + return error(VF_ErrorLocals, "invalid local index"); \ } \ - if( !workmap_can_push(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_push(1) ) return error(VF_ErrorDataFlow, \ "operand stack overflow"); \ \ WorkmapElement value = workmap_get_local(idx); \ \ if( !workmap_expect_strict(value, TYPE) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ @@ -210,9 +203,9 @@ #define CHECK_xxLOAD( idx, TYPE ) \ if( !workmap_valid_2w_local(idx) ) { \ - return error(VF_ErrorLocals, "invalid local index"); \ + return error(VF_ErrorLocals, "invalid local index"); \ } \ - if( !workmap_can_push(2) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_push(2) ) return error(VF_ErrorDataFlow, \ "operand stack overflow"); \ \ WorkmapElement value_lo = workmap_get_local(idx); \ @@ -221,7 +214,7 @@ if( !workmap_expect_strict(value_lo, TYPE) || \ !workmap_expect_strict(value_hi, SM_HIGH_WORD) ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ @@ -230,15 +223,15 @@ #define CHECK_ALOAD( idx ) \ - if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ + if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ "invalid local index"); \ - if( !workmap_can_push(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_push(1) ) return error(VF_ErrorDataFlow, \ "operand stack overflow"); \ \ WorkmapElement value = workmap_get_local(idx); \ \ if( !workmap_expect(value, SM_REF_OR_UNINIT) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ @@ -248,7 +241,7 @@ #define CHECK_zALOAD( CHECK ) \ /* check stack */ \ - if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(2) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -257,11 +250,11 @@ \ /* check INs */ \ if( !workmap_expect_strict( index, SM_INTEGER ) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ - if( !CHECK ) return error(VF_ErrorIncompatibleArgument, \ + if( !CHECK ) return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ @@ -271,7 +264,7 @@ #define CHECK_xSTORE( idx, TYPE ) \ - if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ + if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ "invalid local index"); \ POP_x( TYPE ) \ workmap_set_local_const(idx, TYPE); \ @@ -279,7 +272,7 @@ #define CHECK_xxSTORE( idx, TYPE ) \ - if( !workmap_valid_2w_local(idx) ) return error(VF_ErrorLocals, \ + if( !workmap_valid_2w_local(idx) ) return error(VF_ErrorLocals, \ "invalid local index"); \ POP_xx( TYPE ); \ workmap_set_2w_local_const(idx, TYPE); \ @@ -287,15 +280,15 @@ #define CHECK_ASTORE( idx ) \ - if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ + if( !workmap_valid_local(idx) ) return error(VF_ErrorLocals, \ "invalid local index"); \ \ - if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(1) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ WorkmapElement ref = workmap_pop(); \ if( !workmap_expect(ref, SM_REF_OR_UNINIT_OR_RETADR) ) { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ \ @@ -305,7 +298,7 @@ #define CHECK_xASTORE( CHECK, TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(3) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(3) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -318,14 +311,14 @@ !workmap_expect_strict( index, SM_INTEGER ) || \ !CHECK ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ #define CHECK_xxASTORE( CHECK, TYPE ) \ /* check stack */ \ - if( !workmap_can_pop(4) ) return error(VF_ErrorDataFlow, \ + if( !workmap_can_pop(4) ) return error(VF_ErrorDataFlow, \ "unable to pop from empty operand stack"); \ \ /* pop INs */ \ @@ -340,7 +333,7 @@ !workmap_expect_strict( index, SM_INTEGER ) || \ !CHECK ) \ { \ - return error(VF_ErrorIncompatibleArgument, \ + return error(VF_ErrorIncompatibleArgument, \ "incompartible argument"); \ } \ @@ -350,10 +343,9 @@ ///////////////////////////////////////////////////////////////////////////////////// - /** -* check type-safety of a single instruction (second pass in case of java5 verification) -*/ + * check type-safety of a single instruction (second pass in case of java5 verification) + */ template vf_Result vf_Context_x::dataflow_instruction(Address instr) { @@ -1814,16 +1806,16 @@ /** -* check type-safety for exception handlers of a single instruction (second pass in case of java5 verification) -*/ + * check type-safety for exception handlers of a single instruction (second pass in case of java5 verification) + */ template vf_Result vf_Context_x::dataflow_handlers(Address instr) { if( !m_handlecount || instr < next_start_pc && !no_locals_info && !locals_changed ) return VF_OK; - unsigned short start_pc; - unsigned short end_pc; - unsigned short handler_pc; - unsigned short handler_cp_index; + uint16 start_pc; + uint16 end_pc; + uint16 handler_pc; + uint16 handler_cp_index; int clean_required = false; int new_loop_start = m_handlecount; @@ -1898,8 +1890,8 @@ /** -* create workmap for zero instruction from method's arguments (second pass in case of java5 verification) -*/ + * Creates a workmap for zero instruction from method's arguments (second pass in case of java5 verification). + */ template vf_Result vf_Context_x::create_method_initial_workmap() { // allocate memory for working stack map @@ -1950,8 +1942,8 @@ /** -* check conditions for accessing protected non-static fields in different package -*/ + * check conditions for accessing protected non-static fields in different package + */ template vf_Result vf_Context_x::popFieldRef(SmConstant expected_ref, unsigned short cp_idx) { int check = tpool.checkFieldAccess( expected_ref, cp_idx); @@ -1974,8 +1966,8 @@ /** -* check conditions for accessing protected virtual methods in different package -*/ + * check conditions for accessing protected virtual methods in different package + */ template vf_Result vf_Context_x::popVirtualRef(SmConstant expected_ref, unsigned short cp_idx) { int check = tpool.checkVirtualAccess( expected_ref, cp_idx); @@ -2014,9 +2006,9 @@ /** -* create constraint vector in case of a branch -* simple conatraints are created for pairs of both locals and stack (current must be assignable to target) -*/ + * create constraint vector in case of a branch + * simple conatraints are created for pairs of both locals and stack (current must be assignable to target) + */ template vf_Result vf_Context_x::new_generic_vector_constraint_impl(StackmapHead *target) { if( target->depth != workmap->depth ) return error(VF_ErrorStackDepth, "stack depth does not match"); @@ -2037,9 +2029,9 @@ /** -* create constraint vector for exception handler -* simple conatraints are created for pairs of local variable (current must be assignable to start of exception handler) -*/ + * create constraint vector for exception handler + * simple conatraints are created for pairs of local variable (current must be assignable to start of exception handler) + */ template vf_Result vf_Context_x::new_handler_vector_constraint(Address handler_instr) { vf_Result tcr; @@ -2062,18 +2054,18 @@ /** -* specail care for calls in try blocks -*/ + * specail care for calls in try blocks + */ template vf_Result vf_Context_x::propagate_bogus_to_handlers(Address instr, SmConstant uninit_value) { if( !m_handlecount ) return VF_OK; //loop start and loop finish calculated in dataflow_handlers for( unsigned short idx = loop_start; idx < loop_finish; idx++ ) { - unsigned short start_pc; - unsigned short end_pc; - unsigned short handler_pc; - unsigned short handler_cp_index; + uint16 start_pc; + uint16 end_pc; + uint16 handler_pc; + uint16 handler_cp_index; method_get_exc_handler_info( m_method, idx, &start_pc, &end_pc, &handler_pc, &handler_cp_index ); @@ -2097,11 +2089,6 @@ return VF_OK; } -//////////////////////////////////////////////////////////////// - - -template class vf_Context_x; -template class vf_Context_x; - - -} // namespace CPVerifier +#pragma warning (disable:4660) // warning C4660: template-class specialization is already instantiated +template class vf_Context_x; +template class vf_Context_x;