From patchwork Wed Jan 22 16:40:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Nevill X-Patchwork-Id: 23550 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B4C6203C6 for ; Wed, 22 Jan 2014 16:40:37 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id v10sf1254711pde.9 for ; Wed, 22 Jan 2014 08:40:36 -0800 (PST) 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=pOfRoZRcpPgcNINQOEojNzA9TQT9n8KU/8n7Dmsm6ac=; b=Jk6n3Mz9UWeZXLWC6nfqloUeQoB7mKUq3ZR8z65Q0TSuwi1P6pHSysU8bBMX3ZDqQw rs0oqHirWG2LBvnOHKWP8ZEX8HzoCPf/Z9kjlD1drj0g78mQ9yrsqMjwbw2xyj0dZNf1 vYxzoc2+oaTlK3yMk16g78PVctA3b5M6FWEpoEDGrViXZi3L41okrjaJIJOATJnVJeUT aaHlfpX2jQySZKsmgk78j7qzbbDYq0Fjh4UYXXjowogUVmvKbOGCPoPxrFb7JEuGOUOW kOOgxMJIbxcJ/IfkTaaZCtGzb8kl/cMbLC69wGdYB6f339C5YmCAkXeF2DLm/7nJ91sh uPLA== X-Gm-Message-State: ALoCoQl4D5MQj4hvijzrlu2N7LxVP2u5kbPzNLhFtpHbb1Xa73oKl1y+soUsXOsccaEe1JeqWBV8 X-Received: by 10.66.253.9 with SMTP id zw9mr1019305pac.38.1390408836888; Wed, 22 Jan 2014 08:40:36 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.119 with SMTP id 110ls115035qgw.28.gmail; Wed, 22 Jan 2014 08:40:36 -0800 (PST) X-Received: by 10.220.225.71 with SMTP id ir7mr92213vcb.50.1390408836738; Wed, 22 Jan 2014 08:40:36 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id kp12si4866085vcb.16.2014.01.22.08.40.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 08:40:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x14so356340vbb.8 for ; Wed, 22 Jan 2014 08:40:36 -0800 (PST) X-Received: by 10.58.161.227 with SMTP id xv3mr1485965veb.31.1390408836625; Wed, 22 Jan 2014 08:40:36 -0800 (PST) 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.174.196 with SMTP id u4csp197244vcz; Wed, 22 Jan 2014 08:40:36 -0800 (PST) X-Received: by 10.194.90.144 with SMTP id bw16mr2686072wjb.1.1390408835503; Wed, 22 Jan 2014 08:40:35 -0800 (PST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id i2si7252085wie.6.2014.01.22.08.40.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 08:40:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of edward.nevill@linaro.org) client-ip=209.85.212.176; Received: by mail-wi0-f176.google.com with SMTP id hi8so5818696wib.3 for ; Wed, 22 Jan 2014 08:40:35 -0800 (PST) X-Received: by 10.194.60.103 with SMTP id g7mr2676395wjr.37.1390408834950; Wed, 22 Jan 2014 08:40:34 -0800 (PST) Received: from [10.0.7.5] ([88.98.47.97]) by mx.google.com with ESMTPSA id ux5sm15966447wjc.6.2014.01.22.08.40.33 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 22 Jan 2014 08:40:33 -0800 (PST) Message-ID: <1390408832.4665.8.camel@localhost.localdomain> Subject: Patch to fix SEGV/SIGBUS in client with +CompressedOops From: Edward Nevill Reply-To: edward.nevill@linaro.org To: "aarch64-port-dev@openjdk.java.net" Cc: patches@linaro.org, Andy Johnson Date: Wed, 22 Jan 2014 16:40:32 +0000 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: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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, The following patch fixes a problem in the client compiler whereby the cmpval in emit_compare_and_swap was being encoded as a compressed oop while still live. This variously resulted in a SIGBUS or SIGSEGV depending on whether the resultant compressed oop was aligned or not. The patch uses a temp to encode the oop. I have also incorporation a fix to the problem spotted by Andrew Dinn whereby casw did a cbnz rather than a cbnzw on a compressed oop. There is also a minor tweak to use the two arg version of encode_heap_oop(dest, src) instead of the single arg version which removes two redundant moves. OK to push? Ed. --- CUT HERE --- exporting patch: # HG changeset patch # User Edward Nevill edward.nevill@linaro.org # Date 1390408183 0 # Wed Jan 22 16:29:43 2014 +0000 # Node ID 813458fe14eeb9da65e68a12abb85ae1343b2b2d # Parent 895bbf967b692fecdc4919deeb8a30907b5bd2cb - Add fix spotted by Andrew Dinn to do cbnzw instead of cbnz in casw - Use temp reg in emit_compare_and_swap to avoid corrupting cmpval - Minor tweak to use 2 arg vsn of encode_heap_oop diff -r 895bbf967b69 -r 813458fe14ee src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp --- a/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Fri Jan 17 13:39:19 2014 -0500 +++ b/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp Wed Jan 22 16:29:43 2014 +0000 @@ -1584,7 +1584,7 @@ __ stlxrw(rscratch1, newval, addr); // retry so we only ever return after a load fails to compare // ensures we don't return a stale value after a failed write. - __ cbnz(rscratch1, retry_load); + __ cbnzw(rscratch1, retry_load); __ bind(nope); } @@ -1615,10 +1615,12 @@ if (op->code() == lir_cas_obj) { if (UseCompressedOops) { - __ encode_heap_oop(cmpval); - __ mov(rscratch2, newval); + Register t1 = op->tmp1()->as_register(); + assert(op->tmp1()->is_valid(), "must be"); + __ encode_heap_oop(t1, cmpval); + cmpval = t1; + __ encode_heap_oop(rscratch2, newval); newval = rscratch2; - __ encode_heap_oop(newval); casw(addr, newval, cmpval); } else { casl(addr, newval, cmpval); --- CUT HERE ---