harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r599008 - in /harmony/enhanced/drlvm/trunk/vm: jitrino/src/jet/ port/src/lil/em64t/pim/ vmcore/src/jvmti/ vmcore/src/util/em64t/base/
Date Wed, 28 Nov 2007 14:05:16 GMT
Author: varlax
Date: Wed Nov 28 06:05:15 2007
New Revision: 599008

URL: http://svn.apache.org/viewvc?rev=599008&view=rev
Log:
Applied HARMONY-5057 [drlvm][jvmti] Make JVMTI PopFrame platform independent and enable it
on Linux x86-64

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/rt.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t_internal.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp Wed Nov 28 06:05:15 2007
@@ -483,6 +483,7 @@
                                                      CodeBlockHeatDefault,
                                                      0, CAA_Allocate);
         m_infoBlock.set_code_start(m_vmCode);
+        m_infoBlock.set_code_len(total_code_size);
     }
     //
     // Copy and reposition code from m_codeStream into the allocated buf.

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.cpp Wed Nov 28 06:05:15 2007
@@ -98,6 +98,10 @@
     int r = max_idx;
     int m = 0;
     const char * val = NULL;
+
+    assert(rt_header->code_start <= ip);
+    assert(ip < rt_header->code_start + rt_header->m_code_len);
+
     //
     // Step 1.
     // Find first element which is above or equal to the given IP.

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.h?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/mib.h Wed Nov 28 06:05:15 2007
@@ -274,6 +274,22 @@
         return rt_header->code_start;
     }
 
