From patchwork Fri Dec 13 11:26:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Nevill X-Patchwork-Id: 22322 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2DD4823FBA for ; Fri, 13 Dec 2013 11:26:47 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id f64sf3355463yha.10 for ; Fri, 13 Dec 2013 03:26:47 -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=afrSmDb5GtqT8BDlyXNZHUTDBiwqTL5y3RmZh+PFi3Y=; b=lXUM/5ivjFnqN8yfDqk+ZwQnZ4n3Fhe6h3LIkFnVVHUnMeQWW9dxDFJ7ZAfXIsiRat 0GtXIQY0wdIFHVfiOmsnjXFZ1RqKI2wYdiVvaHHQdriTVprr3A4QcuxPF48zp3lSev9b on2GebAaOuKutbXgvPPG4qqUIM2Au/HrXRqZiB5qWCgwd8xIqgMEhCxnfDmJz1M68mjc FDbfUUYYnc7YWGUkMa582cGGsRuZZ/ksfpxbkNty5yXlQpFcKLJSKVSwyHQGDMVOM7cG YMOJ3wlUyLq7BggZzuz9lr14sHxuJa66Aqa6XKa0L42fywNfqt4/2bYuRIzz3Oypz1Le otAw== X-Gm-Message-State: ALoCoQnb3Z659IezovPoHWJk8J1TxdLXc6mhXo800tkL/unsWpuKLjrte8NFXMDvnneH0Zbw+9Zc X-Received: by 10.58.50.202 with SMTP id e10mr365931veo.41.1386934007476; Fri, 13 Dec 2013 03:26:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.35 with SMTP id c3ls881573qed.83.gmail; Fri, 13 Dec 2013 03:26:47 -0800 (PST) X-Received: by 10.221.19.68 with SMTP id qj4mr503154vcb.60.1386934007340; Fri, 13 Dec 2013 03:26:47 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id in18si602070vec.57.2013.12.13.03.26.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 03:26:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so1250855veb.20 for ; Fri, 13 Dec 2013 03:26:47 -0800 (PST) X-Received: by 10.58.246.136 with SMTP id xw8mr899879vec.41.1386934007224; Fri, 13 Dec 2013 03:26:47 -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 u4csp29176vcz; Fri, 13 Dec 2013 03:26:46 -0800 (PST) X-Received: by 10.194.172.105 with SMTP id bb9mr1845270wjc.45.1386934006268; Fri, 13 Dec 2013 03:26:46 -0800 (PST) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id lh4si919606wic.71.2013.12.13.03.26.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 03:26:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of edward.nevill@linaro.org) client-ip=209.85.212.177; Received: by mail-wi0-f177.google.com with SMTP id cc10so914576wib.10 for ; Fri, 13 Dec 2013 03:26:45 -0800 (PST) X-Received: by 10.194.89.97 with SMTP id bn1mr1872308wjb.18.1386934005790; Fri, 13 Dec 2013 03:26:45 -0800 (PST) Received: from [192.168.1.112] ([213.122.173.130]) by mx.google.com with ESMTPSA id q19sm6388520wiw.4.2013.12.13.03.26.44 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 13 Dec 2013 03:26:45 -0800 (PST) Message-ID: <1386934003.26061.17.camel@localhost.localdomain> Subject: RFR: Fix SEGV in checkcast_copy From: Edward Nevill Reply-To: edward.nevill@linaro.org To: "aarch64-port-dev@openjdk.java.net" Cc: patches@linaro.org Date: Fri, 13 Dec 2013 11:26:43 +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.128.175 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 checkcast_copy where gen_write_ref_array_post_barrier was being called with start > end, gen_write_ref_array_post_barrier assumes there is always something to write, so this caused a SEGV. This fix mirrors the code for X86. The alternative would be to fix gen_write_ref_array_post_barrier to just exit if start > end, but I have decided to just mirror the X86 code. This fixes a number of SEGVs I am seeing at random places in jtreg/langtools. OK to push? Ed. --- CUT HERE --- exporting patch: # HG changeset patch # User Edward Nevill edward.nevill@linaro.org # Date 1386933610 0 # Fri Dec 13 11:20:10 2013 +0000 # Node ID 1f9222c232e0ef699034a48ce8bda49d76fedbe8 # Parent 390889cee20523b8bf400433ac171654893c3702 Fix SIGV in checkcast_copy diff -r 390889cee205 -r 1f9222c232e0 src/cpu/aarch64/vm/stubGenerator_aarch64.cpp --- a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Thu Dec 12 17:58:29 2013 +0000 +++ b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Dec 13 11:20:10 2013 +0000 @@ -1590,7 +1590,7 @@ address generate_checkcast_copy(const char *name, address *entry, bool dest_uninitialized = false) { - Label L_load_element, L_store_element, L_do_card_marks, L_done; + Label L_load_element, L_store_element, L_do_card_marks, L_done, L_done_pop; // Input registers (after setup_arg_regs) const Register from = c_rarg0; // source array address @@ -1692,13 +1692,15 @@ // Emit GC store barriers for the oops we have copied and report // their number to the caller. - __ sub(count, count_save, count); // K = partially copied oop count + __ subs(count, count_save, count); // K = partially copied oop count __ eon(count, count, zr); // report (-1^K) to caller + __ br(Assembler::EQ, L_done_pop); __ BIND(L_do_card_marks); __ add(to, to, -heapOopSize); // make an inclusive end pointer gen_write_ref_array_post_barrier(start_to, to, rscratch1); + __ bind(L_done_pop); __ pop(r18->bit() | r19->bit() | r20->bit()| r21->bit(), sp); inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr); --- CUT HERE ---