You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2006/12/11 13:27:37 UTC

svn commit: r485644 [1/3] - in /harmony/enhanced/drlvm/trunk/vm: interpreter/src/ vmcore/include/ vmcore/src/class_support/ vmcore/src/exception/ vmcore/src/jit/ vmcore/src/jvmti/ vmcore/src/util/ia32/base/

Author: gshimansky
Date: Mon Dec 11 04:27:35 2006
New Revision: 485644

URL: http://svn.apache.org/viewvc?view=rev&rev=485644
Log:
Applied HARMONY-2505 [drlvm] Class file parser improvements

Acceptance tests passed on ubuntu6 x86, windows 2003 server and suse9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class_File_Loader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_em64t.cpp Mon Dec 11 04:27:35 2006
@@ -87,7 +87,7 @@
     M2N_ALLOC_MACRO;
     hythread_suspend_enable();
 
-    int sz = method->get_num_arg_bytes() >> 2;
+    int sz = method->get_num_arg_slots();
 
     int n_ints = 0;
     int n_fps = 0;
@@ -287,7 +287,7 @@
 
     M2N_ALLOC_MACRO;
     
-    word sz = method->get_num_arg_bytes() >> 2;
+    word sz = method->get_num_arg_slots();
 
     int n_ints = 0;
     int n_fps = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ia32.cpp Mon Dec 11 04:27:35 2006
@@ -97,7 +97,7 @@
     M2N_ALLOC_MACRO;
     hythread_suspend_enable();
     
-    int sz = method->get_num_arg_bytes() >> 2;
+    int sz = method->get_num_arg_slots();
     uword *arg_words = (uword*) ALLOC_FRAME((sz + 2) * sizeof(uword));
 
     int argId = 0;
@@ -268,7 +268,7 @@
     M2N_ALLOC_MACRO;
     
     frame.This = *(method->get_class()->get_class_handle());
-    int sz = method->get_num_arg_bytes() >> 2;
+    int sz = method->get_num_arg_slots();
     uword *args = (uword*) ALLOC_FRAME((sz + 2) * sizeof(uword));
     args[0] = (uword) get_jni_native_intf();
     args[1] = (uword) &frame.This; 

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interp_native_ipf.cpp Mon Dec 11 04:27:35 2006
@@ -89,7 +89,7 @@
     M2N_ALLOC_MACRO;
     hythread_suspend_enable();
     
-    int sz = method->get_num_arg_bytes() >> 2;
+    int sz = method->get_num_arg_slots();
     uword *arg_words = (uword*) ALLOC_FRAME((sz + 2) * sizeof(uword));
     uword fpargs[6 + 1/* for fptypes */];
     // types of fpargs[6], 0 - float, 1 - double
@@ -282,7 +282,7 @@
     M2N_ALLOC_MACRO;
     
     frame.This = *(method->get_class()->get_class_handle());
-    int sz = method->get_num_arg_bytes() >> 2;
+    int sz = method->get_num_arg_slots();
     uword *args = (uword*) ALLOC_FRAME((sz + 2) * sizeof(uword));
     uword fpargs[6 + 1/* for fptypes */];
     // types of fpargs[6], 0 - float, 1 - double

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Mon Dec 11 04:27:35 2006
@@ -3271,7 +3271,7 @@
     // Setup locals and stack on C stack.
     SETUP_LOCALS_AND_STACK(frame, method);
 