+    /**
+     * @brief Sets size of native code, in bytes.
+     */
+    void set_code_len(unsigned len)
+    {
+        rt_header->m_code_len = len;
+    }
+    
+    /**
+     * @brief Returns size of native code, in bytes.
+     */
+    unsigned get_code_len(void)
+    {
+        return rt_header->m_code_len;
+    }
+
     void set_compile_params(const OpenMethodExecutionParams& compileParams)
     {
         rt_header->compileParams = compileParams;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/rt.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/rt.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/rt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/rt.cpp Wed Nov 28 06:05:15 2007
@@ -397,7 +397,13 @@
     
     void *** pip = (void***)((char*)context + ip_off);
     char * where = (char*)**pip;
+#ifdef _DEBUG
     char * meth_start = infoBlock.get_code_start();
+    unsigned meth_len = infoBlock.get_code_len();
+    assert(meth_start <= where);
+    assert(where < meth_start + meth_len);
+#endif
+
     unsigned whereLen = (unsigned)(where - meth_start);
     if (whereLen<infoBlock.get_warmup_len()) {
         return;
@@ -497,7 +503,16 @@
 {
     char * pinfo = (char*)method_get_info_block_jit(method, jit);
     assert(MethodInfoBlock::is_valid_data(pinfo));
+
     MethodInfoBlock rtinfo(pinfo);
+#ifdef _DEBUG
+    char * where = (char*)ip;
+    char * meth_start = rtinfo.get_code_start();
+    unsigned meth_len = rtinfo.get_code_len();
+    assert(meth_start <= where);
+    assert(where < meth_start + meth_len);
+#endif
+
     *pbc_pc = (unsigned short)rtinfo.get_pc((char*)ip);
 
     if (rtinfo.get_flags() & DBG_TRACE_RT) {

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t.cpp Wed Nov 28 06:05:15
2007
@@ -273,7 +273,7 @@
 
 unsigned m2n_push_m2n_size(unsigned num_callee_saves,
                            unsigned num_std_need_to_save) {
-    return 82 - (5 * num_callee_saves) +
+    return 91 - (5 * num_callee_saves) +
             m2n_ts_to_register_size(num_std_need_to_save, 0);
 }
 
@@ -296,6 +296,10 @@
             LcgEM64TContext::get_reg_from_map(LcgEM64TContext::GR_LOCALS_OFFSET + i),
             size_64);        
     }
+    // init pop_regs to null
+    bytes_to_m2n_top -= LcgEM64TContext::GR_SIZE;
+    buf = mov(buf, M_Base_Opnd(rsp_reg, bytes_to_m2n_top),
+        Imm_Opnd(size_32, 0), size_64);
     // store current_frame_type
     bytes_to_m2n_top -= LcgEM64TContext::GR_SIZE;
     assert(fit32(current_frame_type));
@@ -406,8 +410,8 @@
     buf = mov(buf, r11_opnd, M_Base_Opnd(rsp_reg, bytes_to_m2n_bottom), size_64);
     bytes_to_m2n_bottom += LcgEM64TContext::GR_SIZE;
     buf = mov(buf, M_Base_Opnd(r11_reg, 0), r10_opnd, size_64);
-    // skip local_object_handles, method, current_frame_type
-    bytes_to_m2n_bottom += 3 * LcgEM64TContext::GR_SIZE;
+    // skip local_object_handles, method, current_frame_type, pop_regs
+    bytes_to_m2n_bottom += 4 * LcgEM64TContext::GR_SIZE;
 
     // restore part of callee-saves registers
     for (int i = LcgEM64TContext::MAX_GR_LOCALS - 1; i >= (int)num_callee_saves; i--)
{
@@ -423,12 +427,11 @@
 
 // returns pointer to the registers used for jvmti PopFrame
 Registers* get_pop_frame_registers(M2nFrame* m2nf) {
-    // Empty implementation
-    return NULL;
+    return m2nf->pop_regs;
 }
 
 // sets pointer to the registers used for jvmti PopFrame
 void set_pop_frame_registers(M2nFrame* m2nf, Registers* regs) {
-    // Empty implementation
+    m2nf->pop_regs = regs;
 }
 

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t_internal.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t_internal.h?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t_internal.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/m2n_em64t_internal.h Wed Nov 28
06:05:15 2007
@@ -33,9 +33,9 @@
 #include "encoder.h"
 
 #ifdef _WIN64
-const unsigned m2n_sizeof_m2n_frame = 112;
+const unsigned m2n_sizeof_m2n_frame = 120;
 #else
-const unsigned m2n_sizeof_m2n_frame = 96;
+const unsigned m2n_sizeof_m2n_frame = 104;
 #endif
 
 typedef struct M2nFrame M2nFrame;
@@ -59,6 +59,7 @@
     ObjectHandles *      local_object_handles;
     Method_Handle        method;
     frame_type           current_frame_type;
+    Registers*           pop_regs; // This is only for M2nFrames for suspended managed code
(as against ones that call stubs and prepare jvmtiPopFrame)
     uint64               rbx;
     uint64               rbp;
 #ifdef _WIN64

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_capability.cpp Wed Nov 28 06:05:15
2007
@@ -159,7 +159,7 @@
     1, // can_get_owned_monitor_info
     1, // can_get_current_contended_monitor
     1, // can_get_monitor_info
-    0, // can_pop_frame
+    1, // can_pop_frame
     0, // can_redefine_classes
     1, // can_signal_thread
     1, // can_get_source_file_name

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_pop_frame.cpp Wed Nov 28 06:05:15
2007
@@ -138,21 +138,7 @@
     assert(0);
 }
 
-#elif defined _EM64T_
-
-void jvmti_jit_prepare_pop_frame(){
-    assert(0);
-}
-
-void jvmti_jit_complete_pop_frame(){
-    assert(0);
-}
-
-void jvmti_jit_do_pop_frame(){
-    assert(0);
-}
-
-#else // _IA32_
+#else // _IA32_ & _EM64T_
 
 // requires stack iterator and buffer to save intermediate information
 static void jvmti_jit_prepare_pop_frame(StackIterator* si, uint32* buf) {
@@ -191,57 +177,27 @@
 
     // find correct ip and restore required registers context
     NativeCodePtr current_method_addr = NULL;
+    cci = si_get_code_chunk_info(si);
+    method = cci->get_method();
     NativeCodePtr ip = si_get_ip(si);
+    JIT *jit = cci->get_jit();
+
     TRACE(("PopFrame method %s.%s%s, set IP begin: %p",
         class_get_name(method_get_class(si_get_code_chunk_info(si)->get_method())),
         method_get_name(si_get_code_chunk_info(si)->get_method()),
         method_get_descriptor(si_get_code_chunk_info(si)->get_method()), ip ));
-    size_t ip_reduce;
 
-    // invoke static
-    if (is_method_static) {
-        ip_reduce = 6;
-
-    // invoke interface
-    } else if (0xd0ff == (*((unsigned short*)(((char*)ip)-2)))) {
-        ip_reduce = 2;
-        current_method_addr = cci->get_code_block_addr();
-        *buf = (uint32)current_method_addr;
-        jitContext->p_eax = buf;
-
-    // invoke virtual and special
-    } else {
-        VTable_Handle vtable = class_get_vtable( method_class);
-        *buf = (uint32) vtable;
-        unsigned short code = (*((unsigned short*)(((char*)ip)-3)));
-
-        // invoke virtual
-        if (0x50ff == code) {
-            jitContext->p_eax = buf;
-            ip_reduce = 3;
-        } else if (0x51ff == code) {
-            jitContext->p_ecx = buf;
-            ip_reduce = 3;
-        } else if (0x52ff == code) {
-            jitContext->p_edx = buf;
-            ip_reduce = 3;
-        } else if (0x53ff == code) {
-            jitContext->p_ebx = buf;
-            ip_reduce = 3;
-
-        // invoke special
-        } else{
-            ip_reduce = 6;
-        }
-    }
+    uint16 bcOffset;
+    NativeCodePtr bcip;
+    jit->fix_handler_context(method, si_get_jit_context(si));
+    jit->get_bc_location_for_native(method, (NativeCodePtr)((POINTER_SIZE_INT)ip - 1),
&bcOffset);
+    jit->get_native_location_for_bc(method, bcOffset, &bcip);
+    si_set_ip(si, bcip, false);
 
-    // set correct ip
-    ip = (NativeCodePtr)(((char*)ip) - ip_reduce);
     TRACE(("PopFrame method %s.%s%s, set IP end: %p",
         class_get_name(method_get_class(si_get_code_chunk_info(si)->get_method())),
         method_get_name(si_get_code_chunk_info(si)->get_method()),
         method_get_descriptor(si_get_code_chunk_info(si)->get_method()), ip ));
-    si_set_ip(si, ip, false);
 }
 
 void jvmti_jit_prepare_pop_frame() {
@@ -263,38 +219,8 @@
     jvmti_jit_prepare_pop_frame(si, &buf);
 
     // save regs value from jit context to m2n
-    JitFrameContext* jitContext = si_get_jit_context(si);
     Registers* regs = get_pop_frame_registers(top_frame);
-
-    regs->esp = jitContext->esp;
-    regs->eip = *(jitContext->p_eip);
-    regs->esi = *(jitContext->p_esi);
-    regs->edi = *(jitContext->p_edi);
-    regs->ebp = *(jitContext->p_ebp);
-
-    if (0 == jitContext->p_eax) {
-        regs->eax = 0;
-    } else {
-        regs->eax = *(jitContext->p_eax);
-    }
-
-    if (0 == jitContext->p_ebx) {
-        regs->ebx = 0;
-    } else {
-        regs->ebx = *(jitContext->p_ebx);
-    }
-
-    if (0 == jitContext->p_ecx) {
-        regs->ecx = 0;
-    } else {
-        regs->ecx = *(jitContext->p_ecx);
-    }
-
-    if (0 == jitContext->p_edx) {
-        regs->edx = 0;
-    } else {
-        regs->edx = *(jitContext->p_edx);
-    }
+    si_copy_to_registers(si, regs);
 
     // set pop done frame state
     m2n_set_frame_type(top_frame, frame_type(FRAME_POP_DONE | FRAME_MODIFIED_STACK));

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp?rev=599008&r1=599007&r2=599008&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp Wed Nov 28
06:05:15 2007
@@ -56,10 +56,10 @@
     uint64 * const m2n_base_addr = (uint64 *)m2n_get_frame_base(m2n_get_last_frame());
      // 6(scratched registers on the stack)
     assert(m2n_get_size() % 8 == 0);
-    // 15 = 1(alignment) + n(fp) + n(gp) registers were preserved on the stack
+    // 14 = 0(alignment) + n(fp) + n(gp) registers were preserved on the stack
     uint64 * const inputs_addr = m2n_base_addr
             - (m2n_get_size() / 8) + 2
-            - 1 - MAX_GR - MAX_FR;
+            - MAX_GR - MAX_FR;
      // 1(return ip);
 #ifdef _WIN64
     // WIN64, reserve 4 words of shadow space
@@ -172,7 +172,7 @@
 //    method handle
 
 // Stack size should be (% 8 == 0) but shouldn't be (% 16 == 0)
-const int ALIGNMENT = 8;
+const int ALIGNMENT = 0;
 
 const int32 gr_stack_size = (1 + MAX_GR)*GR_STACK_SIZE
         + SHADOW;



Mime
View raw message