From patchwork Wed Nov 30 22:30:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 128605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2BB6FB6F7F for ; Thu, 1 Dec 2011 09:31:54 +1100 (EST) Received: (qmail 9083 invoked by alias); 30 Nov 2011 22:31:52 -0000 Received: (qmail 9071 invoked by uid 22791); 30 Nov 2011 22:31:51 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_GJ, TW_OV X-Spam-Check-By: sourceware.org Received: from mail-bw0-f47.google.com (HELO mail-bw0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Nov 2011 22:31:37 +0000 Received: by bkbzv15 with SMTP id zv15so872204bkb.20 for ; Wed, 30 Nov 2011 14:31:36 -0800 (PST) Received: by 10.204.132.78 with SMTP id a14mr4564554bkt.15.1322692295943; Wed, 30 Nov 2011 14:31:35 -0800 (PST) Received: from localhost.localdomain ([173.160.232.49]) by mx.google.com with ESMTPS id l5sm7014856bkv.9.2011.11.30.14.31.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Nov 2011 14:31:33 -0800 (PST) From: Richard Henderson To: gcc-patches@gcc.gnu.org Subject: [PATCH] Swap the action and jmpbuf arguments to GTM_longjmp Date: Wed, 30 Nov 2011 14:30:14 -0800 Message-Id: <1322692214-32636-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On several ABIs, the first register parameter is the same as the return value register. Moving the action parameter first avoids the need for register shuffling on these targets. * libitm_i.h (GTM_longjmp): Swap first and second arguments. * beginend.c (_ITM_abortTransaction): Update to match. (GTM::gtm_thread::restart): Likewise. * config/alpha/sjlj.S (GTM_longjmp): Likewise. * config/x86/sjlj.S (GTM_longjmp): Likewise. --- libitm/ChangeLog | 8 ++++++++ libitm/beginend.cc | 12 ++++++------ libitm/config/alpha/sjlj.S | 44 ++++++++++++++++++++++---------------------- libitm/config/x86/sjlj.S | 19 +++++++++---------- libitm/libitm_i.h | 2 +- 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index be994a5..3358464 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,11 @@ +2011-11-30 Richard Henderson + + * libitm_i.h (GTM_longjmp): Swap first and second arguments. + * beginend.c (_ITM_abortTransaction): Update to match. + (GTM::gtm_thread::restart): Likewise. + * config/alpha/sjlj.S (GTM_longjmp): Likewise. + * config/x86/sjlj.S (GTM_longjmp): Likewise. + 2011-11-23 Iain Sandoe * Makefile.am (libitm_la_LDFLAGS): Remove "-no-undefined". diff --git a/libitm/beginend.cc b/libitm/beginend.cc index a266975..d8ef651 100644 --- a/libitm/beginend.cc +++ b/libitm/beginend.cc @@ -404,8 +404,8 @@ _ITM_abortTransaction (_ITM_abortReason reason) tx->rollback (cp, true); // Jump to nested transaction (use the saved jump buffer). - GTM_longjmp (&longjmp_jb, a_abortTransaction | a_restoreLiveVariables, - longjmp_prop); + GTM_longjmp (a_abortTransaction | a_restoreLiveVariables, + &longjmp_jb, longjmp_prop); } else { @@ -421,8 +421,8 @@ _ITM_abortTransaction (_ITM_abortReason reason) gtm_thread::serial_lock.read_unlock (tx); tx->state = 0; - GTM_longjmp (&tx->jb, a_abortTransaction | a_restoreLiveVariables, - tx->prop); + GTM_longjmp (a_abortTransaction | a_restoreLiveVariables, + &tx->jb, tx->prop); } } @@ -512,8 +512,8 @@ GTM::gtm_thread::restart (gtm_restart_reason r) disp = abi_disp(); } - GTM_longjmp (&jb, - choose_code_path(prop, disp) | a_restoreLiveVariables, prop); + GTM_longjmp (choose_code_path(prop, disp) | a_restoreLiveVariables, + &jb, prop); } void ITM_REGPARM diff --git a/libitm/config/alpha/sjlj.S b/libitm/config/alpha/sjlj.S index 3aa5f06..615eacb 100644 --- a/libitm/config/alpha/sjlj.S +++ b/libitm/config/alpha/sjlj.S @@ -81,28 +81,28 @@ _ITM_beginTransaction: GTM_longjmp: .prologue 0 - ldq $26, 0($16) - ldq $9, 8($16) - ldq $10, 16($16) - ldq $11, 24($16) - - ldq $12, 32($16) - ldq $13, 40($16) - ldq $14, 48($16) - ldq $15, 56($16) - - ldq $1, 64($16) - ldt $f2, 72($16) - ldt $f3, 80($16) - ldt $f4, 88($16) - - ldt $f5, 96($16) - ldt $f6, 104($16) - ldt $f7, 112($16) - ldt $f8, 120($16) - - ldt $f9, 128($16) - mov $17, $0 + ldq $26, 0($17) + ldq $9, 8($17) + ldq $10, 16($17) + ldq $11, 24($17) + + ldq $12, 32($17) + ldq $13, 40($17) + ldq $14, 48($17) + ldq $15, 56($17) + + ldq $1, 64($17) + ldt $f2, 72($17) + ldt $f3, 80($17) + ldt $f4, 88($17) + + ldt $f5, 96($17) + ldt $f6, 104($17) + ldt $f7, 112($17) + ldt $f8, 120($17) + + ldt $f9, 128($17) + mov $16, $0 mov $1, $30 ret .end GTM_longjmp diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S index 39e0c75..8faa0c6 100644 --- a/libitm/config/x86/sjlj.S +++ b/libitm/config/x86/sjlj.S @@ -113,21 +113,20 @@ SYM(_ITM_beginTransaction): SYM(GTM_longjmp): cfi_startproc #ifdef __x86_64__ - movq (%rdi), %rcx - movq 8(%rdi), %rdx - movq 16(%rdi), %rbx - movq 24(%rdi), %rbp - movq 32(%rdi), %r12 - movq 40(%rdi), %r13 - movq 48(%rdi), %r14 - movq 56(%rdi), %r15 - movl %esi, %eax + movq (%rsi), %rcx + movq 8(%rsi), %rdx + movq 16(%rsi), %rbx + movq 24(%rsi), %rbp + movq 32(%rsi), %r12 + movq 40(%rsi), %r13 + movq 48(%rsi), %r14 + movq 56(%rsi), %r15 + movl %edi, %eax cfi_def_cfa(%rcx, 0) cfi_register(%rip, %rdx) movq %rcx, %rsp jmp *%rdx #else - xchgl %eax, %edx movl (%edx), %ecx movl 4(%edx), %ebx movl 8(%edx), %esi diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h index ba1afb4..ff6884e 100644 --- a/libitm/libitm_i.h +++ b/libitm/libitm_i.h @@ -285,7 +285,7 @@ namespace GTM HIDDEN { // are used. extern uint64_t gtm_spin_count_var; -extern "C" uint32_t GTM_longjmp (const gtm_jmpbuf *, uint32_t, uint32_t) +extern "C" uint32_t GTM_longjmp (uint32_t, const gtm_jmpbuf *, uint32_t) ITM_NORETURN ITM_REGPARM; extern "C" void GTM_LB (const void *, size_t) ITM_REGPARM;