-    int args = method->get_num_arg_bytes() >> 2;
+    int args = method->get_num_arg_slots();
 
     for(int i = args-1; i >= 0; --i) {
         frame.locals(i) = prevFrame.stack.pick(args-1 - i);
@@ -3425,7 +3425,7 @@
 static void
 interpreterInvokeVirtual(StackFrame& prevFrame, Method *method) {
 
-    int args = method->get_num_arg_bytes() >> 2;
+    int args = method->get_num_arg_slots();
     CREF cr = prevFrame.stack.pick(args-1).cr;
 
     if (cr == 0) {
@@ -3459,7 +3459,7 @@
 static void
 interpreterInvokeInterface(StackFrame& prevFrame, Method *method) {
 
-    int args = method->get_num_arg_bytes() >> 2;
+    int args = method->get_num_arg_slots();
     CREF cr = prevFrame.stack.pick(args-1).cr;
 
     if (cr == 0) {
@@ -3515,7 +3515,7 @@
 static void
 interpreterInvokeSpecial(StackFrame& prevFrame, Method *method) {
 
-    int args = method->get_num_arg_bytes() >> 2;
+    int args = method->get_num_arg_slots();
     CREF cr = prevFrame.stack.pick(args-1).cr;
 
     if (cr == 0) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Mon Dec 11 04:27:35 2006
@@ -225,7 +225,9 @@
      * @return <code>true</code> if the index is a valid one in the constant
      *         pool; otherwise <code>false</code>.*/
     bool is_valid_index(uint16 index) const {
-        return /*index > 0 && */index < m_size;
+        // index is valid if it's greater than zero and less than m_size
+        // See specification 4.2 about constant_pool_count
+        return index != 0 && index < m_size;
     }
 
     /** Checks whether the constant-pool entry is resolved.
@@ -632,7 +634,7 @@
      * @param[in] clss - the class that the given constant pool belongs to
      * @return <code>true</code> if the constant pool of clss is valid;
      *         otherwise <code>false</code>.*/
-    bool check(Class* clss);
+    bool check(Global_Env *, Class* clss);
 
     /** Clears the constant-pool content: tags and entries arrays.*/
     void clear() {
@@ -1435,6 +1437,12 @@
      * flag is set.
      * @return <code>true</code> if the class is enum.*/
     bool is_enum() const { return (m_access_flags & ACC_ENUM) != 0; }
+
+    /** Checks whether the class has the <code>ACC_SYNTHETIC</code> flag set.
+     * @return <code>true</code> if the class has the <code>ACC_SYNTHETIC</code> 
+     *         access flag set.*/
+
+    bool is_synthetic() const { return (m_access_flags & ACC_SYNTHETIC) != 0; }
     
     /** Checks whether the class is an annotation.
      * @return <code>true</code> if the class is an annotation.*/

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h?view=diff&rev=485644&r1=485643&r2=485644
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h Mon Dec 11 04:27:35 2006
@@ -131,13 +131,6 @@
 
     bool parse(Class* clss, ByteReader& cfs);
 
-   /* 
-    * returns ATTR_ERROR if attribute was recognized but parsing failed;
-    * returns ATTR_UNDEF if attribute was not recognized 
-    * otherwise returns passed attr value
-    */
-    Attributes process_common_attribute(Attributes attr, uint32 attr_len, ByteReader& cfs);
-
 public:
 #ifdef VM_STATS
     uint64 num_accesses;
@@ -432,6 +425,11 @@
     };
     State get_state()                   {return _state;}
     void set_state(State st)            {_state=st;}
+    
+    struct LocalVarOffset{
+        int value;
+        LocalVarOffset* next;
+    }; 
 
     // "Bytecode" exception handlers, i.e., those from the class file
     unsigned num_bc_exception_handlers() const { return _n_handlers; }
@@ -483,7 +481,7 @@
 
     // Returns number of bytes of arguments pushed on the stack.
     // This value depends on the descriptor and the calling convention.
-    unsigned get_num_arg_bytes() const { return _arguments_size; }
+    unsigned get_num_arg_slots() const { return _arguments_slot_num; }
 
     // Returns number of arguments.  For non-static methods, the this pointer
     // is included in this number
@@ -625,8 +623,8 @@
 
     bool parse(Global_Env& env, Class* clss, ByteReader& cfs);
 
-    void calculate_arguments_size();
-
+    void calculate_arguments_slot_num();
+    
     unsigned calculate_size() {
         unsigned size = sizeof(Class_Member) + sizeof(Method);
         if(_local_vars_table)
@@ -651,7 +649,7 @@
     AnnotationValue * _default_value;
 
     unsigned _index;                // index in method table
-    unsigned _arguments_size;   // size of method arguments on the stack
+    unsigned _arguments_slot_num;   // number of slots for method arguments
     uint16 _max_stack;
     uint16 _max_locals;
     uint16 _n_exceptions;           // num exceptions method can throw
@@ -687,8 +685,8 @@
     Line_Number_Table *_line_number_table;
     Local_Var_Table *_local_vars_table;
 
-    bool _parse_local_vars(const char* attr_name, Local_Var_Table** lvt_address,
-        ConstantPool& cp, unsigned attr_len, ByteReader &cfs);
+    bool _parse_local_vars(Local_Var_Table* table, LocalVarOffset* offset_list,
+        ConstantPool& cp, ByteReader &cfs, const char* attr_name, Attributes attr);
 
     // This is the number of breakpoints which should be set in the
     // method when it is compiled. This number does not reflect