Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 11395 invoked from network); 28 Nov 2007 14:05:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Nov 2007 14:05:42 -0000 Received: (qmail 55223 invoked by uid 500); 28 Nov 2007 14:05:29 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 55209 invoked by uid 500); 28 Nov 2007 14:05:29 -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 55200 invoked by uid 99); 28 Nov 2007 14:05:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Nov 2007 06:05:29 -0800 X-ASF-Spam-Status: No, hits=-100.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; Wed, 28 Nov 2007 14:05:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 63DAA1A9832; Wed, 28 Nov 2007 06:05:20 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071128140520.63DAA1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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= (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;