From patchwork Thu May 1 14:07:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Nevill X-Patchwork-Id: 29496 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 912B9203F3 for ; Thu, 1 May 2014 14:07:54 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf15324885pab.7 for ; Thu, 01 May 2014 07:07:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:reply-to:to :cc:date:organization:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=+Ezvu6WsY3uKSLrB4EOhyPHwgfHtEFinh6sImO1W52A=; b=GZSTAxrcZ2CsIAFYLvohazzUjpDnma79otEH2xcFlfs8JX2J5nqsRM0mO/CyejZrai 69wOnjZXas5AZLA02P9gHbYbb48oFJE5ujzv6PFvHyHs1yOaEjM/292AwXbuAS8zAlIm xE+3p6idfCK4PN+6GS1Vyij5AnGk7n0Q7c3O8oX+943Kl9SuquAznE5jQh0giaVSZJRo zb42i3vC7wDBfRweumjffqTamAFNctvXjPGH0h25Ox1Hov012Fmev/vUli3QA2sOVAK/ OGQfb39YHmaZ3FHx8sA0d7Lcns/Bd2oeNpu20w6XYiwDc0jZkdHxh2v/XuBSSRfdcvBR tfkQ== X-Gm-Message-State: ALoCoQnqTwyDAM1ohVdnuJNO3uO/wSSYEpNEy1+0DIBP+cfjKr8aAw6DfXck9LrFacdPuAm7kWqW X-Received: by 10.66.102.36 with SMTP id fl4mr5635555pab.20.1398953273580; Thu, 01 May 2014 07:07:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.147 with SMTP id 19ls1006535qgp.68.gmail; Thu, 01 May 2014 07:07:53 -0700 (PDT) X-Received: by 10.52.160.98 with SMTP id xj2mr180413vdb.80.1398953273442; Thu, 01 May 2014 07:07:53 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id tm8si6062821vdc.134.2014.05.01.07.07.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 07:07:53 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so3967492veb.0 for ; Thu, 01 May 2014 07:07:53 -0700 (PDT) X-Received: by 10.58.116.175 with SMTP id jx15mr2900603veb.9.1398953273372; Thu, 01 May 2014 07:07:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp26956vcb; Thu, 1 May 2014 07:07:52 -0700 (PDT) X-Received: by 10.194.187.107 with SMTP id fr11mr361307wjc.70.1398953271679; Thu, 01 May 2014 07:07:51 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by mx.google.com with ESMTPS id fm9si10733955wjc.194.2014.05.01.07.07.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 07:07:51 -0700 (PDT) Received-SPF: none (google.com: edward.nevill@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.181; Received: by mail-we0-f181.google.com with SMTP id q58so3080969wes.26 for ; Thu, 01 May 2014 07:07:51 -0700 (PDT) X-Received: by 10.194.187.107 with SMTP id fr11mr361285wjc.70.1398953271231; Thu, 01 May 2014 07:07:51 -0700 (PDT) Received: from [10.0.7.5] ([88.98.47.97]) by mx.google.com with ESMTPSA id go20sm41357777wjc.18.2014.05.01.07.07.50 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Thu, 01 May 2014 07:07:50 -0700 (PDT) Message-ID: <1398953269.20704.8.camel@localhost.localdomain> Subject: RFR: Fix instruction size from 8 to 4 From: Edward Nevill Reply-To: edward.nevill@linaro.org To: "aarch64-port-dev@openjdk.java.net" Cc: patches@linaro.org Date: Thu, 01 May 2014 15:07:49 +0100 Organization: Linaro X-Mailer: Evolution 3.8.5 (3.8.5-2.fc19) Mime-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: edward.nevill@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Hi, I noticed while looking at the assembly output from C2 that the loops were not being aligned correctly as in this short code section 0x0000007f8d170a84: mov w0, wzr 0x0000007f8d170a88: nop ;*iload_1 ; - dhry::execute@9 (line 8) <<<<< Incorrectly aligned here ;; B6: # B6 B7 <- B5 B6 Loop: B6-B6 inner Freq: 4.99998 0x0000007f8d170a8c: add x12, x10, w11, sxtw #2 0x0000007f8d170a90: ldr w12, [x12,#16] 0x0000007f8d170a94: add w0, w0, w12 ;*iadd ; - dhry::execute@15 (line 8) 0x0000007f8d170a98: add w11, w11, #0x1 ;*iinc ; - dhry::execute@17 (line 7) 0x0000007f8d170a9c: cmp w11, w1 0x0000007f8d170aa0: b.lt 0x0000007f8d170a8c The reason for this is that instruction_size is incorrectly defined in nativeInst_aarch64.hpp. It was defined as BytesPerWord which is of course 8. I have changed this to '4'. The code works out the no. of nops to emit as padding/instruction_size which explains why it emitted too few nops in the above. I have applied the patch below and the code is now generated as 0x0000007f88d83cc4: mov w0, wzr 0x0000007f88d83cc8: nop 0x0000007f88d83ccc: nop ;*iload_1 ; - dhry::execute@9 (line 8) ;; B6: # B6 B7 <- B5 B6 Loop: B6-B6 inner Freq: 4.99998 0x0000007f88d83cd0: add x12, x10, w11, sxtw #2 0x0000007f88d83cd4: ldr w12, [x12,#16] 0x0000007f88d83cd8: add w0, w0, w12 ;*iadd ; - dhry::execute@15 (line 8) 0x0000007f88d83cdc: add w11, w11, #0x1 ;*iinc ; - dhry::execute@17 (line 7) 0x0000007f88d83ce0: cmp w11, w1 0x0000007f88d83ce4: b.lt 0x0000007f88d83cd0 OK to push? Ed. --- CUT HERE --- # HG changeset patch # User Edward Nevill edward.nevill@linaro.org # Date 1398952656 -3600 # Thu May 01 14:57:36 2014 +0100 # Node ID f67f9b1b52ae8b1778dacb49df641bb5b6e48da1 # Parent 9d641fdeea4d1772617b097fc231dcff8e4aa634 Fix instruction size from 8 to 4 diff -r 9d641fdeea4d -r f67f9b1b52ae src/cpu/aarch64/vm/nativeInst_aarch64.hpp --- a/src/cpu/aarch64/vm/nativeInst_aarch64.hpp Tue Apr 29 14:58:56 2014 +0100 +++ b/src/cpu/aarch64/vm/nativeInst_aarch64.hpp Thu May 01 14:57:36 2014 +0100 @@ -54,7 +54,7 @@ class NativeInstruction VALUE_OBJ_CLASS_SPEC { friend class Relocation; public: - enum { instruction_size = BytesPerWord }; + enum { instruction_size = 4 }; inline bool is_nop(); bool is_dtrace_trap(); inline bool is_call(); --- CUT HERE ---