harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcfi...@apache.org
Subject svn commit: r649574 [6/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 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.h?rev=649574&r1=649573&r2=649574&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/recompute.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
- */  
-
 #ifndef __RECOMPUTE_H__
 #define __RECOMPUTE_H__
 
@@ -29,451 +25,448 @@
 
 vf_Result vf_recompute_stackmaptable(Method_Handle method, uint8** attrBytes, char** error,
void* trustedPairs);
 
-namespace CPVerifier_5 {
-
-    //possible relations between verificaton types
-    enum ConstraintType_Ex {
-        CTX_REVERSED_GENERIC = 4,
-        CTX_REVERSED_ARRAY2REF = 5,
-        CTX_POSSIBLE_STACKMAP = 6
-    };
-
-    struct ReversedGenericCnstr : Constraint {
-        ReversedGenericCnstr *next() {
-            return (ReversedGenericCnstr *) Constraint::next(Constraint::next(), CTX_REVERSED_GENERIC);
-        }
-    };
-
-    struct ReversedArrayCnstr : Constraint {
-        ReversedArrayCnstr *next() {
-            return (ReversedArrayCnstr *) Constraint::next(Constraint::next(), CTX_REVERSED_ARRAY2REF);
-        }
-    };
-
-    struct StackmapAttrCnstr : Constraint {
-        int depth;
-
-        StackmapAttrCnstr *next() {
-            return (StackmapAttrCnstr *) Constraint::next(Constraint::next(), CTX_POSSIBLE_STACKMAP);
-        }
+//possible relations between verificaton types
+enum ConstraintType_Ex {
+    CTX_REVERSED_GENERIC = 4,
+    CTX_REVERSED_ARRAY2REF = 5,
+    CTX_POSSIBLE_STACKMAP = 6
+};
+
+struct ReversedGenericCnstr : Constraint {
+    ReversedGenericCnstr *next() {
+        return (ReversedGenericCnstr *) Constraint::next(Constraint::next(), CTX_REVERSED_GENERIC);
+    }
+};
+
+struct ReversedArrayCnstr : Constraint {
+    ReversedArrayCnstr *next() {
+        return (ReversedArrayCnstr *) Constraint::next(Constraint::next(), CTX_REVERSED_ARRAY2REF);
+    }
+};
+
+struct StackmapAttrCnstr : Constraint {
+    int depth;
+
+    StackmapAttrCnstr *next() {
+        return (StackmapAttrCnstr *) Constraint::next(Constraint::next(), CTX_POSSIBLE_STACKMAP);
+    }
+};
+
+struct StackmapElement_Ex : StackmapElement_5 { //TODO: should be rewritten to save footprint
+    ReversedGenericCnstr *firstReversedGenericCnstr() {
+        return (ReversedGenericCnstr*)Constraint::next(others, CTX_REVERSED_GENERIC);
+    }
+
+    ReversedArrayCnstr *firstReversedArrayCnstr() {
+        return (ReversedArrayCnstr*)Constraint::next(others, CTX_REVERSED_ARRAY2REF);
+    }
+
+    StackmapAttrCnstr *firstStackmapAttrCnstr() {
+        return (StackmapAttrCnstr*)Constraint::next(others, CTX_POSSIBLE_STACKMAP);
+    }
+
+    int newReversedGenericCnstr_safe(Memory *mem, StackmapElement_5 *to) {
+        ReversedGenericCnstr *rgen = firstReversedGenericCnstr();
+        while( rgen ) {
+            if( rgen->variable == to ) return false;
+            rgen = rgen->next();
+        }
+        newConstraint(mem, CTX_REVERSED_GENERIC)->variable = to;
+        return true;
+    }
+
+    int newReversedArrayCnstr_safe(Memory *mem, StackmapElement_5 *to) {
+        ReversedArrayCnstr *rarr = firstReversedArrayCnstr();
+        while( rarr ) {
+            if( rarr->variable == to ) return false;
+            rarr = rarr->next();
+        }
+        newConstraint(mem, CTX_REVERSED_ARRAY2REF)->variable = to;
+        return true;
+    }
+
+    void newStackmapAttrCnstr(Memory *mem, SmConstant value) {
+        StackmapAttrCnstr *sm = (StackmapAttrCnstr *)mem->malloc(sizeof(StackmapAttrCnstr));
+
+        sm->nxt = others;
+        sm->type = (ConstraintType)CTX_POSSIBLE_STACKMAP;
+        sm->value = value.c;
+        sm->depth = 0;
+
+        others = sm;
+    }
+
+    void removeIncoming(IncomingType *inc) {
+        IncomingType *ptr = firstIncoming();
+        assert(ptr);
+
+        if( inc == ptr ) {
+            POINTER_SIZE_INT mask = (POINTER_SIZE_INT)incoming & 3;
+            incoming = (IncomingType *) ((POINTER_SIZE_INT)inc->next() | mask);
+        } else {
+            while( ptr->next() != inc ) {
+                ptr = ptr->next();
+                assert(ptr);
+            }
+            ptr->nxt = inc->nxt;
+        }
+    }
+
+    void removeOther(Constraint *o) {
+        Constraint *ptr = firstOthers();
+        assert(ptr);
+
+        if( o == ptr ) {
+            others = o->next();
+        } else {
+            while( ptr->next() != o ) {
+                ptr = ptr->next();
+                assert(ptr);
+            }
+            ptr->nxt = o->nxt;
+        }
+    }
+
+};
+
+struct RefInfo {
+    union {
+        SmConstant *supercls;
+        unsigned    mask;
     };
 
-    struct StackmapElement_Ex : StackmapElement { //TODO: should be rewritten to save footprint
-        ReversedGenericCnstr *firstReversedGenericCnstr() {
-            return (ReversedGenericCnstr*)Constraint::next(others, CTX_REVERSED_GENERIC);
-        }
-
-        ReversedArrayCnstr *firstReversedArrayCnstr() {
-            return (ReversedArrayCnstr*)Constraint::next(others, CTX_REVERSED_ARRAY2REF);
-        }
-
-        StackmapAttrCnstr *firstStackmapAttrCnstr() {
-            return (StackmapAttrCnstr*)Constraint::next(others, CTX_POSSIBLE_STACKMAP);
-        }
+    void init() {
+        mask = 0xFFFFFFFF;
+    }
+
+    int is_being_calculated() {
+        return mask == 0xFFFFFFFE;
+    }
+
+    void set_being_calculated() {
+        mask = 0xFFFFFFFE;
+    }
+
+    int is_calculated() {
+        return mask != 0xFFFFFFFF && !is_being_calculated();
+    }
+
+    int is_interface() {
+        return !supercls;
+    }
+
+    void set_interface() {
+        supercls = 0;
+        *((SmConstant*)&mask) = SM_NONE;
+    }
+
+    SmConstant *superclasses() {
+        //always return valis pointer
+        return supercls ? supercls : (SmConstant*)&mask;
+    }
+
+    void set_superclasses(SmConstant *s) {
+        mask = 0; //just in case
+        supercls = s;
+    }
+};
+
+struct TrustedPair {
+    SmConstant from;
+    SmConstant to;
+};
+
+//
+// Context - main class of Type Checker
+//
+
+class vf_Context_5e : public vf_Context_5 {
+public:
+    vf_Context_5e(SharedClasswideData &classwide, void *_unparsedPairs) :
+      vf_Context_5(classwide), parsedTrustedData(0), parsedDataSz(0), unparsedPairs(_unparsedPairs)
+      {
+          //we would like to flush StackMapTable attribute from this method
+          stackmapattr_calculation = true;
+      }
+
+    vf_Result recompute_stackmaptable(Method_Handle method);
+
+    ~vf_Context_5e() {
+        tc_free(parsedTrustedData);
+    }
+        
+    uint8* written_stackmap;
 
-        int newReversedGenericCnstr_safe(Memory *mem, StackmapElement *to) {
-            ReversedGenericCnstr *rgen = firstReversedGenericCnstr();
-            while( rgen ) {
-                if( rgen->variable == to ) return false;
-                rgen = rgen->next();
-            }
-            newConstraint(mem, CTX_REVERSED_GENERIC)->variable = to;
-            return true;
-        }
+protected:
+    void writeStackMapFrame(Address instr);
+    vf_Result fillCurFrame(PropsHead_5 *head);
+    void writeStackMapFrame_Full(Address offset);
+    void writeStackMapFrame_SameLocalsOneStack(Address offset);
+    void writeStackMapFrame_Same(Address offset);
+    void writeStackMapFrame_Cut(Address offset, int attr_delta, int workmap_delta);
+    void writeStackMapFrame_Append(Address offset, int attr_delta, int workmap_delta);
+    void writeStackMapElements(Address start, uint32 cnt);
 
-        int newReversedArrayCnstr_safe(Memory *mem, StackmapElement *to) {
-            ReversedArrayCnstr *rarr = firstReversedArrayCnstr();
-            while( rarr ) {
-                if( rarr->variable == to ) return false;
-                rarr = rarr->next();
-            }
-            newConstraint(mem, CTX_REVERSED_ARRAY2REF)->variable = to;
-            return true;
+    void writeByte(uint16 byte) {
+        assert(byte < 256);
+        if( !written_stackmap ) {
+            attrLen = 2; // reserve uint16 for number of enries
+            attrSz = 0;
         }
 
-        void newStackmapAttrCnstr(Memory *mem, SmConstant value) {
-            StackmapAttrCnstr *sm = (StackmapAttrCnstr *)mem->malloc(sizeof(StackmapAttrCnstr));
 
-            sm->nxt = others;
-            sm->type = (ConstraintType)CTX_POSSIBLE_STACKMAP;
-            sm->value = value.c;
-            sm->depth = 0;
-
-            others = sm;
-        }
-
-        void removeIncoming(IncomingType *inc) {
-            IncomingType *ptr = firstIncoming();
-            assert(ptr);
-
-            if( inc == ptr ) {
-                POINTER_SIZE_INT mask = (POINTER_SIZE_INT)incoming & 3;
-                incoming = (IncomingType *) ((POINTER_SIZE_INT)inc->next() | mask);
-            } else {
-                while( ptr->next() != inc ) {
-                    ptr = ptr->next();
-                    assert(ptr);
-                }
-                ptr->nxt = inc->nxt;
-            }
-        }
 
-        void removeOther(Constraint *o) {
-            Constraint *ptr = firstOthers();
-            assert(ptr);
-
-            if( o == ptr ) {
-                others = o->next();
-            } else {
-                while( ptr->next() != o ) {
-                    ptr = ptr->next();
-                    assert(ptr);
-                }
-                ptr->nxt = o->nxt;
-            }
+        if( attrLen + 6 >= attrSz ) {
+            attrSz += 4096;
+            written_stackmap = (uint8*) tc_realloc(written_stackmap, attrSz);
         }
 
-    };
-
-    struct RefInfo {
-        union {
-            SmConstant *supercls;
-            unsigned    mask;
-        };
-
-        void init() {
-            mask = 0xFFFFFFFF;
-        }
+        written_stackmap[attrLen + 6] = (uint8) byte;
+        attrLen++;
+    }
 
-        int is_being_calculated() {
-            return mask == 0xFFFFFFFE;
-        }
 
-        void set_being_calculated() {
-            mask = 0xFFFFFFFE;
-        }
+    unsigned lastLocalsNo;
+    int lastInstr;
+    WorkmapHead *curFrame;
+    ///////////////////////
+    vf_Result do_recompute();
+    vf_Result mantain_node_consistency(StackmapElement_5 *el);
+    vf_Result arc_consistensy_in_node(StackmapElement_5 *el, int depth);
+    vf_Result mantain_arc_consistency(int depth);
+    vf_Result calculate_subgraph(StackmapElement_5 *el);
+    vf_Result do_backtracking(int depth);
 
-        int is_calculated() {
-            return mask != 0xFFFFFFFF && !is_being_calculated();
-        }
+    void push_subgraph(StackmapElement_5 *el);
+    void insert_back_refs(StackmapElement_5 *el);
 
-        int is_interface() {
-            return !supercls;
-        }
+    SmConstant get_node_value(PropsHead_5 *head, int i) {
+        StackmapElement_Ex *el;
 
-        void set_interface() {
-            supercls = 0;
-            *((SmConstant*)&mask) = SM_NONE;
-        }
+        if( head->is_workmap() ) {
+            WorkmapHead *w = head->getWorkmap();
+            if( !w->elements[i].isVariable() ) {
+                return w->elements[i].getConst();
+            }
 
-        SmConstant *superclasses() {
-            //always return valis pointer
-            return supercls ? supercls : (SmConstant*)&mask;
+            el = (StackmapElement_Ex*)(w->elements[i].getVariable());
+        } else {
+            el = (StackmapElement_Ex*)(&head->getStackmap()->elements[i]);
         }
 
-        void set_superclasses(SmConstant *s) {
-            mask = 0; //just in case
-            supercls = s;
+        if( is_node_calculated(el) ) {
+            return el->firstIncoming()->value;
         }
-    };
-
-    struct TrustedPair {
-        SmConstant from;
-        SmConstant to;
-    };
-
-    //
-    // Context - main class of Type Checker
-    //
-
-    class vf_Context_5e : public vf_Context_5 {
-    public:
-        vf_Context_5e(SharedClasswideData &classwide, void *_unparsedPairs) :
-          vf_Context_5(classwide), parsedTrustedData(0), parsedDataSz(0), unparsedPairs(_unparsedPairs)
-          {
-              //we would like to flush StackMapTable attribute from this method
-              stackmapattr_calculation = true;
-          }
-
-        vf_Result recompute_stackmaptable(Method_Handle method);
-
-        ~vf_Context_5e() {
-            tc_free(parsedTrustedData);
-        }
-            
-        uint8* written_stackmap;
-
-    protected:
-        void writeStackMapFrame( Address instr);
-        vf_Result fillCurFrame(PropsHead *head);
-        void writeStackMapFrame_Full( uint32 offset);
-        void writeStackMapFrame_SameLocalsOneStack( uint32 offset);
-        void writeStackMapFrame_Same( uint32 offset);
-        void writeStackMapFrame_Cut( uint32 offset, int attr_delta, int workmap_delta);
-        void writeStackMapFrame_Append( uint32 offset, int attr_delta, int workmap_delta);
-        void writeStackMapElements( uint32 start, uint32 cnt);
-
-        void writeByte(uint8 byte) {
-            if( !written_stackmap ) {
-                attrLen = 2; // reserve uint16 for number of enries
-                attrSz = 0;
-            }
-
+        assert(no_stackmap_choice(el));
 
-
-            if( attrLen + 6 >= attrSz ) {
-                attrSz += 4096;
-                written_stackmap = (uint8*) tc_realloc(written_stackmap, attrSz);
+        for( StackmapAttrCnstr *sm = el->firstStackmapAttrCnstr(); sm; sm=sm->next()
) {
+            if( !sm->depth ) {
+                return sm->value;
             }
-
-            written_stackmap[attrLen + 6] = byte;
-            attrLen++;
         }
+        assert(0);
+        return SM_BOGUS;
+    }
 
+    int is_node_calculated(StackmapElement_5 *el) {
+        assert(el->firstIncoming());
+        //assert( el->firstIncoming()->next() || !SmConstant(el->firstIncoming()->value).isReference()
|| class_get_cp_class_entry(k_class, tpool.sm_get_refname(el->firstIncoming()->value)));
+        return !el->firstIncoming()->next();
+    }
 
-        unsigned lastLocalsNo;
-        int lastInstr;
-        WorkmapHead *curFrame;
-        ///////////////////////
-        vf_Result do_recompute();
-        vf_Result mantain_node_consistency(StackmapElement *el);
-        vf_Result arc_consistensy_in_node(StackmapElement *el, int depth);
-        vf_Result mantain_arc_consistency(int depth);
-        vf_Result calculate_subgraph(StackmapElement *el);
-        vf_Result do_backtracking(int depth);
-
-        void push_subgraph(StackmapElement *el);
-        void insert_back_refs(StackmapElement *el);
-
-        SmConstant get_node_value(PropsHead *head, int i) {
-            StackmapElement_Ex *el;
-
-            if( head->is_workmap() ) {
-                WorkmapHead *w = head->getWorkmap();
-                if( !w->elements[i].isVariable() ) {
-                    return w->elements[i].getConst();
-                }
-
-                el = (StackmapElement_Ex*)(w->elements[i].getVariable());
-            } else {
-                el = (StackmapElement_Ex*)(&head->getStackmap()->elements[i]);
-            }
-
-            if( is_node_calculated(el) ) {
-                return el->firstIncoming()->value;
-            }
-            assert(no_stackmap_choice(el));
-
-            for( StackmapAttrCnstr *sm = el->firstStackmapAttrCnstr(); sm; sm=sm->next()
) {
-                if( !sm->depth ) {
-                    return sm->value;
-                }
-            }
-            assert(0);
-            return SM_BOGUS;
-        }
-
-        int is_node_calculated(StackmapElement *el) {
-            assert(el->firstIncoming());
-            //assert( el->firstIncoming()->next() || !SmConstant(el->firstIncoming()->value).isReference()
|| class_get_cp_class_entry(k_class, tpool.sm_get_refname(el->firstIncoming()->value)));
-            return !el->firstIncoming()->next();
-        }
-
-        int no_stackmap_choice(StackmapElement_Ex *el) {
-            assert(el->firstStackmapAttrCnstr());
-            int stackmapcnt = 0;
-            for( StackmapAttrCnstr *sm = el->firstStackmapAttrCnstr(); sm; sm=sm->next()
) {
-                if( !sm->depth ) {
-                    stackmapcnt++;
-                    if( stackmapcnt == 2 ) return false;
-                }
+    int no_stackmap_choice(StackmapElement_Ex *el) {
+        assert(el->firstStackmapAttrCnstr());
+        int stackmapcnt = 0;
+        for( StackmapAttrCnstr *sm = el->firstStackmapAttrCnstr(); sm; sm=sm->next()
) {
+            if( !sm->depth ) {
+                stackmapcnt++;
+                if( stackmapcnt == 2 ) return false;
             }
-            assert(stackmapcnt == 1);
-            //assert( class_get_cp_class_entry(k_class, tpool.sm_get_refname(el->firstStackmapAttrCnstr()->value)));
-            return true;
         }
+        assert(stackmapcnt == 1);
+        //assert( class_get_cp_class_entry(k_class, tpool.sm_get_refname(el->firstStackmapAttrCnstr()->value)));
+        return true;
+    }
 
-        SmConstant get_object_array(int dimension) {
-            return dimension ? get_ref_array(dimension, "java/lang/Object") : tpool.sm_get_const_object();
-        }
+    SmConstant get_object_array(int dimension) {
+        return dimension ? get_ref_array(dimension, "java/lang/Object") : tpool.sm_get_const_object();
+    }
 
-        SmConstant get_ref_array(int dimension, SmConstant ref) {
-            return dimension ? get_ref_array(dimension, tpool.sm_get_refname(ref)) : ref;
-        }
+    SmConstant get_ref_array(int dimension, SmConstant ref) {
+        return dimension ? get_ref_array(dimension, tpool.sm_get_refname(ref)) : ref;
+    }
 
-        SmConstant get_ref_array(int dimension, const char* ref_name) {
-            assert(dimension);
-            int name_len = (int)strlen(ref_name);
+    SmConstant get_ref_array(int dimension, const char* ref_name) {
+        assert(dimension);
+        int name_len = (int)strlen(ref_name);
 
-            char *name = (char*)mem.malloc(name_len + dimension + 2);
-            tc_memset(name, '[', dimension);
-            name[dimension] = 'L';
-            tc_memcpy(name + dimension + 1, ref_name, name_len);
-            name[dimension + name_len + 1] = ';';
+        char *name = (char*)mem.malloc(name_len + dimension + 2);
+        tc_memset(name, '[', dimension);
+        name[dimension] = 'L';
+        tc_memcpy(name + dimension + 1, ref_name, name_len);
+        name[dimension + name_len + 1] = ';';
 
-            SmConstant ret = tpool.get_ref_type(name, name_len + dimension + 2);
-            mem.dealloc_last(name, name_len + dimension + 2);
-            return ret;
-        }
+        SmConstant ret = tpool.get_ref_type(name, name_len + dimension + 2);
+        mem.dealloc_last(name, name_len + dimension + 2);
+        return ret;
+    }
 
 
-        SmConstant get_zerodim(SmConstant value) {
-            const char* name = tpool.sm_get_refname(value);
-            if( name[0] != '[' ) return value;
+    SmConstant get_zerodim(SmConstant value) {
+        const char* name = tpool.sm_get_refname(value);
+        if( name[0] != '[' ) return value;
 
-            while( name[0] == '[' ) name++;
-            return tpool.get_type(name);
-        }
+        while( name[0] == '[' ) name++;
+        return tpool.get_type(name);
+    }
 
-        unsigned array_dims(SmConstant ref) {
-            const char* start = tpool.sm_get_refname(ref);
-            const char* name = start;
-            while( name[0] == '[' ) name++;
-            return (unsigned)(name-start);
-        }
+    unsigned array_dims(SmConstant ref) {
+        const char* start = tpool.sm_get_refname(ref);
+        const char* name = start;
+        while( name[0] == '[' ) name++;
+        return (unsigned)(name-start);
+    }
 
-        int isObjectOrInterface(SmConstant ref) {
-            if( ref == tpool.sm_get_const_object() ) return true;
+    int isObjectOrInterface(SmConstant ref) {
+        if( ref == tpool.sm_get_const_object() ) return true;
 
-            Class_Handle h = tpool.sm_get_handler(ref);
-            if( h && h != CLASS_NOT_LOADED ) return class_is_interface(h);
+        Class_Handle h = tpool.sm_get_handler(ref);
+        if( h && h != CLASS_NOT_LOADED ) return class_is_interface(h);
 
-            parseTrustedData(ref);
-            return parsedTrustedData[ref.getReferenceIdx()].is_interface();
-        }
+        parseTrustedData(ref);
+        return parsedTrustedData[ref.getReferenceIdx()].is_interface();
+    }
 
-        int knownly_assignable(SmConstant from, SmConstant to, int array_element = 0) {
-            if( from == to && !array_element ) return true;
+    int knownly_assignable(SmConstant from, SmConstant to, int array_element = 0) {
+        if( from == to && !array_element ) return true;
 
-            unsigned from_dims = array_dims(from);
-            unsigned to_dims = array_dims(to) + (array_element ? 1 : 0);
+        unsigned from_dims = array_dims(from);
+        unsigned to_dims = array_dims(to) + (array_element ? 1 : 0);
 
-            if( to_dims > from_dims ) return false;
-            if( to_dims < from_dims ) return isObjectOrInterface( get_zerodim(to) );
+        if( to_dims > from_dims ) return false;
+        if( to_dims < from_dims ) return isObjectOrInterface( get_zerodim(to) );
 
-            from = get_zerodim(from);
-            to = get_zerodim(to);
+        from = get_zerodim(from);
+        to = get_zerodim(to);
 
-            if( isObjectOrInterface(to) ) return true;
+        if( isObjectOrInterface(to) ) return true;
 
-            parseTrustedData(from); // it may change class_handler for 'to'
+        parseTrustedData(from); // it may change class_handler for 'to'
 
-            Class_Handle t = tpool.sm_get_handler(to);
-            assert(t);
+        Class_Handle t = tpool.sm_get_handler(to);
+        assert(t);
 
-            for( SmConstant *sm = parsedTrustedData[from.getReferenceIdx()].superclasses();
*sm != SM_NONE; sm++ ) {
-                if( *sm == to ) {
-                    return true;
-                }
+        for( SmConstant *sm = parsedTrustedData[from.getReferenceIdx()].superclasses(); *sm
!= SM_NONE; sm++ ) {
+            if( *sm == to ) {
+                return true;
+            }
 
-                if( t != CLASS_NOT_LOADED ) {
-                    Class_Handle f = tpool.sm_get_handler(*sm);
-                    if( f != CLASS_NOT_LOADED && vf_is_extending(f, t) ) return true;
-                }
+            if( t != CLASS_NOT_LOADED ) {
+                Class_Handle f = tpool.sm_get_handler(*sm);
+                if( f != CLASS_NOT_LOADED && vf_is_extending(f, t) ) return true;
             }
-            return false;
         }
+        return false;
+    }
 
 
-        int check_possible_stackmap(StackmapElement *el, SmConstant sm) {
-            for( IncomingType *inc = el->firstIncoming()->next(); inc; inc = inc->next())
{
-                if( !knownly_assignable(inc->value, sm) ) {
-                    //bad stackmap element
-                    return false;
-                }
+    int check_possible_stackmap(StackmapElement_5 *el, SmConstant sm) {
+        for( IncomingType *inc = el->firstIncoming()->next(); inc; inc = inc->next())
{
+            if( !knownly_assignable(inc->value, sm) ) {
+                //bad stackmap element
+                return false;
             }
+        }
 
-            for( ExpectedType *exp = el->firstExpected(); exp; exp = exp->next() )
{
-                if( !knownly_assignable(sm, exp->value) ) {
-                    //bad stackmap element
-                    return false;
-                }
+        for( ExpectedType *exp = el->firstExpected(); exp; exp = exp->next() ) {
+            if( !knownly_assignable(sm, exp->value) ) {
+                //bad stackmap element
+                return false;
             }
-            return true;
         }
+        return true;
+    }
 
-        int is_arc(Constraint *c) {
-            return is_direct_arc(c) || is_reversed_arc(c);
-        }
+    int is_arc(Constraint *c) {
+        return is_direct_arc(c) || is_reversed_arc(c);
+    }
 
-        int is_direct_arc(Constraint *c) {
-            return c->type == CT_GENERIC || c->type == CT_ARRAY2REF;
-        }
+    int is_direct_arc(Constraint *c) {
+        return c->type == CT_GENERIC || c->type == CT_ARRAY2REF;
+    }
 
-        int is_reversed_arc(Constraint *c) {
-            return (ConstraintType_Ex)c->type == CTX_REVERSED_GENERIC || (ConstraintType_Ex)c->type
== CTX_REVERSED_ARRAY2REF;
-        }
+    int is_reversed_arc(Constraint *c) {
+        return (ConstraintType_Ex)c->type == CTX_REVERSED_GENERIC || (ConstraintType_Ex)c->type
== CTX_REVERSED_ARRAY2REF;
+    }
 
 
-        void reduceTryBlocks(Address dead_code_start, Address dead_code_end) {
-            unsigned short start_pc;
-            unsigned short end_pc;
-            unsigned short handler_pc;
-            unsigned short handler_cp_index;
+    void reduceTryBlocks(Address dead_code_start, Address dead_code_end) {
+        uint16 start_pc;
+        uint16 end_pc;
+        uint16 handler_pc;
+        uint16 handler_cp_index;
 
-            for( unsigned idx = 0; idx < m_handlecount; idx++ ) {
-                method_get_exc_handler_info( m_method, idx, &start_pc, &end_pc, &handler_pc,
&handler_cp_index );
+        for( uint16 idx = 0; idx < m_handlecount; idx++ ) {
+            method_get_exc_handler_info( m_method, idx, &start_pc, &end_pc, &handler_pc,
&handler_cp_index );
 
-                if( start_pc >= dead_code_start && end_pc <= dead_code_end
) {
-                    method_remove_exc_handler( m_method, idx );
-                    idx--;
-                } else if( end_pc > dead_code_start && end_pc <= dead_code_end
) {
-                    method_modify_exc_handler_info( m_method, idx, start_pc, dead_code_start,
handler_pc, handler_cp_index );
-                } else if( start_pc >= dead_code_start && start_pc < dead_code_end
 ) {
-                    method_modify_exc_handler_info( m_method, idx, dead_code_end, end_pc,
handler_pc, handler_cp_index );
-                }
+            if( start_pc >= dead_code_start && end_pc <= dead_code_end ) {
+                method_remove_exc_handler( m_method, idx );
+                idx--;
+            } else if( end_pc > dead_code_start && end_pc <= dead_code_end
) {
+                method_modify_exc_handler_info( m_method, idx, start_pc, dead_code_start,
handler_pc, handler_cp_index );
+            } else if( start_pc >= dead_code_start && start_pc < dead_code_end
 ) {
+                method_modify_exc_handler_info( m_method, idx, dead_code_end, end_pc, handler_pc,
handler_cp_index );
             }
         }
+    }
 
-        void parseTrustedData(SmConstant value, int knownly_interface = false);
-        void parseTrustedPairs();
+    void parseTrustedData(SmConstant value, int knownly_interface = false);
+    void parseTrustedPairs();
 
-        void tryResolve(SmConstant ref) {
-            vf_ValidType *f = tpool.getVaildType(ref.getReferenceIdx());
-            if( !f->cls ) {
-                f->cls = vf_resolve_class(k_class, f->name, false);
-                if( !f->cls ) f->cls = CLASS_NOT_LOADED;
-            }
+    void tryResolve(SmConstant ref) {
+        vf_ValidType *f = tpool.getVaildType(ref.getReferenceIdx());
+        if( !f->cls ) {
+            f->cls = vf_resolve_class(k_class, f->name, false);
+            if( !f->cls ) f->cls = CLASS_NOT_LOADED;
         }
+    }
 
 
-        FastStack<StackmapElement*> arc_stack;
-        FastStack<StackmapElement*> subgraph_stack;
-        FastStack<SmConstant> class_stack;
-        
-        RefInfo *parsedTrustedData;
-        int parsedDataSz;
+    FastStack<StackmapElement_5*> arc_stack;
+    FastStack<StackmapElement_5*> subgraph_stack;
+    FastStack<SmConstant> class_stack;
+    
+    RefInfo *parsedTrustedData;
+    int parsedDataSz;
 
-        TrustedPair* trustedPairs;
-        int trustedPairsCnt;
-        void* unparsedPairs;
+    TrustedPair* trustedPairs;
+    int trustedPairsCnt;
+    void* unparsedPairs;
 
 
-        uint32 attrLen;
-        uint32 attrSz;
-    };
+    uint32 attrLen;
+    uint32 attrSz;
+};
 
 
 
 #define ITERATE_THRU_STACKMAP_VECTORS(CODE)                                         \
-    for( int i = 0; i < props.hash_size; i++ ) {                                    \
-        PropsHead *pro = (PropsHead*)(props.propHashTable[i]);                      \
-        while(pro) {                                                                \
-            if( !pro->is_workmap() ) {                                              \
-                StackmapHead *sm = pro->getStackmap();                              \
-                                                                                    \
-                for( unsigned j = 0; j < m_stack_start + sm->depth; j++ ) {       
 \
-                    /*skip uninit flag*/                                            \
-                    if( j == m_max_locals && j < m_stack_start ) continue;   
      \
-                                                                                    \
-                    StackmapElement *el = &(sm->elements[j]);                    
  \
-                    CODE;                                                           \
-                }                                                                   \
-            }                                                                       \
-            pro=(PropsHead *)pro->next;                                             \
-        }                                                                           \
-    }                                                                               \
-
-} // namespace CPVerifier_5
+for( i = 0; i < props.hash_size; i++ ) {                                    \
+    PropsHead_5 *pro = (PropsHead_5*)(props.propHashTable[i]);                      \
+    while(pro) {                                                                \
+        if( !pro->is_workmap() ) {                                              \
+            StackmapHead *sm = pro->getStackmap();                              \
+                                                                                \
+            for( unsigned j = 0; j < m_stack_start + sm->depth; j++ ) {         \
+                /*skip uninit flag*/                                            \
+                if( j == m_max_locals && j < m_stack_start ) continue;       
  \
+                                                                                \
+                StackmapElement_5 *el = &(sm->elements[j]);                      
\
+                CODE;                                                           \
+            }                                                                   \
+        }                                                                       \
+        pro=(PropsHead_5 *)pro->next;                                             \
+    }                                                                           \
+}                                                                               \
 
 #endif

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp?rev=649574&r1=649573&r2=649574&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/write_attr.cpp Fri
Apr 18 08:29:36 2008
@@ -14,31 +14,17 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Mikhail Loenko
- */  
-
-
-
-#include <iostream>
-
-using namespace std;
-
 #include "recompute.h"
 #include "../java6/stackmap_6.h"
 #include "time.h"
 
-using namespace CPVerifier;
-using namespace CPVerifier_5;
-using namespace CPVerifier_6;
-
 static char err_message[5000];
 
 
 void vf_Context_5e::writeStackMapFrame( Address instr )
 {
     assert(instr < m_code_length || 1 + lastInstr < instr );
-    uint32 offset = lastInstr == -1 ? instr : instr - lastInstr - 1;
+    Address offset = lastInstr == -1 ? instr : instr - lastInstr - 1;
     lastInstr = instr;
 
     if( curFrame->depth == 0 ) {
@@ -57,20 +43,23 @@
         }
 
         if( all_locals_same ) {
-            return writeStackMapFrame_Same(offset);
+            writeStackMapFrame_Same(offset);
+            return;
         } 
 
         if( first_changed_local < lastLocalsNo ) {
             //check whether it's a CUT
             if( last_changed_local >= lastLocalsNo ) {
-                return writeStackMapFrame_Full(offset);
+                writeStackMapFrame_Full(offset);
+                return;
             }
 
             int cut_sz = 0; // number of elements cut in attribute (long and double are single
size units)
             int cut_realsz = 0; // number of elements cut in workmap structure (long and
double are double size units)
             for( unsigned i = first_changed_local; i < lastLocalsNo; i++ ) {
                 if( curFrame->elements[i].getConst() != SM_BOGUS ) {
-                    return writeStackMapFrame_Full(offset);
+                    writeStackMapFrame_Full(offset);
+                    return;
                 }
 
                 cut_realsz++;
@@ -80,9 +69,11 @@
                 }
             }
             if( cut_sz > 3 ) {
-                return writeStackMapFrame_Full(offset);
+                writeStackMapFrame_Full(offset);
+                return;
             }
-            return writeStackMapFrame_Cut(offset, cut_sz, cut_realsz);
+             writeStackMapFrame_Cut(offset, cut_sz, cut_realsz);
+            return;
         } else {
             //check whether it's an APPEND
             int app_sz = 0;  // number of elements appended in attribute (long and double
are single size units)
@@ -97,24 +88,29 @@
             }
             if( app_sz > 3 ) {
                 //can't append more than 3 elements
-                return writeStackMapFrame_Full(offset);
+                writeStackMapFrame_Full(offset);
+                return;
             }
-            return writeStackMapFrame_Append(offset, app_sz, app_realsz);
+            writeStackMapFrame_Append(offset, app_sz, app_realsz);
+            return;
         }
     } else if( curFrame->depth == 1 || curFrame->depth == 2 && curFrame->elements[m_stack_start
+ 1].getConst() == SM_HIGH_WORD) {
         for( unsigned i = 0; i < m_max_locals; i++ ) {
             if( curFrame->elements[i].getConst() != workmap->elements[i].getConst()
) {
-                return writeStackMapFrame_Full(offset);
+                writeStackMapFrame_Full(offset);
+                return;
             }
         }
-        return writeStackMapFrame_SameLocalsOneStack(offset);
+        writeStackMapFrame_SameLocalsOneStack(offset);
+        return;
     } else {
-        return writeStackMapFrame_Full(offset);
+        writeStackMapFrame_Full(offset);
+        return; 
     }
 
 } // writeStackMapFrame
 
-void vf_Context_5e::writeStackMapFrame_Full( uint32 offset ) {
+void vf_Context_5e::writeStackMapFrame_Full( Address offset ) {
     writeByte(255); // full stack frame
 
     writeByte(offset >> 8); // offset
@@ -128,7 +124,8 @@
     }
 
     unsigned locals_sz = 0; // number of elements in attribute (long and double are single
size units)
-    for( unsigned i = 0; i < locals_realsz; i++ ) {
+    unsigned i;
+    for( i = 0; i < locals_realsz; i++ ) {
         if( curFrame->elements[i].getConst() != SM_HIGH_WORD ) {
              locals_sz++;
         }
@@ -143,7 +140,7 @@
     /////////////////////////////////
 
     unsigned stack_sz = 0; // number of stack elements in attribute (long and double are
single size units)
-    for( unsigned i = 0; i < curFrame->depth; i++ ) {
+    for( i = 0; i < curFrame->depth; i++ ) {
         if( curFrame->elements[m_stack_start + i].getConst() != SM_HIGH_WORD ) {
              stack_sz++;
         }
@@ -156,7 +153,7 @@
 
 }
 
-void vf_Context_5e::writeStackMapFrame_SameLocalsOneStack( uint32 offset ) {
+void vf_Context_5e::writeStackMapFrame_SameLocalsOneStack( Address offset ) {
     
     if( offset < 64 ) {
         writeByte(offset + 64); // same locals one stack item
@@ -170,7 +167,7 @@
     }
 }
 
-void vf_Context_5e::writeStackMapFrame_Same( uint32 offset ) {
+void vf_Context_5e::writeStackMapFrame_Same( Address offset ) {
 
     if( offset < 64 ) {
         writeByte(offset); // same
@@ -181,7 +178,7 @@
     }
 }
 
-void vf_Context_5e::writeStackMapFrame_Cut( uint32 offset, int cut_sz, int cut_realsz ) {
+void vf_Context_5e::writeStackMapFrame_Cut( Address offset, int cut_sz, int cut_realsz )
{
 
     writeByte(251 - cut_sz); // same extended
 
@@ -191,7 +188,7 @@
     lastLocalsNo -= cut_realsz;
 }
 
-void vf_Context_5e::writeStackMapFrame_Append( uint32 offset, int app_sz, int app_realsz
) {
+void vf_Context_5e::writeStackMapFrame_Append( Address offset, int app_sz, int app_realsz
) {
 
     writeByte(251 + app_sz); // same extended
 
@@ -203,7 +200,7 @@
     lastLocalsNo += app_realsz;
 }
 
-void vf_Context_5e::writeStackMapElements( uint32 start, uint32 cnt ) {
+void vf_Context_5e::writeStackMapElements( Address start, uint32 cnt ) {
     while( cnt ) {
         SmConstant el = curFrame->elements[start].const_val;
         workmap->elements[start].const_val = el;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h?rev=649574&r1=649573&r2=649574&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.h
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_class_interface.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
- */  
-
 #ifndef __X_CLASS_INTERFACE_H__
 #define __X_CLASS_INTERFACE_H__
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp?rev=649574&r1=649573&r2=649574&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.cpp Fri
Apr 18 08:29:36 2008
@@ -14,24 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Mikhail Loenko
- */  
-
-
-
-#include <iostream>
-
-using namespace std;
-
 #include "recompute.h"
 #include "x_verifier.h"
 #include "../java6/context_6.h"
 #include "time.h"
-
-using namespace CPVerifier;
-using namespace CPVerifier_6;
-
 
 /**
  * Allocates an empty verification context for a class, 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h?rev=649574&r1=649573&r2=649574&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier-3363/x_verifier/x_verifier.h Fri Apr
18 08:29:36 2008
@@ -14,12 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/** 
- * @author Mikhail Loenko
- */  
-
-
-
 #ifndef __X_VERIFIER_H__
 #define __X_VERIFIER_H__
 



Mime
View raw message