Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 59547 invoked from network); 3 Mar 2007 23:11:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Mar 2007 23:11:06 -0000 Received: (qmail 60043 invoked by uid 500); 3 Mar 2007 23:11:15 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 59944 invoked by uid 500); 3 Mar 2007 23:11:14 -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 59935 invoked by uid 99); 3 Mar 2007 23:11:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Mar 2007 15:11:14 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME 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; Sat, 03 Mar 2007 15:11:05 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 409501A981C; Sat, 3 Mar 2007 15:10:45 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r514264 - /harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm Date: Sat, 03 Mar 2007 23:10:45 -0000 To: commits@harmony.apache.org From: gshimansky@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070303231045.409501A981C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gshimansky Date: Sat Mar 3 15:10:44 2007 New Revision: 514264 URL: http://svn.apache.org/viewvc?view=rev&rev=514264 Log: It is not very well documented, but it seems like all methods on windows x86_64 have to be called with RSP aligned on 16 bytes boundary. This patch makes interpreter call all native methods with RSP agligned to 16 bytes. Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm?view=diff&rev=514264&r1=514263&r2=514264 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm (original) +++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/invokeJNI_Windows_em64t.asm Sat Mar 3 15:10:44 2007 @@ -1,7 +1,7 @@ -PUBLIC invokeJNI +PUBLIC invokeJNI -_TEXT SEGMENT +_TEXT SEGMENT invokeJNI PROC @@ -11,8 +11,8 @@ ; r8 - n mem args ; r9 - function ptr - push rbp - mov rbp, rsp + push rbp + mov rbp, rsp mov rax, rcx ; mem mov rcx, r8 ; n mem args @@ -22,15 +22,27 @@ movsd xmm2, qword ptr [rax+24] movsd xmm3, qword ptr [rax+32] -; store memory args - mov r10, r9 ; func ptr - lea r9, qword ptr [rax+rcx*8+64] - sub r9, rsp ; offset + mov r10, r9 ; func ptr +; check for memory args cmp rcx, 0 jz cycle_end + + mov rdx, rsp ; Check stack alignment on 16 bytes + and rdx, 8 ; This code may be removed after we make sure that + jz no_abort ; compiler always calls us with aligned stack + int 3 +no_abort: + mov rdx, rcx ; Align stack on 16 bytes before pushing stack + and rdx, 1 ; arguments in case we have odd number of stack + shl rdx, 3 ; arguments + sub rsp, rdx + +; store memory args + lea r9, qword ptr [rax + rcx * 8 + 64] + sub r9, rsp ; offset cycle: - push qword ptr [rsp+r9] - loop cycle + push qword ptr [rsp+r9] + loop cycle cycle_end: mov rcx, [rax + 40] mov rdx, [rax + 48] @@ -39,14 +51,14 @@ sub rsp, 32 ; shadow space - call r10 - leave - ret + call r10 + leave + ret invokeJNI ENDP -_TEXT ENDS +_TEXT ENDS END