Skip to content
Permalink
Browse files

Merge

  • Loading branch information
vidmik committed Jul 22, 2020
2 parents f8c1d79 + 39b22d1 commit 9ff01f7b2f0ec46f41ded6a66db2d7fc6ac5a291
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -723,8 +723,7 @@ void ConnectionGraph::add_to_congraph_unsafe_access(Node* n, uint opcode, Unique
if (adr_type->isa_oopptr()
|| ((opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass)
&& adr_type == TypeRawPtr::NOTNULL
&& adr->in(AddPNode::Address)->is_Proj()
&& adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
&& is_captured_store_address(adr))) {
delayed_worklist->push(n); // Process it later.
#ifdef ASSERT
assert (adr->is_AddP(), "expecting an AddP");
@@ -771,8 +770,7 @@ bool ConnectionGraph::add_final_edges_unsafe_access(Node* n, uint opcode) {
if (adr_type->isa_oopptr()
|| ((opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass)
&& adr_type == TypeRawPtr::NOTNULL
&& adr->in(AddPNode::Address)->is_Proj()
&& adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
&& is_captured_store_address(adr))) {
// Point Address to Value
PointsToNode* adr_ptn = ptnode_adr(adr->_idx);
assert(adr_ptn != NULL &&
@@ -1584,8 +1582,7 @@ int ConnectionGraph::find_init_values(JavaObjectNode* pta, PointsToNode* init_va
// Raw pointers are used for initializing stores so skip it
// since it should be recorded already
Node* base = get_addp_base(field->ideal_node());
assert(adr_type->isa_rawptr() && base->is_Proj() &&
(base->in(0) == alloc),"unexpected pointer type");
assert(adr_type->isa_rawptr() && is_captured_store_address(field->ideal_node()), "unexpected pointer type");
#endif
continue;
}
@@ -1916,8 +1913,7 @@ void ConnectionGraph::optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklis
Node *n = storestore_worklist.pop();
MemBarStoreStoreNode *storestore = n ->as_MemBarStoreStore();
Node *alloc = storestore->in(MemBarNode::Precedent)->in(0);
assert (alloc->is_Allocate(), "storestore should point to AllocateNode");
if (not_global_escape(alloc)) {
if (alloc->is_Allocate() && not_global_escape(alloc)) {
MemBarNode* mb = MemBarNode::make(C, Op_MemBarCPUOrder, Compile::AliasIdxBot);
mb->init_req(TypeFunc::Memory, storestore->in(TypeFunc::Memory));
mb->init_req(TypeFunc::Control, storestore->in(TypeFunc::Control));
@@ -2251,11 +2247,29 @@ bool FieldNode::has_base(JavaObjectNode* jobj) const {
}
#endif

bool ConnectionGraph::is_captured_store_address(Node* addp) {
// Handle simple case first.
assert(_igvn->type(addp)->isa_oopptr() == NULL, "should be raw access");
if (addp->in(AddPNode::Address)->is_Proj() && addp->in(AddPNode::Address)->in(0)->is_Allocate()) {
return true;
} else if (addp->in(AddPNode::Address)->is_Phi()) {
for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) {
Node* addp_use = addp->fast_out(i);
if (addp_use->is_Store()) {
for (DUIterator_Fast jmax, j = addp_use->fast_outs(jmax); j < jmax; j++) {
if (addp_use->fast_out(j)->is_Initialize()) {
return true;
}
}
}
}
}
return false;
}

int ConnectionGraph::address_offset(Node* adr, PhaseTransform *phase) {
const Type *adr_type = phase->type(adr);
if (adr->is_AddP() && adr_type->isa_oopptr() == NULL &&
adr->in(AddPNode::Address)->is_Proj() &&
adr->in(AddPNode::Address)->in(0)->is_Allocate()) {
if (adr->is_AddP() && adr_type->isa_oopptr() == NULL && is_captured_store_address(adr)) {
// We are computing a raw address for a store captured by an Initialize
// compute an appropriate address type. AddP cases #3 and #5 (see below).
int offs = (int)phase->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
@@ -2358,7 +2372,7 @@ Node* ConnectionGraph::get_addp_base(Node *addp) {
assert(opcode == Op_ConP || opcode == Op_ThreadLocal ||
opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() ||
(uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) ||
(uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity");
is_captured_store_address(addp), "sanity");
}
}
return base;
@@ -2974,7 +2988,10 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist,
continue;
}
if (!n->is_CheckCastPP()) { // not unique CheckCastPP.
assert(!alloc->is_Allocate(), "allocation should have unique type");
// we could reach here for allocate case if one init is associated with many allocs.
if (alloc->is_Allocate()) {
alloc->as_Allocate()->_is_scalar_replaceable = false;
}
continue;
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -512,6 +512,7 @@ class ConnectionGraph: public ResourceObj {
// offset of a field reference
int address_offset(Node* adr, PhaseTransform *phase);

bool is_captured_store_address(Node* addp);

// Propagate unique types created for unescaped allocated objects
// through the graph
@@ -75,13 +75,34 @@
this.stackTraceOffset = stackTraceOffset(name, isJDK);
}

private static boolean isExceptionEvent(String name) {
switch (name) {
case Type.EVENT_NAME_PREFIX + "JavaErrorThrow" :
case Type.EVENT_NAME_PREFIX + "JavaExceptionThrow" :
return true;
}
return false;
}

private static boolean isUsingHandler(String name) {
switch (name) {
case Type.EVENT_NAME_PREFIX + "SocketRead" :
case Type.EVENT_NAME_PREFIX + "SocketWrite" :
case Type.EVENT_NAME_PREFIX + "FileRead" :
case Type.EVENT_NAME_PREFIX + "FileWrite" :
case Type.EVENT_NAME_PREFIX + "FileForce" :
return true;
}
return false;
}

private static int stackTraceOffset(String name, boolean isJDK) {
if (isJDK) {
if (name.equals(Type.EVENT_NAME_PREFIX + "JavaExceptionThrow")) {
return 5;
if (isExceptionEvent(name)) {
return 4;
}
if (name.equals(Type.EVENT_NAME_PREFIX + "JavaErrorThrow")) {
return 5;
if (isUsingHandler(name)) {
return 3;
}
}
return 4;
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* @test
* @bug 8242895
* @summary full loop unroll before EA creates phis between allocs projs and init
* @run main/othervm -Xbatch -XX:CompileCommand=dontinline,*DataA.m1 compiler.escapeAnalysis.TestIdealAllocShape
*/

package compiler.escapeAnalysis;

public class TestIdealAllocShape {
static volatile DataA f1;

static class DataA {
DataA f1;
DataA(DataA p1) {
this.f1 = p1;
}
public void m1() {}
}

public static DataA test1() {
DataA l1 = new DataA(null);
for (int i=0; i<2; i++) {
try {
return new DataA(l1); // l1 is a GlobalEscape. // control break.
} catch (Exception e) {
}
}
return null;
}

public static DataA test2() {
DataA l1 = new DataA(null);
for (int i=0; i<2; i++) {
try {
f1 = new DataA(l1); // l1 is a GlobalEscape.
break; // control break.
} catch (Exception e) {
}
}
synchronized(l1) { // elided sync
l1.m1();
}
return null;
}

public static void main(String argv[]) {

for (int i=0; i<20000; i++) {
TestIdealAllocShape.test1();
}

for (int i=0; i<20000; i++) {
TestIdealAllocShape.test2();
}
}
}
@@ -570,6 +570,7 @@ java/foreign/TestMismatch.java 8249684 macosx-all
java/lang/StringCoding/CheckEncodings.sh 7008363 generic-all
java/lang/ProcessHandle/InfoTest.java 8211847 aix-ppc64
java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java 8151492 generic-all
java/lang/invoke/LFCaching/LFGarbageCollectedTest.java 8078602 generic-all

############################################################################

@@ -588,6 +589,7 @@ javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-al
# jdk_io

java/io/pathNames/GeneralWin32.java 8180264 windows-all
java/io/File/GetXSpace.java 6501010,8249703 windows-all,macosx-all

############################################################################

@@ -24,7 +24,6 @@
/**
* @test
* @bug 4057701 6286712 6364377
* @ignore until 6492634 and 6501010 is fixed
* @run build GetXSpace
* @run shell GetXSpace.sh
* @summary Basic functionality of File.get-X-Space methods.
@@ -135,7 +134,7 @@ private static ArrayList space(String f) throws IOException {
ArrayList al = new ArrayList();

Process p = null;
String cmd = "df -k" + (f == null ? "" : " " + f);
String cmd = "df -k -P" + (f == null ? "" : " " + f);
p = Runtime.getRuntime().exec(cmd);
BufferedReader in = new BufferedReader
(new InputStreamReader(p.getInputStream()));
@@ -26,7 +26,7 @@
# set platform-dependent variable
OS=`uname -s`
case "$OS" in
Linux ) TMP=/tmp ;;
Linux | Darwin ) TMP=/tmp ;;
Windows_98 ) return ;;
Windows* ) SID=`sid`; TMP="c:/temp" ;;
* )
@@ -49,11 +49,11 @@ allow() {
case "$OS" in
Windows* ) chacl -g ${SID}:f $* ;;
* ) chmod 777 $* ;;
esac
esac
}

runTest() {
${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} GetXSpace $*
${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} GetXSpace $*
if [ $? -eq 0 ]
then echo "Passed"
else
@@ -64,17 +64,17 @@ runTest() {

# df output
runTest

# readable file in an unreadable directory
mkdir ${TMP1}
mkdir -p ${TMP1}
touch ${TMP1}/foo
deny ${TMP1}
runTest ${TMP1}/foo
allow ${TMP1}
rm -rf ${TMP1}

if [ ${FAIL} -ne 0 ]
then
then
echo ""
echo "${FAIL} test(s) failed"
exit 1
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
* @bug 8046703
* @key randomness
* @library /lib/testlibrary /java/lang/invoke/common
* @ignore 8078602
* @summary Test verifies that lambda forms are garbage collected
* @author kshefov
* @build jdk.test.lib.TimeLimitedRunner

0 comments on commit 9ff01f7

Please sign in to comment.