From a354960abb8aa6cfa09bc372a2c97eb98107ac15 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Mon, 27 Jan 2014 10:20:51 -0800 Subject: [PATCH 001/185] 8032566: Crash in JIT when running Scala compiler (and compiling Scala std lib) Switch off EliminateAutoBox flag by default in jdk8 release. Reviewed-by: iveresov --- hotspot/src/share/vm/opto/c2_globals.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 4f45d28666b..093344bb32d 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -452,7 +452,7 @@ notproduct(bool, PrintEliminateLocks, false, \ "Print out when locks are eliminated") \ \ - product(bool, EliminateAutoBox, true, \ + product(bool, EliminateAutoBox, false, \ "Control optimizations for autobox elimination") \ \ diagnostic(bool, UseImplicitStableValues, true, \ From f5a766e0367c993c1afa67a648b8d614cafa27fe Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Sun, 25 May 2014 09:37:20 +0200 Subject: [PATCH 002/185] 8041923: Command line output is missing from jinfo Reviewed-by: dcubed, allwin, jbachorik --- jdk/src/share/classes/sun/tools/jinfo/JInfo.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java index 4911ef713d9..ce446378ffb 100644 --- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java +++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java @@ -158,6 +158,8 @@ final public class JInfo { sysprops(pid); System.out.println(); flags(pid); + System.out.println(); + commandLine(pid); } else { usage(1); } @@ -248,6 +250,12 @@ final public class JInfo { drain(vm, in); } + private static void commandLine(String pid) throws IOException { + HotSpotVirtualMachine vm = (HotSpotVirtualMachine) attach(pid); + InputStream in = vm.executeJCmd("VM.command_line"); + drain(vm, in); + } + private static void sysprops(String pid) throws IOException { HotSpotVirtualMachine vm = (HotSpotVirtualMachine) attach(pid); InputStream in = vm.executeJCmd("VM.system_properties"); From 61db60f592f5bb4d3f16f97677c76827847071c0 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 26 May 2014 15:52:40 +0100 Subject: [PATCH 003/185] 8043958: Remove unused com.sun.pept classes from jdk repository Reviewed-by: lancea --- jdk/make/CompileJavaClasses.gmk | 2 +- .../share/classes/com/sun/pept/Delegate.java | 67 ------ .../com/sun/pept/encoding/Decoder.java | 69 ------ .../com/sun/pept/encoding/Encoder.java | 70 ------ .../classes/com/sun/pept/ept/Acceptor.java | 54 ----- .../classes/com/sun/pept/ept/ContactInfo.java | 58 ----- .../com/sun/pept/ept/ContactInfoList.java | 55 ----- .../sun/pept/ept/ContactInfoListIterator.java | 64 ----- .../classes/com/sun/pept/ept/EPTFactory.java | 106 --------- .../classes/com/sun/pept/ept/MessageInfo.java | 151 ------------ .../sun/pept/presentation/MessageStruct.java | 223 ------------------ .../com/sun/pept/presentation/Stub.java | 67 ------ .../sun/pept/presentation/TargetFinder.java | 58 ----- .../com/sun/pept/presentation/Tie.java | 78 ------ .../com/sun/pept/protocol/Interceptors.java | 62 ----- .../sun/pept/protocol/MessageDispatcher.java | 73 ------ .../com/sun/pept/transport/Connection.java | 91 ------- 17 files changed, 1 insertion(+), 1347 deletions(-) delete mode 100644 jdk/src/share/classes/com/sun/pept/Delegate.java delete mode 100644 jdk/src/share/classes/com/sun/pept/encoding/Decoder.java delete mode 100644 jdk/src/share/classes/com/sun/pept/encoding/Encoder.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/Acceptor.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java delete mode 100644 jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java delete mode 100644 jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java delete mode 100644 jdk/src/share/classes/com/sun/pept/presentation/Stub.java delete mode 100644 jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java delete mode 100644 jdk/src/share/classes/com/sun/pept/presentation/Tie.java delete mode 100644 jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java delete mode 100644 jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java delete mode 100644 jdk/src/share/classes/com/sun/pept/transport/Connection.java diff --git a/jdk/make/CompileJavaClasses.gmk b/jdk/make/CompileJavaClasses.gmk index f0ea1835967..6d2acb6708f 100644 --- a/jdk/make/CompileJavaClasses.gmk +++ b/jdk/make/CompileJavaClasses.gmk @@ -38,7 +38,7 @@ EXCLUDES := ########################################################################################## -EXCLUDES += com/sun/pept \ +EXCLUDES += \ com/sun/tools/example/trace \ com/sun/tools/example/debug/bdi \ com/sun/tools/example/debug/event \ diff --git a/jdk/src/share/classes/com/sun/pept/Delegate.java b/jdk/src/share/classes/com/sun/pept/Delegate.java deleted file mode 100644 index 7d29ce00c6b..00000000000 --- a/jdk/src/share/classes/com/sun/pept/Delegate.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Delegate.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept; - -import com.sun.pept.presentation.MessageStruct; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Delegate { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a MessageStruct with ... - *

- */ - public MessageStruct getMessageStruct(); -/** - *

- * Does ... - *

- * - *

- * - * @param message ... - *

- */ - public void send(MessageStruct message); - -} // end Delegate diff --git a/jdk/src/share/classes/com/sun/pept/encoding/Decoder.java b/jdk/src/share/classes/com/sun/pept/encoding/Decoder.java deleted file mode 100644 index 3af6e03bc84..00000000000 --- a/jdk/src/share/classes/com/sun/pept/encoding/Decoder.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Decoder.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.encoding; - -import com.sun.pept.ept.MessageInfo; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Decoder { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void decode(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void receiveAndDecode(MessageInfo messageInfo); - -} // end Decoder diff --git a/jdk/src/share/classes/com/sun/pept/encoding/Encoder.java b/jdk/src/share/classes/com/sun/pept/encoding/Encoder.java deleted file mode 100644 index 66a6d642931..00000000000 --- a/jdk/src/share/classes/com/sun/pept/encoding/Encoder.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Encoder.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.encoding; - -import com.sun.pept.ept.MessageInfo; -import java.nio.ByteBuffer; -import java.util.*; - -/** - *

- * - * @author Arun Gupta - *

- */ -public interface Encoder { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void encodeAndSend(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - * @return a ByteBuffer with ... - *

- * @param messageInfo ... - *

- */ - public ByteBuffer encode(MessageInfo messageInfo); - -} // end Encoder diff --git a/jdk/src/share/classes/com/sun/pept/ept/Acceptor.java b/jdk/src/share/classes/com/sun/pept/ept/Acceptor.java deleted file mode 100644 index 82b59c1198b..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/Acceptor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Acceptor.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Acceptor extends EPTFactory { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- */ - public void accept(); - -} // end Acceptor diff --git a/jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java b/jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java deleted file mode 100644 index 2981a5128b3..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "ContactInfo.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import com.sun.pept.transport.Connection; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface ContactInfo extends EPTFactory { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a Connection with ... - *

- * @param messageInfo ... - *

- */ - public Connection getConnection(MessageInfo messageInfo); - -} // end ContactInfo diff --git a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java b/jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java deleted file mode 100644 index b1ac49bbaaa..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "ContactInfoList.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface ContactInfoList { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a ContactInfoListIterator with ... - *

- */ - public ContactInfoListIterator iterator(); - -} // end ContactInfoList diff --git a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java b/jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java deleted file mode 100644 index 16143ddcb6b..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "ContactInfoListIterator.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface ContactInfoListIterator { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a boolean with ... - *

- */ - public boolean hasNext(); -/** - *

- * Does ... - *

- * - * @return a ContactInfo with ... - *

- */ - public ContactInfo next(); - -} // end ContactInfoListIterator diff --git a/jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java b/jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java deleted file mode 100644 index 05595f09282..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "EPTFactory.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import com.sun.pept.encoding.Decoder; -import com.sun.pept.encoding.Encoder; -import com.sun.pept.presentation.TargetFinder; -import com.sun.pept.protocol.Interceptors; -import com.sun.pept.protocol.MessageDispatcher; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface EPTFactory { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a MessageDispatcher with ... - *

- * @param messageInfo ... - *

- */ - public MessageDispatcher getMessageDispatcher(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - * @return a Encoder with ... - *

- * @param messageInfo ... - *

- */ - public Encoder getEncoder(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - * @return a Decoder with ... - *

- * @param messageInfo ... - *

- */ - public Decoder getDecoder(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - * @return a Interceptors with ... - *

- * @param x ... - *

- */ - public Interceptors getInterceptors(MessageInfo x); -/** - *

- * Does ... - *

- * - * @return a TargetFinder with ... - *

- * @param x ... - *

- */ - public TargetFinder getTargetFinder(MessageInfo x); - -} // end EPTFactory diff --git a/jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java b/jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java deleted file mode 100644 index 9a4cd159a55..00000000000 --- a/jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "MessageInfo.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.ept; - -import com.sun.pept.encoding.Decoder; -import com.sun.pept.encoding.Encoder; -import com.sun.pept.presentation.MessageStruct; -import com.sun.pept.protocol.MessageDispatcher; -import com.sun.pept.transport.Connection; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface MessageInfo extends MessageStruct { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a EPTFactory with ... - *

- */ - public EPTFactory getEPTFactory(); -/** - *

- * Does ... - *

- * - * @return a MessageDispatcher with ... - *

- */ - public MessageDispatcher getMessageDispatcher(); -/** - *

- * Does ... - *

- * - * @return a Encoder with ... - *

- */ - public Encoder getEncoder(); -/** - *

- * Does ... - *

- * - * @return a Decoder with ... - *

- */ - public Decoder getDecoder(); -/** - *

- * Does ... - *

- * - * @return a Connection with ... - *

- */ - public Connection getConnection(); -/** - *

- * Does ... - *

- * - *

- * - * @param eptFactory ... - *

- */ - public void setEPTFactory(EPTFactory eptFactory); -/** - *

- * Does ... - *

- * - *

- * - * @param messageDispatcher ... - *

- */ - public void setMessageDispatcher(MessageDispatcher messageDispatcher); -/** - *

- * Does ... - *

- * - *

- * - * @param encoder ... - *

- */ - public void setEncoder(Encoder encoder); -/** - *

- * Does ... - *

- * - *

- * - * @param decoder ... - *

- */ - public void setDecoder(Decoder decoder); -/** - *

- * Does ... - *

- * - *

- * - * @param connection ... - *

- */ - public void setConnection(Connection connection); - -} // end MessageInfo diff --git a/jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java b/jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java deleted file mode 100644 index 85f4fc7f889..00000000000 --- a/jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "MessageStruct.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.presentation; - -import java.util.*; -import java.lang.reflect.Method; -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface MessageStruct { - - /////////////////////////////////////// - //attributes - - -/** - *

- * Represents ... - *

- */ - public static final int NORMAL_RESPONSE = 0; - -/** - *

- * Represents ... - *

- */ - public static final int CHECKED_EXCEPTION_RESPONSE = 1; - -/** - *

- * Represents ... - *

- */ - public static final int UNCHECKED_EXCEPTION_RESPONSE = 2; - -/** - *

- * Represents ... - *

- */ - public static final int REQUEST_RESPONSE_MEP = 1; - -/** - *

- * Represents ... - *

- */ - public static final int ONE_WAY_MEP = 2; - -/** - *

- * Represents ... - *

- */ - public static final int ASYNC_POLL_MEP = 3; - -/** - *

- * Represents ... - *

- */ - public static final int ASYNC_CALLBACK_MEP = 4; - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @param data ... - *

- * - *

- */ - public void setData(Object[] data); -/** - *

- * Does ... - *

- * - * @return a Object[] with ... - *

- */ - public Object[] getData(); -/** - *

- * Does ... - *

- * - *

- * - * @param name ... - *

- * @param value ... - *

- */ - public void setMetaData(Object name, Object value); -/** - *

- * Does ... - *

- * - * @return a Object with ... - *

- * @param name ... - *

- */ - public Object getMetaData(Object name); -/** - *

- * Does ... - *

- * - *

- * - * @param messageExchangePattern ... - *

- */ - public void setMEP(int messageExchangePattern); -/** - *

- * Does ... - *

- * - * @return a int with ... - *

- */ - public int getMEP(); -/** - *

- * Does ... - *

- * - * @return a int with ... - *

- */ - public int getResponseType(); -/** - *

- * Does ... - *

- * - *

- * - * @param responseType ... - *

- */ - public void setResponseType(int responseType); -/** - *

- * Does ... - *

- * - * @return a Object with ... - *

- */ - public Object getResponse(); -/** - *

- * Does ... - *

- * - *

- * - * @param response ... - *

- */ - public void setResponse(Object response); -/** - *

- * Does ... - *

- * - *

- * - * @param method ... - *

- */ - public void setMethod(Method method); -/** - *

- * Does ... - *

- * - * @return a Method with ... - *

- */ - public Method getMethod(); - -} // end MessageStruct diff --git a/jdk/src/share/classes/com/sun/pept/presentation/Stub.java b/jdk/src/share/classes/com/sun/pept/presentation/Stub.java deleted file mode 100644 index 4b44dd4e276..00000000000 --- a/jdk/src/share/classes/com/sun/pept/presentation/Stub.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Stub.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.presentation; - -import com.sun.pept.Delegate; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Stub { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param delegate ... - *

- */ - public void _setDelegate(Delegate delegate); -/** - *

- * Does ... - *

- * - * @return a Delegate with ... - *

- */ - public Delegate _getDelegate(); - -} // end Stub diff --git a/jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java b/jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java deleted file mode 100644 index 6fabf9b9404..00000000000 --- a/jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "TargetFinder.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.presentation; - -import com.sun.pept.ept.MessageInfo; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface TargetFinder { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - * @return a Tie with ... - *

- * @param x ... - *

- */ - public Tie findTarget(MessageInfo x); - -} // end TargetFinder diff --git a/jdk/src/share/classes/com/sun/pept/presentation/Tie.java b/jdk/src/share/classes/com/sun/pept/presentation/Tie.java deleted file mode 100644 index ed4dae25c33..00000000000 --- a/jdk/src/share/classes/com/sun/pept/presentation/Tie.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** Java interface "Tie.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.presentation; - -import com.sun.pept.ept.MessageInfo; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Tie { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param servant ... - *

- */ - public void _setServant(Object servant); -/** - *

- * Does ... - *

- * - * @return a Object with ... - *

- */ - public Object _getServant(); -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void _invoke(MessageInfo messageInfo); - -} // end Tie diff --git a/jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java b/jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java deleted file mode 100644 index acfe1b927dd..00000000000 --- a/jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** - * $Id: Interceptors.java,v 1.1 2005/05/23 22:09:18 bbissett Exp $ - */ - -/** Java interface "Interceptors.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.protocol; - -import com.sun.pept.ept.MessageInfo; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Interceptors { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void interceptMessage(MessageInfo messageInfo); - -} // end Interceptors diff --git a/jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java b/jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java deleted file mode 100644 index 83b81f27236..00000000000 --- a/jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** - * $Id: MessageDispatcher.java,v 1.1 2005/05/23 22:09:18 bbissett Exp $ - */ - -/** Java interface "MessageDispatcher.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.protocol; - -import com.sun.pept.ept.MessageInfo; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface MessageDispatcher { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void send(MessageInfo messageInfo); -/** - *

- * Does ... - *

- * - *

- * - * @param messageInfo ... - *

- */ - public void receive(MessageInfo messageInfo); - -} // end MessageDispatcher diff --git a/jdk/src/share/classes/com/sun/pept/transport/Connection.java b/jdk/src/share/classes/com/sun/pept/transport/Connection.java deleted file mode 100644 index 489827fbc59..00000000000 --- a/jdk/src/share/classes/com/sun/pept/transport/Connection.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2005, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/** - * $Id: Connection.java,v 1.2 2005/07/23 04:09:58 kohlert Exp $ - */ - -/** Java interface "Connection.java" generated from Poseidon for UML. - * Poseidon for UML is developed by Gentleware. - * Generated with velocity template engine. - */ -package com.sun.pept.transport; - -import com.sun.pept.ept.EPTFactory; -import java.nio.ByteBuffer; -import java.util.*; - -/** - *

- * - * @author Dr. Harold Carr - *

- */ -public interface Connection { - - /////////////////////////////////////// - // operations - -/** - *

- * Does ... - *

- * - *

- * - * @param byteBuffer ... - *

- */ - public void write(ByteBuffer byteBuffer); -/** - *

- * Does ... - *

- * - * @return a EPTFactory with ... - *

- */ - public EPTFactory getEPTFactory(); -/** - *

- * Does ... - *

- * - * @return a int with ... - *

- * @param byteBuffer ... - *

- */ - public int read(ByteBuffer byteBuffer); -/** - *

- * Does ... - *

- * - *

- */ - public ByteBuffer readUntilEnd(); - -} // end Connection From 73995e8591af009bedf84e9c1dfdf6ea93e16708 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Mon, 26 May 2014 19:59:28 +0400 Subject: [PATCH 004/185] 8043476: java/util/BitSet/BSMethods.java failed with: java.lang.OutOfMemoryError: Java heap space Reviewed-by: alanb --- jdk/test/java/util/BitSet/BSMethods.java | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/jdk/test/java/util/BitSet/BSMethods.java b/jdk/test/java/util/BitSet/BSMethods.java index 9aa419ac9bf..86d7499a428 100644 --- a/jdk/test/java/util/BitSet/BSMethods.java +++ b/jdk/test/java/util/BitSet/BSMethods.java @@ -26,6 +26,7 @@ * 4979017 4979028 4979031 5030267 6222207 8040806 * @summary Test the operation of the methods of BitSet class * @author Mike McCloskey, Martin Buchholz + * @run main/othervm BSMethods */ import java.util.*; @@ -897,15 +898,20 @@ public class BSMethods { private static void testToString() { check(new BitSet().toString().equals("{}")); check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}")); - try { - check(makeSet(Integer.MAX_VALUE-1).toString().equals( - "{" + (Integer.MAX_VALUE-1) + "}")); - check(makeSet(Integer.MAX_VALUE).toString().equals( - "{" + Integer.MAX_VALUE + "}")); - check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals( - "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}")); - } catch (IndexOutOfBoundsException exc) { - fail("toString() with indices near MAX_VALUE"); + + final long MB = 1024*1024; + if (Runtime.getRuntime().maxMemory() >= 512*MB) { + // only run it if we have enough memory + try { + check(makeSet(Integer.MAX_VALUE-1).toString().equals( + "{" + (Integer.MAX_VALUE-1) + "}")); + check(makeSet(Integer.MAX_VALUE).toString().equals( + "{" + Integer.MAX_VALUE + "}")); + check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals( + "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}")); + } catch (IndexOutOfBoundsException exc) { + fail("toString() with indices near MAX_VALUE"); + } } } From b47c2517adb6e45869e435a3a846ecb65f4ae583 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 24 Feb 2014 18:11:55 +0400 Subject: [PATCH 005/185] 8037210: Get rid of char-based descriptions 'J' of basic types Reviewed-by: jrose, psandoz, twisti --- .../java/lang/invoke/BoundMethodHandle.java | 468 ++++++++--------- .../java/lang/invoke/DirectMethodHandle.java | 12 +- .../lang/invoke/InvokerBytecodeGenerator.java | 277 +++++----- .../classes/java/lang/invoke/LambdaForm.java | 493 +++++++++++++----- .../java/lang/invoke/MethodHandle.java | 27 +- .../java/lang/invoke/MethodHandleImpl.java | 2 +- .../java/lang/invoke/MethodHandleNatives.java | 37 +- .../java/lang/invoke/MethodHandleStatics.java | 13 + .../java/lang/invoke/MethodHandles.java | 13 +- .../java/lang/invoke/SimpleMethodHandle.java | 10 +- jdk/test/java/lang/invoke/LambdaFormTest.java | 78 +++ 11 files changed, 831 insertions(+), 599 deletions(-) create mode 100644 jdk/test/java/lang/invoke/LambdaFormTest.java diff --git a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java index ea75ddfef6f..f860c77e5e2 100644 --- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java @@ -26,11 +26,10 @@ package java.lang.invoke; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static java.lang.invoke.LambdaForm.basicTypes; -import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic; +import static java.lang.invoke.LambdaForm.*; +import static java.lang.invoke.LambdaForm.BasicType.*; import static java.lang.invoke.MethodHandleStatics.*; -import java.lang.invoke.LambdaForm.Name; import java.lang.invoke.LambdaForm.NamedFunction; import java.lang.invoke.MethodHandles.Lookup; import java.lang.reflect.Field; @@ -61,22 +60,22 @@ import jdk.internal.org.objectweb.asm.Type; // BMH API and internals // - static MethodHandle bindSingle(MethodType type, LambdaForm form, char xtype, Object x) { + static MethodHandle bindSingle(MethodType type, LambdaForm form, BasicType xtype, Object x) { // for some type signatures, there exist pre-defined concrete BMH classes try { switch (xtype) { - case 'L': + case L_TYPE: if (true) return bindSingle(type, form, x); // Use known fast path. - return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('L').constructor[0].invokeBasic(type, form, x); - case 'I': - return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('I').constructor[0].invokeBasic(type, form, ValueConversions.widenSubword(x)); - case 'J': - return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('J').constructor[0].invokeBasic(type, form, (long) x); - case 'F': - return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('F').constructor[0].invokeBasic(type, form, (float) x); - case 'D': - return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('D').constructor[0].invokeBasic(type, form, (double) x); - default : throw new InternalError("unexpected xtype: " + xtype); + return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(L_TYPE).constructor[0].invokeBasic(type, form, x); + case I_TYPE: + return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(I_TYPE).constructor[0].invokeBasic(type, form, ValueConversions.widenSubword(x)); + case J_TYPE: + return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(J_TYPE).constructor[0].invokeBasic(type, form, (long) x); + case F_TYPE: + return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(F_TYPE).constructor[0].invokeBasic(type, form, (float) x); + case D_TYPE: + return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(D_TYPE).constructor[0].invokeBasic(type, form, (double) x); + default : throw newInternalError("unexpected xtype: " + xtype); } } catch (Throwable t) { throw newInternalError(t); @@ -87,23 +86,23 @@ import jdk.internal.org.objectweb.asm.Type; return new Species_L(type, form, x); } - MethodHandle cloneExtend(MethodType type, LambdaForm form, char xtype, Object x) { + MethodHandle cloneExtend(MethodType type, LambdaForm form, BasicType xtype, Object x) { try { switch (xtype) { - case 'L': return cloneExtendL(type, form, x); - case 'I': return cloneExtendI(type, form, ValueConversions.widenSubword(x)); - case 'J': return cloneExtendJ(type, form, (long) x); - case 'F': return cloneExtendF(type, form, (float) x); - case 'D': return cloneExtendD(type, form, (double) x); + case L_TYPE: return copyWithExtendL(type, form, x); + case I_TYPE: return copyWithExtendI(type, form, ValueConversions.widenSubword(x)); + case J_TYPE: return copyWithExtendJ(type, form, (long) x); + case F_TYPE: return copyWithExtendF(type, form, (float) x); + case D_TYPE: return copyWithExtendD(type, form, (double) x); } } catch (Throwable t) { throw newInternalError(t); } - throw new InternalError("unexpected type: " + xtype); + throw newInternalError("unexpected type: " + xtype); } @Override - MethodHandle bindArgument(int pos, char basicType, Object value) { + MethodHandle bindArgument(int pos, BasicType basicType, Object value) { MethodType type = type().dropParameterTypes(pos, pos+1); LambdaForm form = internalForm().bind(1+pos, speciesData()); return cloneExtend(type, form, basicType, value); @@ -111,9 +110,9 @@ import jdk.internal.org.objectweb.asm.Type; @Override MethodHandle dropArguments(MethodType srcType, int pos, int drops) { - LambdaForm form = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos+drops)); + LambdaForm form = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos + drops)); try { - return clone(srcType, form); + return copyWith(srcType, form); } catch (Throwable t) { throw newInternalError(t); } @@ -122,26 +121,23 @@ import jdk.internal.org.objectweb.asm.Type; @Override MethodHandle permuteArguments(MethodType newType, int[] reorder) { try { - return clone(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList()))); + return copyWith(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList()))); } catch (Throwable t) { throw newInternalError(t); } } - static final String EXTENSION_TYPES = "LIJFD"; - static final byte INDEX_L = 0, INDEX_I = 1, INDEX_J = 2, INDEX_F = 3, INDEX_D = 4; - static byte extensionIndex(char type) { - int i = EXTENSION_TYPES.indexOf(type); - if (i < 0) throw new InternalError(); - return (byte) i; - } - /** * Return the {@link SpeciesData} instance representing this BMH species. All subclasses must provide a * static field containing this value, and they must accordingly implement this method. */ /*non-public*/ abstract SpeciesData speciesData(); + /** + * Return the number of fields in this BMH. Equivalent to speciesData().fieldCount(). + */ + /*non-public*/ abstract int fieldCount(); + @Override final Object internalProperties() { return "/BMH="+internalValues(); @@ -159,38 +155,33 @@ import jdk.internal.org.objectweb.asm.Type; /*non-public*/ final Object arg(int i) { try { switch (speciesData().fieldType(i)) { - case 'L': return argL(i); - case 'I': return argI(i); - case 'F': return argF(i); - case 'D': return argD(i); - case 'J': return argJ(i); + case L_TYPE: return speciesData().getters[i].invokeBasic(this); + case I_TYPE: return (int) speciesData().getters[i].invokeBasic(this); + case J_TYPE: return (long) speciesData().getters[i].invokeBasic(this); + case F_TYPE: return (float) speciesData().getters[i].invokeBasic(this); + case D_TYPE: return (double) speciesData().getters[i].invokeBasic(this); } } catch (Throwable ex) { throw newInternalError(ex); } - throw new InternalError("unexpected type: " + speciesData().types+"."+i); + throw new InternalError("unexpected type: " + speciesData().typeChars+"."+i); } - /*non-public*/ final Object argL(int i) throws Throwable { return speciesData().getters[i].invokeBasic(this); } - /*non-public*/ final int argI(int i) throws Throwable { return (int) speciesData().getters[i].invokeBasic(this); } - /*non-public*/ final float argF(int i) throws Throwable { return (float) speciesData().getters[i].invokeBasic(this); } - /*non-public*/ final double argD(int i) throws Throwable { return (double) speciesData().getters[i].invokeBasic(this); } - /*non-public*/ final long argJ(int i) throws Throwable { return (long) speciesData().getters[i].invokeBasic(this); } // // cloning API // - /*non-public*/ abstract BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable; - /*non-public*/ abstract BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable; - /*non-public*/ abstract BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable; - /*non-public*/ abstract BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable; - /*non-public*/ abstract BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable; - /*non-public*/ abstract BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable; + /*non-public*/ abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf); + /*non-public*/ abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg); + /*non-public*/ abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg); + /*non-public*/ abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg); + /*non-public*/ abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg); + /*non-public*/ abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg); // The following is a grossly irregular hack: @Override MethodHandle reinvokerTarget() { try { - return (MethodHandle) argL(0); + return (MethodHandle) arg(0); } catch (Throwable ex) { throw newInternalError(ex); } @@ -203,7 +194,7 @@ import jdk.internal.org.objectweb.asm.Type; private // make it private to force users to access the enclosing class first static final class Species_L extends BoundMethodHandle { final Object argL0; - /*non-public*/ Species_L(MethodType mt, LambdaForm lf, Object argL0) { + private Species_L(MethodType mt, LambdaForm lf, Object argL0) { super(mt, lf); this.argL0 = argL0; } @@ -213,140 +204,95 @@ import jdk.internal.org.objectweb.asm.Type; /*non-public*/ SpeciesData speciesData() { return SPECIES_DATA; } - /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class); @Override - /*non-public*/ final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable { + /*non-public*/ int fieldCount() { + return 1; + } + /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class); + /*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) { return new Species_L(mt, lf, argL0); } @Override - /*non-public*/ final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, narg); + /*non-public*/ final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) { + return new Species_L(mt, lf, argL0); } @Override - /*non-public*/ final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, narg); + /*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) { + try { + return (BoundMethodHandle) SPECIES_DATA.extendWith(L_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg); + } catch (Throwable ex) { + throw uncaughtException(ex); + } } @Override - /*non-public*/ final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, narg); + /*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) { + try { + return (BoundMethodHandle) SPECIES_DATA.extendWith(I_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg); + } catch (Throwable ex) { + throw uncaughtException(ex); + } } @Override - /*non-public*/ final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, narg); + /*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) { + try { + return (BoundMethodHandle) SPECIES_DATA.extendWith(J_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg); + } catch (Throwable ex) { + throw uncaughtException(ex); + } } @Override - /*non-public*/ final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, narg); + /*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) { + try { + return (BoundMethodHandle) SPECIES_DATA.extendWith(F_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg); + } catch (Throwable ex) { + throw uncaughtException(ex); + } + } + @Override + /*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) { + try { + return (BoundMethodHandle) SPECIES_DATA.extendWith(D_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg); + } catch (Throwable ex) { + throw uncaughtException(ex); + } } } -/* - static final class Species_LL extends BoundMethodHandle { - final Object argL0; - final Object argL1; - public Species_LL(MethodType mt, LambdaForm lf, Object argL0, Object argL1) { - super(mt, lf); - this.argL0 = argL0; - this.argL1 = argL1; - } - @Override - public SpeciesData speciesData() { - return SPECIES_DATA; - } - public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LL", Species_LL.class); - @Override - public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable { - return new Species_LL(mt, lf, argL0, argL1); - } - @Override - public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg); - } - } - - static final class Species_JL extends BoundMethodHandle { - final long argJ0; - final Object argL1; - public Species_JL(MethodType mt, LambdaForm lf, long argJ0, Object argL1) { - super(mt, lf); - this.argJ0 = argJ0; - this.argL1 = argL1; - } - @Override - public SpeciesData speciesData() { - return SPECIES_DATA; - } - public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("JL", Species_JL.class); - @Override public final long argJ0() { return argJ0; } - @Override public final Object argL1() { return argL1; } - @Override - public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable { - return new Species_JL(mt, lf, argJ0, argL1); - } - @Override - public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg); - } - @Override - public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable { - return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg); - } - } -*/ - // // BMH species meta-data // /** - * Meta-data wrapper for concrete BMH classes. + * Meta-data wrapper for concrete BMH types. + * Each BMH type corresponds to a given sequence of basic field types (LIJFD). + * The fields are immutable; their values are fully specified at object construction. + * Each BMH type supplies an array of getter functions which may be used in lambda forms. + * A BMH is constructed by cloning a shorter BMH and adding one or more new field values. + * As a degenerate and common case, the "shorter BMH" can be missing, and contributes zero prior fields. */ static class SpeciesData { - final String types; + final String typeChars; + final BasicType[] typeCodes; final Class clazz; // Bootstrapping requires circular relations MH -> BMH -> SpeciesData -> MH // Therefore, we need a non-final link in the chain. Use array elements. final MethodHandle[] constructor; final MethodHandle[] getters; + final NamedFunction[] nominalGetters; final SpeciesData[] extensions; /*non-public*/ int fieldCount() { - return types.length(); + return typeCodes.length; } - /*non-public*/ char fieldType(int i) { - return types.charAt(i); + /*non-public*/ BasicType fieldType(int i) { + return typeCodes[i]; + } + /*non-public*/ char fieldTypeChar(int i) { + return typeChars.charAt(i); } public String toString() { - return "SpeciesData["+(isPlaceholder() ? "" : clazz.getSimpleName())+":"+types+"]"; + return "SpeciesData["+(isPlaceholder() ? "" : clazz.getSimpleName())+":"+typeChars+"]"; } /** @@ -354,45 +300,46 @@ import jdk.internal.org.objectweb.asm.Type; * represents a MH bound to a generic invoker, which in turn forwards to the corresponding * getter. */ - Name getterName(Name mhName, int i) { - MethodHandle mh = getters[i]; - assert(mh != null) : this+"."+i; - return new Name(mh, mhName); - } - NamedFunction getterFunction(int i) { - return new NamedFunction(getters[i]); + return nominalGetters[i]; } static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class); private SpeciesData(String types, Class clazz) { - this.types = types; + this.typeChars = types; + this.typeCodes = basicTypes(types); this.clazz = clazz; if (!INIT_DONE) { - this.constructor = new MethodHandle[1]; + this.constructor = new MethodHandle[1]; // only one ctor this.getters = new MethodHandle[types.length()]; + this.nominalGetters = new NamedFunction[types.length()]; } else { this.constructor = Factory.makeCtors(clazz, types, null); this.getters = Factory.makeGetters(clazz, types, null); + this.nominalGetters = Factory.makeNominalGetters(types, null, this.getters); } - this.extensions = new SpeciesData[EXTENSION_TYPES.length()]; + this.extensions = new SpeciesData[ARG_TYPE_LIMIT]; } private void initForBootstrap() { assert(!INIT_DONE); if (constructor[0] == null) { + String types = typeChars; Factory.makeCtors(clazz, types, this.constructor); Factory.makeGetters(clazz, types, this.getters); + Factory.makeNominalGetters(types, this.nominalGetters, this.getters); } } - private SpeciesData(String types) { + private SpeciesData(String typeChars) { // Placeholder only. - this.types = types; + this.typeChars = typeChars; + this.typeCodes = basicTypes(typeChars); this.clazz = null; this.constructor = null; this.getters = null; + this.nominalGetters = null; this.extensions = null; } private boolean isPlaceholder() { return clazz == null; } @@ -401,18 +348,15 @@ import jdk.internal.org.objectweb.asm.Type; static { CACHE.put("", EMPTY); } // make bootstrap predictable private static final boolean INIT_DONE; // set after finishes... - SpeciesData extendWithType(char type) { - int i = extensionIndex(type); - SpeciesData d = extensions[i]; - if (d != null) return d; - extensions[i] = d = get(types+type); - return d; + SpeciesData extendWith(byte type) { + return extendWith(BasicType.basicType(type)); } - SpeciesData extendWithIndex(byte index) { - SpeciesData d = extensions[index]; + SpeciesData extendWith(BasicType type) { + int ord = type.ordinal(); + SpeciesData d = extensions[ord]; if (d != null) return d; - extensions[index] = d = get(types+EXTENSION_TYPES.charAt(index)); + extensions[ord] = d = get(typeChars+type.basicTypeChar()); return d; } @@ -456,8 +400,6 @@ import jdk.internal.org.objectweb.asm.Type; static { // pre-fill the BMH speciesdata cache with BMH's inner classes final Class rootCls = BoundMethodHandle.class; - SpeciesData d0 = BoundMethodHandle.SPECIES_DATA; // trigger class init - assert(d0 == null || d0 == lookupCache("")) : d0; try { for (Class c : rootCls.getDeclaredClasses()) { if (rootCls.isAssignableFrom(c)) { @@ -465,7 +407,7 @@ import jdk.internal.org.objectweb.asm.Type; SpeciesData d = Factory.speciesDataFromConcreteBMHClass(cbmh); assert(d != null) : cbmh.getName(); assert(d.clazz == cbmh); - assert(d == lookupCache(d.types)); + assert(d == lookupCache(d.typeChars)); } } } catch (Throwable e) { @@ -516,11 +458,10 @@ import jdk.internal.org.objectweb.asm.Type; static final String BMHSPECIES_DATA_GFC_SIG = "(" + JLS_SIG + JLC_SIG + ")" + SPECIES_DATA_SIG; static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG; static final String VOID_SIG = "()V"; + static final String INT_SIG = "()I"; static final String SIG_INCIPIT = "(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;"; - static final Class[] TYPES = new Class[] { Object.class, int.class, long.class, float.class, double.class }; - static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" }; /** @@ -551,31 +492,35 @@ import jdk.internal.org.objectweb.asm.Type; * final Object argL0; * final Object argL1; * final int argI2; - * Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) { + * private Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) { * super(mt, lf); * this.argL0 = argL0; * this.argL1 = argL1; * this.argI2 = argI2; * } * final SpeciesData speciesData() { return SPECIES_DATA; } + * final int fieldCount() { return 3; } * static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class); - * final BoundMethodHandle clone(MethodType mt, LambdaForm lf) { - * return SPECIES_DATA.constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2); + * static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) { + * return new Species_LLI(mt, lf, argL0, argL1, argI2); * } - * final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) { - * return SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) { + * return new Species_LLI(mt, lf, argL0, argL1, argI2); * } - * final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) { - * return SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) { + * return SPECIES_DATA.extendWith(L_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); * } - * final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) { - * return SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) { + * return SPECIES_DATA.extendWith(I_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); * } - * final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) { - * return SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) { + * return SPECIES_DATA.extendWith(J_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); * } - * final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) { - * return SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) { + * return SPECIES_DATA.extendWith(F_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); + * } + * public final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) { + * return SPECIES_DATA.extendWith(D_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg); * } * } * @@ -586,8 +531,9 @@ import jdk.internal.org.objectweb.asm.Type; static Class generateConcreteBMHClass(String types) { final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES); - final String className = SPECIES_PREFIX_PATH + types; - final String sourceFile = SPECIES_PREFIX_NAME + types; + String shortTypes = LambdaForm.shortenSignature(types); + final String className = SPECIES_PREFIX_PATH + shortTypes; + final String sourceFile = SPECIES_PREFIX_NAME + shortTypes; final int NOT_ACC_PUBLIC = 0; // not ACC_PUBLIC cw.visit(V1_6, NOT_ACC_PUBLIC + ACC_FINAL + ACC_SUPER, className, null, BMH, null); cw.visitSource(sourceFile, null); @@ -606,11 +552,11 @@ import jdk.internal.org.objectweb.asm.Type; MethodVisitor mv; // emit constructor - mv = cw.visitMethod(NOT_ACC_PUBLIC, "", makeSignature(types, true), null, null); + mv = cw.visitMethod(ACC_PRIVATE, "", makeSignature(types, true), null, null); mv.visitCode(); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 2); + mv.visitVarInsn(ALOAD, 0); // this + mv.visitVarInsn(ALOAD, 1); // type + mv.visitVarInsn(ALOAD, 2); // form mv.visitMethodInsn(INVOKESPECIAL, BMH, "", makeSignature("", true), false); @@ -647,39 +593,73 @@ import jdk.internal.org.objectweb.asm.Type; mv.visitMaxs(0, 0); mv.visitEnd(); - // emit clone() - mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "clone", makeSignature("", false), null, E_THROWABLE); + // emit implementation of fieldCount() + mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "fieldCount", INT_SIG, null, null); mv.visitCode(); - // return speciesData().constructor[0].invokeBasic(mt, lf, argL0, ...) - // obtain constructor - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG); - mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG); - mv.visitInsn(ICONST_0); - mv.visitInsn(AALOAD); + int fc = types.length(); + if (fc <= (ICONST_5 - ICONST_0)) { + mv.visitInsn(ICONST_0 + fc); + } else { + mv.visitIntInsn(SIPUSH, fc); + } + mv.visitInsn(IRETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + // emit make() ...factory method wrapping constructor + mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_STATIC, "make", makeSignature(types, false), null, null); + mv.visitCode(); + // make instance + mv.visitTypeInsn(NEW, className); + mv.visitInsn(DUP); + // load mt, lf + mv.visitVarInsn(ALOAD, 0); // type + mv.visitVarInsn(ALOAD, 1); // form + // load factory method arguments + for (int i = 0, j = 0; i < types.length(); ++i, ++j) { + // i counts the arguments, j counts corresponding argument slots + char t = types.charAt(i); + mv.visitVarInsn(typeLoadOp(t), j + 2); // parameters start at 3 + if (t == 'J' || t == 'D') { + ++j; // adjust argument register access + } + } + + // finally, invoke the constructor and return + mv.visitMethodInsn(INVOKESPECIAL, className, "", makeSignature(types, true), false); + mv.visitInsn(ARETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + + // emit copyWith() + mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWith", makeSignature("", false), null, null); + mv.visitCode(); + // make instance + mv.visitTypeInsn(NEW, className); + mv.visitInsn(DUP); // load mt, lf mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 2); // put fields on the stack emitPushFields(types, className, mv); // finally, invoke the constructor and return - mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types, false), false); + mv.visitMethodInsn(INVOKESPECIAL, className, "", makeSignature(types, true), false); mv.visitInsn(ARETURN); mv.visitMaxs(0, 0); mv.visitEnd(); - // for each type, emit cloneExtendT() - for (Class c : TYPES) { - char t = Wrapper.basicTypeChar(c); - mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "cloneExtend" + t, makeSignature(String.valueOf(t), false), null, E_THROWABLE); + // for each type, emit copyWithExtendT() + for (BasicType type : BasicType.ARG_TYPES) { + int ord = type.ordinal(); + char btChar = type.basicTypeChar(); + mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWithExtend" + btChar, makeSignature(String.valueOf(btChar), false), null, E_THROWABLE); mv.visitCode(); - // return SPECIES_DATA.extendWithIndex(extensionIndex(t)).constructor[0].invokeBasic(mt, lf, argL0, ..., narg) + // return SPECIES_DATA.extendWith(t).constructor[0].invokeBasic(mt, lf, argL0, ..., narg) // obtain constructor mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG); - int iconstInsn = ICONST_0 + extensionIndex(t); + int iconstInsn = ICONST_0 + ord; assert(iconstInsn <= ICONST_5); mv.visitInsn(iconstInsn); - mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWithIndex", BMHSPECIES_DATA_EWI_SIG, false); + mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWith", BMHSPECIES_DATA_EWI_SIG, false); mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG); mv.visitInsn(ICONST_0); mv.visitInsn(AALOAD); @@ -689,9 +669,9 @@ import jdk.internal.org.objectweb.asm.Type; // put fields on the stack emitPushFields(types, className, mv); // put narg on stack - mv.visitVarInsn(typeLoadOp(t), 3); + mv.visitVarInsn(typeLoadOp(btChar), 3); // finally, invoke the constructor and return - mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + t, false), false); + mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + btChar, false), false); mv.visitInsn(ARETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -730,7 +710,7 @@ import jdk.internal.org.objectweb.asm.Type; case 'J': return LLOAD; case 'F': return FLOAD; case 'D': return DLOAD; - default : throw new InternalError("unrecognized type " + t); + default : throw newInternalError("unrecognized type " + t); } } @@ -771,10 +751,19 @@ import jdk.internal.org.objectweb.asm.Type; static MethodHandle[] makeCtors(Class cbmh, String types, MethodHandle mhs[]) { if (mhs == null) mhs = new MethodHandle[1]; + if (types.equals("")) return mhs; // hack for empty BMH species mhs[0] = makeCbmhCtor(cbmh, types); return mhs; } + static NamedFunction[] makeNominalGetters(String types, NamedFunction[] nfs, MethodHandle[] getters) { + if (nfs == null) nfs = new NamedFunction[types.length()]; + for (int i = 0; i < nfs.length; ++i) { + nfs[i] = new NamedFunction(getters[i]); + } + return nfs; + } + // // Auxiliary methods. // @@ -808,52 +797,11 @@ import jdk.internal.org.objectweb.asm.Type; static MethodHandle makeCbmhCtor(Class cbmh, String types) { try { - return linkConstructor(LOOKUP.findConstructor(cbmh, MethodType.fromMethodDescriptorString(makeSignature(types, true), null))); + return LOOKUP.findStatic(cbmh, "make", MethodType.fromMethodDescriptorString(makeSignature(types, false), null)); } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) { throw newInternalError(e); } } - - /** - * Wrap a constructor call in a {@link LambdaForm}. - * - * If constructors ({@code } methods) are called in LFs, problems might arise if the LFs - * are turned into bytecode, because the call to the allocator is routed through an MH, and the - * verifier cannot find a {@code NEW} instruction preceding the {@code INVOKESPECIAL} to - * {@code }. To avoid this, we add an indirection by invoking {@code } through - * {@link MethodHandle#linkToSpecial}. - * - * The last {@link LambdaForm.Name Name} in the argument's form is expected to be the {@code void} - * result of the {@code } invocation. This entry is replaced. - */ - private static MethodHandle linkConstructor(MethodHandle cmh) { - final LambdaForm lf = cmh.form; - final int initNameIndex = lf.names.length - 1; - final Name initName = lf.names[initNameIndex]; - final MemberName ctorMN = initName.function.member; - final MethodType ctorMT = ctorMN.getInvocationType(); - - // obtain function member (call target) - // linker method type replaces initial parameter (BMH species) with BMH to avoid naming a species (anonymous class!) - final MethodType linkerMT = ctorMT.changeParameterType(0, BoundMethodHandle.class).appendParameterTypes(MemberName.class); - MemberName linkerMN = new MemberName(MethodHandle.class, "linkToSpecial", linkerMT, REF_invokeStatic); - try { - linkerMN = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linkerMN, null, NoSuchMethodException.class); - assert(linkerMN.isStatic()); - } catch (ReflectiveOperationException ex) { - throw newInternalError(ex); - } - // extend arguments array - Object[] newArgs = Arrays.copyOf(initName.arguments, initName.arguments.length + 1); - newArgs[newArgs.length - 1] = ctorMN; - // replace function - final NamedFunction nf = new NamedFunction(linkerMN); - final Name linkedCtor = new Name(nf, newArgs); - linkedCtor.initIndex(initNameIndex); - lf.names[initNameIndex] = linkedCtor; - return cmh; - } - } private static final Lookup LOOKUP = Lookup.IMPL_LOOKUP; diff --git a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java index 9c054519b43..0fbc4619e22 100644 --- a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java @@ -31,6 +31,7 @@ import java.util.Arrays; import sun.invoke.util.VerifyAccess; import static java.lang.invoke.MethodHandleNatives.Constants.*; import static java.lang.invoke.LambdaForm.*; +import static java.lang.invoke.LambdaForm.BasicType.*; import static java.lang.invoke.MethodTypeForm.*; import static java.lang.invoke.MethodHandleStatics.*; import java.lang.ref.WeakReference; @@ -124,11 +125,6 @@ class DirectMethodHandle extends MethodHandle { return new Constructor(mtype, lform, ctor, init, instanceClass); } - @Override - MethodHandle copyWith(MethodType mt, LambdaForm lf) { - return new DirectMethodHandle(mt, lf, member); - } - @Override String internalProperties() { return "/DMH="+member.toString(); @@ -146,9 +142,9 @@ class DirectMethodHandle extends MethodHandle { } @Override - MethodHandle bindArgument(int pos, char basicType, Object value) { + MethodHandle bindArgument(int pos, BasicType basicType, Object value) { // If the member needs dispatching, do so. - if (pos == 0 && basicType == 'L') { + if (pos == 0 && basicType == L_TYPE) { DirectMethodHandle concrete = maybeRebind(value); if (concrete != null) return concrete.bindReceiver(value); @@ -274,7 +270,7 @@ class DirectMethodHandle extends MethodHandle { result = NEW_OBJ; } names[LINKER_CALL] = new Name(linker, outArgs); - lambdaName += "_" + LambdaForm.basicTypeSignature(mtype); + lambdaName += "_" + shortenSignature(basicTypeSignature(mtype)); LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result); // This is a tricky bit of code. Don't send it through the LF interpreter. lform.compileToBytecode(); diff --git a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 145203b0a07..7bcdfaf5e89 100644 --- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -26,7 +26,7 @@ package java.lang.invoke; import sun.invoke.util.VerifyAccess; -import java.lang.invoke.LambdaForm.Name; +import static java.lang.invoke.LambdaForm.*; import sun.invoke.util.Wrapper; @@ -38,6 +38,7 @@ import jdk.internal.org.objectweb.asm.*; import java.lang.reflect.*; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleNatives.Constants.*; +import static java.lang.invoke.LambdaForm.BasicType.*; import sun.invoke.util.VerifyType; /** @@ -115,7 +116,7 @@ class InvokerBytecodeGenerator { Name[] names = form.names; for (int i = 0, index = 0; i < localsMap.length; i++) { localsMap[i] = index; - index += Wrapper.forBasicType(names[i].type).stackSlots(); + index += names[i].type.basicTypeSlots(); } } @@ -358,47 +359,52 @@ class InvokerBytecodeGenerator { /* * NOTE: These load/store methods use the localsMap to find the correct index! */ - private void emitLoadInsn(char type, int index) { - int opcode; - switch (type) { - case 'I': opcode = Opcodes.ILOAD; break; - case 'J': opcode = Opcodes.LLOAD; break; - case 'F': opcode = Opcodes.FLOAD; break; - case 'D': opcode = Opcodes.DLOAD; break; - case 'L': opcode = Opcodes.ALOAD; break; - default: - throw new InternalError("unknown type: " + type); - } + private void emitLoadInsn(BasicType type, int index) { + int opcode = loadInsnOpcode(type); mv.visitVarInsn(opcode, localsMap[index]); } - private void emitAloadInsn(int index) { - emitLoadInsn('L', index); - } - private void emitStoreInsn(char type, int index) { - int opcode; + private int loadInsnOpcode(BasicType type) throws InternalError { switch (type) { - case 'I': opcode = Opcodes.ISTORE; break; - case 'J': opcode = Opcodes.LSTORE; break; - case 'F': opcode = Opcodes.FSTORE; break; - case 'D': opcode = Opcodes.DSTORE; break; - case 'L': opcode = Opcodes.ASTORE; break; - default: - throw new InternalError("unknown type: " + type); + case I_TYPE: return Opcodes.ILOAD; + case J_TYPE: return Opcodes.LLOAD; + case F_TYPE: return Opcodes.FLOAD; + case D_TYPE: return Opcodes.DLOAD; + case L_TYPE: return Opcodes.ALOAD; + default: + throw new InternalError("unknown type: " + type); } + } + private void emitAloadInsn(int index) { + emitLoadInsn(L_TYPE, index); + } + + private void emitStoreInsn(BasicType type, int index) { + int opcode = storeInsnOpcode(type); mv.visitVarInsn(opcode, localsMap[index]); } + + private int storeInsnOpcode(BasicType type) throws InternalError { + switch (type) { + case I_TYPE: return Opcodes.ISTORE; + case J_TYPE: return Opcodes.LSTORE; + case F_TYPE: return Opcodes.FSTORE; + case D_TYPE: return Opcodes.DSTORE; + case L_TYPE: return Opcodes.ASTORE; + default: + throw new InternalError("unknown type: " + type); + } + } private void emitAstoreInsn(int index) { - emitStoreInsn('L', index); + emitStoreInsn(L_TYPE, index); } /** * Emit a boxing call. * - * @param type primitive type class to box. + * @param wrapper primitive type class to box. */ - private void emitBoxing(Class type) { - Wrapper wrapper = Wrapper.forPrimitiveType(type); + private void emitBoxing(Wrapper wrapper) { String owner = "java/lang/" + wrapper.wrapperType().getSimpleName(); String name = "valueOf"; String desc = "(" + wrapper.basicTypeChar() + ")L" + owner + ";"; @@ -408,10 +414,9 @@ class InvokerBytecodeGenerator { /** * Emit an unboxing call (plus preceding checkcast). * - * @param type wrapper type class to unbox. + * @param wrapper wrapper type class to unbox. */ - private void emitUnboxing(Class type) { - Wrapper wrapper = Wrapper.forWrapperType(type); + private void emitUnboxing(Wrapper wrapper) { String owner = "java/lang/" + wrapper.wrapperType().getSimpleName(); String name = wrapper.primitiveSimpleName() + "Value"; String desc = "()" + wrapper.basicTypeChar(); @@ -425,9 +430,12 @@ class InvokerBytecodeGenerator { * @param ptype type of value present on stack * @param pclass type of value required on stack */ - private void emitImplicitConversion(char ptype, Class pclass) { + private void emitImplicitConversion(BasicType ptype, Class pclass) { + assert(basicType(pclass) == ptype); // boxing/unboxing handled by caller + if (pclass == ptype.basicTypeClass() && ptype != L_TYPE) + return; // nothing to do switch (ptype) { - case 'L': + case L_TYPE: if (VerifyType.isNullConversion(Object.class, pclass)) return; if (isStaticallyNameable(pclass)) { @@ -441,18 +449,9 @@ class InvokerBytecodeGenerator { mv.visitTypeInsn(Opcodes.CHECKCAST, OBJARY); } return; - case 'I': + case I_TYPE: if (!VerifyType.isNullConversion(int.class, pclass)) - emitPrimCast(ptype, Wrapper.basicTypeChar(pclass)); - return; - case 'J': - assert(pclass == long.class); - return; - case 'F': - assert(pclass == float.class); - return; - case 'D': - assert(pclass == double.class); + emitPrimCast(ptype.basicTypeWrapper(), Wrapper.forPrimitiveType(pclass)); return; } throw new InternalError("bad implicit conversion: tc="+ptype+": "+pclass); @@ -461,15 +460,15 @@ class InvokerBytecodeGenerator { /** * Emits an actual return instruction conforming to the given return type. */ - private void emitReturnInsn(Class type) { + private void emitReturnInsn(BasicType type) { int opcode; - switch (Wrapper.basicTypeChar(type)) { - case 'I': opcode = Opcodes.IRETURN; break; - case 'J': opcode = Opcodes.LRETURN; break; - case 'F': opcode = Opcodes.FRETURN; break; - case 'D': opcode = Opcodes.DRETURN; break; - case 'L': opcode = Opcodes.ARETURN; break; - case 'V': opcode = Opcodes.RETURN; break; + switch (type) { + case I_TYPE: opcode = Opcodes.IRETURN; break; + case J_TYPE: opcode = Opcodes.LRETURN; break; + case F_TYPE: opcode = Opcodes.FRETURN; break; + case D_TYPE: opcode = Opcodes.DRETURN; break; + case L_TYPE: opcode = Opcodes.ARETURN; break; + case V_TYPE: opcode = Opcodes.RETURN; break; default: throw new InternalError("unknown return type: " + type); } @@ -531,7 +530,7 @@ class InvokerBytecodeGenerator { // avoid store/load/return and just return) if (i == lambdaForm.names.length - 1 && i == lambdaForm.result) { // return value - do nothing - } else if (name.type != 'V') { + } else if (name.type != V_TYPE) { // non-void: actually assign emitStoreInsn(name.type, name.index()); } @@ -865,20 +864,24 @@ class InvokerBytecodeGenerator { private void emitPushArgument(Name name, int paramIndex) { Object arg = name.arguments[paramIndex]; - char ptype = name.function.parameterType(paramIndex); - MethodType mtype = name.function.methodType(); + Class ptype = name.function.methodType().parameterType(paramIndex); + emitPushArgument(ptype, arg); + } + + private void emitPushArgument(Class ptype, Object arg) { + BasicType bptype = basicType(ptype); if (arg instanceof Name) { Name n = (Name) arg; emitLoadInsn(n.type, n.index()); - emitImplicitConversion(n.type, mtype.parameterType(paramIndex)); - } else if ((arg == null || arg instanceof String) && ptype == 'L') { + emitImplicitConversion(n.type, ptype); + } else if ((arg == null || arg instanceof String) && bptype == L_TYPE) { emitConst(arg); } else { - if (Wrapper.isWrapperType(arg.getClass()) && ptype != 'L') { + if (Wrapper.isWrapperType(arg.getClass()) && bptype != L_TYPE) { emitConst(arg); } else { mv.visitLdcInsn(constantPlaceholder(arg)); - emitImplicitConversion('L', mtype.parameterType(paramIndex)); + emitImplicitConversion(L_TYPE, ptype); } } } @@ -888,52 +891,33 @@ class InvokerBytecodeGenerator { */ private void emitReturn() { // return statement - if (lambdaForm.result == -1) { + Class rclass = invokerType.returnType(); + BasicType rtype = lambdaForm.returnType(); + assert(rtype == basicType(rclass)); // must agree + if (rtype == V_TYPE) { // void mv.visitInsn(Opcodes.RETURN); + // it doesn't matter what rclass is; the JVM will discard any value } else { LambdaForm.Name rn = lambdaForm.names[lambdaForm.result]; - char rtype = Wrapper.basicTypeChar(invokerType.returnType()); // put return value on the stack if it is not already there - if (lambdaForm.result != lambdaForm.names.length - 1) { + if (lambdaForm.result != lambdaForm.names.length - 1 || + lambdaForm.result < lambdaForm.arity) { emitLoadInsn(rn.type, lambdaForm.result); } - // potentially generate cast - // rtype is the return type of the invoker - generated code must conform to this - // rn.type is the type of the result Name in the LF - if (rtype != rn.type) { - // need cast - if (rtype == 'L') { - // possibly cast the primitive to the correct type for boxing - char boxedType = Wrapper.forWrapperType(invokerType.returnType()).basicTypeChar(); - if (boxedType != rn.type) { - emitPrimCast(rn.type, boxedType); - } - // cast primitive to reference ("boxing") - emitBoxing(invokerType.returnType()); - } else { - // to-primitive cast - if (rn.type != 'L') { - // prim-to-prim cast - emitPrimCast(rn.type, rtype); - } else { - // ref-to-prim cast ("unboxing") - throw new InternalError("no ref-to-prim (unboxing) casts supported right now"); - } - } - } + emitImplicitConversion(rtype, rclass); // generate actual return statement - emitReturnInsn(invokerType.returnType()); + emitReturnInsn(rtype); } } /** * Emit a type conversion bytecode casting from "from" to "to". */ - private void emitPrimCast(char from, char to) { + private void emitPrimCast(Wrapper from, Wrapper to) { // Here's how. // - indicates forbidden // <-> indicates implicit @@ -950,17 +934,15 @@ class InvokerBytecodeGenerator { // no cast required, should be dead code anyway return; } - Wrapper wfrom = Wrapper.forBasicType(from); - Wrapper wto = Wrapper.forBasicType(to); - if (wfrom.isSubwordOrInt()) { + if (from.isSubwordOrInt()) { // cast from {byte,short,char,int} to anything emitI2X(to); } else { // cast from {long,float,double} to anything - if (wto.isSubwordOrInt()) { + if (to.isSubwordOrInt()) { // cast to {byte,short,char,int} emitX2I(from); - if (wto.bitWidth() < 32) { + if (to.bitWidth() < 32) { // targets other than int require another conversion emitI2X(to); } @@ -968,20 +950,26 @@ class InvokerBytecodeGenerator { // cast to {long,float,double} - this is verbose boolean error = false; switch (from) { - case 'J': - if (to == 'F') { mv.visitInsn(Opcodes.L2F); } - else if (to == 'D') { mv.visitInsn(Opcodes.L2D); } - else error = true; + case LONG: + switch (to) { + case FLOAT: mv.visitInsn(Opcodes.L2F); break; + case DOUBLE: mv.visitInsn(Opcodes.L2D); break; + default: error = true; break; + } break; - case 'F': - if (to == 'J') { mv.visitInsn(Opcodes.F2L); } - else if (to == 'D') { mv.visitInsn(Opcodes.F2D); } - else error = true; + case FLOAT: + switch (to) { + case LONG : mv.visitInsn(Opcodes.F2L); break; + case DOUBLE: mv.visitInsn(Opcodes.F2D); break; + default: error = true; break; + } break; - case 'D': - if (to == 'J') { mv.visitInsn(Opcodes.D2L); } - else if (to == 'F') { mv.visitInsn(Opcodes.D2F); } - else error = true; + case DOUBLE: + switch (to) { + case LONG : mv.visitInsn(Opcodes.D2L); break; + case FLOAT: mv.visitInsn(Opcodes.D2F); break; + default: error = true; break; + } break; default: error = true; @@ -994,16 +982,16 @@ class InvokerBytecodeGenerator { } } - private void emitI2X(char type) { + private void emitI2X(Wrapper type) { switch (type) { - case 'B': mv.visitInsn(Opcodes.I2B); break; - case 'S': mv.visitInsn(Opcodes.I2S); break; - case 'C': mv.visitInsn(Opcodes.I2C); break; - case 'I': /* naught */ break; - case 'J': mv.visitInsn(Opcodes.I2L); break; - case 'F': mv.visitInsn(Opcodes.I2F); break; - case 'D': mv.visitInsn(Opcodes.I2D); break; - case 'Z': + case BYTE: mv.visitInsn(Opcodes.I2B); break; + case SHORT: mv.visitInsn(Opcodes.I2S); break; + case CHAR: mv.visitInsn(Opcodes.I2C); break; + case INT: /* naught */ break; + case LONG: mv.visitInsn(Opcodes.I2L); break; + case FLOAT: mv.visitInsn(Opcodes.I2F); break; + case DOUBLE: mv.visitInsn(Opcodes.I2D); break; + case BOOLEAN: // For compatibility with ValueConversions and explicitCastArguments: mv.visitInsn(Opcodes.ICONST_1); mv.visitInsn(Opcodes.IAND); @@ -1012,39 +1000,24 @@ class InvokerBytecodeGenerator { } } - private void emitX2I(char type) { + private void emitX2I(Wrapper type) { switch (type) { - case 'J': mv.visitInsn(Opcodes.L2I); break; - case 'F': mv.visitInsn(Opcodes.F2I); break; - case 'D': mv.visitInsn(Opcodes.D2I); break; - default: throw new InternalError("unknown type: " + type); + case LONG: mv.visitInsn(Opcodes.L2I); break; + case FLOAT: mv.visitInsn(Opcodes.F2I); break; + case DOUBLE: mv.visitInsn(Opcodes.D2I); break; + default: throw new InternalError("unknown type: " + type); } } - private static String basicTypeCharSignature(String prefix, MethodType type) { - StringBuilder buf = new StringBuilder(prefix); - for (Class ptype : type.parameterList()) - buf.append(Wrapper.forBasicType(ptype).basicTypeChar()); - buf.append('_').append(Wrapper.forBasicType(type.returnType()).basicTypeChar()); - return buf.toString(); - } - /** * Generate bytecode for a LambdaForm.vmentry which calls interpretWithArguments. */ static MemberName generateLambdaFormInterpreterEntryPoint(String sig) { - assert(LambdaForm.isValidSignature(sig)); - //System.out.println("generateExactInvoker "+sig); - // compute method type - // first parameter and return type - char tret = LambdaForm.signatureReturn(sig); - MethodType type = MethodType.methodType(LambdaForm.typeClass(tret), MethodHandle.class); - // other parameter types - int arity = LambdaForm.signatureArity(sig); - for (int i = 1; i < arity; i++) { - type = type.appendParameterTypes(LambdaForm.typeClass(sig.charAt(i))); - } - InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", "interpret_"+tret, type); + assert(isValidSignature(sig)); + String name = "interpret_"+signatureReturn(sig).basicTypeChar(); + MethodType type = signatureType(sig); // sig includes leading argument + type = type.changeParameterType(0, MethodHandle.class); + InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", name, type); return g.loadMethod(g.generateLambdaFormInterpreterEntryPointBytes()); } @@ -1066,10 +1039,10 @@ class InvokerBytecodeGenerator { Class ptype = invokerType.parameterType(i); mv.visitInsn(Opcodes.DUP); emitIconstInsn(i); - emitLoadInsn(Wrapper.basicTypeChar(ptype), i); + emitLoadInsn(basicType(ptype), i); // box if primitive type if (ptype.isPrimitive()) { - emitBoxing(ptype); + emitBoxing(Wrapper.forPrimitiveType(ptype)); } mv.visitInsn(Opcodes.AASTORE); } @@ -1082,11 +1055,11 @@ class InvokerBytecodeGenerator { // maybe unbox Class rtype = invokerType.returnType(); if (rtype.isPrimitive() && rtype != void.class) { - emitUnboxing(Wrapper.asWrapperType(rtype)); + emitUnboxing(Wrapper.forPrimitiveType(rtype)); } // return statement - emitReturnInsn(rtype); + emitReturnInsn(basicType(rtype)); classFileEpilogue(); bogusMethod(invokerType); @@ -1100,14 +1073,12 @@ class InvokerBytecodeGenerator { * Generate bytecode for a NamedFunction invoker. */ static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) { - MethodType invokerType = LambdaForm.NamedFunction.INVOKER_METHOD_TYPE; - String invokerName = basicTypeCharSignature("invoke_", typeForm.erasedType()); + MethodType invokerType = NamedFunction.INVOKER_METHOD_TYPE; + String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType())); InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType); return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm)); } - static int nfi = 0; - private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) { MethodType dstType = typeForm.erasedType(); classFilePrologue(); @@ -1133,8 +1104,8 @@ class InvokerBytecodeGenerator { Class sptype = dstType.basicType().wrap().parameterType(i); Wrapper dstWrapper = Wrapper.forBasicType(dptype); Wrapper srcWrapper = dstWrapper.isSubwordOrInt() ? Wrapper.INT : dstWrapper; // narrow subword from int - emitUnboxing(srcWrapper.wrapperType()); - emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar()); + emitUnboxing(srcWrapper); + emitPrimCast(srcWrapper, dstWrapper); } } @@ -1148,15 +1119,15 @@ class InvokerBytecodeGenerator { Wrapper srcWrapper = Wrapper.forBasicType(rtype); Wrapper dstWrapper = srcWrapper.isSubwordOrInt() ? Wrapper.INT : srcWrapper; // widen subword to int // boolean casts not allowed - emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar()); - emitBoxing(dstWrapper.primitiveType()); + emitPrimCast(srcWrapper, dstWrapper); + emitBoxing(dstWrapper); } // If the return type is void we return a null reference. if (rtype == void.class) { mv.visitInsn(Opcodes.ACONST_NULL); } - emitReturnInsn(Object.class); // NOTE: NamedFunction invokers always return a reference value. + emitReturnInsn(L_TYPE); // NOTE: NamedFunction invokers always return a reference value. classFileEpilogue(); bogusMethod(dstType); diff --git a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java index a5e40ed5211..36630459b88 100644 --- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java +++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java @@ -30,14 +30,14 @@ import java.lang.reflect.Method; import java.util.Map; import java.util.List; import java.util.Arrays; -import java.util.ArrayList; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; import sun.invoke.util.Wrapper; +import java.lang.reflect.Field; + +import static java.lang.invoke.LambdaForm.BasicType.*; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleNatives.Constants.*; -import java.lang.reflect.Field; -import java.util.Objects; /** * The symbolic, non-executable form of a method handle's invocation semantics. @@ -130,13 +130,119 @@ class LambdaForm { public static final int VOID_RESULT = -1, LAST_RESULT = -2; + enum BasicType { + L_TYPE('L', Object.class, Wrapper.OBJECT), // all reference types + I_TYPE('I', int.class, Wrapper.INT), + J_TYPE('J', long.class, Wrapper.LONG), + F_TYPE('F', float.class, Wrapper.FLOAT), + D_TYPE('D', double.class, Wrapper.DOUBLE), // all primitive types + V_TYPE('V', void.class, Wrapper.VOID); // not valid in all contexts + + static final BasicType[] ALL_TYPES = BasicType.values(); + static final BasicType[] ARG_TYPES = Arrays.copyOf(ALL_TYPES, ALL_TYPES.length-1); + + static final int ARG_TYPE_LIMIT = ARG_TYPES.length; + static final int TYPE_LIMIT = ALL_TYPES.length; + + private final char btChar; + private final Class btClass; + private final Wrapper btWrapper; + + private BasicType(char btChar, Class btClass, Wrapper wrapper) { + this.btChar = btChar; + this.btClass = btClass; + this.btWrapper = wrapper; + } + + char basicTypeChar() { + return btChar; + } + Class basicTypeClass() { + return btClass; + } + Wrapper basicTypeWrapper() { + return btWrapper; + } + int basicTypeSlots() { + return btWrapper.stackSlots(); + } + + static BasicType basicType(byte type) { + return ALL_TYPES[type]; + } + static BasicType basicType(char type) { + switch (type) { + case 'L': return L_TYPE; + case 'I': return I_TYPE; + case 'J': return J_TYPE; + case 'F': return F_TYPE; + case 'D': return D_TYPE; + case 'V': return V_TYPE; + // all subword types are represented as ints + case 'Z': + case 'B': + case 'S': + case 'C': + return I_TYPE; + default: + throw newInternalError("Unknown type char: '"+type+"'"); + } + } + static BasicType basicType(Wrapper type) { + char c = type.basicTypeChar(); + return basicType(c); + } + static BasicType basicType(Class type) { + if (!type.isPrimitive()) return L_TYPE; + return basicType(Wrapper.forPrimitiveType(type)); + } + + static char basicTypeChar(Class type) { + return basicType(type).btChar; + } + static BasicType[] basicTypes(List> types) { + BasicType[] btypes = new BasicType[types.size()]; + for (int i = 0; i < btypes.length; i++) { + btypes[i] = basicType(types.get(i)); + } + return btypes; + } + static BasicType[] basicTypes(String types) { + BasicType[] btypes = new BasicType[types.length()]; + for (int i = 0; i < btypes.length; i++) { + btypes[i] = basicType(types.charAt(i)); + } + return btypes; + } + static boolean isBasicTypeChar(char c) { + return "LIJFDV".indexOf(c) >= 0; + } + static boolean isArgBasicTypeChar(char c) { + return "LIJFD".indexOf(c) >= 0; + } + + static { assert(checkBasicType()); } + private static boolean checkBasicType() { + for (int i = 0; i < ARG_TYPE_LIMIT; i++) { + assert ARG_TYPES[i].ordinal() == i; + assert ARG_TYPES[i] == ALL_TYPES[i]; + } + for (int i = 0; i < TYPE_LIMIT; i++) { + assert ALL_TYPES[i].ordinal() == i; + } + assert ALL_TYPES[TYPE_LIMIT - 1] == V_TYPE; + assert !Arrays.asList(ARG_TYPES).contains(V_TYPE); + return true; + } + } + LambdaForm(String debugName, int arity, Name[] names, int result) { assert(namesOK(arity, names)); this.arity = arity; this.result = fixResult(result, names); this.names = names.clone(); - this.debugName = debugName; + this.debugName = fixDebugName(debugName); normalize(); } @@ -168,12 +274,12 @@ class LambdaForm { // Called only from getPreparedForm. assert(isValidSignature(sig)); this.arity = signatureArity(sig); - this.result = (signatureReturn(sig) == 'V' ? -1 : arity); + this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity); this.names = buildEmptyNames(arity, sig); this.debugName = "LF.zero"; assert(nameRefsAreLegal()); assert(isEmpty()); - assert(sig.equals(basicTypeSignature())); + assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature(); } private static Name[] buildEmptyNames(int arity, String basicTypeSignature) { @@ -181,24 +287,55 @@ class LambdaForm { int resultPos = arity + 1; // skip '_' if (arity < 0 || basicTypeSignature.length() != resultPos+1) throw new IllegalArgumentException("bad arity for "+basicTypeSignature); - int numRes = (basicTypeSignature.charAt(resultPos) == 'V' ? 0 : 1); + int numRes = (basicType(basicTypeSignature.charAt(resultPos)) == V_TYPE ? 0 : 1); Name[] names = arguments(numRes, basicTypeSignature.substring(0, arity)); for (int i = 0; i < numRes; i++) { - names[arity + i] = constantZero(arity + i, basicTypeSignature.charAt(resultPos + i)); + Name zero = new Name(constantZero(basicType(basicTypeSignature.charAt(resultPos + i)))); + names[arity + i] = zero.newIndex(arity + i); } return names; } private static int fixResult(int result, Name[] names) { - if (result >= 0) { - if (names[result].type == 'V') - return -1; - } else if (result == LAST_RESULT) { - return names.length - 1; - } + if (result == LAST_RESULT) + result = names.length - 1; // might still be void + if (result >= 0 && names[result].type == V_TYPE) + result = VOID_RESULT; return result; } + private static String fixDebugName(String debugName) { + if (DEBUG_NAME_COUNTERS != null) { + int under = debugName.indexOf('_'); + int length = debugName.length(); + if (under < 0) under = length; + String debugNameStem = debugName.substring(0, under); + Integer ctr; + synchronized (DEBUG_NAME_COUNTERS) { + ctr = DEBUG_NAME_COUNTERS.get(debugNameStem); + if (ctr == null) ctr = 0; + DEBUG_NAME_COUNTERS.put(debugNameStem, ctr+1); + } + StringBuilder buf = new StringBuilder(debugNameStem); + buf.append('_'); + int leadingZero = buf.length(); + buf.append((int) ctr); + for (int i = buf.length() - leadingZero; i < 3; i++) + buf.insert(leadingZero, '0'); + if (under < length) { + ++under; // skip "_" + while (under < length && Character.isDigit(debugName.charAt(under))) { + ++under; + } + if (under < length && debugName.charAt(under) == '_') ++under; + if (under < length) + buf.append('_').append(debugName, under, length); + } + return buf.toString(); + } + return debugName; + } + private static boolean namesOK(int arity, Name[] names) { for (int i = 0; i < names.length; i++) { Name n = names[i]; @@ -294,14 +431,14 @@ class LambdaForm { // } /** Report the return type. */ - char returnType() { - if (result < 0) return 'V'; + BasicType returnType() { + if (result < 0) return V_TYPE; Name n = names[result]; return n.type; } /** Report the N-th argument type. */ - char parameterType(int n) { + BasicType parameterType(int n) { assert(n < arity); return names[n].type; } @@ -319,15 +456,15 @@ class LambdaForm { final String basicTypeSignature() { StringBuilder buf = new StringBuilder(arity() + 3); for (int i = 0, a = arity(); i < a; i++) - buf.append(parameterType(i)); - return buf.append('_').append(returnType()).toString(); + buf.append(parameterType(i).basicTypeChar()); + return buf.append('_').append(returnType().basicTypeChar()).toString(); } static int signatureArity(String sig) { assert(isValidSignature(sig)); return sig.indexOf('_'); } - static char signatureReturn(String sig) { - return sig.charAt(signatureArity(sig)+1); + static BasicType signatureReturn(String sig) { + return basicType(sig.charAt(signatureArity(sig)+1)); } static boolean isValidSignature(String sig) { int arity = sig.indexOf('_'); @@ -339,27 +476,15 @@ class LambdaForm { char c = sig.charAt(i); if (c == 'V') return (i == siglen - 1 && arity == siglen - 2); - if (ALL_TYPES.indexOf(c) < 0) return false; // must be [LIJFD] + if (!isArgBasicTypeChar(c)) return false; // must be [LIJFD] } return true; // [LIJFD]*_[LIJFDV] } - static Class typeClass(char t) { - switch (t) { - case 'I': return int.class; - case 'J': return long.class; - case 'F': return float.class; - case 'D': return double.class; - case 'L': return Object.class; - case 'V': return void.class; - default: assert false; - } - return null; - } static MethodType signatureType(String sig) { Class[] ptypes = new Class[signatureArity(sig)]; for (int i = 0; i < ptypes.length; i++) - ptypes[i] = typeClass(sig.charAt(i)); - Class rtype = typeClass(signatureReturn(sig)); + ptypes[i] = basicType(sig.charAt(i)).btClass; + Class rtype = signatureReturn(sig).btClass; return MethodType.methodType(rtype, ptypes); } @@ -543,21 +668,21 @@ class LambdaForm { assert(mt.parameterCount() == arity-1); for (int i = 0; i < av.length; i++) { Class pt = (i == 0 ? MethodHandle.class : mt.parameterType(i-1)); - assert(valueMatches(sig.charAt(i), pt, av[i])); + assert(valueMatches(basicType(sig.charAt(i)), pt, av[i])); } return true; } - private static boolean valueMatches(char tc, Class type, Object x) { + private static boolean valueMatches(BasicType tc, Class type, Object x) { // The following line is needed because (...)void method handles can use non-void invokers - if (type == void.class) tc = 'V'; // can drop any kind of value + if (type == void.class) tc = V_TYPE; // can drop any kind of value assert tc == basicType(type) : tc + " == basicType(" + type + ")=" + basicType(type); switch (tc) { - case 'I': assert checkInt(type, x) : "checkInt(" + type + "," + x +")"; break; - case 'J': assert x instanceof Long : "instanceof Long: " + x; break; - case 'F': assert x instanceof Float : "instanceof Float: " + x; break; - case 'D': assert x instanceof Double : "instanceof Double: " + x; break; - case 'L': assert checkRef(type, x) : "checkRef(" + type + "," + x + ")"; break; - case 'V': break; // allow anything here; will be dropped + case I_TYPE: assert checkInt(type, x) : "checkInt(" + type + "," + x +")"; break; + case J_TYPE: assert x instanceof Long : "instanceof Long: " + x; break; + case F_TYPE: assert x instanceof Float : "instanceof Float: " + x; break; + case D_TYPE: assert x instanceof Double : "instanceof Double: " + x; break; + case L_TYPE: assert checkRef(type, x) : "checkRef(" + type + "," + x + ")"; break; + case V_TYPE: break; // allow anything here; will be dropped default: assert(false); } return true; @@ -736,7 +861,7 @@ class LambdaForm { * The first parameter to a LambdaForm, a0:L, always represents the form's method handle, so 0 is not * accepted as valid. */ - LambdaForm bindImmediate(int pos, char basicType, Object value) { + LambdaForm bindImmediate(int pos, BasicType basicType, Object value) { // must be an argument, and the types must match assert pos > 0 && pos < arity && names[pos].type == basicType && Name.typesMatch(basicType, value); @@ -782,8 +907,8 @@ class LambdaForm { LambdaForm bind(int namePos, BoundMethodHandle.SpeciesData oldData) { Name name = names[namePos]; - BoundMethodHandle.SpeciesData newData = oldData.extendWithType(name.type); - return bind(name, newData.getterName(names[0], oldData.fieldCount()), oldData, newData); + BoundMethodHandle.SpeciesData newData = oldData.extendWith(name.type); + return bind(name, new Name(newData.getterFunction(oldData.fieldCount()), names[0]), oldData, newData); } LambdaForm bind(Name name, Name binding, BoundMethodHandle.SpeciesData oldData, @@ -874,7 +999,7 @@ class LambdaForm { return false; } - LambdaForm addArguments(int pos, char... types) { + LambdaForm addArguments(int pos, BasicType... types) { assert(pos <= arity); int length = names.length; int inTypes = types.length; @@ -895,13 +1020,10 @@ class LambdaForm { } LambdaForm addArguments(int pos, List> types) { - char[] basicTypes = new char[types.size()]; - for (int i = 0; i < basicTypes.length; i++) - basicTypes[i] = basicType(types.get(i)); - return addArguments(pos, basicTypes); + return addArguments(pos, basicTypes(types)); } - LambdaForm permuteArguments(int skip, int[] reorder, char[] types) { + LambdaForm permuteArguments(int skip, int[] reorder, BasicType[] types) { // Note: When inArg = reorder[outArg], outArg is fed by a copy of inArg. // The types are the types of the new (incoming) arguments. int length = names.length; @@ -960,7 +1082,7 @@ class LambdaForm { return new LambdaForm(debugName, arity2, names2, result2); } - static boolean permutedTypesMatch(int[] reorder, char[] types, Name[] names, int skip) { + static boolean permutedTypesMatch(int[] reorder, BasicType[] types, Name[] names, int skip) { int inTypes = types.length; int outArgs = reorder.length; for (int i = 0; i < outArgs; i++) { @@ -1044,7 +1166,7 @@ class LambdaForm { String sig = m.getName().substring("invoke_".length()); int arity = LambdaForm.signatureArity(sig); MethodType srcType = MethodType.genericMethodType(arity); - if (LambdaForm.signatureReturn(sig) == 'V') + if (LambdaForm.signatureReturn(sig) == V_TYPE) srcType = srcType.changeReturnType(void.class); MethodTypeForm typeForm = srcType.form(); typeForm.namedFunctionInvoker = DirectMethodHandle.make(m); @@ -1134,7 +1256,7 @@ class LambdaForm { MethodHandle mh2 = typeForm.namedFunctionInvoker; if (mh2 != null) return mh2; // benign race if (!mh.type().equals(INVOKER_METHOD_TYPE)) - throw new InternalError(mh.debugString()); + throw newInternalError(mh.debugString()); return typeForm.namedFunctionInvoker = mh; } @@ -1193,11 +1315,6 @@ class LambdaForm { return true; } - String basicTypeSignature() { - //return LambdaForm.basicTypeSignature(resolvedHandle.type()); - return LambdaForm.basicTypeSignature(methodType()); - } - MethodType methodType() { if (resolvedHandle != null) return resolvedHandle.type(); @@ -1224,18 +1341,15 @@ class LambdaForm { return (member == null) ? null : member.getDeclaringClass(); } - char returnType() { + BasicType returnType() { return basicType(methodType().returnType()); } - char parameterType(int n) { + BasicType parameterType(int n) { return basicType(methodType().parameterType(n)); } int arity() { - //int siglen = member.getMethodType().parameterCount(); - //if (!member.isStatic()) siglen += 1; - //return siglen; return methodType().parameterCount(); } @@ -1243,44 +1357,63 @@ class LambdaForm { if (member == null) return String.valueOf(resolvedHandle); return member.getDeclaringClass().getSimpleName()+"."+member.getName(); } - } - void resolve() { - for (Name n : names) n.resolve(); - } - - public static char basicType(Class type) { - char c = Wrapper.basicTypeChar(type); - if ("ZBSC".indexOf(c) >= 0) c = 'I'; - assert("LIJFDV".indexOf(c) >= 0); - return c; - } - public static char[] basicTypes(List> types) { - char[] btypes = new char[types.size()]; - for (int i = 0; i < btypes.length; i++) { - btypes[i] = basicType(types.get(i)); + public boolean isIdentity() { + return this.equals(identity(returnType())); + } + + public boolean isConstantZero() { + return this.equals(constantZero(returnType())); } - return btypes; } + public static String basicTypeSignature(MethodType type) { char[] sig = new char[type.parameterCount() + 2]; int sigp = 0; for (Class pt : type.parameterList()) { - sig[sigp++] = basicType(pt); + sig[sigp++] = basicTypeChar(pt); } sig[sigp++] = '_'; - sig[sigp++] = basicType(type.returnType()); + sig[sigp++] = basicTypeChar(type.returnType()); assert(sigp == sig.length); return String.valueOf(sig); } + public static String shortenSignature(String signature) { + // Hack to make signatures more readable when they show up in method names. + final int NO_CHAR = -1, MIN_RUN = 3; + int c0, c1 = NO_CHAR, c1reps = 0; + StringBuilder buf = null; + int len = signature.length(); + if (len < MIN_RUN) return signature; + for (int i = 0; i <= len; i++) { + // shift in the next char: + c0 = c1; c1 = (i == len ? NO_CHAR : signature.charAt(i)); + if (c1 == c0) { ++c1reps; continue; } + // shift in the next count: + int c0reps = c1reps; c1reps = 1; + // end of a character run + if (c0reps < MIN_RUN) { + if (buf != null) { + while (--c0reps >= 0) + buf.append((char)c0); + } + continue; + } + // found three or more in a row + if (buf == null) + buf = new StringBuilder().append(signature, 0, i - c0reps); + buf.append((char)c0).append(c0reps); + } + return (buf == null) ? signature : buf.toString(); + } static final class Name { - final char type; + final BasicType type; private short index; final NamedFunction function; @Stable final Object[] arguments; - private Name(int index, char type, NamedFunction function, Object[] arguments) { + private Name(int index, BasicType type, NamedFunction function, Object[] arguments) { this.index = (short)index; this.type = type; this.function = function; @@ -1292,7 +1425,7 @@ class LambdaForm { } Name(MethodType functionType, Object... arguments) { this(new NamedFunction(functionType), arguments); - assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == 'L'); + assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == L_TYPE); } Name(MemberName function, Object... arguments) { this(new NamedFunction(function), arguments); @@ -1303,14 +1436,14 @@ class LambdaForm { for (int i = 0; i < arguments.length; i++) assert(typesMatch(function.parameterType(i), arguments[i])) : "types don't match: function.parameterType(" + i + ")=" + function.parameterType(i) + ", arguments[" + i + "]=" + arguments[i] + " in " + debugString(); } - Name(int index, char type) { + /** Create a raw parameter of the given type, with an expected index. */ + Name(int index, BasicType type) { this(index, type, null, null); } - Name(char type) { - this(-1, type); - } + /** Create a raw parameter of the given type. */ + Name(BasicType type) { this(-1, type); } - char type() { return type; } + BasicType type() { return type; } int index() { return index; } boolean initIndex(int i) { if (index != i) { @@ -1319,7 +1452,9 @@ class LambdaForm { } return true; } - + char typeChar() { + return type.btChar; + } void resolve() { if (function != null) @@ -1397,18 +1532,18 @@ class LambdaForm { return function == null; } boolean isConstantZero() { - return !isParam() && arguments.length == 0 && function.equals(constantZero(0, type).function); + return !isParam() && arguments.length == 0 && function.isConstantZero(); } public String toString() { - return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+type; + return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+typeChar(); } public String debugString() { String s = toString(); return (function == null) ? s : s + "=" + exprString(); } public String exprString() { - if (function == null) return "null"; + if (function == null) return toString(); StringBuilder buf = new StringBuilder(function.toString()); buf.append("("); String cma = ""; @@ -1423,17 +1558,17 @@ class LambdaForm { return buf.toString(); } - private static boolean typesMatch(char parameterType, Object object) { + static boolean typesMatch(BasicType parameterType, Object object) { if (object instanceof Name) { return ((Name)object).type == parameterType; } switch (parameterType) { - case 'I': return object instanceof Integer; - case 'J': return object instanceof Long; - case 'F': return object instanceof Float; - case 'D': return object instanceof Double; + case I_TYPE: return object instanceof Integer; + case J_TYPE: return object instanceof Long; + case F_TYPE: return object instanceof Float; + case D_TYPE: return object instanceof Double; } - assert(parameterType == 'L'); + assert(parameterType == L_TYPE); return true; } @@ -1510,7 +1645,7 @@ class LambdaForm { @Override public int hashCode() { if (isParam()) - return index | (type << 8); + return index | (type.ordinal() << 8); return function.hashCode() ^ Arrays.hashCode(arguments); } } @@ -1545,10 +1680,12 @@ class LambdaForm { } static Name argument(int which, char type) { - int tn = ALL_TYPES.indexOf(type); - if (tn < 0 || which >= INTERNED_ARGUMENT_LIMIT) + return argument(which, basicType(type)); + } + static Name argument(int which, BasicType type) { + if (which >= INTERNED_ARGUMENT_LIMIT) return new Name(which, type); - return INTERNED_ARGUMENTS[tn][which]; + return INTERNED_ARGUMENTS[type.ordinal()][which]; } static Name internArgument(Name n) { assert(n.isParam()) : "not param: " + n; @@ -1590,56 +1727,118 @@ class LambdaForm { names[i] = argument(i, basicType(types.parameterType(i))); return names; } - static final String ALL_TYPES = "LIJFD"; // omit V, not an argument type static final int INTERNED_ARGUMENT_LIMIT = 10; private static final Name[][] INTERNED_ARGUMENTS - = new Name[ALL_TYPES.length()][INTERNED_ARGUMENT_LIMIT]; + = new Name[ARG_TYPE_LIMIT][INTERNED_ARGUMENT_LIMIT]; static { - for (int tn = 0; tn < ALL_TYPES.length(); tn++) { - for (int i = 0; i < INTERNED_ARGUMENTS[tn].length; i++) { - char type = ALL_TYPES.charAt(tn); - INTERNED_ARGUMENTS[tn][i] = new Name(i, type); + for (BasicType type : BasicType.ARG_TYPES) { + int ord = type.ordinal(); + for (int i = 0; i < INTERNED_ARGUMENTS[ord].length; i++) { + INTERNED_ARGUMENTS[ord][i] = new Name(i, type); } } } private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory(); - static Name constantZero(int which, char type) { - return CONSTANT_ZERO[ALL_TYPES.indexOf(type)].newIndex(which); + static LambdaForm identityForm(BasicType type) { + return LF_identityForm[type.ordinal()]; } - private static final Name[] CONSTANT_ZERO - = new Name[ALL_TYPES.length()]; - static { - for (int tn = 0; tn < ALL_TYPES.length(); tn++) { - char bt = ALL_TYPES.charAt(tn); - Wrapper wrap = Wrapper.forBasicType(bt); - MemberName zmem = new MemberName(LambdaForm.class, "zero"+bt, MethodType.methodType(wrap.primitiveType()), REF_invokeStatic); + static LambdaForm zeroForm(BasicType type) { + return LF_zeroForm[type.ordinal()]; + } + static NamedFunction identity(BasicType type) { + return NF_identity[type.ordinal()]; + } + static NamedFunction constantZero(BasicType type) { + return NF_zero[type.ordinal()]; + } + private static final LambdaForm[] LF_identityForm = new LambdaForm[TYPE_LIMIT]; + private static final LambdaForm[] LF_zeroForm = new LambdaForm[TYPE_LIMIT]; + private static final NamedFunction[] NF_identity = new NamedFunction[TYPE_LIMIT]; + private static final NamedFunction[] NF_zero = new NamedFunction[TYPE_LIMIT]; + private static void createIdentityForms() { + for (BasicType type : BasicType.ALL_TYPES) { + int ord = type.ordinal(); + char btChar = type.basicTypeChar(); + boolean isVoid = (type == V_TYPE); + Class btClass = type.btClass; + MethodType zeType = MethodType.methodType(btClass); + MethodType idType = isVoid ? zeType : zeType.appendParameterTypes(btClass); + + // Look up some symbolic names. It might not be necessary to have these, + // but if we need to emit direct references to bytecodes, it helps. + // Zero is built from a call to an identity function with a constant zero input. + MemberName idMem = new MemberName(LambdaForm.class, "identity_"+btChar, idType, REF_invokeStatic); + MemberName zeMem = new MemberName(LambdaForm.class, "zero_"+btChar, zeType, REF_invokeStatic); try { - zmem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zmem, null, NoSuchMethodException.class); + zeMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zeMem, null, NoSuchMethodException.class); + idMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, idMem, null, NoSuchMethodException.class); } catch (IllegalAccessException|NoSuchMethodException ex) { throw newInternalError(ex); } - NamedFunction zcon = new NamedFunction(zmem); - Name n = new Name(zcon).newIndex(0); - assert(n.type == ALL_TYPES.charAt(tn)); - CONSTANT_ZERO[tn] = n; - assert(n.isConstantZero()); + + NamedFunction idFun = new NamedFunction(idMem); + LambdaForm idForm; + if (isVoid) { + Name[] idNames = new Name[] { argument(0, L_TYPE) }; + idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT); + } else { + Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) }; + idForm = new LambdaForm(idMem.getName(), 2, idNames, 1); + } + LF_identityForm[ord] = idForm; + NF_identity[ord] = idFun; + + NamedFunction zeFun = new NamedFunction(zeMem); + LambdaForm zeForm; + if (isVoid) { + zeForm = idForm; + } else { + Object zeValue = Wrapper.forBasicType(btChar).zero(); + Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) }; + zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1); + } + LF_zeroForm[ord] = zeForm; + NF_zero[ord] = zeFun; + + assert(idFun.isIdentity()); + assert(zeFun.isConstantZero()); + assert(new Name(zeFun).isConstantZero()); + } + + // Do this in a separate pass, so that SimpleMethodHandle.make can see the tables. + for (BasicType type : BasicType.ALL_TYPES) { + int ord = type.ordinal(); + NamedFunction idFun = NF_identity[ord]; + LambdaForm idForm = LF_identityForm[ord]; + MemberName idMem = idFun.member; + idFun.resolvedHandle = SimpleMethodHandle.make(idMem.getInvocationType(), idForm); + + NamedFunction zeFun = NF_zero[ord]; + LambdaForm zeForm = LF_zeroForm[ord]; + MemberName zeMem = zeFun.member; + zeFun.resolvedHandle = SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm); + + assert(idFun.isIdentity()); + assert(zeFun.isConstantZero()); + assert(new Name(zeFun).isConstantZero()); } } // Avoid appealing to ValueConversions at bootstrap time: - private static int zeroI() { return 0; } - private static long zeroJ() { return 0; } - private static float zeroF() { return 0; } - private static double zeroD() { return 0; } - private static Object zeroL() { return null; } - - // Put this last, so that previous static inits can run before. - static { - if (USE_PREDEFINED_INTERPRET_METHODS) - PREPARED_FORMS.putAll(computeInitialPreparedForms()); - } + private static int identity_I(int x) { return x; } + private static long identity_J(long x) { return x; } + private static float identity_F(float x) { return x; } + private static double identity_D(double x) { return x; } + private static Object identity_L(Object x) { return x; } + private static void identity_V() { return; } // same as zeroV, but that's OK + private static int zero_I() { return 0; } + private static long zero_J() { return 0; } + private static float zero_F() { return 0; } + private static double zero_D() { return 0; } + private static Object zero_L() { return null; } + private static void zero_V() { return; } /** * Internal marker for byte-compiled LambdaForms. @@ -1690,7 +1889,21 @@ class LambdaForm { static final native Object linkToInterface(Object x1, MemberName mn) throws Throwable; */ - static { NamedFunction.initializeInvokers(); } + private static final HashMap DEBUG_NAME_COUNTERS; + static { + if (debugEnabled()) + DEBUG_NAME_COUNTERS = new HashMap<>(); + else + DEBUG_NAME_COUNTERS = null; + } + + // Put this last, so that previous static inits can run before. + static { + createIdentityForms(); + if (USE_PREDEFINED_INTERPRET_METHODS) + PREPARED_FORMS.putAll(computeInitialPreparedForms()); + NamedFunction.initializeInvokers(); + } // The following hack is necessary in order to suppress TRACE_INTERPRETER // during execution of the static initializes of this class. diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java index f142076f528..19664528f26 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java @@ -27,10 +27,12 @@ package java.lang.invoke; import java.util.*; +import java.lang.invoke.LambdaForm.BasicType; import sun.invoke.util.*; import sun.misc.Unsafe; import static java.lang.invoke.MethodHandleStatics.*; +import static java.lang.invoke.LambdaForm.BasicType.*; /** * A method handle is a typed, directly executable reference to an underlying method, @@ -729,7 +731,7 @@ public abstract class MethodHandle { *
  • If the return type T0 is void and T1 a primitive, * a zero value is introduced. * - * (Note: Both T0 and T1 may be regarded as static types, + * (Note: Both T0 and T1 may be regarded as static types, * because neither corresponds specifically to the dynamic type of any * actual argument or return value.) *

    @@ -1374,7 +1376,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString()); } /*non-public*/ - MethodHandle bindArgument(int pos, char basicType, Object value) { + MethodHandle bindArgument(int pos, BasicType basicType, Object value) { // Override this if it can be improved. return rebind().bindArgument(pos, basicType, value); } @@ -1382,26 +1384,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString()); /*non-public*/ MethodHandle bindReceiver(Object receiver) { // Override this if it can be improved. - return bindArgument(0, 'L', receiver); - } - - /*non-public*/ - MethodHandle bindImmediate(int pos, char basicType, Object value) { - // Bind an immediate value to a position in the arguments. - // This means, elide the respective argument, - // and replace all references to it in NamedFunction args with the specified value. - - // CURRENT RESTRICTIONS - // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others) - assert pos == 0 && basicType == 'L' && value instanceof Unsafe; - MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver! - LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos - return copyWith(type2, form2); - } - - /*non-public*/ - MethodHandle copyWith(MethodType mt, LambdaForm lf) { - throw new InternalError("copyWith: " + this.getClass()); + return bindArgument(0, L_TYPE, receiver); } /*non-public*/ diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java index cdf6e5a75ce..6abceb5ad19 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -412,7 +412,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; @Override - MethodHandle bindArgument(int pos, char basicType, Object value) { + MethodHandle bindArgument(int pos, BasicType basicType, Object value) { return asFixedArity().bindArgument(pos, basicType, value); } diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java index fd5cac8cd7b..0f5169e95e2 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java @@ -78,7 +78,7 @@ class MethodHandleNatives { // The JVM calls MethodHandleNatives.. Cascade the calls as needed: MethodHandleImpl.initStatics(); -} + } // All compile-time constants go here. // There is an opportunity to check them against the JVM's idea of them. @@ -293,6 +293,17 @@ class MethodHandleNatives { Class caller = (Class)callerObj; String name = nameObj.toString().intern(); MethodType type = (MethodType)typeObj; + if (!TRACE_METHOD_LINKAGE) + return linkCallSiteImpl(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + return linkCallSiteTracing(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + } + static MemberName linkCallSiteImpl(Class caller, + MethodHandle bootstrapMethod, + String name, MethodType type, + Object staticArguments, + Object[] appendixResult) { CallSite callSite = CallSite.makeSite(bootstrapMethod, name, type, @@ -306,6 +317,30 @@ class MethodHandleNatives { return Invokers.linkToCallSiteMethod(type); } } + // Tracing logic: + static MemberName linkCallSiteTracing(Class caller, + MethodHandle bootstrapMethod, + String name, MethodType type, + Object staticArguments, + Object[] appendixResult) { + Object bsmReference = bootstrapMethod.internalMemberName(); + if (bsmReference == null) bsmReference = bootstrapMethod; + Object staticArglist = (staticArguments instanceof Object[] ? + java.util.Arrays.asList((Object[]) staticArguments) : + staticArguments); + System.out.println("linkCallSite "+caller.getName()+" "+ + bsmReference+" "+ + name+type+"/"+staticArglist); + try { + MemberName res = linkCallSiteImpl(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + System.out.println("linkCallSite => "+res+" + "+appendixResult[0]); + return res; + } catch (Throwable ex) { + System.out.println("linkCallSite => throw "+ex); + throw ex; + } + } /** * The JVM wants a pointer to a MethodType. Oblige it by finding or creating one. diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java index 8a8eedfe1bf..50a14b35d52 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java @@ -65,6 +65,16 @@ import sun.misc.Unsafe; COMPILE_THRESHOLD = (Integer) values[4]; } + /** Tell if any of the debugging switches are turned on. + * If this is the case, it is reasonable to perform extra checks or save extra information. + */ + /*non-public*/ static boolean debugEnabled() { + return (DEBUG_METHOD_HANDLE_NAMES | + DUMP_CLASS_FILES | + TRACE_INTERPRETER | + TRACE_METHOD_LINKAGE); + } + /*non-public*/ static String getNameString(MethodHandle target, MethodType type) { if (type == null) type = target.type(); @@ -93,6 +103,9 @@ import sun.misc.Unsafe; } // handy shared exception makers (they simplify the common case code) + /*non-public*/ static InternalError newInternalError(String message) { + return new InternalError(message); + } /*non-public*/ static InternalError newInternalError(String message, Throwable cause) { return new InternalError(message, cause); } diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java index 834650c84fa..48a937c1998 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java @@ -37,10 +37,11 @@ import sun.reflect.CallerSensitive; import sun.reflect.Reflection; import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; +import java.lang.invoke.LambdaForm.BasicType; +import static java.lang.invoke.LambdaForm.BasicType.*; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleNatives.Constants.*; import java.util.concurrent.ConcurrentHashMap; -import sun.security.util.SecurityConstants; /** * This class consists exclusively of static methods that operate on or return @@ -2189,12 +2190,12 @@ assert((int)twice.invokeExact(21) == 42); Object value = values[i]; Class ptype = oldType.parameterType(pos+i); if (ptype.isPrimitive()) { - char btype = 'I'; + BasicType btype = I_TYPE; Wrapper w = Wrapper.forPrimitiveType(ptype); switch (w) { - case LONG: btype = 'J'; break; - case FLOAT: btype = 'F'; break; - case DOUBLE: btype = 'D'; break; + case LONG: btype = J_TYPE; break; + case FLOAT: btype = F_TYPE; break; + case DOUBLE: btype = D_TYPE; break; } // perform unboxing and/or primitive conversion value = w.convert(value, ptype); @@ -2205,7 +2206,7 @@ assert((int)twice.invokeExact(21) == 42); if (pos == 0) { result = result.bindReceiver(value); } else { - result = result.bindArgument(pos, 'L', value); + result = result.bindArgument(pos, L_TYPE, value); } } return result; diff --git a/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java index 07f08dd6962..752505ee68e 100644 --- a/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java @@ -26,7 +26,7 @@ package java.lang.invoke; import static java.lang.invoke.LambdaForm.*; -import static java.lang.invoke.MethodHandleNatives.Constants.*; +import static java.lang.invoke.LambdaForm.BasicType.*; /** * A method handle whose behavior is determined only by its LambdaForm. @@ -42,7 +42,7 @@ final class SimpleMethodHandle extends MethodHandle { } @Override - MethodHandle bindArgument(int pos, char basicType, Object value) { + MethodHandle bindArgument(int pos, BasicType basicType, Object value) { MethodType type2 = type().dropParameterTypes(pos, pos+1); LambdaForm form2 = internalForm().bind(1+pos, BoundMethodHandle.SpeciesData.EMPTY); return BoundMethodHandle.bindSingle(type2, form2, basicType, value); @@ -59,10 +59,4 @@ final class SimpleMethodHandle extends MethodHandle { LambdaForm form2 = internalForm().permuteArguments(1, reorder, basicTypes(newType.parameterList())); return new SimpleMethodHandle(newType, form2); } - - @Override - MethodHandle copyWith(MethodType mt, LambdaForm lf) { - return new SimpleMethodHandle(mt, lf); - } - } diff --git a/jdk/test/java/lang/invoke/LambdaFormTest.java b/jdk/test/java/lang/invoke/LambdaFormTest.java new file mode 100644 index 00000000000..f078189c5c0 --- /dev/null +++ b/jdk/test/java/lang/invoke/LambdaFormTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2014, 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 + * @summary unit tests for java.lang.invoke.LambdaForm + * @run junit/othervm test.java.lang.invoke.LambdaFormTest + */ +package test.java.lang.invoke; + +import org.junit.Test; +import java.lang.reflect.Method; +import static org.junit.Assert.*; + +public class LambdaFormTest { + static final Method M_shortenSignature; + static { + try { + Class impl = Class.forName("java.lang.invoke.LambdaForm", false, null); + Method m = impl.getDeclaredMethod("shortenSignature", String.class); + m.setAccessible(true); + M_shortenSignature = m; + } catch(Exception e) { + throw new AssertionError(e); + } + } + + public static String shortenSignature(String signature) throws ReflectiveOperationException { + return (String)M_shortenSignature.invoke(null, signature); + } + + @Test + public void testShortenSignature() throws ReflectiveOperationException { + for (String s : new String[] { + // invariant strings: + "L", "LL", "ILL", "LIL", "LLI", "IILL", "ILIL", "ILLI", + // a few mappings: + "LLL=L3", "LLLL=L4", "LLLLLLLLLL=L10", + "IIIDDD=I3D3", "IDDD=ID3", "IIDDD=IID3", "IIID=I3D", "IIIDD=I3DD" + }) { + String s2 = s.substring(s.indexOf('=')+1); + String s1 = s.equals(s2) ? s : s.substring(0, s.length() - s2.length() - 1); + // mix the above cases with before and after reps of Z* + for (int k = -3; k <= 3; k++) { + String beg = (k < 0 ? "ZZZZ".substring(-k) : ""); + String end = (k > 0 ? "ZZZZ".substring(+k) : ""); + String ks1 = beg+s1+end; + String ks2 = shortenSignature(beg)+s2+shortenSignature(end); + String ks3 = shortenSignature(ks1); + assertEquals(ks2, ks3); + } + } + } + + public static void main(String[] args) throws ReflectiveOperationException { + LambdaFormTest test = new LambdaFormTest(); + test.testShortenSignature(); + } +} From ae28b717f4a216c9db76ba3df1404d5896b58bc3 Mon Sep 17 00:00:00 2001 From: Albert Noll Date: Thu, 8 May 2014 12:49:21 +0200 Subject: [PATCH 006/185] 8042431: compiler/7200264/TestIntVect.java fails with: Test Failed: AddVI 0 < 4 Define a new function that determines the minimum number of compiler threads for a particular platform/configuration. Reviewed-by: kvn --- hotspot/src/share/vm/runtime/arguments.cpp | 34 ++++++++++++++++++++-- hotspot/src/share/vm/runtime/arguments.hpp | 1 + 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index d146785b53b..9fb4c5ba34b 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1151,6 +1151,32 @@ void Arguments::set_tiered_flags() { } } +/** + * Returns the minimum number of compiler threads needed to run the JVM. The following + * configurations are possible. + * + * 1) The JVM is build using an interpreter only. As a result, the minimum number of + * compiler threads is 0. + * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As + * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1. + * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However, + * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only + * C1 can be used, so the minimum number of compiler threads is 1. + * 4) The JVM is build using the compilers and tiered compilation is enabled. The option + * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result, + * the minimum number of compiler threads is 2. + */ +int Arguments::get_min_number_of_compiler_threads() { +#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) + return 0; // case 1 +#else + if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) { + return 1; // case 2 or case 3 + } + return 2; // case 4 (tiered) +#endif +} + #if INCLUDE_ALL_GCS static void disable_adaptive_size_policy(const char* collector_name) { if (UseAdaptiveSizePolicy) { @@ -2398,9 +2424,11 @@ bool Arguments::check_vm_args_consistency() { status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength"); status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize"); - // TieredCompilation needs at least 2 compiler threads. - const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : CI_COMPILER_COUNT; - status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount"); + int min_number_of_compiler_threads = get_min_number_of_compiler_threads(); + // The default CICompilerCount's value is CI_COMPILER_COUNT. + assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number"); + // Check the minimum number of compiler threads + status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount"); if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index f898c24b22d..903fcd5db85 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -323,6 +323,7 @@ class Arguments : AllStatic { // Tiered static void set_tiered_flags(); + static int get_min_number_of_compiler_threads(); // CMS/ParNew garbage collectors static void set_parnew_gc_flags(); static void set_cms_and_parnew_gc_flags(); From d2af4e35ec7bc7439942a1218ad68c012b335673 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Fri, 9 May 2014 09:12:39 +0200 Subject: [PATCH 007/185] 8029343: CodeCache::allocate increments '_number_of_blobs' even if allocation fails Incrementing the number of code blobs in CodeCache::allocate(...) is now only performed if allocation succeeds. The guarantee is fixed. Reviewed-by: kvn, iveresov --- hotspot/src/share/vm/code/codeCache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp index b3a857c2062..a2e8f0e0f15 100644 --- a/hotspot/src/share/vm/code/codeCache.cpp +++ b/hotspot/src/share/vm/code/codeCache.cpp @@ -178,10 +178,12 @@ CodeBlob* CodeCache::allocate(int size, bool is_critical) { // cache will contain a garbage CodeBlob until the caller can // run the constructor for the CodeBlob subclass he is busy // instantiating. - guarantee(size >= 0, "allocation request must be reasonable"); assert_locked_or_safepoint(CodeCache_lock); + assert(size > 0, "allocation request must be reasonable"); + if (size <= 0) { + return NULL; + } CodeBlob* cb = NULL; - _number_of_blobs++; while (true) { cb = (CodeBlob*)_heap->allocate(size, is_critical); if (cb != NULL) break; @@ -199,6 +201,7 @@ CodeBlob* CodeCache::allocate(int size, bool is_critical) { maxCodeCacheUsed = MAX2(maxCodeCacheUsed, ((address)_heap->high_boundary() - (address)_heap->low_boundary()) - unallocated_capacity()); print_trace("allocation", cb, size); + _number_of_blobs++; return cb; } From 5938d3d5b90eac7a257d638c3f91c33244500d3f Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 13 May 2014 11:25:17 +0200 Subject: [PATCH 008/185] 8021770: BackEdgeThreshold option is no longer used and should be removed The BackEdgeThreshold option is removed because it is no longer used. Reviewed-by: twisti, kvn, cjplummer --- hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp | 1 - hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp | 1 - hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp | 1 - hotspot/src/cpu/x86/vm/c1_globals_x86.hpp | 1 - hotspot/src/cpu/x86/vm/c2_globals_x86.hpp | 1 - hotspot/src/cpu/zero/vm/shark_globals_zero.hpp | 1 - hotspot/src/share/vm/runtime/arguments.cpp | 1 + hotspot/src/share/vm/runtime/globals.hpp | 5 ----- 8 files changed, 1 insertion(+), 11 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp index 58e4f3887cb..cfa7559c42a 100644 --- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp @@ -41,7 +41,6 @@ define_pd_global(bool, UseOnStackReplacement, true); define_pd_global(bool, ProfileInterpreter, true); define_pd_global(bool, TieredCompilation, false); define_pd_global(intx, CompileThreshold, 10000); -define_pd_global(intx, BackEdgeThreshold, 140000); define_pd_global(intx, OnStackReplacePercentage, 140); define_pd_global(intx, ConditionalMoveLimit, 3); diff --git a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp index 111f22730d3..54e35cb94d9 100644 --- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp @@ -40,7 +40,6 @@ define_pd_global(bool, ProfileTraps, false); define_pd_global(bool, UseOnStackReplacement, true ); define_pd_global(bool, TieredCompilation, false); define_pd_global(intx, CompileThreshold, 1000 ); // Design center runs on 1.3.1 -define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, OnStackReplacePercentage, 1400 ); define_pd_global(bool, UseTLAB, true ); diff --git a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp index 10005a76b89..3969f39ecf8 100644 --- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp @@ -44,7 +44,6 @@ define_pd_global(bool, ProfileInterpreter, true); #endif // CC_INTERP define_pd_global(bool, TieredCompilation, trueInTiered); define_pd_global(intx, CompileThreshold, 10000); -define_pd_global(intx, BackEdgeThreshold, 140000); define_pd_global(intx, OnStackReplacePercentage, 140); define_pd_global(intx, ConditionalMoveLimit, 4); diff --git a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp index 742a5d8601d..fb7cb2889be 100644 --- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp @@ -41,7 +41,6 @@ define_pd_global(bool, ProfileTraps, false); define_pd_global(bool, UseOnStackReplacement, true ); define_pd_global(bool, TieredCompilation, false); define_pd_global(intx, CompileThreshold, 1500 ); -define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, OnStackReplacePercentage, 933 ); define_pd_global(intx, FreqInlineSize, 325 ); diff --git a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp index 880d9439462..0366d8fcf49 100644 --- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp @@ -45,7 +45,6 @@ define_pd_global(bool, ProfileInterpreter, true); #endif // CC_INTERP define_pd_global(bool, TieredCompilation, trueInTiered); define_pd_global(intx, CompileThreshold, 10000); -define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, OnStackReplacePercentage, 140); define_pd_global(intx, ConditionalMoveLimit, 3); diff --git a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp index edb7364c80f..b86cb79dd86 100644 --- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp @@ -43,7 +43,6 @@ define_pd_global(intx, Tier2CompileThreshold, 1500); define_pd_global(intx, Tier3CompileThreshold, 2500); define_pd_global(intx, Tier4CompileThreshold, 4500); -define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, Tier2BackEdgeThreshold, 100000); define_pd_global(intx, Tier3BackEdgeThreshold, 100000); define_pd_global(intx, Tier4BackEdgeThreshold, 100000); diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index da1ed40c534..8960f7e63ef 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -310,6 +310,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = { { "UseBoundThreads", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "DefaultThreadPriority", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "NoYieldsInMicrolock", JDK_Version::jdk(9), JDK_Version::jdk(10) }, + { "BackEdgeThreshold", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { NULL, JDK_Version(0), JDK_Version(0) } }; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index b2f622e3c91..df3d941ec0d 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -177,7 +177,6 @@ define_pd_global(bool, ProfileTraps, false); define_pd_global(bool, TieredCompilation, false); define_pd_global(intx, CompileThreshold, 0); -define_pd_global(intx, BackEdgeThreshold, 0); define_pd_global(intx, OnStackReplacePercentage, 0); define_pd_global(bool, ResizeTLAB, false); @@ -3525,10 +3524,6 @@ class CommandLineFlags { product_pd(intx, CompileThreshold, \ "number of interpreted method invocations before (re-)compiling") \ \ - product_pd(intx, BackEdgeThreshold, \ - "Interpreter Back edge threshold at which an OSR compilation is " \ - "invoked") \ - \ product(intx, Tier0InvokeNotifyFreqLog, 7, \ "Interpreter (tier 0) invocation notification frequency") \ \ From 54db2c2d612c573f91f69b7b387b43a8e1c9d563 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Tue, 13 May 2014 11:32:10 -0700 Subject: [PATCH 009/185] 8032463: VirtualDispatch test timeout with DeoptimizeALot Introduce code aging for warm method detection Reviewed-by: kvn, twisti --- .../src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp | 1 + .../src/cpu/sparc/vm/c1_Runtime1_sparc.cpp | 2 +- hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp | 1 + hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp | 5 +- hotspot/src/share/vm/c1/c1_CodeStubs.hpp | 4 +- hotspot/src/share/vm/c1/c1_Compilation.hpp | 4 + hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 26 +++- hotspot/src/share/vm/c1/c1_LIRGenerator.hpp | 2 +- hotspot/src/share/vm/c1/c1_Runtime1.cpp | 23 +++- hotspot/src/share/vm/c1/c1_Runtime1.hpp | 2 +- hotspot/src/share/vm/ci/ciMethod.cpp | 9 ++ hotspot/src/share/vm/ci/ciMethod.hpp | 5 + hotspot/src/share/vm/oops/method.hpp | 7 ++ hotspot/src/share/vm/oops/methodCounters.cpp | 1 + hotspot/src/share/vm/oops/methodCounters.hpp | 34 +++++- hotspot/src/share/vm/oops/methodData.cpp | 1 + hotspot/src/share/vm/oops/methodData.hpp | 7 ++ hotspot/src/share/vm/opto/compile.cpp | 1 + hotspot/src/share/vm/opto/compile.hpp | 5 +- hotspot/src/share/vm/opto/parse.hpp | 1 + hotspot/src/share/vm/opto/parse1.cpp | 28 +++++ .../src/share/vm/runtime/deoptimization.cpp | 49 ++++---- .../src/share/vm/runtime/deoptimization.hpp | 3 +- hotspot/src/share/vm/runtime/globals.hpp | 14 +++ hotspot/src/share/vm/runtime/sweeper.cpp | 114 +++++++++++++----- hotspot/src/share/vm/runtime/sweeper.hpp | 1 + hotspot/src/share/vm/runtime/vmStructs.cpp | 2 + 27 files changed, 283 insertions(+), 69 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp index 8584037f1ca..f3709eb8d05 100644 --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @@ -414,6 +414,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { void DeoptimizeStub::emit_code(LIR_Assembler* ce) { __ bind(_entry); + __ set(_trap_request, G4); __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type); __ delayed()->nop(); ce->add_call_info_here(_info); diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp index 0b065201261..1eeca870804 100644 --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @@ -781,7 +781,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { { __ set_info("deoptimize", dont_gc_arguments); OopMap* oop_map = save_live_registers(sasm); - int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize)); + int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), G4); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); restore_live_registers(sasm); diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp index a6e7731bdd5..718c82904f0 100644 --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp @@ -430,6 +430,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) { void DeoptimizeStub::emit_code(LIR_Assembler* ce) { __ bind(_entry); + ce->store_parameter(_trap_request, 0); __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::deoptimize_id))); ce->add_call_info_here(_info); DEBUG_ONLY(__ should_not_reach_here()); diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp index fd6302d21be..580964a7cd9 100644 --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -1468,9 +1468,10 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { case deoptimize_id: { StubFrame f(sasm, "deoptimize", dont_gc_arguments); - const int num_rt_args = 1; // thread + const int num_rt_args = 2; // thread, trap_request OopMap* oop_map = save_live_registers(sasm, num_rt_args); - int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize)); + f.load_argument(0, rax); + int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), rax); oop_maps = new OopMapSet(); oop_maps->add_gc_map(call_offset, oop_map); restore_live_registers(sasm); diff --git a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp index d3c5a0d8bbb..2d0c31e2afe 100644 --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp @@ -450,9 +450,11 @@ class PatchingStub: public CodeStub { class DeoptimizeStub : public CodeStub { private: CodeEmitInfo* _info; + jint _trap_request; public: - DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {} + DeoptimizeStub(CodeEmitInfo* info, Deoptimization::DeoptReason reason, Deoptimization::DeoptAction action) : + _info(new CodeEmitInfo(info)), _trap_request(Deoptimization::make_trap_request(reason, action)) {} virtual void emit_code(LIR_Assembler* e); virtual CodeEmitInfo* info() const { return _info; } diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp index 8ff7f3e50c3..6ecd26477e0 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp @@ -251,6 +251,10 @@ class Compilation: public StackObj { return env()->comp_level() == CompLevel_full_profile && C1UpdateMethodData && MethodData::profile_return(); } + bool age_code() const { + return _method->profile_aging(); + } + // will compilation make optimistic assumptions that might lead to // deoptimization and that the runtime will account for? bool is_optimistic() const { diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 14bc1993ff6..4e4caaa26cb 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2782,7 +2782,10 @@ void LIRGenerator::do_Base(Base* x) { __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL); } } - + if (compilation()->age_code()) { + CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, 0), NULL, false); + decrement_age(info); + } // increment invocation counters if needed if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting. profile_parameters(x); @@ -3328,6 +3331,27 @@ void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool bac increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true); } +void LIRGenerator::decrement_age(CodeEmitInfo* info) { + ciMethod* method = info->scope()->method(); + MethodCounters* mc_adr = method->ensure_method_counters(); + if (mc_adr != NULL) { + LIR_Opr mc = new_pointer_register(); + __ move(LIR_OprFact::intptrConst(mc_adr), mc); + int offset = in_bytes(MethodCounters::nmethod_age_offset()); + LIR_Address* counter = new LIR_Address(mc, offset, T_INT); + LIR_Opr result = new_register(T_INT); + __ load(counter, result); + __ sub(result, LIR_OprFact::intConst(1), result); + __ store(result, counter); + // DeoptimizeStub will reexecute from the current state in code info. + CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured, + Deoptimization::Action_make_not_entrant); + __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0)); + __ branch(lir_cond_lessEqual, T_INT, deopt); + } +} + + void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info, ciMethod *method, int frequency, int bci, bool backedge, bool notify) { diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp index 90b278f4356..13446a9ebe9 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp @@ -372,7 +372,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { increment_event_counter(info, bci, true); } } - + void decrement_age(CodeEmitInfo* info); CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false); CodeEmitInfo* state_for(Instruction* x); diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 9942e44b842..1bafb67f69c 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -685,19 +685,32 @@ JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock)) JRT_END // Cf. OptoRuntime::deoptimize_caller_frame -JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread)) +JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request)) // Called from within the owner thread, so no need for safepoint RegisterMap reg_map(thread, false); frame stub_frame = thread->last_frame(); - assert(stub_frame.is_runtime_frame(), "sanity check"); + assert(stub_frame.is_runtime_frame(), "Sanity check"); frame caller_frame = stub_frame.sender(®_map); + nmethod* nm = caller_frame.cb()->as_nmethod_or_null(); + assert(nm != NULL, "Sanity check"); + methodHandle method(thread, nm->method()); + assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same"); + Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request); + Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request); - // We are coming from a compiled method; check this is true. - assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity"); + if (action == Deoptimization::Action_make_not_entrant) { + if (nm->make_not_entrant()) { + if (reason == Deoptimization::Reason_tenured) { + MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/); + if (trap_mdo != NULL) { + trap_mdo->inc_tenure_traps(); + } + } + } + } // Deoptimize the caller frame. Deoptimization::deoptimize_frame(thread, caller_frame.id()); - // Return to the now deoptimized frame. JRT_END diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.hpp b/hotspot/src/share/vm/c1/c1_Runtime1.hpp index 276ca44ffbe..9d72a45c891 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp @@ -156,7 +156,7 @@ class Runtime1: public AllStatic { static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock); static void monitorexit (JavaThread* thread, BasicObjectLock* lock); - static void deoptimize(JavaThread* thread); + static void deoptimize(JavaThread* thread, jint trap_request); static int access_field_patching(JavaThread* thread); static int move_klass_patching(JavaThread* thread); diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp index dbbbb7fabc8..2e4ef93a946 100644 --- a/hotspot/src/share/vm/ci/ciMethod.cpp +++ b/hotspot/src/share/vm/ci/ciMethod.cpp @@ -129,6 +129,7 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) { constantPoolHandle cpool = h_m()->constants(); _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol); _method_data = NULL; + _nmethod_age = h_m()->nmethod_age(); // Take a snapshot of these values, so they will be commensurate with the MDO. if (ProfileInterpreter || TieredCompilation) { int invcnt = h_m()->interpreter_invocation_count(); @@ -1275,6 +1276,14 @@ bool ciMethod::check_call(int refinfo_index, bool is_static) const { return false; } +// ------------------------------------------------------------------ +// ciMethod::profile_aging +// +// Should the method be compiled with an age counter? +bool ciMethod::profile_aging() const { + return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) && + !MethodCounters::is_nmethod_age_unset(nmethod_age())); +} // ------------------------------------------------------------------ // ciMethod::print_codes // diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index e061ea463e5..2b9cf376991 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -68,6 +68,7 @@ class ciMethod : public ciMetadata { int _max_locals; vmIntrinsics::ID _intrinsic_id; int _handler_count; + int _nmethod_age; int _interpreter_invocation_count; int _interpreter_throwout_count; int _instructions_size; @@ -168,6 +169,10 @@ class ciMethod : public ciMetadata { int interpreter_invocation_count() const { check_is_loaded(); return _interpreter_invocation_count; } int interpreter_throwout_count() const { check_is_loaded(); return _interpreter_throwout_count; } int size_of_parameters() const { check_is_loaded(); return _size_of_parameters; } + int nmethod_age() const { check_is_loaded(); return _nmethod_age; } + + // Should the method be compiled with an age counter? + bool profile_aging() const; // Code size for inlining decisions. int code_size_for_inlining(); diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index 7d5afaec0b8..3bae50ce712 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -371,6 +371,13 @@ class Method : public Metadata { } } #endif + int nmethod_age() const { + if (method_counters() == NULL) { + return INT_MAX; + } else { + return method_counters()->nmethod_age(); + } + } int invocation_count(); int backedge_count(); diff --git a/hotspot/src/share/vm/oops/methodCounters.cpp b/hotspot/src/share/vm/oops/methodCounters.cpp index 1ee8eb17001..91b05a7bcc8 100644 --- a/hotspot/src/share/vm/oops/methodCounters.cpp +++ b/hotspot/src/share/vm/oops/methodCounters.cpp @@ -34,4 +34,5 @@ void MethodCounters::clear_counters() { backedge_counter()->reset(); set_interpreter_throwout_count(0); set_interpreter_invocation_count(0); + set_nmethod_age(INT_MAX); } diff --git a/hotspot/src/share/vm/oops/methodCounters.hpp b/hotspot/src/share/vm/oops/methodCounters.hpp index 0a6c895b328..75b8c9e6e16 100644 --- a/hotspot/src/share/vm/oops/methodCounters.hpp +++ b/hotspot/src/share/vm/oops/methodCounters.hpp @@ -36,6 +36,15 @@ class MethodCounters: public MetaspaceObj { u2 _number_of_breakpoints; // fullspeed debugging support InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations + // NMethod age is a counter for warm methods detection in the code cache sweeper. + // The counter is reset by the sweeper and is decremented by some of the compiled + // code. The counter values are interpreted as follows: + // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted + // 2. (1..HotMethodDetectionLimit) - the method is warm, the counter is used + // to figure out which methods can be flushed. + // 3. (INT_MIN..0] - method is hot and will deopt and get + // recompiled without the counters + int _nmethod_age; #ifdef TIERED float _rate; // Events (invocation and backedge counter increments) per millisecond @@ -44,7 +53,8 @@ class MethodCounters: public MetaspaceObj { MethodCounters() : _interpreter_invocation_count(0), _interpreter_throwout_count(0), - _number_of_breakpoints(0) + _number_of_breakpoints(0), + _nmethod_age(INT_MAX) #ifdef TIERED , _rate(0), _prev_time(0) @@ -52,6 +62,10 @@ class MethodCounters: public MetaspaceObj { { invocation_counter()->init(); backedge_counter()->init(); + + if (StressCodeAging) { + set_nmethod_age(HotMethodDetectionLimit); + } } public: @@ -104,6 +118,24 @@ class MethodCounters: public MetaspaceObj { InvocationCounter* invocation_counter() { return &_invocation_counter; } InvocationCounter* backedge_counter() { return &_backedge_counter; } + int nmethod_age() { + return _nmethod_age; + } + void set_nmethod_age(int age) { + _nmethod_age = age; + } + void reset_nmethod_age() { + set_nmethod_age(HotMethodDetectionLimit); + } + + static bool is_nmethod_hot(int age) { return age <= 0; } + static bool is_nmethod_warm(int age) { return age < HotMethodDetectionLimit; } + static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; } + + static ByteSize nmethod_age_offset() { + return byte_offset_of(MethodCounters, _nmethod_age); + } + static ByteSize interpreter_invocation_counter_offset() { return byte_offset_of(MethodCounters, _interpreter_invocation_count); } diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp index 4bbdc992d86..2975462fbbf 100644 --- a/hotspot/src/share/vm/oops/methodData.cpp +++ b/hotspot/src/share/vm/oops/methodData.cpp @@ -1130,6 +1130,7 @@ void MethodData::init() { _backedge_counter.init(); _invocation_counter_start = 0; _backedge_counter_start = 0; + _tenure_traps = 0; _num_loops = 0; _num_blocks = 0; _highest_comp_level = 0; diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp index efd05cb5ade..32a48a97a5a 100644 --- a/hotspot/src/share/vm/oops/methodData.hpp +++ b/hotspot/src/share/vm/oops/methodData.hpp @@ -2059,6 +2059,7 @@ private: // Counter values at the time profiling started. int _invocation_counter_start; int _backedge_counter_start; + uint _tenure_traps; #if INCLUDE_RTM_OPT // State of RTM code generation during compilation of the method @@ -2398,6 +2399,12 @@ public: method()->set_not_compilable(CompLevel_full_optimization, true, "decompile_count > PerMethodRecompilationCutoff"); } } + uint tenure_traps() const { + return _tenure_traps; + } + void inc_tenure_traps() { + _tenure_traps += 1; + } // Return pointer to area dedicated to parameters in MDO ParametersTypeData* parameters_type_data() const { diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 738644001b1..3a00ae2f829 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -1089,6 +1089,7 @@ void Compile::Init(int aliaslevel) { set_do_scheduling(OptoScheduling); set_do_count_invocations(false); set_do_method_data_update(false); + set_age_code(has_method() && method()->profile_aging()); set_rtm_state(NoRTM); // No RTM lock eliding by default #if INCLUDE_RTM_OPT if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) { diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index aa4a5720502..a875259b823 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -311,6 +311,7 @@ class Compile : public Phase { bool _do_freq_based_layout; // True if we intend to do frequency based block layout bool _do_count_invocations; // True if we generate code to count invocations bool _do_method_data_update; // True if we generate code to update MethodData*s + bool _age_code; // True if we need to profile code age (decrement the aging counter) int _AliasLevel; // Locally-adjusted version of AliasLevel flag. bool _print_assembly; // True if we should dump assembly code for this compilation bool _print_inlining; // True if we should print inlining for this compilation @@ -584,7 +585,9 @@ class Compile : public Phase { void set_do_count_invocations(bool z){ _do_count_invocations = z; } bool do_method_data_update() const { return _do_method_data_update; } void set_do_method_data_update(bool z) { _do_method_data_update = z; } - int AliasLevel() const { return _AliasLevel; } + bool age_code() const { return _age_code; } + void set_age_code(bool z) { _age_code = z; } + int AliasLevel() const { return _AliasLevel; } bool print_assembly() const { return _print_assembly; } void set_print_assembly(bool z) { _print_assembly = z; } bool print_inlining() const { return _print_inlining; } diff --git a/hotspot/src/share/vm/opto/parse.hpp b/hotspot/src/share/vm/opto/parse.hpp index aae634a9563..e810c9d4d58 100644 --- a/hotspot/src/share/vm/opto/parse.hpp +++ b/hotspot/src/share/vm/opto/parse.hpp @@ -581,6 +581,7 @@ class Parse : public GraphKit { void jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0); bool create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi); + void decrement_age(); // helper functions for methodData style profiling void test_counter_against_threshold(Node* cnt, int limit); void increment_and_test_invocation_counter(int limit); diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index d7c7a40bc50..6fea7130786 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -568,6 +568,9 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses, Pars } else { set_map(entry_map); do_method_entry(); + if (depth() == 1 && C->age_code()) { + decrement_age(); + } } if (depth() == 1) { // Add check to deoptimize the nmethod if RTM state was changed @@ -2048,6 +2051,31 @@ void Parse::rtm_deopt() { #endif } +void Parse::decrement_age() { + MethodCounters* mc = method()->ensure_method_counters(); + if (mc == NULL) { + C->record_failure("Must have MCs"); + return; + } + assert(!is_osr_parse(), "Not doing this for OSRs"); + + // Set starting bci for uncommon trap. + set_parse_bci(0); + + const TypePtr* adr_type = TypeRawPtr::make((address)mc); + Node* mc_adr = makecon(adr_type); + Node* cnt_adr = basic_plus_adr(mc_adr, mc_adr, in_bytes(MethodCounters::nmethod_age_offset())); + Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered); + Node* decr = _gvn.transform(new (C) SubINode(cnt, makecon(TypeInt::ONE))); + store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered); + Node *chk = _gvn.transform(new (C) CmpINode(decr, makecon(TypeInt::ZERO))); + Node* tst = _gvn.transform(new (C) BoolNode(chk, BoolTest::gt)); + { BuildCutout unless(this, tst, PROB_ALWAYS); + uncommon_trap(Deoptimization::Reason_tenured, + Deoptimization::Action_make_not_entrant); + } +} + //------------------------------return_current--------------------------------- // Append current _map to _exit_return void Parse::return_current(Node* value) { diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index 1ec4e3b12f8..eec441873c3 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -744,6 +744,8 @@ int Deoptimization::deoptimize_dependents() { return 0; } +Deoptimization::DeoptAction Deoptimization::_unloaded_action + = Deoptimization::Action_reinterpret; #ifdef COMPILER2 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray* objects, TRAPS) { @@ -1185,6 +1187,23 @@ JRT_LEAF(void, Deoptimization::popframe_preserve_args(JavaThread* thread, int by } JRT_END +MethodData* +Deoptimization::get_method_data(JavaThread* thread, methodHandle m, + bool create_if_missing) { + Thread* THREAD = thread; + MethodData* mdo = m()->method_data(); + if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) { + // Build an MDO. Ignore errors like OutOfMemory; + // that simply means we won't have an MDO to update. + Method::build_interpreter_method_data(m, THREAD); + if (HAS_PENDING_EXCEPTION) { + assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); + CLEAR_PENDING_EXCEPTION; + } + mdo = m()->method_data(); + } + return mdo; +} #if defined(COMPILER2) || defined(SHARK) void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) { @@ -1285,7 +1304,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra // Ensure that we can record deopt. history: // Need MDO to record RTM code generation state. - bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking ); + bool create_if_missing = ProfileTraps || UseCodeAging RTM_OPT_ONLY( || UseRTMLocking ); MethodData* trap_mdo = get_method_data(thread, trap_method, create_if_missing); @@ -1421,7 +1440,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra // // The other actions cause immediate removal of the present code. - bool update_trap_state = true; + bool update_trap_state = (reason != Reason_tenured); bool make_not_entrant = false; bool make_not_compilable = false; bool reprofile = false; @@ -1548,7 +1567,6 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra if (make_not_entrant && maybe_prior_recompile && maybe_prior_trap) { reprofile = true; } - } // Take requested actions on the method: @@ -1577,6 +1595,11 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra trap_mdo->atomic_set_rtm_state(ProfileRTM); } #endif + // For code aging we count traps separately here, using make_not_entrant() + // as a guard against simultaneous deopts in multiple threads. + if (reason == Reason_tenured && trap_mdo != NULL) { + trap_mdo->inc_tenure_traps(); + } } if (inc_recompile_count) { @@ -1609,24 +1632,6 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra } JRT_END -MethodData* -Deoptimization::get_method_data(JavaThread* thread, methodHandle m, - bool create_if_missing) { - Thread* THREAD = thread; - MethodData* mdo = m()->method_data(); - if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) { - // Build an MDO. Ignore errors like OutOfMemory; - // that simply means we won't have an MDO to update. - Method::build_interpreter_method_data(m, THREAD); - if (HAS_PENDING_EXCEPTION) { - assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); - CLEAR_PENDING_EXCEPTION; - } - mdo = m()->method_data(); - } - return mdo; -} - ProfileData* Deoptimization::query_update_method_data(MethodData* trap_mdo, int trap_bci, @@ -1813,8 +1818,6 @@ const char* Deoptimization::format_trap_state(char* buf, size_t buflen, //--------------------------------statics-------------------------------------- -Deoptimization::DeoptAction Deoptimization::_unloaded_action - = Deoptimization::Action_reinterpret; const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = { // Note: Keep this in sync. with enum DeoptReason. "none", diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp index eb8e2cbdede..d0af1823248 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.hpp +++ b/hotspot/src/share/vm/runtime/deoptimization.hpp @@ -62,6 +62,7 @@ class Deoptimization : AllStatic { Reason_speculate_class_check, // saw unexpected object class from type speculation Reason_speculate_null_check, // saw unexpected null from type speculation Reason_rtm_state_change, // rtm state change detected + Reason_tenured, // age of the code has reached the limit Reason_LIMIT, // Note: Keep this enum in sync. with _trap_reason_name. Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc @@ -357,8 +358,8 @@ class Deoptimization : AllStatic { // returning to a deoptimized caller static void popframe_preserve_args(JavaThread* thread, int bytes_to_save, void* start_address); - private: static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing); + private: // Update the mdo's count and per-BCI reason bits, returning previous state: static ProfileData* query_update_method_data(MethodData* trap_mdo, int trap_bci, diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index df3d941ec0d..aab516a55d9 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2561,6 +2561,20 @@ class CommandLineFlags { diagnostic(bool, PrintMethodFlushingStatistics, false, \ "print statistics about method flushing") \ \ + diagnostic(intx, HotMethodDetectionLimit, 100000, \ + "Number of compiled code invocations after which " \ + "the method is considered as hot by the flusher") \ + \ + diagnostic(intx, MinPassesBeforeFlush, 10, \ + "Minimum number of sweeper passes before an nmethod " \ + "can be flushed") \ + \ + product(bool, UseCodeAging, true, \ + "Insert counter to detect warm methods") \ + \ + diagnostic(bool, StressCodeAging, false, \ + "Start with counters compiled in") \ + \ develop(bool, UseRelocIndex, false, \ "Use an index to speed random access to relocations") \ \ diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp index 4eba81debe6..99047609fdc 100644 --- a/hotspot/src/share/vm/runtime/sweeper.cpp +++ b/hotspot/src/share/vm/runtime/sweeper.cpp @@ -573,37 +573,7 @@ int NMethodSweeper::process_nmethod(nmethod *nm) { SWEEP(nm); } } else { - if (UseCodeCacheFlushing) { - if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) { - // Do not make native methods and OSR-methods not-entrant - nm->dec_hotness_counter(); - // Get the initial value of the hotness counter. This value depends on the - // ReservedCodeCacheSize - int reset_val = hotness_counter_reset_val(); - int time_since_reset = reset_val - nm->hotness_counter(); - double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity); - // The less free space in the code cache we have - the bigger reverse_free_ratio() is. - // I.e., 'threshold' increases with lower available space in the code cache and a higher - // NmethodSweepActivity. If the current hotness counter - which decreases from its initial - // value until it is reset by stack walking - is smaller than the computed threshold, the - // corresponding nmethod is considered for removal. - if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > 10)) { - // A method is marked as not-entrant if the method is - // 1) 'old enough': nm->hotness_counter() < threshold - // 2) The method was in_use for a minimum amount of time: (time_since_reset > 10) - // The second condition is necessary if we are dealing with very small code cache - // sizes (e.g., <10m) and the code cache size is too small to hold all hot methods. - // The second condition ensures that methods are not immediately made not-entrant - // after compilation. - nm->make_not_entrant(); - // Code cache state change is tracked in make_not_entrant() - if (PrintMethodFlushing && Verbose) { - tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f", - nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold); - } - } - } - } + possibly_flush(nm); // Clean-up all inline caches that point to zombie/non-reentrant methods MutexLocker cl(CompiledIC_lock); nm->cleanup_inline_caches(); @@ -612,6 +582,88 @@ int NMethodSweeper::process_nmethod(nmethod *nm) { return freed_memory; } + +void NMethodSweeper::possibly_flush(nmethod* nm) { + if (UseCodeCacheFlushing) { + if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) { + bool make_not_entrant = false; + + // Do not make native methods and OSR-methods not-entrant + nm->dec_hotness_counter(); + // Get the initial value of the hotness counter. This value depends on the + // ReservedCodeCacheSize + int reset_val = hotness_counter_reset_val(); + int time_since_reset = reset_val - nm->hotness_counter(); + double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity); + // The less free space in the code cache we have - the bigger reverse_free_ratio() is. + // I.e., 'threshold' increases with lower available space in the code cache and a higher + // NmethodSweepActivity. If the current hotness counter - which decreases from its initial + // value until it is reset by stack walking - is smaller than the computed threshold, the + // corresponding nmethod is considered for removal. + if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > MinPassesBeforeFlush)) { + // A method is marked as not-entrant if the method is + // 1) 'old enough': nm->hotness_counter() < threshold + // 2) The method was in_use for a minimum amount of time: (time_since_reset > MinPassesBeforeFlush) + // The second condition is necessary if we are dealing with very small code cache + // sizes (e.g., <10m) and the code cache size is too small to hold all hot methods. + // The second condition ensures that methods are not immediately made not-entrant + // after compilation. + make_not_entrant = true; + } + + // The stack-scanning low-cost detection may not see the method was used (which can happen for + // flat profiles). Check the age counter for possible data. + if (UseCodeAging && make_not_entrant && (nm->is_compiled_by_c2() || nm->is_compiled_by_c1())) { + MethodCounters* mc = nm->method()->method_counters(); + if (mc != NULL) { + // Snapshot the value as it's changed concurrently + int age = mc->nmethod_age(); + if (MethodCounters::is_nmethod_hot(age)) { + // The method has gone through flushing, and it became relatively hot that it deopted + // before we could take a look at it. Give it more time to appear in the stack traces, + // proportional to the number of deopts. + MethodData* md = nm->method()->method_data(); + if (md != NULL && time_since_reset > (int)(MinPassesBeforeFlush * (md->tenure_traps() + 1))) { + // It's been long enough, we still haven't seen it on stack. + // Try to flush it, but enable counters the next time. + mc->reset_nmethod_age(); + } else { + make_not_entrant = false; + } + } else if (MethodCounters::is_nmethod_warm(age)) { + // Method has counters enabled, and the method was used within + // previous MinPassesBeforeFlush sweeps. Reset the counter. Stay in the existing + // compiled state. + mc->reset_nmethod_age(); + // delay the next check + nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val()); + make_not_entrant = false; + } else if (MethodCounters::is_nmethod_age_unset(age)) { + // No counters were used before. Set the counters to the detection + // limit value. If the method is going to be used again it will be compiled + // with counters that we're going to use for analysis the the next time. + mc->reset_nmethod_age(); + } else { + // Method was totally idle for 10 sweeps + // The counter already has the initial value, flush it and may be recompile + // later with counters + } + } + } + + if (make_not_entrant) { + nm->make_not_entrant(); + + // Code cache state change is tracked in make_not_entrant() + if (PrintMethodFlushing && Verbose) { + tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f", + nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold); + } + } + } + } +} + // Print out some state information about the current sweep and the // state of the code cache if it's requested. void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp index f7482d8194d..d9630b2e5c4 100644 --- a/hotspot/src/share/vm/runtime/sweeper.hpp +++ b/hotspot/src/share/vm/runtime/sweeper.hpp @@ -111,6 +111,7 @@ class NMethodSweeper : public AllStatic { static int hotness_counter_reset_val(); static void report_state_change(nmethod* nm); static void possibly_enable_sweeper(); + static void possibly_flush(nmethod* nm); static void print(); // Printing/debugging }; diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 67bf7b1033d..f169c3b2ef0 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -361,10 +361,12 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; nonstatic_field(MethodData, _arg_local, intx) \ nonstatic_field(MethodData, _arg_stack, intx) \ nonstatic_field(MethodData, _arg_returned, intx) \ + nonstatic_field(MethodData, _tenure_traps, uint) \ nonstatic_field(DataLayout, _header._struct._tag, u1) \ nonstatic_field(DataLayout, _header._struct._flags, u1) \ nonstatic_field(DataLayout, _header._struct._bci, u2) \ nonstatic_field(DataLayout, _cells[0], intptr_t) \ + nonstatic_field(MethodCounters, _nmethod_age, int) \ nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \ nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \ nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \ From 38d80b03c4c0b7b7cadf05059b16e109421d0670 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Tue, 11 Mar 2014 15:06:34 +0400 Subject: [PATCH 010/185] 8023461: Thread holding lock at safepoint that vm can block on: MethodCompileQueue_lock Reviewed-by: kvn, iveresov --- .../src/share/vm/compiler/compileBroker.cpp | 44 +++++++++++++++++-- .../src/share/vm/compiler/compileBroker.hpp | 7 +++ hotspot/src/share/vm/oops/method.hpp | 42 +++++++++++------- hotspot/src/share/vm/prims/whitebox.cpp | 4 +- .../vm/runtime/advancedThresholdPolicy.cpp | 22 +++++----- 5 files changed, 86 insertions(+), 33 deletions(-) diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index b2320eac8bd..ff292fbd747 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -704,13 +704,39 @@ CompileTask* CompileQueue::get() { return NULL; } - CompileTask* task = CompilationPolicy::policy()->select_task(this); + CompileTask* task; + { + No_Safepoint_Verifier nsv; + task = CompilationPolicy::policy()->select_task(this); + } remove(task); + purge_stale_tasks(); // may temporarily release MCQ lock return task; } -void CompileQueue::remove(CompileTask* task) -{ +// Clean & deallocate stale compile tasks. +// Temporarily releases MethodCompileQueue lock. +void CompileQueue::purge_stale_tasks() { + assert(lock()->owned_by_self(), "must own lock"); + if (_first_stale != NULL) { + // Stale tasks are purged when MCQ lock is released, + // but _first_stale updates are protected by MCQ lock. + // Once task processing starts and MCQ lock is released, + // other compiler threads can reuse _first_stale. + CompileTask* head = _first_stale; + _first_stale = NULL; + { + MutexUnlocker ul(lock()); + for (CompileTask* task = head; task != NULL; ) { + CompileTask* next_task = task->next(); + CompileTaskWrapper ctw(task); // Frees the task + task = next_task; + } + } + } +} + +void CompileQueue::remove(CompileTask* task) { assert(lock()->owned_by_self(), "must own lock"); if (task->prev() != NULL) { task->prev()->set_next(task->next()); @@ -730,6 +756,16 @@ void CompileQueue::remove(CompileTask* task) --_size; } +void CompileQueue::remove_and_mark_stale(CompileTask* task) { + assert(lock()->owned_by_self(), "must own lock"); + remove(task); + + // Enqueue the task for reclamation (should be done outside MCQ lock) + task->set_next(_first_stale); + task->set_prev(NULL); + _first_stale = task; +} + // methods in the compile queue need to be marked as used on the stack // so that they don't get reclaimed by Redefine Classes void CompileQueue::mark_on_stack() { @@ -2006,7 +2042,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { // Note that the queued_for_compilation bits are cleared without // protection of a mutex. [They were set by the requester thread, - // when adding the task to the complie queue -- at which time the + // when adding the task to the compile queue -- at which time the // compile queue lock was held. Subsequently, we acquired the compile // queue lock to get this task off the compile queue; thus (to belabour // the point somewhat) our clearing of the bits must be occurring diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index dc0b0ba854f..d3a25dddcc4 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -196,7 +196,11 @@ class CompileQueue : public CHeapObj { CompileTask* _first; CompileTask* _last; + CompileTask* _first_stale; + int _size; + + void purge_stale_tasks(); public: CompileQueue(const char* name, Monitor* lock) { _name = name; @@ -204,6 +208,7 @@ class CompileQueue : public CHeapObj { _first = NULL; _last = NULL; _size = 0; + _first_stale = NULL; } const char* name() const { return _name; } @@ -211,6 +216,7 @@ class CompileQueue : public CHeapObj { void add(CompileTask* task); void remove(CompileTask* task); + void remove_and_mark_stale(CompileTask* task); CompileTask* first() { return _first; } CompileTask* last() { return _last; } @@ -219,6 +225,7 @@ class CompileQueue : public CHeapObj { bool is_empty() const { return _first == NULL; } int size() const { return _size; } + // Redefine Classes support void mark_on_stack(); void free_all(); diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index 3bae50ce712..315746c501f 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -200,10 +200,11 @@ class Method : public Metadata { // Tracking number of breakpoints, for fullspeed debugging. // Only mutated by VM thread. u2 number_of_breakpoints() const { - if (method_counters() == NULL) { + MethodCounters* mcs = method_counters(); + if (mcs == NULL) { return 0; } else { - return method_counters()->number_of_breakpoints(); + return mcs->number_of_breakpoints(); } } void incr_number_of_breakpoints(TRAPS) { @@ -220,8 +221,9 @@ class Method : public Metadata { } // Initialization only void clear_number_of_breakpoints() { - if (method_counters() != NULL) { - method_counters()->clear_number_of_breakpoints(); + MethodCounters* mcs = method_counters(); + if (mcs != NULL) { + mcs->clear_number_of_breakpoints(); } } @@ -268,10 +270,11 @@ class Method : public Metadata { } int interpreter_throwout_count() const { - if (method_counters() == NULL) { + MethodCounters* mcs = method_counters(); + if (mcs == NULL) { return 0; } else { - return method_counters()->interpreter_throwout_count(); + return mcs->interpreter_throwout_count(); } } @@ -346,26 +349,28 @@ class Method : public Metadata { return method_counters()->interpreter_invocation_count(); } } - void set_prev_event_count(int count, TRAPS) { - MethodCounters* mcs = get_method_counters(CHECK); + void set_prev_event_count(int count) { + MethodCounters* mcs = method_counters(); if (mcs != NULL) { mcs->set_interpreter_invocation_count(count); } } jlong prev_time() const { - return method_counters() == NULL ? 0 : method_counters()->prev_time(); + MethodCounters* mcs = method_counters(); + return mcs == NULL ? 0 : mcs->prev_time(); } - void set_prev_time(jlong time, TRAPS) { - MethodCounters* mcs = get_method_counters(CHECK); + void set_prev_time(jlong time) { + MethodCounters* mcs = method_counters(); if (mcs != NULL) { mcs->set_prev_time(time); } } float rate() const { - return method_counters() == NULL ? 0 : method_counters()->rate(); + MethodCounters* mcs = method_counters(); + return mcs == NULL ? 0 : mcs->rate(); } - void set_rate(float rate, TRAPS) { - MethodCounters* mcs = get_method_counters(CHECK); + void set_rate(float rate) { + MethodCounters* mcs = method_counters(); if (mcs != NULL) { mcs->set_rate(rate); } @@ -390,9 +395,12 @@ class Method : public Metadata { static MethodCounters* build_method_counters(Method* m, TRAPS); int interpreter_invocation_count() { - if (TieredCompilation) return invocation_count(); - else return (method_counters() == NULL) ? 0 : - method_counters()->interpreter_invocation_count(); + if (TieredCompilation) { + return invocation_count(); + } else { + MethodCounters* mcs = method_counters(); + return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count(); + } } int increment_interpreter_invocation_count(TRAPS) { if (TieredCompilation) ShouldNotReachHere(); diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 2e6b9952b8b..5e2fbed5ced 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -495,8 +495,8 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method)) #ifdef TIERED mcs->set_rate(0.0F); - mh->set_prev_event_count(0, THREAD); - mh->set_prev_time(0, THREAD); + mh->set_prev_event_count(0); + mh->set_prev_time(0); #endif } WB_END diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp index a92c36c3e62..1b97c18b7f7 100644 --- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp @@ -75,11 +75,14 @@ void AdvancedThresholdPolicy::initialize() { // update_rate() is called from select_task() while holding a compile queue lock. void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) { - JavaThread* THREAD = JavaThread::current(); + // Skip update if counters are absent. + // Can't allocate them since we are holding compile queue lock. + if (m->method_counters() == NULL) return; + if (is_old(m)) { // We don't remove old methods from the queue, // so we can just zero the rate. - m->set_rate(0, THREAD); + m->set_rate(0); return; } @@ -95,14 +98,15 @@ void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) { if (delta_s >= TieredRateUpdateMinTime) { // And we must've taken the previous point at least 1ms before. if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) { - m->set_prev_time(t, THREAD); - m->set_prev_event_count(event_count, THREAD); - m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond - } else + m->set_prev_time(t); + m->set_prev_event_count(event_count); + m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond + } else { if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) { // If nothing happened for 25ms, zero the rate. Don't modify prev values. - m->set_rate(0, THREAD); + m->set_rate(0); } + } } } @@ -164,7 +168,6 @@ CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { for (CompileTask* task = compile_queue->first(); task != NULL;) { CompileTask* next_task = task->next(); Method* method = task->method(); - MethodData* mdo = method->method_data(); update_rate(t, method); if (max_task == NULL) { max_task = task; @@ -175,8 +178,7 @@ CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { if (PrintTieredEvents) { print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level()); } - CompileTaskWrapper ctw(task); // Frees the task - compile_queue->remove(task); + compile_queue->remove_and_mark_stale(task); method->clear_queued_for_compilation(); task = next_task; continue; From d9bd02ffc269240b77c01153f6f48c643e1991ce Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 18 Apr 2014 10:47:23 +0400 Subject: [PATCH 011/185] 8035169: Move ThreadGroupUtils from the sun.misc package Reviewed-by: anthony, serb, azvegint --- jdk/src/macosx/classes/sun/font/CFontManager.java | 2 +- jdk/src/macosx/classes/sun/lwawt/LWToolkit.java | 2 +- jdk/src/macosx/native/sun/awt/awt.m | 2 +- jdk/src/share/classes/sun/awt/AWTAutoShutdown.java | 2 +- .../classes/sun/{misc => awt/util}/ThreadGroupUtils.java | 4 ++-- jdk/src/share/classes/sun/font/CreatedFontTracker.java | 2 +- jdk/src/share/classes/sun/font/SunFontManager.java | 2 +- jdk/src/share/classes/sun/java2d/Disposer.java | 2 +- jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java | 2 +- jdk/src/solaris/classes/sun/awt/X11/XToolkit.java | 2 +- jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java | 2 +- .../classes/sun/awt/shell/Win32ShellFolderManager2.java | 2 +- jdk/src/windows/classes/sun/awt/windows/WToolkit.java | 2 +- .../classes/sun/java2d/d3d/D3DScreenUpdateManager.java | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) rename jdk/src/share/classes/sun/{misc => awt/util}/ThreadGroupUtils.java (95%) diff --git a/jdk/src/macosx/classes/sun/font/CFontManager.java b/jdk/src/macosx/classes/sun/font/CFontManager.java index ad2bfab62ba..8e1cead53c2 100644 --- a/jdk/src/macosx/classes/sun/font/CFontManager.java +++ b/jdk/src/macosx/classes/sun/font/CFontManager.java @@ -40,7 +40,7 @@ import javax.swing.plaf.FontUIResource; import sun.awt.FontConfiguration; import sun.awt.HeadlessToolkit; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.lwawt.macosx.*; public class CFontManager extends SunFontManager { diff --git a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java index 8dd9467eed6..b18fdb004f1 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java @@ -35,7 +35,7 @@ import java.util.*; import sun.awt.*; import sun.print.*; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import static sun.lwawt.LWWindowPeer.PeerType; diff --git a/jdk/src/macosx/native/sun/awt/awt.m b/jdk/src/macosx/native/sun/awt/awt.m index 0f553d0e69f..f5fe3ea9eba 100644 --- a/jdk/src/macosx/native/sun/awt/awt.m +++ b/jdk/src/macosx/native/sun/awt/awt.m @@ -435,7 +435,7 @@ JNF_COCOA_ENTER(env); forceEmbeddedMode = YES; } JNIEnv* env = [ThreadUtilities getJNIEnvUncached]; - jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/misc/ThreadGroupUtils"); + jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils"); jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;"); jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup); [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)]; diff --git a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java index f03cd50988d..d5b7633f224 100644 --- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java +++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java @@ -35,7 +35,7 @@ import java.util.Map; import java.util.Set; import sun.util.logging.PlatformLogger; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; /** * This class is to let AWT shutdown automatically when a user is done diff --git a/jdk/src/share/classes/sun/misc/ThreadGroupUtils.java b/jdk/src/share/classes/sun/awt/util/ThreadGroupUtils.java similarity index 95% rename from jdk/src/share/classes/sun/misc/ThreadGroupUtils.java rename to jdk/src/share/classes/sun/awt/util/ThreadGroupUtils.java index 066a8002f72..5d58a1c29d4 100644 --- a/jdk/src/share/classes/sun/misc/ThreadGroupUtils.java +++ b/jdk/src/share/classes/sun/awt/util/ThreadGroupUtils.java @@ -23,13 +23,13 @@ * questions. */ -package sun.misc; +package sun.awt.util; /** * A utility class needed to access the root {@code ThreadGroup} * * The class should not depend on any others, because it' called from JNI_OnLoad of the AWT - * native library. Triggering class loading could could lead to a deadlock. + * native library. Triggering class loading could lead to a deadlock. */ public final class ThreadGroupUtils { diff --git a/jdk/src/share/classes/sun/font/CreatedFontTracker.java b/jdk/src/share/classes/sun/font/CreatedFontTracker.java index 02b264db785..43f8b098658 100644 --- a/jdk/src/share/classes/sun/font/CreatedFontTracker.java +++ b/jdk/src/share/classes/sun/font/CreatedFontTracker.java @@ -35,7 +35,7 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import sun.awt.AppContext; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; public class CreatedFontTracker { diff --git a/jdk/src/share/classes/sun/font/SunFontManager.java b/jdk/src/share/classes/sun/font/SunFontManager.java index 8487b9632a1..04df414365c 100644 --- a/jdk/src/share/classes/sun/font/SunFontManager.java +++ b/jdk/src/share/classes/sun/font/SunFontManager.java @@ -52,7 +52,7 @@ import javax.swing.plaf.FontUIResource; import sun.awt.AppContext; import sun.awt.FontConfiguration; import sun.awt.SunToolkit; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.java2d.FontSupport; import sun.util.logging.PlatformLogger; diff --git a/jdk/src/share/classes/sun/java2d/Disposer.java b/jdk/src/share/classes/sun/java2d/Disposer.java index 1acf1447cdc..ba69ce763dd 100644 --- a/jdk/src/share/classes/sun/java2d/Disposer.java +++ b/jdk/src/share/classes/sun/java2d/Disposer.java @@ -25,7 +25,7 @@ package sun.java2d; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java b/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java index a73a883d16f..ecf1ed3467b 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java @@ -25,7 +25,7 @@ package sun.java2d.opengl; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.java2d.pipe.RenderBuffer; import sun.java2d.pipe.RenderQueue; import static sun.java2d.pipe.BufferedOpCodes.*; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index c10a1d9522c..3648e874b6a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -51,7 +51,7 @@ import sun.awt.datatransfer.DataTransferer; import sun.font.FontConfigManager; import sun.java2d.SunGraphicsEnvironment; import sun.misc.*; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.print.PrintJob2D; import sun.security.action.GetPropertyAction; import sun.security.action.GetBooleanAction; diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java index d69a4a0bce0..10365f9a647 100644 --- a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java +++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java @@ -42,7 +42,7 @@ import sun.java2d.opengl.GLXGraphicsConfig; import sun.java2d.xr.XRGraphicsConfig; import sun.java2d.loops.SurfaceType; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; /** * This is an implementation of a GraphicsDevice object for a single diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java index c6b7351699e..269eff2e421 100644 --- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java +++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java @@ -39,7 +39,7 @@ import java.util.concurrent.*; import static sun.awt.shell.Win32ShellFolder2.*; import sun.awt.OSInfo; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; // NOTE: This class supersedes Win32ShellFolderManager, which was removed // from distribution after version 1.4.2. diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java index 71af30e5190..2a27c2df9cc 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java +++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java @@ -40,7 +40,7 @@ import sun.awt.AWTAutoShutdown; import sun.awt.AWTPermissions; import sun.awt.LightweightFrame; import sun.awt.SunToolkit; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.awt.Win32GraphicsDevice; import sun.awt.Win32GraphicsEnvironment; import sun.awt.datatransfer.DataTransferer; diff --git a/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java b/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java index bc9e98eb85c..bd210e92765 100644 --- a/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java +++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java @@ -38,7 +38,7 @@ import java.util.ArrayList; import java.util.HashMap; import sun.awt.AWTAccessor; -import sun.misc.ThreadGroupUtils; +import sun.awt.util.ThreadGroupUtils; import sun.awt.Win32GraphicsConfig; import sun.awt.windows.WComponentPeer; import sun.java2d.InvalidPipeException; From 0a31e5f2467b81735348e7b555ee106d11330f37 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 18 Apr 2014 20:10:39 +0400 Subject: [PATCH 012/185] 8026252: [macosx] Change AWT_DEBUG_BUG_REPORT_MESSAGE for macosx platform Reviewed-by: azvegint, pchelko --- jdk/src/macosx/native/sun/osxapp/AWT_debug.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/native/sun/osxapp/AWT_debug.h b/jdk/src/macosx/native/sun/osxapp/AWT_debug.h index 1d02a824f3a..46f57cc6d73 100644 --- a/jdk/src/macosx/native/sun/osxapp/AWT_debug.h +++ b/jdk/src/macosx/native/sun/osxapp/AWT_debug.h @@ -32,9 +32,10 @@ #define kInternalError "java/lang/InternalError" #define AWT_DEBUG_LOG(str) \ - NSLog(@"Cocoa AWT: %@ %@", str, [NSThread callStackSymbols]) + NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols]) #define AWT_DEBUG_BUG_REPORT_MESSAGE \ - NSLog(@"\tPlease file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.") + NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \ +with this message and a reproducible test case.") #endif From 81ae76b8dd94c3d1cdbcdcd3cc8c6ad568646ab6 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Fri, 18 Apr 2014 09:56:34 -0700 Subject: [PATCH 013/185] 8038644: Fix raw and unchecked warnings in sun.java2d.* Reviewed-by: darcy, prr --- jdk/src/share/classes/sun/java2d/Spans.java | 23 ++++++++----------- .../classes/sun/java2d/SunGraphics2D.java | 7 ++++-- .../sun/java2d/SunGraphicsEnvironment.java | 2 +- .../classes/sun/java2d/cmm/lcms/LCMS.java | 4 ++-- .../share/classes/sun/java2d/loops/Blit.java | 12 +++++----- .../sun/java2d/loops/CustomComponent.java | 2 +- .../sun/java2d/loops/GeneralRenderer.java | 2 +- .../sun/java2d/loops/GraphicsPrimitive.java | 15 ++++++------ .../java2d/loops/GraphicsPrimitiveMgr.java | 21 +++++++++-------- .../java2d/loops/GraphicsPrimitiveProxy.java | 6 ++--- .../classes/sun/java2d/loops/MaskBlit.java | 12 +++++----- .../sun/java2d/opengl/OGLBlitLoops.java | 8 +++---- .../sun/java2d/pipe/AlphaPaintPipe.java | 20 ++++++++-------- .../classes/sun/java2d/pipe/RenderQueue.java | 4 ++-- .../sun/java2d/pipe/SpanClipRenderer.java | 6 ++--- .../sun/java2d/x11/X11SurfaceData.java | 2 +- 16 files changed, 74 insertions(+), 72 deletions(-) diff --git a/jdk/src/share/classes/sun/java2d/Spans.java b/jdk/src/share/classes/sun/java2d/Spans.java index ae708f1f161..abd1eda118f 100644 --- a/jdk/src/share/classes/sun/java2d/Spans.java +++ b/jdk/src/share/classes/sun/java2d/Spans.java @@ -49,7 +49,7 @@ public class Spans { * Holds a list of individual * Span instances. */ - private List mSpans = new Vector(kMaxAddsSinceSort); + private List mSpans = new Vector<>(kMaxAddsSinceSort); /** * The number of Span @@ -144,7 +144,7 @@ public class Spans { Collections.sort(mSpans); mAddsSinceSort = 0; - Iterator iter = mSpans.iterator(); + Iterator iter = mSpans.iterator(); /* Have 'span' start at the first span in * the collection. The collection may be empty @@ -152,7 +152,7 @@ public class Spans { */ Span span = null; if (iter.hasNext()) { - span = (Span) iter.next(); + span = iter.next(); } /* Loop over the spans collapsing those that intersect @@ -160,7 +160,7 @@ public class Spans { */ while (iter.hasNext()) { - Span nextSpan = (Span) iter.next(); + Span nextSpan = iter.next(); /* The spans are in ascending start position * order and so the next span's starting point @@ -202,9 +202,9 @@ public class Spans { private void printSpans() { System.out.println("----------"); if (mSpans != null) { - Iterator iter = mSpans.iterator(); + Iterator iter = mSpans.iterator(); while (iter.hasNext()) { - Span span = (Span) iter.next(); + Span span = iter.next(); System.out.println(span); } } @@ -216,7 +216,7 @@ public class Spans { /** * Holds a single half-open interval. */ - static class Span implements Comparable { + static class Span implements Comparable { /** * The span includes the starting point. @@ -315,8 +315,7 @@ public class Spans { * position. The end position is ignored * in this ranking. */ - public int compareTo(Object o) { - Span otherSpan = (Span) o; + public int compareTo(Span otherSpan) { float otherStart = otherSpan.getStart(); int result; @@ -345,7 +344,7 @@ public class Spans { * SpanIntersection.instance to * get the single instance of this class. */ - static class SpanIntersection implements Comparator { + static class SpanIntersection implements Comparator { /** * This class is a Singleton and the following @@ -361,10 +360,8 @@ public class Spans { } - public int compare(Object o1, Object o2) { + public int compare(Span span1, Span span2) { int result; - Span span1 = (Span) o1; - Span span2 = (Span) o2; /* Span 1 is entirely to the left of span2. * span1: <-----< diff --git a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java index 287549c2062..58f90c36b11 100644 --- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java +++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java @@ -1430,8 +1430,11 @@ public final class SunGraphics2D } } - RenderingHints makeHints(Map hints) { - RenderingHints model = new RenderingHints(hints); + RenderingHints makeHints(Map hints) { + RenderingHints model = new RenderingHints(null); + if (hints != null) { + model.putAll(hints); + } model.put(SunHints.KEY_RENDERING, SunHints.Value.get(SunHints.INTKEY_RENDERING, renderHint)); diff --git a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java index c4e0be79f1c..cc2d113e064 100644 --- a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java +++ b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java @@ -82,7 +82,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment public SunGraphicsEnvironment() { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { String version = System.getProperty("os.version", "0.0"); try { diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java index d01dff66c45..c9333616065 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java @@ -189,7 +189,7 @@ public class LCMS implements PCMM { LCMSImageLayout dest); public static native void freeTransform(long ID); - public static native void initLCMS(Class Trans, Class IL, Class Pf); + public static native void initLCMS(Class Trans, Class IL, Class Pf); private LCMS() {}; @@ -201,7 +201,7 @@ public class LCMS implements PCMM { } java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { /* We need to load awt here because of usage trace and * disposer frameworks diff --git a/jdk/src/share/classes/sun/java2d/loops/Blit.java b/jdk/src/share/classes/sun/java2d/loops/Blit.java index 7a337e15214..802385279a2 100644 --- a/jdk/src/share/classes/sun/java2d/loops/Blit.java +++ b/jdk/src/share/classes/sun/java2d/loops/Blit.java @@ -217,8 +217,8 @@ public class Blit extends GraphicsPrimitive Blit performop; Blit convertresult; - WeakReference srcTmp; - WeakReference dstTmp; + WeakReference srcTmp; + WeakReference dstTmp; public GeneralXorBlit(SurfaceType srctype, CompositeType comptype, @@ -257,14 +257,14 @@ public class Blit extends GraphicsPrimitive } else { SurfaceData cachedSrc = null; if (srcTmp != null) { - cachedSrc = (SurfaceData) srcTmp.get(); + cachedSrc = srcTmp.get(); } src = convertFrom(convertsrc, srcData, srcx, srcy, width, height, cachedSrc); sx = 0; sy = 0; if (src != cachedSrc) { - srcTmp = new WeakReference(src); + srcTmp = new WeakReference<>(src); } } @@ -277,7 +277,7 @@ public class Blit extends GraphicsPrimitive // assert: convertresult != null SurfaceData cachedDst = null; if (dstTmp != null) { - cachedDst = (SurfaceData) dstTmp.get(); + cachedDst = dstTmp.get(); } dst = convertFrom(convertdst, dstData, dstx, dsty, width, height, cachedDst); @@ -285,7 +285,7 @@ public class Blit extends GraphicsPrimitive dy = 0; opclip = null; if (dst != cachedDst) { - dstTmp = new WeakReference(dst); + dstTmp = new WeakReference<>(dst); } } diff --git a/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java b/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java index 55a921aeb1d..ff346172387 100644 --- a/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java +++ b/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java @@ -50,7 +50,7 @@ public final class CustomComponent { public static void register() { // REMIND: This does not work for all destinations yet since // the screen SurfaceData objects do not implement getRaster - Class owner = CustomComponent.class; + Class owner = CustomComponent.class; GraphicsPrimitive[] primitives = { new GraphicsPrimitiveProxy(owner, "OpaqueCopyAnyToArgb", Blit.methodSignature, diff --git a/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java b/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java index ac01d5324c3..af0fa2ece8b 100644 --- a/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java +++ b/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java @@ -50,7 +50,7 @@ import sun.font.GlyphList; public final class GeneralRenderer { public static void register() { - Class owner = GeneralRenderer.class; + Class owner = GeneralRenderer.class; GraphicsPrimitive[] primitives = { new GraphicsPrimitiveProxy(owner, "SetFillRectANY", FillRect.methodSignature, diff --git a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java index 47db650374a..ca23fe72aec 100644 --- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java +++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java @@ -316,7 +316,7 @@ public abstract class GraphicsPrimitive { public abstract GraphicsPrimitive traceWrap(); - static HashMap traceMap; + static HashMap traceMap; public static int traceflags; public static String tracefile; @@ -427,13 +427,14 @@ public abstract class GraphicsPrimitive { public void run() { PrintStream ps = getTraceOutputFile(); - Iterator iterator = traceMap.entrySet().iterator(); + Iterator> iterator = + traceMap.entrySet().iterator(); long total = 0; int numprims = 0; while (iterator.hasNext()) { - Map.Entry me = (Map.Entry) iterator.next(); + Map.Entry me = iterator.next(); Object prim = me.getKey(); - int[] count = (int[]) me.getValue(); + int[] count = me.getValue(); if (count[0] == 1) { ps.print("1 call to "); } else { @@ -455,15 +456,15 @@ public abstract class GraphicsPrimitive { public synchronized static void tracePrimitive(Object prim) { if ((traceflags & TRACECOUNTS) != 0) { if (traceMap == null) { - traceMap = new HashMap(); + traceMap = new HashMap<>(); TraceReporter.setShutdownHook(); } - Object o = traceMap.get(prim); + int[] o = traceMap.get(prim); if (o == null) { o = new int[1]; traceMap.put(prim, o); } - ((int[]) o)[0]++; + o[0]++; } if ((traceflags & TRACELOG) != 0) { PrintStream ps = getTraceOutputFile(); diff --git a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java index 6f76f544bec..177aa2148aa 100644 --- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java +++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java @@ -45,11 +45,11 @@ public final class GraphicsPrimitiveMgr { private static GraphicsPrimitive generalPrimitives[]; private static boolean needssort = true; - private static native void initIDs(Class GP, Class ST, Class CT, - Class SG2D, Class Color, Class AT, - Class XORComp, Class AlphaComp, - Class Path2D, Class Path2DFloat, - Class SHints); + private static native void initIDs(Class GP, Class ST, Class CT, + Class SG2D, Class Color, Class AT, + Class XORComp, Class AlphaComp, + Class Path2D, Class Path2DFloat, + Class SHints); private static native void registerNativeLoops(); static { @@ -73,16 +73,17 @@ public final class GraphicsPrimitiveMgr { public int uniqueID; } - private static Comparator primSorter = new Comparator() { - public int compare(Object o1, Object o2) { - int id1 = ((GraphicsPrimitive) o1).getUniqueID(); - int id2 = ((GraphicsPrimitive) o2).getUniqueID(); + private static Comparator primSorter = + new Comparator() { + public int compare(GraphicsPrimitive o1, GraphicsPrimitive o2) { + int id1 = o1.getUniqueID(); + int id2 = o2.getUniqueID(); return (id1 == id2 ? 0 : (id1 < id2 ? -1 : 1)); } }; - private static Comparator primFinder = new Comparator() { + private static Comparator primFinder = new Comparator() { public int compare(Object o1, Object o2) { int id1 = ((GraphicsPrimitive) o1).getUniqueID(); int id2 = ((PrimitiveSpec) o2).uniqueID; diff --git a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java index 15c93111d69..73f18a60946 100644 --- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java +++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java @@ -41,7 +41,7 @@ package sun.java2d.loops; */ public class GraphicsPrimitiveProxy extends GraphicsPrimitive { - private Class owner; + private Class owner; private String relativeClassName; /** @@ -53,7 +53,7 @@ public class GraphicsPrimitiveProxy extends GraphicsPrimitive { * @param relativeClassName The name of the class this is a proxy for. * This should not include the package. */ - public GraphicsPrimitiveProxy(Class owner, String relativeClassName, + public GraphicsPrimitiveProxy(Class owner, String relativeClassName, String methodSignature, int primID, SurfaceType srctype, @@ -80,7 +80,7 @@ public class GraphicsPrimitiveProxy extends GraphicsPrimitive { String name = getPackageName(owner.getName()) + "." + relativeClassName; try { - Class clazz = Class.forName(name); + Class clazz = Class.forName(name); GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance(); if (!satisfiesSameAs(p)) { throw new RuntimeException("Primitive " + p diff --git a/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java b/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java index 39a047d19ff..1572d05e0b6 100644 --- a/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java +++ b/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java @@ -143,8 +143,8 @@ public class MaskBlit extends GraphicsPrimitive MaskBlit performop; Blit convertresult; - WeakReference srcTmp; - WeakReference dstTmp; + WeakReference srcTmp; + WeakReference dstTmp; public General(SurfaceType srctype, CompositeType comptype, @@ -184,14 +184,14 @@ public class MaskBlit extends GraphicsPrimitive } else { SurfaceData cachedSrc = null; if (srcTmp != null) { - cachedSrc = (SurfaceData) srcTmp.get(); + cachedSrc = srcTmp.get(); } src = convertFrom(convertsrc, srcData, srcx, srcy, width, height, cachedSrc); sx = 0; sy = 0; if (src != cachedSrc) { - srcTmp = new WeakReference(src); + srcTmp = new WeakReference<>(src); } } @@ -204,7 +204,7 @@ public class MaskBlit extends GraphicsPrimitive // assert: convertresult != null SurfaceData cachedDst = null; if (dstTmp != null) { - cachedDst = (SurfaceData) dstTmp.get(); + cachedDst = dstTmp.get(); } dst = convertFrom(convertdst, dstData, dstx, dsty, width, height, cachedDst); @@ -212,7 +212,7 @@ public class MaskBlit extends GraphicsPrimitive dy = 0; opclip = null; if (dst != cachedDst) { - dstTmp = new WeakReference(dst); + dstTmp = new WeakReference<>(dst); } } diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java index a613daf4808..64459c1145e 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java @@ -728,7 +728,7 @@ class OGLTextureToSurfaceTransform extends TransformBlit { class OGLGeneralBlit extends Blit { private Blit performop; - private WeakReference srcTmp; + private WeakReference srcTmp; OGLGeneralBlit(SurfaceType dstType, CompositeType compType, @@ -750,7 +750,7 @@ class OGLGeneralBlit extends Blit { SurfaceData cachedSrc = null; if (srcTmp != null) { // use cached intermediate surface, if available - cachedSrc = (SurfaceData)srcTmp.get(); + cachedSrc = srcTmp.get(); } // convert source to IntArgbPre @@ -763,7 +763,7 @@ class OGLGeneralBlit extends Blit { if (src != cachedSrc) { // cache the intermediate surface - srcTmp = new WeakReference(src); + srcTmp = new WeakReference<>(src); } } } @@ -802,7 +802,7 @@ class OGLAnyCompositeBlit extends Blit { if (dstBuffer != cachedDst) { // cache the intermediate surface - dstTmp = new WeakReference(dstBuffer); + dstTmp = new WeakReference<>(dstBuffer); } // now blit the buffer back to the destination diff --git a/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java b/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java index 547211cf1e5..70cb1c18efe 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java @@ -48,16 +48,16 @@ import sun.java2d.loops.GraphicsPrimitiveMgr; * SunGraphics2D. */ public class AlphaPaintPipe implements CompositePipe { - static WeakReference cachedLastRaster; - static WeakReference cachedLastColorModel; - static WeakReference cachedLastData; + static WeakReference cachedLastRaster; + static WeakReference cachedLastColorModel; + static WeakReference cachedLastData; static class TileContext { SunGraphics2D sunG2D; PaintContext paintCtxt; ColorModel paintModel; - WeakReference lastRaster; - WeakReference lastData; + WeakReference lastRaster; + WeakReference lastData; MaskBlit lastMask; Blit lastBlit; SurfaceData dstData; @@ -105,8 +105,8 @@ public class AlphaPaintPipe implements CompositePipe { SurfaceData srcData = null; Raster lastRas = null; if (context.lastData != null && context.lastRaster != null) { - srcData = (SurfaceData) context.lastData.get(); - lastRas = (Raster) context.lastRaster.get(); + srcData = context.lastData.get(); + lastRas = context.lastRaster.get(); if (srcData == null || lastRas == null) { srcData = null; lastRas = null; @@ -127,7 +127,7 @@ public class AlphaPaintPipe implements CompositePipe { } if (lastRas != srcRaster) { lastRas = srcRaster; - context.lastRaster = new WeakReference(lastRas); + context.lastRaster = new WeakReference<>(lastRas); // REMIND: This will fail for a non-Writable raster! BufferedImage bImg = new BufferedImage(paintModel, @@ -135,7 +135,7 @@ public class AlphaPaintPipe implements CompositePipe { paintModel.isAlphaPremultiplied(), null); srcData = BufImgSurfaceData.createData(bImg); - context.lastData = new WeakReference(srcData); + context.lastData = new WeakReference<>(srcData); context.lastMask = null; context.lastBlit = null; } @@ -197,7 +197,7 @@ public class AlphaPaintPipe implements CompositePipe { { // Avoid creating new WeakReference if possible cachedLastColorModel = - new WeakReference(context.paintModel); + new WeakReference<>(context.paintModel); } cachedLastData = context.lastData; } diff --git a/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java b/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java index 6f65c05349c..f9dc262f17c 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java +++ b/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java @@ -81,10 +81,10 @@ public abstract class RenderQueue { * A Set containing hard references to Objects that must stay alive until * the queue has been completely flushed. */ - protected Set refSet; + protected Set refSet; protected RenderQueue() { - refSet = new HashSet(); + refSet = new HashSet<>(); buf = RenderBuffer.allocate(BUFFER_SIZE); } diff --git a/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java b/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java index bba66f65907..0e18b92a7d7 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java +++ b/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java @@ -39,14 +39,14 @@ public class SpanClipRenderer implements CompositePipe { CompositePipe outpipe; - static Class RegionClass = Region.class; - static Class RegionIteratorClass = RegionIterator.class; + static Class RegionClass = Region.class; + static Class RegionIteratorClass = RegionIterator.class; static { initIDs(RegionClass, RegionIteratorClass); } - static native void initIDs(Class rc, Class ric); + static native void initIDs(Class rc, Class ric); public SpanClipRenderer(CompositePipe pipe) { outpipe = pipe; diff --git a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java index af65891495f..4e6c24f2e23 100644 --- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java +++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java @@ -72,7 +72,7 @@ public abstract class X11SurfaceData extends XSurfaceData { protected int depth; - private static native void initIDs(Class xorComp, boolean tryDGA); + private static native void initIDs(Class xorComp, boolean tryDGA); protected native void initSurface(int depth, int width, int height, long drawable); From a2651f668e20d651428158c7cc56bfb6590246e5 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 21 Apr 2014 11:00:46 +0400 Subject: [PATCH 014/185] 8037477: Reproducible hang of JAWS and webstart application with JAB 2.0.4 Reviewed-by: anthony, serb --- .../accessibility/AccessibleContext.java | 23 ++++++++++++++++ .../share/classes/sun/awt/AWTAccessor.java | 27 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java index 15f0f7f3983..b7f584b95db 100644 --- a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java +++ b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java @@ -25,6 +25,9 @@ package javax.accessibility; +import sun.awt.AWTAccessor; +import sun.awt.AppContext; + import java.util.Locale; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; @@ -79,6 +82,26 @@ import java.awt.IllegalComponentStateException; */ public abstract class AccessibleContext { + /** + * The AppContext that should be used to dispatch events for this + * AccessibleContext + */ + private volatile AppContext targetAppContext; + + static { + AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() { + @Override + public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) { + accessibleContext.targetAppContext = appContext; + } + + @Override + public AppContext getAppContext(AccessibleContext accessibleContext) { + return accessibleContext.targetAppContext; + } + }); + } + /** * Constant used to determine when the accessibleName property has * changed. The old value in the PropertyChangeEvent will be the old diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index 9e41cd4dfaa..b99ccdfe2ee 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -27,6 +27,7 @@ package sun.awt; import sun.misc.Unsafe; +import javax.accessibility.AccessibleContext; import java.awt.*; import java.awt.KeyboardFocusManager; import java.awt.DefaultKeyboardFocusManager; @@ -761,6 +762,14 @@ public final class AWTAccessor { void updateSystemColors(); } + /* + * An accessor object for the AccessibleContext class + */ + public interface AccessibleContextAccessor { + void setAppContext(AccessibleContext accessibleContext, AppContext appContext); + AppContext getAppContext(AccessibleContext accessibleContext); + } + /* * Accessor instances are initialized in the static initializers of * corresponding AWT classes by using setters defined below. @@ -791,6 +800,7 @@ public final class AWTAccessor { private static ToolkitAccessor toolkitAccessor; private static InvocationEventAccessor invocationEventAccessor; private static SystemColorAccessor systemColorAccessor; + private static AccessibleContextAccessor accessibleContextAccessor; /* * Set an accessor object for the java.awt.Component class. @@ -1234,4 +1244,21 @@ public final class AWTAccessor { public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) { AWTAccessor.systemColorAccessor = systemColorAccessor; } + + /* + * Get the accessor object for the javax.accessibility.AccessibleContext class. + */ + public static AccessibleContextAccessor getAccessibleContextAccessor() { + if (accessibleContextAccessor == null) { + unsafe.ensureClassInitialized(AccessibleContext.class); + } + return accessibleContextAccessor; + } + + /* + * Set the accessor object for the javax.accessibility.AccessibleContext class. + */ + public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) { + AWTAccessor.accessibleContextAccessor = accessor; + } } From 704f4dc11341abce912047621f389f50b2f5930f Mon Sep 17 00:00:00 2001 From: Dmitriy Ermashov Date: Mon, 21 Apr 2014 14:35:14 +0400 Subject: [PATCH 015/185] 8039279: Move awt tests to openjdk repository Reviewed-by: pchelko, alexsch --- .../SetMaximizedBounds.java | 88 +++++++ .../ChangeGridSize/ChangeGridSize.java | 189 ++++++++++++++ .../ComponentPreferredSize.java | 181 ++++++++++++++ .../ModifierRobotKeyTest.java | 230 ++++++++++++++++++ .../LockingKeyStateTest.java | 126 ++++++++++ 5 files changed, 814 insertions(+) create mode 100644 jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java create mode 100644 jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java create mode 100644 jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java create mode 100644 jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java create mode 100644 jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java diff --git a/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java b/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java new file mode 100644 index 00000000000..da5b3800eae --- /dev/null +++ b/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2014, 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. + */ + +import java.awt.*; + +/* + * @test + * @summary When Frame.setExtendedState(Frame.MAXIMIZED_BOTH) + * is called for a Frame after been called setMaximizedBounds() with + * certain value, Frame bounds must equal to this value. + * + * @library ../../../../lib/testlibrary + * @build ExtendedRobot + * @run main SetMaximizedBounds + */ + +public class SetMaximizedBounds { + + Frame frame; + Rectangle bound; + boolean supported; + ExtendedRobot robot; + static Rectangle max = new Rectangle(100,100,400,400); + + public void doTest() throws Exception { + robot = new ExtendedRobot(); + + EventQueue.invokeAndWait( () -> { + frame = new Frame( "TestFrame "); + frame.setLayout(new FlowLayout()); + + if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { + supported = true; + frame.setMaximizedBounds(max); + } else { + supported = false; + } + + frame.setSize(200, 200); + frame.setVisible(true); + }); + + robot.waitForIdle(2000); + if (supported) { + EventQueue.invokeAndWait( () -> { + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + }); + robot.waitForIdle(2000); + bound = frame.getBounds(); + if(!bound.equals(max)) + throw new RuntimeException("The bounds of the Frame do not equal to what" + + " is specified when the frame is in Frame.MAXIMIZED_BOTH state"); + } else { + System.out.println("Frame.MAXIMIZED_BOTH not supported"); + } + + frame.dispose(); + } + + public static void main(String[] args) throws Exception { + String os = System.getProperty("os.name").toLowerCase(); + System.out.println(os); + if (os.contains("windows") || os.contains("os x")) + new SetMaximizedBounds().doTest(); + else + System.out.println("Platform "+os+" is not supported. Supported platforms are Windows and OS X."); + } +} diff --git a/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java b/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java new file mode 100644 index 00000000000..86f7a7a8b3a --- /dev/null +++ b/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2006, 2014, 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. + */ + +import java.awt.*; +import java.awt.event.*; + +/* + * @test + * @summary Have different components having different preferred sizes + * added to a grid layout. Change the rows and columns of the + * grid layout and check the components are re-laid out. + * The strategy followed is to calculate the component location + * depending on the preferred sizes and gaps and click the cornors + * of the components to check if events are triggered + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main ChangeGridSize + * @run main ChangeGridSize -hg 20 -vg 20 + */ + +public class ChangeGridSize { + + private int width = 200; + private int height = 200; + private final int hGap, vGap; + private final int rows = 3; + private final int columns = 2; + private final int componentCount = 6; + + private Button[] buttons; + private Frame frame; + + private ExtendedRobot robot; + private GridLayout layout; + + private volatile boolean actionPerformed = false; + + public ChangeGridSize(int hGap, int vGap) throws Exception { + this.hGap = hGap; + this.vGap = vGap; + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( () -> { + frame = new Frame("Test frame"); + frame.setSize(width, height); + layout = new GridLayout(rows + 3, columns - 1, hGap, vGap); + frame.setLayout(layout); + + buttons = new Button[componentCount]; + for (int i = 0; i < componentCount; i++) { + buttons[i] = new Button("Button" + i); + frame.add(buttons[i]); + buttons[i].addActionListener( (event) -> { actionPerformed = true; }); + } + frame.setVisible(true); + }); + } + + public static void main(String[] args) throws Exception { + int hGap = 0; + int vGap = 0; + for (int i = 0; i < args.length; i++) { + switch (args[i]) { + case "-hg": + hGap = Integer.parseInt(args[++i]); + break; + case "-vg": + vGap = Integer.parseInt(args[++i]); + break; + } + } + new ChangeGridSize(hGap, vGap).doTest(); + } + + private void resizeFrame() throws Exception { + EventQueue.invokeAndWait(() -> { + Insets insets = frame.getInsets(); + double dH = (height-insets.top-insets.bottom - vGap*(rows-1)) % rows; + double dW = (width-insets.left-insets.right - hGap*(columns-1)) % columns; + height -= dH; + width -= dW; + frame.setSize(width, height); + frame.revalidate(); + }); + robot.waitForIdle(); + } + + private void changeGridSize() throws Exception { + EventQueue.invokeAndWait(() -> { + layout.setRows(rows); + layout.setColumns(columns); + + frame.revalidate(); + }); + robot.waitForIdle(); + } + + public void testBoundaries(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY) throws Exception { + + actionPerformed = false; + robot.mouseMove(topLeftX, topLeftY); + robot.delay(500); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(3000); + + if(!actionPerformed) + throw new RuntimeException("Clicking on the left top of button did not trigger action event"); + + actionPerformed = false; + robot.mouseMove(bottomRightX, bottomRightY); + robot.delay(500); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(3000); + + if(!actionPerformed) + throw new RuntimeException("Clicking on the bottom right of button did not trigger action event"); + } + + private void doTest() throws Exception { + robot.waitForIdle(); + changeGridSize(); + resizeFrame(); + + int availableWidth = width - frame.getInsets().left - + frame.getInsets().right; + int componentWidth = (availableWidth + hGap) / columns - hGap; + int availableHeight = height - frame.getInsets().top - + frame.getInsets().bottom; + int componentHeight = (availableHeight + vGap) / rows - vGap; + + for (int i = 0; i < buttons.length; i++) { + if (buttons[i].getSize().width != componentWidth || + buttons[i].getSize().height != componentHeight) { + throw new RuntimeException( + "FAIL: Button " + i + " not of proper size" + + "Expected: " + componentWidth + "*" + componentHeight + + "Actual: " + buttons[i].getSize().width + "*" + buttons[i].getSize().height); + } + } + + // Components are visible. They should trigger events. + // Now you can check for the actual size shown. + int currentRow = 1; + int currentColumn = 0; + for (int i = 0; i < buttons.length; i++) { + currentColumn++; + if (currentColumn > columns) { + currentColumn = 1; + currentRow++; + } + + int topPosX = frame.getLocationOnScreen().x + + frame.getInsets().left + + (currentColumn - 1) * (componentWidth + hGap); + int topPosY = frame.getLocationOnScreen().y + + frame.getInsets().top + + (currentRow - 1) * (componentHeight + vGap); + + int bottomPosX = topPosX + componentWidth - 1; + int bottomPosY = topPosY + componentHeight - 1; + testBoundaries(topPosX, topPosY, bottomPosX, bottomPosY); + } + + frame.dispose(); + } +} diff --git a/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java b/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java new file mode 100644 index 00000000000..d8ceac748c8 --- /dev/null +++ b/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2006, 2014, 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. + */ + +import java.awt.*; +import java.awt.event.InputEvent; + +/* + * @test + * @summary Have different components having different preferred sizes + * added to a grid layout having various values of row/columns. + * Check if the compnents are correctly laid out. + * The strategy followed is to calculate the component location + * depending on the preferred sizes and gaps and click the cornors + * of the components to check if events are triggered + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main ComponentPreferredSize + * @run main ComponentPreferredSize -hg 20 -vg 20 + */ + +public class ComponentPreferredSize { + + private int width = 200; + private int height = 200; + private final int hGap, vGap; + private final int rows = 3; + private final int columns = 2; + private final int componentCount = 6; + + private Button[] buttons; + private Frame frame; + + private ExtendedRobot robot; + private GridLayout layout; + + private volatile boolean actionPerformed = false; + + public ComponentPreferredSize(int hGap, int vGap) throws Exception { + this.hGap = hGap; + this.vGap = vGap; + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( () -> { + frame = new Frame("Test frame"); + frame.setSize(width, height); + layout = new GridLayout(rows, columns, hGap, vGap); + frame.setLayout(layout); + + buttons = new Button[componentCount]; + for (int i = 0; i < componentCount; i++) { + buttons[i] = new Button("Button" + i); + buttons[i].setPreferredSize(new Dimension((int) Math.random() * 100, + (int) Math.random() * 100)); + frame.add(buttons[i]); + buttons[i].addActionListener((event) -> {actionPerformed = true;}); + } + + frame.setVisible(true); + }); + } + + public static void main(String[] args) throws Exception { + int hGap = 0; + int vGap = 0; + for (int i = 0; i < args.length; i++) { + switch (args[i]) { + case "-hg": + hGap = Integer.parseInt(args[++i]); + break; + case "-vg": + vGap = Integer.parseInt(args[++i]); + break; + } + } + new ComponentPreferredSize(hGap, vGap).doTest(); + } + + private void resizeFrame() throws Exception { + EventQueue.invokeAndWait(() -> { + Insets insets = frame.getInsets(); + double dH = (height-insets.top-insets.bottom - vGap*(rows-1)) % rows; + double dW = (width-insets.left-insets.right - hGap*(columns-1)) % columns; + height -= dH; + width -= dW; + frame.setSize(width, height); + frame.revalidate(); + }); + robot.waitForIdle(); + } + + public void testBoundaries(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY) throws Exception { + + actionPerformed = false; + robot.mouseMove(topLeftX, topLeftY); + robot.delay(500); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(3000); + + if(!actionPerformed) + throw new RuntimeException("Clicking on the left top of button did not trigger action event"); + + actionPerformed = false; + robot.mouseMove(bottomRightX, bottomRightY); + robot.delay(500); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(3000); + + if(!actionPerformed) + throw new RuntimeException("Clicking on the bottom right of button did not trigger action event"); + } + + private void doTest() throws Exception { + robot.waitForIdle(); + resizeFrame(); + + int availableWidth = width - frame.getInsets().left - + frame.getInsets().right; + int componentWidth = (availableWidth + hGap) / columns - hGap; + int availableHeight = height - frame.getInsets().top - + frame.getInsets().bottom; + int componentHeight = (availableHeight + vGap) / rows - vGap; + + for (int i = 0; i < buttons.length; i++) { + if (buttons[i].getSize().width != componentWidth || + buttons[i].getSize().height != componentHeight) { + throw new RuntimeException( + "FAIL: Button " + i + " not of proper size" + + "Expected: " + componentWidth + "*" + componentHeight + + "Actual: " + buttons[i].getSize().width + "*" + buttons[i].getSize().height); + } + } + + // Components are visible. They should trigger events. + // Now you can check for the actual size shown. + int currentRow = 1; + int currentColumn = 0; + for (int i = 0; i < buttons.length; i++) { + currentColumn++; + if (currentColumn > columns) { + currentColumn = 1; + currentRow++; + } + + int topPosX = frame.getLocationOnScreen().x + + frame.getInsets().left + + (currentColumn - 1) * (componentWidth + hGap); + int topPosY = frame.getLocationOnScreen().y + + frame.getInsets().top + + (currentRow - 1) * (componentHeight + vGap); + + int bottomPosX = topPosX + componentWidth - 1; + int bottomPosY = topPosY + componentHeight - 1; + testBoundaries(topPosX, topPosY, bottomPosX, bottomPosY); + } + + frame.dispose(); + } +} diff --git a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java new file mode 100644 index 00000000000..5cdc8085255 --- /dev/null +++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2007, 2014, 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. + */ + + +import java.awt.*; +import java.awt.event.*; + +import static jdk.testlibrary.Asserts.assertTrue; + +/* + * @test + * @summary Make sure that modifier key mask is set when robot press + * some key with one or more modifiers. + * + * @library ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @run main ModifierRobotKeyTest + */ + +public class ModifierRobotKeyTest extends KeyAdapter { + + private boolean focusGained = false; + private boolean startTest = false; + private ExtendedRobot robot; + private Frame frame; + private Canvas canvas; + + private volatile boolean tempPress = false; + + private int[] textKeys, modifierKeys, inputMasks; + private boolean[] modifierStatus, textStatus; + + private final static int waitDelay = 5000; + private Object tempLock = new Object(); + private Object keyLock = new Object(); + + public static void main(String[] args) throws Exception { + ModifierRobotKeyTest test = new ModifierRobotKeyTest(); + test.doTest(); + } + + public ModifierRobotKeyTest() throws Exception { + modifierKeys = new int[3]; + modifierKeys[0] = KeyEvent.VK_SHIFT; + modifierKeys[1] = KeyEvent.VK_CONTROL; + modifierKeys[2] = KeyEvent.VK_ALT; + + inputMasks = new int[3]; + inputMasks[0] = InputEvent.SHIFT_MASK; + inputMasks[1] = InputEvent.CTRL_MASK; + inputMasks[2] = InputEvent.ALT_MASK; + + modifierStatus = new boolean[modifierKeys.length]; + + textKeys = new int[2]; + textKeys[0] = KeyEvent.VK_A; + + String os = System.getProperty("os.name").toLowerCase(); + + if (os.contains("solaris") || os.contains("sunos")) + textKeys[1] = KeyEvent.VK_S; + else if (os.contains("os x")) + textKeys[1] = KeyEvent.VK_K; + else + textKeys[1] = KeyEvent.VK_I; + + textStatus = new boolean[textKeys.length]; + + EventQueue.invokeAndWait( () -> { initializeGUI(); }); + } + + public void keyPressed(KeyEvent event) { + + tempPress = true; + synchronized (tempLock) { tempLock.notifyAll(); } + + if (! startTest) { + return; + } + for (int x = 0; x < inputMasks.length; x++) { + if ((event.getModifiers() & inputMasks[x]) != 0) { + System.out.println("Modifier set: " + event.getKeyModifiersText(inputMasks[x])); + modifierStatus[x] = true; + } + } + for (int x = 0; x < textKeys.length; x++) { + if (event.getKeyCode() == textKeys[x]) { + System.out.println("Text set: " + event.getKeyText(textKeys[x])); + textStatus[x] = true; + } + } + + synchronized (keyLock) { keyLock.notifyAll(); } + } + + private void initializeGUI() { + frame = new Frame("Test frame"); + canvas = new Canvas(); + canvas.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent event) { focusGained = true; } + }); + canvas.addKeyListener(this); + frame.setLayout(new BorderLayout()); + frame.add(canvas); + frame.setSize(200, 200); + frame.setVisible(true); + } + + public void doTest() throws Exception { + robot = new ExtendedRobot(); + + robot.mouseMove((int) frame.getLocationOnScreen().getX() + frame.getSize().width / 2, + (int) frame.getLocationOnScreen().getY() + frame.getSize().height / 2); + robot.click(MouseEvent.BUTTON1_MASK); + robot.waitForIdle(); + + assertTrue(focusGained, "FAIL: Canvas gained focus!"); + + for (int i = 0; i < modifierKeys.length; i++) { + for (int j = 0; j < textKeys.length; j++) { + tempPress = false; + robot.keyPress(modifierKeys[i]); + robot.waitForIdle(); + if (! tempPress) { + synchronized (tempLock) { tempLock.wait(waitDelay); } + } + assertTrue(tempPress, "FAIL: keyPressed triggered for i=" + i); + + resetStatus(); + startTest = true; + robot.keyPress(textKeys[j]); + robot.waitForIdle(); + if (! modifierStatus[i] || ! textStatus[j]) { + synchronized (keyLock) { keyLock.wait(waitDelay); } + } + + + assertTrue(modifierStatus[i] && textStatus[j], + "FAIL: KeyEvent not proper!"+ + "Key checked: i=" + i + "; j=" + j+ + "ModifierStatus = " + modifierStatus[i]+ + "TextStatus = " + textStatus[j]); + startTest = false; + robot.keyRelease(textKeys[j]); + robot.waitForIdle(); + robot.keyRelease(modifierKeys[i]); + robot.waitForIdle(); + } + } + + for (int i = 0; i < modifierKeys.length; i++) { + for (int j = i + 1; j < modifierKeys.length; j++) { + for (int k = 0; k < textKeys.length; k++) { + tempPress = false; + robot.keyPress(modifierKeys[i]); + robot.waitForIdle(); + if (! tempPress) { + synchronized (tempLock) { tempLock.wait(waitDelay); } + } + + assertTrue(tempPress, "FAIL: MultiKeyTest: keyPressed triggered for i=" + i); + + tempPress = false; + robot.keyPress(modifierKeys[j]); + robot.waitForIdle(); + if (! tempPress) { + synchronized (tempLock) { tempLock.wait(waitDelay); } + } + assertTrue(tempPress, "FAIL: MultiKeyTest keyPressed triggered for j=" + j); + + resetStatus(); + startTest = true; + robot.keyPress(textKeys[k]); + robot.waitForIdle(); + if (! modifierStatus[i] || ! modifierStatus[j] || ! textStatus[k]) { + synchronized (keyLock) { + keyLock.wait(waitDelay); + } + } + assertTrue(modifierStatus[i] && modifierStatus[j] && textStatus[k], + "FAIL: KeyEvent not proper!"+ + "Key checked: i=" + i + "; j=" + j + "; k=" + k+ + "Modifier1Status = " + modifierStatus[i]+ + "Modifier2Status = " + modifierStatus[j]+ + "TextStatus = " + textStatus[k]); + + startTest = false; + robot.keyRelease(textKeys[k]); + robot.waitForIdle(); + robot.keyRelease(modifierKeys[j]); + robot.waitForIdle(); + robot.keyRelease(modifierKeys[i]); + robot.waitForIdle(); + } + } + } + + frame.dispose(); + } + + private void resetStatus() { + for (int i = 0; i < modifierStatus.length; i++) { + modifierStatus[i] = false; + } + for (int i = 0; i < textStatus.length; i++) { + textStatus[i] = false; + } + } + +} diff --git a/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java b/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java new file mode 100644 index 00000000000..37aef352a15 --- /dev/null +++ b/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.*; +import java.awt.event.KeyEvent; + +/* + @test + @summary verify LOCK buttons toogle + @author Yuri.Nesterenko, Dmitriy.Ermashov + @library ../../../../lib/testlibrary + @build ExtendedRobot + @run main LockingKeyStateTest +*/ + +public class LockingKeyStateTest { + + Frame frame; + ExtendedRobot robot; + + // Note that Kana lock you may actually toggle only if you have one. + static int[] lockingKeys = { KeyEvent.VK_CAPS_LOCK, KeyEvent.VK_NUM_LOCK, + KeyEvent.VK_SCROLL_LOCK, KeyEvent.VK_KANA_LOCK }; + boolean[] getSupported = new boolean[lockingKeys.length]; + boolean[] setSupported = new boolean[lockingKeys.length]; + boolean[] state0 = new boolean[lockingKeys.length]; + + Toolkit toolkit = Toolkit.getDefaultToolkit(); + + LockingKeyStateTest() throws Exception { + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGui ); + } + + void toggleAllTrue(){toggleAll(true);} + void toggleAllFalse(){toggleAll(false);} + void toggleAll(boolean b) { + for(int i = 0; i < lockingKeys.length; i++) { + if(setSupported[i]) { + toolkit.setLockingKeyState(lockingKeys[i], b); + } + } + } + + void checkAllTrue(){checkAll(true);} + void checkAllFalse(){checkAll(false);} + void checkAll(boolean b) { + for(int i = 0; i < lockingKeys.length; i++) { + if(getSupported[i] && setSupported[i]) { + if (!(toolkit.getLockingKeyState(lockingKeys[i]) == b)) + throw new RuntimeException("State of "+KeyEvent.getKeyText(lockingKeys[i])+" is not "+b); + System.out.println("OK, state of "+KeyEvent.getKeyText(lockingKeys[i])+" is "+b); + } + } + } + + void restoreAll() { + for(int i = 0; i < lockingKeys.length; i++) { + if(setSupported[i] && getSupported[i]) { + toolkit.setLockingKeyState(lockingKeys[i], state0[i]); + } + } + } + + public void createGui() { + for(int i = 0; i < lockingKeys.length; i++) { + getSupported[i] = false; + setSupported[i] = false; + try { + state0[i] = toolkit.getLockingKeyState(lockingKeys[i]); + getSupported[i] = true; + toolkit.setLockingKeyState(lockingKeys[i], state0[i]); + setSupported[i] = true; + } catch (UnsupportedOperationException uoe) { + } + System.out.println(" State get/set of "+KeyEvent.getKeyText(lockingKeys[i])+" is supported? "+ + getSupported[i]+", "+setSupported[i]); + } + frame = new Frame("LockingKeyStateTest Title"); + frame.setSize(200,200); + frame.setVisible(true); + } + + void doTest() throws Exception{ + robot.waitForIdle(); + robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth() / 2, + frame.getLocationOnScreen().y + frame.getHeight() / 2); + robot.click(); + + EventQueue.invokeAndWait( this::toggleAllTrue ); + robot.waitForIdle(2000); + EventQueue.invokeAndWait( this::checkAllTrue ); + EventQueue.invokeAndWait( this::toggleAllFalse ); + robot.waitForIdle(2000); + EventQueue.invokeAndWait( this::checkAllFalse ); + EventQueue.invokeAndWait( this::restoreAll ); + robot.waitForIdle(); + + frame.dispose(); + } + + public static void main(String argv[]) throws Exception { + LockingKeyStateTest af = new LockingKeyStateTest(); + af.doTest(); + } +} From c6886100bee271e778ac99813d655e76b96e2e2d Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Mon, 21 Apr 2014 16:32:41 +0400 Subject: [PATCH 016/185] 8024061: Exception thrown when drag and drop between two components is executed quickly Reviewed-by: pchelko, serb --- .../sun/awt/dnd/SunDropTargetContextPeer.java | 9 +- jdk/test/sun/awt/dnd/8024061/bug8024061.java | 357 ++++++++++++++++++ 2 files changed, 365 insertions(+), 1 deletion(-) create mode 100644 jdk/test/sun/awt/dnd/8024061/bug8024061.java diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java index 2efea8da2de..842b387f6f4 100644 --- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java +++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -239,6 +239,13 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, if (localTransferable != null) { return localTransferable.getTransferData(df); + } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) { + // Workaround to JDK-8024061: Exception thrown when drag and drop + // between two components is executed quickly. + // It is expected localTransferable is not null if javaJVMLocalObjectMimeType + // is used. Executing further results in ClassCastException, so null is + // returned here as no transfer data is available in this case. + return null; } if (dropStatus != STATUS_ACCEPT || dropComplete) { diff --git a/jdk/test/sun/awt/dnd/8024061/bug8024061.java b/jdk/test/sun/awt/dnd/8024061/bug8024061.java new file mode 100644 index 00000000000..07165c09a61 --- /dev/null +++ b/jdk/test/sun/awt/dnd/8024061/bug8024061.java @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2014, 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 8024061 + * @summary Checks that no exception is thrown if dragGestureRecognized + * takes a while to complete. + */ +import sun.awt.OSInfo; +import sun.awt.OSInfo.OSType; +import sun.awt.SunToolkit; + +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.swing.*; + +/** + * If dragGestureRecognized() takes a while to complete and if user performs a drag quickly, + * an exception is thrown from DropTargetListener.dragEnter when it calls + * DropTargetDragEvent.getTransferable(). + *

    + * This class introduces a delay in dragGestureRecognized() to cause the exception. + */ +public class bug8024061 { + private static final DataFlavor DropObjectFlavor; + private static final int DELAY = 1000; + + private final DnDPanel panel1 = new DnDPanel(Color.yellow); + private final DnDPanel panel2 = new DnDPanel(Color.pink); + private final JFrame frame; + + private static final CountDownLatch lock = new CountDownLatch(1); + private static volatile Exception dragEnterException = null; + + static { + DataFlavor flavor = null; + try { + flavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + DropObjectFlavor = flavor; + } + + bug8024061() { + frame = new JFrame("DnDWithRobot"); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + + Dimension d = new Dimension(100, 100); + + panel1.setPreferredSize(d); + panel2.setPreferredSize(d); + + Container content = frame.getContentPane(); + content.setLayout(new GridLayout(1, 2, 5, 5)); + content.add(panel1); + content.add(panel2); + + frame.pack(); + + DropObject drop = new DropObject(); + drop.place(panel1, new Point(10, 10)); + frame.setVisible(true); + } + + public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException { + OSType type = OSInfo.getOSType(); + if (type != OSType.LINUX && type != OSType.SOLARIS) { + System.out.println("This test is for Linux and Solaris only... " + + "skipping!"); + return; + } + + final bug8024061[] dnd = {null}; + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + dnd[0] = new bug8024061(); + } + }); + final Robot robot = new Robot(); + robot.setAutoDelay(10); + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + JFrame frame = dnd[0].frame; + Point point = frame.getLocationOnScreen(); + Point here = new Point(point.x + 35, point.y + 45); + Point there = new Point(point.x + 120, point.y + 45); + here.x += 25; + robot.mouseMove(here.x, here.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + while (here.x < there.x) { + here.x += 20; + robot.mouseMove(here.x, here.y); + System.out.println("x = " + here.x); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + System.out.println("finished"); + + try { + if (lock.await(5, TimeUnit.SECONDS)) { + if (dragEnterException == null) { + System.out.println("Test passed."); + } else { + System.out.println("Test failed."); + dragEnterException.printStackTrace(); + throw new RuntimeException(dragEnterException); + } + } else { + System.out.println("Test failed. Timeout reached"); + throw new RuntimeException("Timed out waiting for dragEnter()"); + } + } finally { + frame.dispose(); + } + } + + class DropObject implements Transferable { + DnDPanel panel; + Color color = Color.CYAN; + int width = 50; + int height = 50; + int x; + int y; + + void draw(Graphics2D g) { + Color savedColor = g.getColor(); + g.setColor(color); + g.fillRect(x, y, width, height); + g.setColor(Color.lightGray); + g.drawRect(x, y, width, height); + g.setColor(savedColor); + } + + boolean contains(int x, int y) { + return (x > this.x && x < this.x + width) + && (y > this.y && y < this.y + height); + } + + @Override + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[]{DropObjectFlavor}; + } + + void place(DnDPanel panel, Point location) { + if (panel != this.panel) { + x = location.x; + y = location.y; + if (this.panel != null) { + this.panel.setDropObject(null); + this.panel.repaint(); + } + this.panel = panel; + this.panel.setDropObject(this); + this.panel.repaint(); + } + } + + @Override + public boolean isDataFlavorSupported(DataFlavor flavor) { + return DropObjectFlavor.equals(flavor); + } + + @Override + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + if (isDataFlavorSupported(flavor)) { + return this; + } else { + throw new UnsupportedFlavorException(flavor); + } + } + } + + class DnDPanel extends JPanel { + DropObject dropObject; + final DragSource dragSource; + final DropTarget dropTarget; + final Color color; + final DragGestureListener dgListener; + final DragSourceListener dsListener; + final DropTargetListener dtListener; + + DnDPanel(Color color) { + this.color = color; + this.dragSource = DragSource.getDefaultDragSource(); + dgListener = new DragGestureListener() { + @Override + public void dragGestureRecognized(DragGestureEvent dge) { + Point location = dge.getDragOrigin(); + if (dropObject != null && dropObject.contains(location.x, location.y)) { + dragSource.startDrag(dge, DragSource.DefaultCopyNoDrop, dropObject, dsListener); + try { + Thread.sleep(DELAY); + } catch (InterruptedException e) { + } + } + } + }; + + dsListener = new DragSourceListener() { + @Override + public void dragEnter(DragSourceDragEvent dsde) { + } + + @Override + public void dragOver(DragSourceDragEvent dsde) { + } + + @Override + public void dropActionChanged(DragSourceDragEvent dsde) { + } + + @Override + public void dragExit(DragSourceEvent dse) { + } + + @Override + public void dragDropEnd(DragSourceDropEvent dsde) { + } + }; + + dtListener = new DropTargetListener() { + @Override + public void dragEnter(DropTargetDragEvent dtde) { + if (dropObject != null) { + dtde.rejectDrag(); + return; + } + dtde.acceptDrag(DnDConstants.ACTION_MOVE); + try { + Transferable t = dtde.getTransferable(); + Object data = t.getTransferData(DropObjectFlavor); + if (data != null) { + throw new Exception("getTransferData returned non-null"); + } + } catch (Exception e) { + dragEnterException = e; + e.printStackTrace(); + } finally { + lock.countDown(); + } + } + + @Override + public void dragOver(DropTargetDragEvent dtde) { + if (dropObject != null) { + dtde.rejectDrag(); + return; + } + dtde.acceptDrag(DnDConstants.ACTION_MOVE); + } + + @Override + public void dropActionChanged(DropTargetDragEvent dtde) { + } + + @Override + public void dragExit(DropTargetEvent dte) { + } + + @Override + public void drop(DropTargetDropEvent dtde) { + if (dropObject != null) { + dtde.rejectDrop(); + return; + } + try { + dtde.acceptDrop(DnDConstants.ACTION_MOVE); + Transferable t = dtde.getTransferable(); + DropObject dropObject = (DropObject) t.getTransferData(DropObjectFlavor); + Point location = dtde.getLocation(); + dropObject.place(DnDPanel.this, location); + dtde.dropComplete(true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + }; + + dragSource.createDefaultDragGestureRecognizer(this, + DnDConstants.ACTION_MOVE, dgListener); + + dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, dtListener, true); + + } + + public void paintComponent(Graphics g) { + super.paintComponent(g); + Color savedColor = g.getColor(); + g.setColor(color); + g.fillRect(0, 0, getWidth(), getHeight()); + g.setColor(savedColor); + if (dropObject != null) { + dropObject.draw((Graphics2D) g); + } + } + + void setDropObject(DropObject dropObject) { + this.dropObject = dropObject; + } + + DropObject findDropObject(int x, int y) { + if (dropObject != null && dropObject.contains(x, y)) { + return dropObject; + } + return null; + } + } +} From 1d1194721bbf7749899315b2316a31ad143f083a Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 21 Apr 2014 20:59:59 +0400 Subject: [PATCH 017/185] 8040656: Classes with overriden methods with covariant returns return random read methods Reviewed-by: alexsch, serb --- .../classes/java/beans/MethodDescriptor.java | 13 +- .../java/beans/Introspector/Test8040656.java | 311 ++++++++++++++++++ 2 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 jdk/test/java/beans/Introspector/Test8040656.java diff --git a/jdk/src/share/classes/java/beans/MethodDescriptor.java b/jdk/src/share/classes/java/beans/MethodDescriptor.java index da2f754c97e..1e169046746 100644 --- a/jdk/src/share/classes/java/beans/MethodDescriptor.java +++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java @@ -162,6 +162,16 @@ public class MethodDescriptor extends FeatureDescriptor { : null; } + private static Method resolve(Method oldMethod, Method newMethod) { + if (oldMethod == null) { + return newMethod; + } + if (newMethod == null) { + return oldMethod; + } + return !oldMethod.isSynthetic() && newMethod.isSynthetic() ? oldMethod : newMethod; + } + /* * Package-private constructor * Merge two method descriptors. Where they conflict, give the @@ -173,8 +183,7 @@ public class MethodDescriptor extends FeatureDescriptor { MethodDescriptor(MethodDescriptor x, MethodDescriptor y) { super(x, y); - Method method = y.methodRef.get(); - this.methodRef.set(null != method ? method : x.methodRef.get()); + this.methodRef.set(resolve(x.methodRef.get(), y.methodRef.get())); params = x.params; if (y.params != null) { params = y.params; diff --git a/jdk/test/java/beans/Introspector/Test8040656.java b/jdk/test/java/beans/Introspector/Test8040656.java new file mode 100644 index 00000000000..73e80ac377f --- /dev/null +++ b/jdk/test/java/beans/Introspector/Test8040656.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.beans.Introspector; +import java.beans.MethodDescriptor; + +/* + * @test + * @bug 8040656 + * @summary Tests that a normal method is preferred to a synthetic one + * @author Sergey Malenkov + */ + +public class Test8040656 { + public static void main(String[] args) throws Exception { + test(String.class, C.class); + test(String.class, C1.class); + test(String.class, C2.class); + test(String.class, C3.class); + test(String.class, C4.class); + test(String.class, C5.class); + test(String.class, C6.class); + test(String.class, C7.class); + test(String.class, C8.class); + test(String.class, C9.class); + } + + private static void test(Class type, Class bean) throws Exception { + for (MethodDescriptor md : Introspector.getBeanInfo(bean).getMethodDescriptors()) { + if (md.getName().equals("getFoo")) { + if (type != md.getMethod().getReturnType()) { + throw new Error("unexpected type"); + } + } + } + } + + public interface A { + public Object getFoo(); + } + + public class C implements A { + @Override + public String getFoo() { + return null; + } + } + + public class C1 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + } + + public class C2 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + } + + public class C3 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + } + + public class C4 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + } + + public class C5 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + + public String getFoo5() { + return null; + } + } + + public class C6 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + + public String getFoo5() { + return null; + } + + public String getFoo6() { + return null; + } + } + + public class C7 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + + public String getFoo5() { + return null; + } + + public String getFoo6() { + return null; + } + + public String getFoo7() { + return null; + } + } + + public class C8 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + + public String getFoo5() { + return null; + } + + public String getFoo6() { + return null; + } + + public String getFoo7() { + return null; + } + + public String getFoo8() { + return null; + } + } + + public class C9 implements A { + @Override + public String getFoo() { + return null; + } + + public String getFoo1() { + return null; + } + + public String getFoo2() { + return null; + } + + public String getFoo3() { + return null; + } + + public String getFoo4() { + return null; + } + + public String getFoo5() { + return null; + } + + public String getFoo6() { + return null; + } + + public String getFoo7() { + return null; + } + + public String getFoo8() { + return null; + } + + public String getFoo9() { + return null; + } + } +} From 7025bc84e60aab89f5ce8b435273c4f763c90d95 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 21 Apr 2014 23:39:30 -0700 Subject: [PATCH 018/185] 8039862: Fix fallthrough lint warnings in 2d Reviewed-by: flar --- jdk/src/share/classes/sun/font/SunFontManager.java | 1 + jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java | 2 ++ jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java | 1 + 3 files changed, 4 insertions(+) diff --git a/jdk/src/share/classes/sun/font/SunFontManager.java b/jdk/src/share/classes/sun/font/SunFontManager.java index 04df414365c..998713b4494 100644 --- a/jdk/src/share/classes/sun/font/SunFontManager.java +++ b/jdk/src/share/classes/sun/font/SunFontManager.java @@ -1161,6 +1161,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { case FONTFORMAT_NATIVE: NativeFont nf = new NativeFont(fileName, false); physicalFont = addToFontList(nf, fontRank); + break; default: } diff --git a/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java b/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java index febaf6a5eb7..4ebee6cd280 100644 --- a/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java +++ b/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java @@ -109,6 +109,7 @@ public class TrueTypeGlyphMapper extends CharToGlyphMapper { cmap = CMap.theNullCmap; } + @SuppressWarnings("fallthrough") private final char remapJAChar(char unicode) { switch (unicode) { case REVERSE_SOLIDUS: @@ -123,6 +124,7 @@ public class TrueTypeGlyphMapper extends CharToGlyphMapper { default: return unicode; } } + @SuppressWarnings("fallthrough") private final int remapJAIntChar(int unicode) { switch (unicode) { case REVERSE_SOLIDUS: diff --git a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java index 4e6c24f2e23..1d83b65a876 100644 --- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java +++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java @@ -515,6 +515,7 @@ public abstract class X11SurfaceData extends XSurfaceData { return getSurfaceType(gc, transparency, false); } + @SuppressWarnings("fallthrough") public static SurfaceType getSurfaceType(X11GraphicsConfig gc, int transparency, boolean pixmapSurface) From f341bacaf3da00f13c04a1bd03480ae1266eb05c Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Tue, 22 Apr 2014 17:55:25 -0700 Subject: [PATCH 019/185] 8039860: Fix fallthrough lint warnings in swing Reviewed-by: malenkov --- .../com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java | 1 + .../java/swing/plaf/windows/WindowsLookAndFeel.java | 1 + .../java/swing/plaf/windows/WindowsTableHeaderUI.java | 2 +- .../javax/swing/plaf/metal/MetalLookAndFeel.java | 3 ++- .../share/classes/javax/swing/text/JTextComponent.java | 1 + .../classes/javax/swing/text/html/StyleSheet.java | 1 + .../swing/text/html/parser/ContentModelState.java | 4 +++- .../classes/javax/swing/text/html/parser/Parser.java | 10 ++++++++++ .../classes/javax/swing/text/rtf/RTFGenerator.java | 3 ++- .../share/classes/javax/swing/text/rtf/RTFParser.java | 3 ++- 10 files changed, 24 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java index d86b4ec92ac..b35e60d7ec6 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java @@ -1683,6 +1683,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { * adjustments that windows/metal do. This is because gtk doesn't * provide margins/insets for checkbox/radiobuttons. */ + @SuppressWarnings("fallthrough") private static class GnomeLayoutStyle extends DefaultLayoutStyle { private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle(); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java index 00530fa19ea..a6c1c895757 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java @@ -2409,6 +2409,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel // Windows LayoutStyle. From: // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp + @SuppressWarnings("fallthrough") private class WindowsLayoutStyle extends DefaultLayoutStyle { @Override public int getPreferredGap(JComponent component1, diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java index c5101177f40..117e9d7b7b1 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java @@ -182,7 +182,6 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI { if (sortOrder != null) { switch(sortOrder) { case ASCENDING: - /* falls through */ case DESCENDING: switch (state) { case NORMAL: @@ -197,6 +196,7 @@ public class WindowsTableHeaderUI extends BasicTableHeaderUI { default: /* do nothing */ } + break; default : /* do nothing */ } diff --git a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java index 6a64676673b..b1aea28c79f 100644 --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -2271,6 +2271,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel // From the JLF Design Guidelines: // http://www.oracle.com/technetwork/java/jlf-135985.html + @SuppressWarnings("fallthrough") private static class MetalLayoutStyle extends DefaultLayoutStyle { private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle(); @@ -2407,4 +2408,4 @@ public class MetalLookAndFeel extends BasicLookAndFeel return 0; } } -} \ No newline at end of file +} diff --git a/jdk/src/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/share/classes/javax/swing/text/JTextComponent.java index 94f950eb88b..ca3c9ebef1a 100644 --- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java +++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java @@ -4473,6 +4473,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A // composed(uncommitted) text is done here after all input // method listeners get called for stealing the events. // + @SuppressWarnings("fallthrough") protected void processInputMethodEvent(InputMethodEvent e) { // let listeners handle the events super.processInputMethodEvent(e); diff --git a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java index de0f2b91fe5..4c5d8d95ce5 100644 --- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java +++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java @@ -2324,6 +2324,7 @@ public class StyleSheet extends StyleContext { * @param itemNum number to format * @param type type of ordered list */ + @SuppressWarnings("fallthrough") String formatItemNum(int itemNum, char type) { String numStyle = "1"; diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java index fb623981fcc..3bc9825d9c0 100644 --- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java +++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -92,12 +92,14 @@ class ContentModelState { * tokens required in the input stream. * @return true if the model can terminate without further input */ + @SuppressWarnings("fallthrough") public boolean terminate() { switch (model.type) { case '+': if ((value == 0) && !(model).empty()) { return false; } + // Fall through case '*': case '?': return (next == null) || next.terminate(); diff --git a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java index 79124461f9c..0963b4b6dc9 100644 --- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java +++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java @@ -852,6 +852,7 @@ class Parser implements DTDConstants { if (lower) { ch = 'a' + (ch - 'A'); } + break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': @@ -876,6 +877,7 @@ class Parser implements DTDConstants { if (lower) { ch = 'a' + (ch - 'A'); } + break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': @@ -1214,6 +1216,7 @@ class Parser implements DTDConstants { /** * Parse attribute value. [33] 331:1 */ + @SuppressWarnings("fallthrough") String parseAttributeValue(boolean lower) throws IOException { int delim = -1; @@ -1258,6 +1261,7 @@ class Parser implements DTDConstants { case '\t': if (delim < 0) c = ' '; + // Fall through case ' ': ch = readCh(); if (delim < 0) { @@ -1559,6 +1563,7 @@ class Parser implements DTDConstants { /** * Parse a start or end tag. */ + @SuppressWarnings("fallthrough") void parseTag() throws IOException { Element elem; boolean net = false; @@ -1602,6 +1607,7 @@ class Parser implements DTDConstants { continue; case '>': ch = readCh(); + return; case -1: return; default: @@ -1626,6 +1632,7 @@ class Parser implements DTDConstants { switch(ch) { case '>': ch = readCh(); + // Fall through case -1: error("invalid.markup"); return; @@ -1657,6 +1664,7 @@ class Parser implements DTDConstants { switch (ch = readCh()) { case '>': ch = readCh(); + // Fall through case '<': // empty end tag. either or ': ch = readCh(); + break; case '<': break; @@ -1875,6 +1884,7 @@ class Parser implements DTDConstants { switch (ch) { case '/': net = true; + // Fall through case '>': ch = readCh(); if (ch == '>' && net) { diff --git a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java index 38b2b7ad864..7aba1408039 100644 --- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java +++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -868,6 +868,7 @@ public void writeEndgroup() afterKeyword = false; } +@SuppressWarnings("fallthrough") public void writeCharacter(char ch) throws IOException { diff --git a/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java b/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java index a251552d76c..2b4969dda1e 100644 --- a/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java +++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -148,6 +148,7 @@ abstract class RTFParser extends AbstractFilter handleText(s); } + @SuppressWarnings("fallthrough") public void write(char ch) throws IOException { From 1b4d763c777d1ba965d002892051b9a249055b2d Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 23 Apr 2014 17:56:05 +0400 Subject: [PATCH 020/185] 8027148: SystemFlavorMap.getNativesForFlavor returns list of native formats in incorrect order Reviewed-by: anthony, serb --- .../awt/datatransfer/SystemFlavorMap.java | 359 ++++++++---------- .../sun/awt/datatransfer/DataTransferer.java | 25 +- .../classes/sun/awt/X11/XDataTransferer.java | 9 +- .../MappingGenerationTest.java | 183 +++++++++ 4 files changed, 344 insertions(+), 232 deletions(-) create mode 100644 jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java diff --git a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java index bc6e1642001..fd54c9414a0 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java +++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java @@ -38,13 +38,14 @@ import java.net.URL; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; -import java.util.WeakHashMap; import sun.awt.AppContext; import sun.awt.datatransfer.DataTransferer; @@ -101,20 +102,12 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ private static final String HTML_TEXT_BASE_TYPE = "text/html"; - /** - * This constant is passed to flavorToNativeLookup() to indicate that a - * a native should be synthesized, stored, and returned by encoding the - * DataFlavor's MIME type in case if the DataFlavor is not found in - * 'flavorToNative' map. - */ - private static final boolean SYNTHESIZE_IF_NOT_FOUND = true; - /** * Maps native Strings to Lists of DataFlavors (or base type Strings for * text DataFlavors). * Do not use the field directly, use getNativeToFlavor() instead. */ - private final Map> nativeToFlavor = new HashMap<>(); + private final Map> nativeToFlavor = new HashMap<>(); /** * Accessor to nativeToFlavor map. Since we use lazy initialization we must @@ -123,7 +116,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * * @return nativeToFlavor */ - private Map> getNativeToFlavor() { + private Map> getNativeToFlavor() { if (!isMapInitialized) { initSystemFlavorMap(); } @@ -135,7 +128,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * native Strings. * Do not use the field directly, use getFlavorToNative() instead. */ - private final Map> flavorToNative = new HashMap<>(); + private final Map> flavorToNative = new HashMap<>(); /** * Accessor to flavorToNative map. Since we use lazy initialization we must @@ -144,29 +137,52 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * * @return flavorToNative */ - private synchronized Map> getFlavorToNative() { + private synchronized Map> getFlavorToNative() { if (!isMapInitialized) { initSystemFlavorMap(); } return flavorToNative; } + /** + * Maps a text DataFlavor primary mime-type to the native. Used only to store + * standard mappings registered in the flavormap.properties + * Do not use this field directly, use getTextTypeToNative() instead. + */ + private Map> textTypeToNative = new HashMap<>(); + /** * Shows if the object has been initialized. */ private boolean isMapInitialized = false; /** - * Caches the result of getNativesForFlavor(). Maps DataFlavors to - * SoftReferences which reference Lists of String natives. + * An accessor to textTypeToNative map. Since we use lazy initialization we + * must use this accessor instead of direct access to the field which may not + * be initialized yet. This method will initialize the field if needed. + * + * @return textTypeToNative */ - private Map>> getNativesForFlavorCache = new HashMap<>(); + private synchronized Map> getTextTypeToNative() { + if (!isMapInitialized) { + initSystemFlavorMap(); + // From this point the map should not be modified + textTypeToNative = Collections.unmodifiableMap(textTypeToNative); + } + return textTypeToNative; + } + + /** + * Caches the result of getNativesForFlavor(). Maps DataFlavors to + * SoftReferences which reference LinkedHashSet of String natives. + */ + private final SoftCache nativesForFlavorCache = new SoftCache<>(); /** * Caches the result getFlavorsForNative(). Maps String natives to - * SoftReferences which reference Lists of DataFlavors. + * SoftReferences which reference LinkedHashSet of DataFlavors. */ - private Map>> getFlavorsForNativeCache = new HashMap<>(); + private final SoftCache flavorsForNativeCache = new SoftCache<>(); /** * Dynamic mapping generation used for text mappings should not be applied @@ -174,7 +190,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * explicitly specified with setFlavorsForNative() or * setNativesForFlavor(). This keeps all such keys. */ - private Set disabledMappingGenerationKeys = new HashSet(); + private Set disabledMappingGenerationKeys = new HashSet<>(); /** * Returns the default FlavorMap for this thread's ClassLoader. @@ -404,7 +420,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { flavor = new DataFlavor(value); } catch (Exception e) { try { - flavor = new DataFlavor(value, (String)null); + flavor = new DataFlavor(value, null); } catch (Exception ee) { ee.printStackTrace(); continue; @@ -412,11 +428,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } final LinkedHashSet dfs = new LinkedHashSet<>(); - dfs.add(flavor); if ("text".equals(flavor.getPrimaryType())) { dfs.addAll(convertMimeTypeToDataFlavors(value)); + store(flavor.mimeType.getBaseType(), key, getTextTypeToNative()); } for (DataFlavor df : dfs) { @@ -505,10 +521,10 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * the appropriate Map location, but rather will be appended to a List * stored in that location. */ - private void store(H hashed, L listed, Map> map) { - List list = map.get(hashed); + private void store(H hashed, L listed, Map> map) { + LinkedHashSet list = map.get(hashed); if (list == null) { - list = new ArrayList<>(1); + list = new LinkedHashSet<>(1); map.put(hashed, list); } if (!list.contains(listed)) { @@ -522,17 +538,16 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * case, a new DataFlavor is synthesized, stored, and returned, if and * only if the specified native is encoded as a Java MIME type. */ - private List nativeToFlavorLookup(String nat) { - List flavors = getNativeToFlavor().get(nat); + private LinkedHashSet nativeToFlavorLookup(String nat) { + LinkedHashSet flavors = getNativeToFlavor().get(nat); if (nat != null && !disabledMappingGenerationKeys.contains(nat)) { DataTransferer transferer = DataTransferer.getInstance(); if (transferer != null) { - List platformFlavors = + LinkedHashSet platformFlavors = transferer.getPlatformMappingsForNative(nat); if (!platformFlavors.isEmpty()) { if (flavors != null) { - platformFlavors.removeAll(new HashSet<>(flavors)); // Prepending the platform-specific mappings ensures // that the flavors added with // addFlavorForUnencodedNative() are at the end of @@ -558,24 +573,22 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } if (flavor != null) { - flavors = new ArrayList<>(1); + flavors = new LinkedHashSet<>(1); getNativeToFlavor().put(nat, flavors); flavors.add(flavor); - getFlavorsForNativeCache.remove(nat); - getFlavorsForNativeCache.remove(null); + flavorsForNativeCache.remove(nat); - List natives = getFlavorToNative().get(flavor); + LinkedHashSet natives = getFlavorToNative().get(flavor); if (natives == null) { - natives = new ArrayList<>(1); + natives = new LinkedHashSet<>(1); getFlavorToNative().put(flavor, natives); } natives.add(nat); - getNativesForFlavorCache.remove(flavor); - getNativesForFlavorCache.remove(null); + nativesForFlavorCache.remove(flavor); } } - return (flavors != null) ? flavors : new ArrayList<>(0); + return (flavors != null) ? flavors : new LinkedHashSet<>(0); } /** @@ -586,18 +599,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * encoding the DataFlavor's MIME type. Otherwise an empty List is returned * and 'flavorToNative' remains unaffected. */ - private List flavorToNativeLookup(final DataFlavor flav, - final boolean synthesize) { - List natives = getFlavorToNative().get(flav); + private LinkedHashSet flavorToNativeLookup(final DataFlavor flav, + final boolean synthesize) { + + LinkedHashSet natives = getFlavorToNative().get(flav); if (flav != null && !disabledMappingGenerationKeys.contains(flav)) { DataTransferer transferer = DataTransferer.getInstance(); if (transferer != null) { - List platformNatives = + LinkedHashSet platformNatives = transferer.getPlatformMappingsForFlavor(flav); if (!platformNatives.isEmpty()) { if (natives != null) { - platformNatives.removeAll(new HashSet<>(natives)); // Prepend the platform-specific mappings to ensure // that the natives added with // addUnencodedNativeForFlavor() are at the end of @@ -612,26 +625,25 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { if (natives == null) { if (synthesize) { String encoded = encodeDataFlavor(flav); - natives = new ArrayList<>(1); + natives = new LinkedHashSet<>(1); getFlavorToNative().put(flav, natives); natives.add(encoded); - getNativesForFlavorCache.remove(flav); - getNativesForFlavorCache.remove(null); - List flavors = getNativeToFlavor().get(encoded); + LinkedHashSet flavors = getNativeToFlavor().get(encoded); if (flavors == null) { - flavors = new ArrayList<>(1); + flavors = new LinkedHashSet<>(1); getNativeToFlavor().put(encoded, flavors); } flavors.add(flav); - getFlavorsForNativeCache.remove(encoded); - getFlavorsForNativeCache.remove(null); + + nativesForFlavorCache.remove(flav); + flavorsForNativeCache.remove(encoded); } else { - natives = new ArrayList<>(0); + natives = new LinkedHashSet<>(0); } } - return natives; + return new LinkedHashSet<>(natives); } /** @@ -659,103 +671,63 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * @see #encodeDataFlavor * @since 1.4 */ + @Override public synchronized List getNativesForFlavor(DataFlavor flav) { - List retval = null; - - // Check cache, even for null flav - SoftReference> ref = getNativesForFlavorCache.get(flav); - if (ref != null) { - retval = ref.get(); - if (retval != null) { - // Create a copy, because client code can modify the returned - // list. - return new ArrayList<>(retval); - } + LinkedHashSet retval = nativesForFlavorCache.check(flav); + if (retval != null) { + return new ArrayList<>(retval); } if (flav == null) { - retval = new ArrayList<>(getNativeToFlavor().keySet()); + retval = new LinkedHashSet<>(getNativeToFlavor().keySet()); } else if (disabledMappingGenerationKeys.contains(flav)) { // In this case we shouldn't synthesize a native for this flavor, // since its mappings were explicitly specified. - retval = flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND); + retval = flavorToNativeLookup(flav, false); } else if (DataTransferer.isFlavorCharsetTextType(flav)) { + retval = new LinkedHashSet<>(0); // For text/* flavors, flavor-to-native mappings specified in // flavormap.properties are stored per flavor's base type. if ("text".equals(flav.getPrimaryType())) { - retval = getAllNativesForType(flav.mimeType.getBaseType()); - if (retval != null) { - // To prevent the List stored in the map from modification. - retval = new ArrayList(retval); + LinkedHashSet textTypeNatives = + getTextTypeToNative().get(flav.mimeType.getBaseType()); + if (textTypeNatives != null) { + retval.addAll(textTypeNatives); } } // Also include text/plain natives, but don't duplicate Strings - List textPlainList = getAllNativesForType(TEXT_PLAIN_BASE_TYPE); - - if (textPlainList != null && !textPlainList.isEmpty()) { - // To prevent the List stored in the map from modification. - // This also guarantees that removeAll() is supported. - textPlainList = new ArrayList<>(textPlainList); - if (retval != null && !retval.isEmpty()) { - // Use HashSet to get constant-time performance for search. - textPlainList.removeAll(new HashSet<>(retval)); - retval.addAll(textPlainList); - } else { - retval = textPlainList; - } + LinkedHashSet textTypeNatives = + getTextTypeToNative().get(TEXT_PLAIN_BASE_TYPE); + if (textTypeNatives != null) { + retval.addAll(textTypeNatives); } - if (retval == null || retval.isEmpty()) { - retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND); + if (retval.isEmpty()) { + retval = flavorToNativeLookup(flav, true); } else { // In this branch it is guaranteed that natives explicitly // listed for flav's MIME type were added with // addUnencodedNativeForFlavor(), so they have lower priority. - List explicitList = - flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND); - - // flavorToNativeLookup() never returns null. - // It can return an empty List, however. - if (!explicitList.isEmpty()) { - // To prevent the List stored in the map from modification. - // This also guarantees that removeAll() is supported. - explicitList = new ArrayList<>(explicitList); - // Use HashSet to get constant-time performance for search. - explicitList.removeAll(new HashSet<>(retval)); - retval.addAll(explicitList); - } + retval.addAll(flavorToNativeLookup(flav, false)); } } else if (DataTransferer.isFlavorNoncharsetTextType(flav)) { - retval = getAllNativesForType(flav.mimeType.getBaseType()); + retval = getTextTypeToNative().get(flav.mimeType.getBaseType()); if (retval == null || retval.isEmpty()) { - retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND); + retval = flavorToNativeLookup(flav, true); } else { // In this branch it is guaranteed that natives explicitly // listed for flav's MIME type were added with // addUnencodedNativeForFlavor(), so they have lower priority. - List explicitList = - flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND); - - // flavorToNativeLookup() never returns null. - // It can return an empty List, however. - if (!explicitList.isEmpty()) { - // To prevent the List stored in the map from modification. - // This also guarantees that add/removeAll() are supported. - retval = new ArrayList<>(retval); - explicitList = new ArrayList<>(explicitList); - // Use HashSet to get constant-time performance for search. - explicitList.removeAll(new HashSet<>(retval)); - retval.addAll(explicitList); - } + retval.addAll(flavorToNativeLookup(flav, false)); } } else { - retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND); + retval = flavorToNativeLookup(flav, true); } - getNativesForFlavorCache.put(flav, new SoftReference<>(retval)); + nativesForFlavorCache.put(flav, retval); // Create a copy, because client code can modify the returned list. return new ArrayList<>(retval); } @@ -791,62 +763,38 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * @see #encodeJavaMIMEType * @since 1.4 */ + @Override public synchronized List getFlavorsForNative(String nat) { - - // Check cache, even for null nat - SoftReference> ref = getFlavorsForNativeCache.get(nat); - if (ref != null) { - List retval = ref.get(); - if (retval != null) { - return new ArrayList<>(retval); - } + LinkedHashSet returnValue = flavorsForNativeCache.check(nat); + if (returnValue != null) { + return new ArrayList<>(returnValue); + } else { + returnValue = new LinkedHashSet<>(); } - final LinkedHashSet returnValue = - new LinkedHashSet<>(); - if (nat == null) { - final List natives = getNativesForFlavor(null); - - for (String n : natives) - { - final List flavors = getFlavorsForNative(n); - - for (DataFlavor df : flavors) - { - returnValue.add(df); - } + for (String n : getNativesForFlavor(null)) { + returnValue.addAll(getFlavorsForNative(n)); } } else { - - final List flavors = nativeToFlavorLookup(nat); - + final LinkedHashSet flavors = nativeToFlavorLookup(nat); if (disabledMappingGenerationKeys.contains(nat)) { - return flavors; + return new ArrayList<>(flavors); } - final List flavorsAndBaseTypes = - nativeToFlavorLookup(nat); + final LinkedHashSet flavorsWithSynthesized = + nativeToFlavorLookup(nat); - for (DataFlavor df : flavorsAndBaseTypes) { + for (DataFlavor df : flavorsWithSynthesized) { returnValue.add(df); if ("text".equals(df.getPrimaryType())) { - try { - returnValue.addAll( - convertMimeTypeToDataFlavors( - new MimeType(df.getMimeType() - ).getBaseType())); - } catch (MimeTypeParseException e) { - e.printStackTrace(); - } + String baseType = df.mimeType.getBaseType(); + returnValue.addAll(convertMimeTypeToDataFlavors(baseType)); } } - } - - final List arrayList = new ArrayList<>(returnValue); - getFlavorsForNativeCache.put(nat, new SoftReference<>(arrayList)); - return new ArrayList<>(arrayList); + flavorsForNativeCache.put(nat, returnValue); + return new ArrayList<>(returnValue); } private static Set convertMimeTypeToDataFlavors( @@ -862,7 +810,6 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } catch (MimeTypeParseException mtpe) { // Cannot happen, since we checked all mappings // on load from flavormap.properties. - assert(false); } if (DataTransferer.doesSubtypeSupportCharset(subType, null)) { @@ -941,10 +888,10 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { } private static final String [] htmlDocumntTypes = - new String [] {"all", "selection", "fragment"}; + new String [] {"all", "selection", "fragment"}; - private static LinkedHashSet handleHtmlMimeTypes( - String baseType, String mimeType) { + private static LinkedHashSet handleHtmlMimeTypes(String baseType, + String mimeType) { LinkedHashSet returnValues = new LinkedHashSet<>(); @@ -981,14 +928,14 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * @see #getNativesForFlavor * @see #encodeDataFlavor */ - public synchronized Map - getNativesForFlavors(DataFlavor[] flavors) + @Override + public synchronized Map getNativesForFlavors(DataFlavor[] flavors) { // Use getNativesForFlavor to generate extra natives for text flavors // and stringFlavor if (flavors == null) { - List flavor_list = getFlavorsForNative(null); + List flavor_list = getFlavorsForNative(null); flavors = new DataFlavor[flavor_list.size()]; flavor_list.toArray(flavors); } @@ -1027,15 +974,14 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { * @see #getFlavorsForNative * @see #encodeJavaMIMEType */ - public synchronized Map - getFlavorsForNatives(String[] natives) + @Override + public synchronized Map getFlavorsForNatives(String[] natives) { // Use getFlavorsForNative to generate extra flavors for text natives - if (natives == null) { - List native_list = getNativesForFlavor(null); - natives = new String[native_list.size()]; - native_list.toArray(natives); + List nativesList = getNativesForFlavor(null); + natives = new String[nativesList.size()]; + nativesList.toArray(natives); } Map retval = new HashMap<>(natives.length, 1.0f); @@ -1044,7 +990,6 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0); retval.put(aNative, flav); } - return retval; } @@ -1070,20 +1015,16 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ public synchronized void addUnencodedNativeForFlavor(DataFlavor flav, String nat) { - if (flav == null || nat == null) { - throw new NullPointerException("null arguments not permitted"); - } + Objects.requireNonNull(nat, "Null native not permitted"); + Objects.requireNonNull(flav, "Null flavor not permitted"); - List natives = getFlavorToNative().get(flav); + LinkedHashSet natives = getFlavorToNative().get(flav); if (natives == null) { - natives = new ArrayList<>(1); + natives = new LinkedHashSet<>(1); getFlavorToNative().put(flav, natives); - } else if (natives.contains(nat)) { - return; } natives.add(nat); - getNativesForFlavorCache.remove(flav); - getNativesForFlavorCache.remove(null); + nativesForFlavorCache.remove(flav); } /** @@ -1116,18 +1057,15 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ public synchronized void setNativesForFlavor(DataFlavor flav, String[] natives) { - if (flav == null || natives == null) { - throw new NullPointerException("null arguments not permitted"); - } + Objects.requireNonNull(natives, "Null natives not permitted"); + Objects.requireNonNull(flav, "Null flavors not permitted"); getFlavorToNative().remove(flav); for (String aNative : natives) { addUnencodedNativeForFlavor(flav, aNative); } disabledMappingGenerationKeys.add(flav); - // Clear the cache to handle the case of empty natives. - getNativesForFlavorCache.remove(flav); - getNativesForFlavorCache.remove(null); + nativesForFlavorCache.remove(flav); } /** @@ -1150,20 +1088,16 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ public synchronized void addFlavorForUnencodedNative(String nat, DataFlavor flav) { - if (nat == null || flav == null) { - throw new NullPointerException("null arguments not permitted"); - } + Objects.requireNonNull(nat, "Null native not permitted"); + Objects.requireNonNull(flav, "Null flavor not permitted"); - List flavors = getNativeToFlavor().get(nat); + LinkedHashSet flavors = getNativeToFlavor().get(nat); if (flavors == null) { - flavors = new ArrayList<>(1); + flavors = new LinkedHashSet<>(1); getNativeToFlavor().put(nat, flavors); - } else if (flavors.contains(flav)) { - return; } flavors.add(flav); - getFlavorsForNativeCache.remove(nat); - getFlavorsForNativeCache.remove(null); + flavorsForNativeCache.remove(nat); } /** @@ -1195,18 +1129,15 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ public synchronized void setFlavorsForNative(String nat, DataFlavor[] flavors) { - if (nat == null || flavors == null) { - throw new NullPointerException("null arguments not permitted"); - } + Objects.requireNonNull(nat, "Null native not permitted"); + Objects.requireNonNull(flavors, "Null flavors not permitted"); getNativeToFlavor().remove(nat); for (DataFlavor flavor : flavors) { addFlavorForUnencodedNative(nat, flavor); } disabledMappingGenerationKeys.add(nat); - // Clear the cache to handle the case of empty flavors. - getFlavorsForNativeCache.remove(nat); - getFlavorsForNativeCache.remove(null); + flavorsForNativeCache.remove(nat); } /** @@ -1307,17 +1238,29 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { : null; } - private List getAllNativesForType(String type) { - Set retval = null; - for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) { - List natives = getFlavorToNative().get(dataFlavor); - if (natives != null && !natives.isEmpty()) { - if (retval == null) { - retval = new LinkedHashSet<>(); - } - retval.addAll(natives); + private static final class SoftCache { + Map>> cache; + + public void put(K key, LinkedHashSet value) { + if (cache == null) { + cache = new HashMap<>(1); } + cache.put(key, new SoftReference<>(value)); + } + + public void remove(K key) { + if (cache == null) return; + cache.remove(null); + cache.remove(key); + } + + public LinkedHashSet check(K key) { + if (cache == null) return null; + SoftReference> ref = cache.get(key); + if (ref != null) { + return ref.get(); + } + return null; } - return retval == null ? null : new ArrayList<>(retval); } } diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java index b4b658a6166..3f22bd86fe9 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -70,22 +70,7 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.security.ProtectionDomain; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.SortedSet; -import java.util.Set; -import java.util.Stack; -import java.util.TreeMap; -import java.util.TreeSet; +import java.util.*; import sun.util.logging.PlatformLogger; @@ -2267,8 +2252,8 @@ search: * If there are no platform-specific mappings for this native, the method * returns an empty List. */ - public List getPlatformMappingsForNative(String nat) { - return new ArrayList<>(); + public LinkedHashSet getPlatformMappingsForNative(String nat) { + return new LinkedHashSet<>(); } /** @@ -2276,8 +2261,8 @@ search: * If there are no platform-specific mappings for this flavor, the method * returns an empty List. */ - public List getPlatformMappingsForFlavor(DataFlavor df) { - return new ArrayList<>(); + public LinkedHashSet getPlatformMappingsForFlavor(DataFlavor df) { + return new LinkedHashSet<>(); } /** diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java index f54bc87c337..554e19507dc 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java @@ -45,6 +45,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import javax.imageio.ImageIO; @@ -330,8 +331,8 @@ public class XDataTransferer extends DataTransferer { * type can be translated by the Data Transfer subsystem. */ @Override - public List getPlatformMappingsForNative(String nat) { - List flavors = new ArrayList<>(); + public LinkedHashSet getPlatformMappingsForNative(String nat) { + LinkedHashSet flavors = new LinkedHashSet<>(); if (nat == null) { return flavors; @@ -392,8 +393,8 @@ public class XDataTransferer extends DataTransferer { * Transfer subsystem. */ @Override - public List getPlatformMappingsForFlavor(DataFlavor df) { - List natives = new ArrayList<>(1); + public LinkedHashSet getPlatformMappingsForFlavor(DataFlavor df) { + LinkedHashSet natives = new LinkedHashSet<>(1); if (df == null) { return natives; diff --git a/jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java b/jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java new file mode 100644 index 00000000000..b0d8587afa3 --- /dev/null +++ b/jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.SystemFlavorMap; +import java.util.List; + +/* + @test + @bug 4512530 8027148 + @summary tests that mappings for text flavors are generated properly + @author das@sparc.spb.su area=datatransfer +*/ + +public class MappingGenerationTest { + + private static final SystemFlavorMap fm = + (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap(); + + public static void main(String[] args) { + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + } + + /** + * Verifies that Lists returned from getNativesForFlavor() and + * getFlavorsForNative() are not modified with a subsequent call + * to addUnencodedNativeForFlavor() and addFlavorForUnencodedNative() + * respectively. + */ + public static void test1() { + DataFlavor df = new DataFlavor("text/plain-test1", null); + String nat = "native1"; + + List natives = fm.getNativesForFlavor(df); + fm.addUnencodedNativeForFlavor(df, nat); + List nativesNew = fm.getNativesForFlavor(df); + if (natives.equals(nativesNew)) { + System.err.println("orig=" + natives); + System.err.println("new=" + nativesNew); + throw new RuntimeException("Test failed"); + } + + List flavors = fm.getFlavorsForNative(nat); + fm.addFlavorForUnencodedNative(nat, df); + List flavorsNew = fm.getFlavorsForNative(nat); + if (flavors.equals(flavorsNew)) { + System.err.println("orig=" + flavors); + System.err.println("new=" + flavorsNew); + throw new RuntimeException("Test failed"); + } + } + + /** + * Verifies that SystemFlavorMap is not affected by modification of + * the Lists returned from getNativesForFlavor() and + * getFlavorsForNative(). + */ + public static void test2() { + DataFlavor df = new DataFlavor("text/plain-test2", null); + String nat = "native2"; + DataFlavor extraDf = new DataFlavor("text/test", null); + + List natives = fm.getNativesForFlavor(df); + natives.add("Should not be here"); + java.util.List nativesNew = fm.getNativesForFlavor(df); + if (natives.equals(nativesNew)) { + System.err.println("orig=" + natives); + System.err.println("new=" + nativesNew); + throw new RuntimeException("Test failed"); + } + + List flavors = fm.getFlavorsForNative(nat); + flavors.add(extraDf); + java.util.List flavorsNew = fm.getFlavorsForNative(nat); + if (flavors.equals(flavorsNew)) { + System.err.println("orig=" + flavors); + System.err.println("new=" + flavorsNew); + throw new RuntimeException("Test failed"); + } + } + + /** + * Verifies that addUnencodedNativeForFlavor() for a particular text flavor + * doesn't affect mappings for other flavors. + */ + public static void test3() { + DataFlavor df1 = new DataFlavor("text/plain-test3", null); + DataFlavor df2 = new DataFlavor("text/plain-test3; charset=Unicode; class=java.io.Reader", null); + String nat = "native3"; + List natives = fm.getNativesForFlavor(df2); + fm.addUnencodedNativeForFlavor(df1, nat); + List nativesNew = fm.getNativesForFlavor(df2); + if (!natives.equals(nativesNew)) { + System.err.println("orig=" + natives); + System.err.println("new=" + nativesNew); + throw new RuntimeException("Test failed"); + } + } + + /** + * Verifies that addUnencodedNativeForFlavor() really adds the specified + * flavor-to-native mapping to the existing mappings. + */ + public static void test4() { + DataFlavor df = new DataFlavor("text/plain-test4; charset=Unicode; class=java.io.Reader", null); + String nat = "native4"; + List natives = fm.getNativesForFlavor(df); + if (!natives.contains(nat)) { + fm.addUnencodedNativeForFlavor(df, nat); + List nativesNew = fm.getNativesForFlavor(df); + natives.add(nat); + if (!natives.equals(nativesNew)) { + System.err.println("orig=" + natives); + System.err.println("new=" + nativesNew); + throw new RuntimeException("Test failed"); + } + } + } + + /** + * Verifies that a flavor doesn't have any flavor-to-native mappings after + * a call to setNativesForFlavor() with this flavor and an empty native + * array as arguments. + */ + public static void test5() { + final DataFlavor flavor = + new DataFlavor("text/plain-TEST5; charset=Unicode", null); + + fm.getNativesForFlavor(flavor); + + fm.setNativesForFlavor(flavor, new String[0]); + + List natives = fm.getNativesForFlavor(flavor); + + if (!natives.isEmpty()) { + System.err.println("natives=" + natives); + throw new RuntimeException("Test failed"); + } + } + + /** + * Verifies that a native doesn't have any native-to-flavor mappings after + * a call to setFlavorsForNative() with this native and an empty flavor + * array as arguments. + */ + public static void test6() { + final String nat = "STRING"; + fm.getFlavorsForNative(nat); + fm.setFlavorsForNative(nat, new DataFlavor[0]); + + List flavors = fm.getFlavorsForNative(nat); + + if (!flavors.isEmpty()) { + System.err.println("flavors=" + flavors); + throw new RuntimeException("Test failed"); + } + } +} From 39ba3c9ea6f296f0dd966bf69808e3a7c9c68bbc Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 23 Apr 2014 18:07:12 +0400 Subject: [PATCH 021/185] 8039567: Duplicated code in DataTransferer Reviewed-by: serb, azvegint --- .../sun/lwawt/macosx/CDataTransferer.java | 3 +- .../sun/awt/datatransfer/DataTransferer.java | 65 ++++--------------- .../classes/sun/awt/X11/XDataTransferer.java | 28 +------- .../sun/awt/windows/WDataTransferer.java | 7 +- 4 files changed, 22 insertions(+), 81 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java index 26d2347ff15..c07356057ee 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java @@ -31,6 +31,7 @@ import sun.awt.image.ImageRepresentation; import java.io.*; import java.net.URL; +import java.nio.charset.Charset; import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.*; @@ -126,7 +127,7 @@ public class CDataTransferer extends DataTransferer { if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) { - String charset = getDefaultTextCharset(); + String charset = Charset.defaultCharset().name(); if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) { try { charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8"); diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java index 3f22bd86fe9..d9c8334df8a 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -57,6 +57,7 @@ import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.IllegalCharsetNameException; +import java.nio.charset.StandardCharsets; import java.nio.charset.UnsupportedCharsetException; import java.lang.reflect.Constructor; @@ -149,7 +150,7 @@ public abstract class DataTransferer { tempSet.add("UTF-16BE"); tempSet.add("UTF-16LE"); tempSet.add("UTF-16"); - tempSet.add(getDefaultTextCharset()); + tempSet.add(Charset.defaultCharset().name()); return Collections.unmodifiableSortedSet(tempSet); } } @@ -162,12 +163,6 @@ public abstract class DataTransferer { */ private static final Map textMIMESubtypeCharsetSupport; - /** - * Cache of the platform default encoding as specified in the - * "file.encoding" system property. - */ - private static String defaultEncoding; - /** * A collection of all natives listed in flavormap.properties with * a primary MIME type of "text". @@ -266,17 +261,7 @@ public abstract class DataTransferer { String encoding = flavor.getParameter("charset"); - return (encoding != null) ? encoding : getDefaultTextCharset(); - } - - /** - * Returns the platform's default character encoding. - */ - public static String getDefaultTextCharset() { - if (defaultEncoding != null) { - return defaultEncoding; - } - return defaultEncoding = Charset.defaultCharset().name(); + return (encoding != null) ? encoding : Charset.defaultCharset().name(); } /** @@ -470,7 +455,7 @@ public abstract class DataTransferer { textNatives.add(format); nativeCharsets.put(format, (charset != null && charset.length() != 0) - ? charset : getDefaultTextCharset()); + ? charset : Charset.defaultCharset().name()); if (eoln != null && eoln.length() != 0 && !eoln.equals("\n")) { nativeEOLNs.put(format, eoln); } @@ -771,19 +756,17 @@ public abstract class DataTransferer { * clipboard string encoding/decoding, basing on clipboard * format and localeTransferable(on decoding, if available) */ - private String getBestCharsetForTextFormat(Long lFormat, + protected String getBestCharsetForTextFormat(Long lFormat, Transferable localeTransferable) throws IOException { String charset = null; if (localeTransferable != null && isLocaleDependentTextFormat(lFormat) && - localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) - { + localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) { try { - charset = new String( - (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor), - "UTF-8" - ); + byte[] charsetNameBytes = (byte[])localeTransferable + .getTransferData(javaTextEncodingFlavor); + charset = new String(charsetNameBytes, StandardCharsets.UTF_8); } catch (UnsupportedFlavorException cannotHappen) { } } else { @@ -791,7 +774,7 @@ public abstract class DataTransferer { } if (charset == null) { // Only happens when we have a custom text type. - charset = getDefaultTextCharset(); + charset = Charset.defaultCharset().name(); } return charset; } @@ -1716,28 +1699,8 @@ search: { Long lFormat = format; - String sourceEncoding = null; - if (isLocaleDependentTextFormat(format) && - localeTransferable != null && - localeTransferable. - isDataFlavorSupported(javaTextEncodingFlavor)) - { - try { - sourceEncoding = new String((byte[])localeTransferable. - getTransferData(javaTextEncodingFlavor), - "UTF-8"); - } catch (UnsupportedFlavorException cannotHappen) { - } - } else { - sourceEncoding = getCharsetForTextFormat(lFormat); - } - - if (sourceEncoding == null) { - // Only happens when we have a custom text type. - sourceEncoding = getDefaultTextCharset(); - } - wrapped = new BufferedReader - (new InputStreamReader(bytestream, sourceEncoding)); + String sourceEncoding = getBestCharsetForTextFormat(format, localeTransferable); + wrapped = new BufferedReader(new InputStreamReader(bytestream, sourceEncoding)); if (targetEncoding == null) { // Throw NullPointerException for compatibility with the former @@ -2318,7 +2281,6 @@ search: */ public static class CharsetComparator extends IndexedComparator { private static final Map charsets; - private static final String defaultEncoding; private static final Integer DEFAULT_CHARSET_INDEX = 2; private static final Integer OTHER_CHARSET_INDEX = 1; @@ -2339,8 +2301,7 @@ search: // US-ASCII is the worst charset supported charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX); - defaultEncoding = DataTransferer.canonicalName(DataTransferer.getDefaultTextCharset()); - charsetsMap.putIfAbsent(defaultEncoding, DEFAULT_CHARSET_INDEX); + charsetsMap.putIfAbsent(Charset.defaultCharset().name(), DEFAULT_CHARSET_INDEX); charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java index 554e19507dc..fd9cbb8f13c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java @@ -259,28 +259,9 @@ public class XDataTransferer extends DataTransferer { Transferable localeTransferable) throws IOException { - String charset = null; - if (localeTransferable != null && - isLocaleDependentTextFormat(format) && - localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) { - try { - charset = new String( - (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor), - "UTF-8" - ); - } catch (UnsupportedFlavorException cannotHappen) { - } - } else { - charset = getCharsetForTextFormat(format); - } - if (charset == null) { - // Only happens when we have a custom text type. - charset = getDefaultTextCharset(); - } - - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(stream, charset)); + String charset = getBestCharsetForTextFormat(format, localeTransferable); + try (InputStreamReader isr = new InputStreamReader(stream, charset); + BufferedReader reader = new BufferedReader(isr)) { String line; ArrayList uriList = new ArrayList<>(); URI uri; @@ -293,9 +274,6 @@ public class XDataTransferer extends DataTransferer { uriList.add(uri); } return uriList.toArray(new URI[uriList.size()]); - } finally { - if (reader != null) - reader.close(); } } diff --git a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java index 4b16e214052..2ccb76462aa 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java @@ -59,6 +59,7 @@ import java.io.File; import java.net.URL; +import java.nio.charset.Charset; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -268,9 +269,9 @@ final class WDataTransferer extends DataTransferer { if (format == CFSTR_INETURL && URL.class.equals(flavor.getRepresentationClass())) { - String charset = getDefaultTextCharset(); - if (localeTransferable != null && localeTransferable. - isDataFlavorSupported(javaTextEncodingFlavor)) + String charset = Charset.defaultCharset().name(); + if (localeTransferable != null + && localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) { try { charset = new String((byte[])localeTransferable. From 781d6564c91d1a182473da2c9f99c744beadbab6 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 23 Apr 2014 21:11:25 +0400 Subject: [PATCH 022/185] 8039464: The scrollbar in JScrollPane has no right border if used WindowsLookAndFeel Reviewed-by: alexsch, serb --- .../plaf/windows/WindowsScrollBarUI.java | 25 ++++- .../swing/JScrollBar/8039464/Test8039464.html | 32 +++++++ .../swing/JScrollBar/8039464/Test8039464.java | 92 +++++++++++++++++++ 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/swing/JScrollBar/8039464/Test8039464.html create mode 100644 jdk/test/javax/swing/JScrollBar/8039464/Test8039464.java diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java index 279bdb72b79..418f326165f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java @@ -51,6 +51,8 @@ import static com.sun.java.swing.plaf.windows.XPStyle.Skin; public class WindowsScrollBarUI extends BasicScrollBarUI { private Grid thumbGrid; private Grid highlightGrid; + private Dimension horizontalThumbSize; + private Dimension verticalThumbSize; /** * Creates a UI for a JScrollBar. @@ -65,11 +67,32 @@ public class WindowsScrollBarUI extends BasicScrollBarUI { protected void installDefaults() { super.installDefaults(); - if (XPStyle.getXP() != null) { + XPStyle xp = XPStyle.getXP(); + if (xp != null) { scrollbar.setBorder(null); + horizontalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNHORZ); + verticalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNVERT); + } else { + horizontalThumbSize = null; + verticalThumbSize = null; } } + private static Dimension getSize(Component component, XPStyle xp, Part part) { + Skin skin = xp.getSkin(component, part); + return new Dimension(skin.getWidth(), skin.getHeight()); + } + + @Override + protected Dimension getMinimumThumbSize() { + if ((horizontalThumbSize == null) || (verticalThumbSize == null)) { + return super.getMinimumThumbSize(); + } + return JScrollBar.HORIZONTAL == scrollbar.getOrientation() + ? horizontalThumbSize + : verticalThumbSize; + } + public void uninstallUI(JComponent c) { super.uninstallUI(c); thumbGrid = highlightGrid = null; diff --git a/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.html b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.html new file mode 100644 index 00000000000..a473b819d1c --- /dev/null +++ b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.html @@ -0,0 +1,32 @@ + + + + +Choose the variable applet size and try to resize the applet. +The test passes the thumb is painted correctly. + + + + + diff --git a/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.java b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.java new file mode 100644 index 00000000000..44bb33abd94 --- /dev/null +++ b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; + +import javax.swing.JApplet; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JScrollBar; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/* + * @test + * @bug 8039464 + * @summary Tests enabling/disabling of titled border's caption + * @author Sergey Malenkov + * @run applet/manual=yesno Test8039464.html + */ + +public class Test8039464 extends JApplet { + static { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception exception) { + throw new Error("unexpected", exception); + } + } + + @Override + public void init() { + init(this); + } + + private static void init(Container container) { + container.setLayout(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.fill = GridBagConstraints.BOTH; + gbc.gridx = 0; + gbc.gridy = 1; + JLabel label = new JLabel(); + Dimension size = new Dimension(111, 0); + label.setPreferredSize(size); + label.setMinimumSize(size); + container.add(label, gbc); + gbc.gridx = 1; + gbc.weightx = 1; + container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc); + gbc.gridx = 2; + gbc.gridy = 0; + gbc.weightx = 0; + gbc.weighty = 1; + container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc); + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JFrame frame = new JFrame("8039464"); + init(frame); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + }); + } +} From 6b14d69b604651b081196ddc015311be01bf6bb1 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Thu, 24 Apr 2014 16:15:08 +0400 Subject: [PATCH 023/185] 8040279: [macosx] Do not use the base image in the MultiResolutionBufferedImage Reviewed-by: serb, pchelko --- .../com/apple/laf/AquaImageFactory.java | 24 +--- .../classes/com/apple/laf/AquaPainter.java | 6 +- .../classes/com/apple/laf/AquaUtils.java | 6 +- .../classes/sun/lwawt/macosx/CImage.java | 36 ++--- .../image/AbstractMultiResolutionImage.java | 123 ++++++++++++++++++ ...e.java => MultiResolutionCachedImage.java} | 56 ++++---- .../swing/JMenuItem/8031573/bug8031573.java | 2 +- .../swing/JOptionPane/8024926/bug8024926.java | 2 +- 8 files changed, 177 insertions(+), 78 deletions(-) create mode 100644 jdk/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java rename jdk/src/share/classes/sun/awt/image/{MultiResolutionBufferedImage.java => MultiResolutionCachedImage.java} (80%) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java index be6a787a45b..9e0f34f7a4c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java @@ -46,10 +46,8 @@ import com.apple.laf.AquaIcon.JRSUIControlSpec; import com.apple.laf.AquaIcon.SystemIcon; import com.apple.laf.AquaUtils.RecyclableObject; import com.apple.laf.AquaUtils.RecyclableSingleton; -import java.util.Arrays; -import java.util.List; -import sun.awt.image.MultiResolutionBufferedImage; import sun.awt.image.MultiResolutionImage; +import sun.awt.image.MultiResolutionCachedImage; public class AquaImageFactory { public static IconUIResource getConfirmImageIcon() { @@ -125,9 +123,9 @@ public class AquaImageFactory { private static final int kAlertIconSize = 64; static IconUIResource getAppIconCompositedOn(final Image background) { - if (background instanceof MultiResolutionBufferedImage) { + if (background instanceof MultiResolutionCachedImage) { int width = background.getWidth(null); - Image mrIconImage = ((MultiResolutionBufferedImage) background).map( + Image mrIconImage = ((MultiResolutionCachedImage) background).map( rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width)); return new IconUIResource(new ImageIcon(mrIconImage)); } @@ -306,21 +304,7 @@ public class AquaImageFactory { private static Image getNSIcon(String imageName) { Image icon = Toolkit.getDefaultToolkit() .getImage("NSImage://" + imageName); - - if (icon instanceof MultiResolutionImage) { - return icon; - } - - int w = icon.getWidth(null); - int h = icon.getHeight(null); - - Dimension[] sizes = new Dimension[]{ - new Dimension(w, h), new Dimension(2 * w, 2 * h) - }; - - return new MultiResolutionBufferedImage(icon, sizes, (width, height) -> - AquaUtils.getCImageCreator().createImageFromName( - imageName, width, height)); + return icon; } public static class NineSliceMetrics { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java index ee4fcba1a4d..a2ebaf1c920 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java @@ -174,11 +174,7 @@ abstract class AquaPainter { bounds, controlState); Image img = cache.getImage(key); if (img == null) { - - Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds, - control, controlState); - - img = new MultiResolutionBufferedImage(baseImage, + img = new MultiResolutionCachedImage(imgW, imgH, (rvWidth, rvHeight) -> createImage(imgX, imgY, rvWidth, rvHeight, bounds, control, controlState)); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java index a20897f7b31..078435b161b 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java @@ -48,7 +48,7 @@ import sun.security.action.GetPropertyAction; import sun.swing.SwingUtilities2; import com.apple.laf.AquaImageFactory.SlicedImageControl; -import sun.awt.image.MultiResolutionBufferedImage; +import sun.awt.image.MultiResolutionCachedImage; final class AquaUtils { @@ -124,8 +124,8 @@ final class AquaUtils { static Image generateLightenedImage(final Image image, final int percent) { final GrayFilter filter = new GrayFilter(true, percent); - return (image instanceof MultiResolutionBufferedImage) - ? ((MultiResolutionBufferedImage) image).map( + return (image instanceof MultiResolutionCachedImage) + ? ((MultiResolutionCachedImage) image).map( rv -> generateLightenedImage(rv, filter)) : generateLightenedImage(image, filter); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java index 17815d4882e..69bdab05734 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java @@ -32,7 +32,7 @@ import java.awt.image.*; import java.util.Arrays; import java.util.List; import sun.awt.image.MultiResolutionImage; -import sun.awt.image.MultiResolutionBufferedImage; +import sun.awt.image.MultiResolutionCachedImage; import sun.awt.image.SunWritableRaster; @@ -62,41 +62,41 @@ public class CImage extends CFRetainedResource { // This is used to create a CImage with an NSImage pointer. It MUST be a CFRetained // NSImage, and the CImage takes ownership of the non-GC retain. If callers need the // NSImage themselves, they MUST call retain on the NSImage themselves. - public BufferedImage createImageUsingNativeSize(final long image) { + public Image createImageUsingNativeSize(final long image) { if (image == 0) return null; final Dimension2D size = nativeGetNSImageSize(image); - return createBufferedImage(image, size.getWidth(), size.getHeight()); + return createImage(image, size.getWidth(), size.getHeight()); } // the width and height passed in as a parameter could differ than the width and the height of the NSImage (image), in that case, the image will be scaled - BufferedImage createBufferedImage(long image, double width, double height) { + Image createImage(long image, double width, double height) { if (image == 0) throw new Error("Unable to instantiate CImage with null native image reference."); return createImageWithSize(image, width, height); } - public BufferedImage createImageWithSize(final long image, final double width, final double height) { + public Image createImageWithSize(final long image, final double width, final double height) { final CImage img = new CImage(image); img.resize(width, height); return img.toImage(); } // This is used to create a CImage that represents the icon of the given file. - public BufferedImage createImageOfFile(final String file, final int width, final int height) { - return createBufferedImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height); + public Image createImageOfFile(final String file, final int width, final int height) { + return createImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height); } - public BufferedImage createImageFromFile(final String file, final double width, final double height) { + public Image createImageFromFile(final String file, final double width, final double height) { final long image = nativeCreateNSImageFromFileContents(file); nativeSetNSImageSize(image, width, height); - return createBufferedImage(image, width, height); + return createImage(image, width, height); } - public BufferedImage createSystemImageFromSelector(final String iconSelector, final int width, final int height) { - return createBufferedImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height); + public Image createSystemImageFromSelector(final String iconSelector, final int width, final int height) { + return createImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height); } public Image createImageFromName(final String name, final int width, final int height) { - return createBufferedImage(nativeCreateNSImageFromImageName(name), width, height); + return createImage(nativeCreateNSImageFromImageName(name), width, height); } public Image createImageFromName(final String name) { @@ -232,7 +232,7 @@ public class CImage extends CFRetainedResource { } /** @return A MultiResolution image created from nsImagePtr, or null. */ - private BufferedImage toImage() { + private Image toImage() { if (ptr == 0) return null; final Dimension2D size = nativeGetNSImageSize(ptr); @@ -243,11 +243,11 @@ public class CImage extends CFRetainedResource { = nativeGetNSImageRepresentationSizes(ptr, size.getWidth(), size.getHeight()); - BufferedImage baseImage = toImage(w, h, w, h); - - return sizes == null || sizes.length < 2 ? baseImage - : new MultiResolutionBufferedImage(baseImage, sizes, - (width, height) -> toImage(w, h, width, height)); + return sizes == null || sizes.length < 2 ? + new MultiResolutionCachedImage(w, h, (width, height) + -> toImage(w, h, width, height)) + : new MultiResolutionCachedImage(w, h, sizes, (width, height) + -> toImage(w, h, width, height)); } private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) { diff --git a/jdk/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java b/jdk/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java new file mode 100644 index 00000000000..5116f517ff0 --- /dev/null +++ b/jdk/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2014, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package sun.awt.image; + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.*; + +/** + * This class provides default implementations for the + * MultiResolutionImage interface. The developer needs only + * to subclass this abstract class and define the getResolutionVariant, + * getResolutionVariants, and getBaseImage methods. + * + * + * For example, + * {@code + * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage { + * + * int baseImageIndex; + * Image[] resolutionVariants; + * + * public CustomMultiResolutionImage(int baseImageIndex, + * Image... resolutionVariants) { + * this.baseImageIndex = baseImageIndex; + * this.resolutionVariants = resolutionVariants; + * } + * + * @Override + * public Image getResolutionVariant(float logicalDPIX, float logicalDPIY, + * float baseImageWidth, float baseImageHeight, + * float destImageWidth, float destImageHeight) { + * // return a resolution variant based on the given logical DPI, + * // base image size, or destination image size + * } + * + * @Override + * public List getResolutionVariants() { + * return Arrays.asList(resolutionVariants); + * } + * + * protected Image getBaseImage() { + * return resolutionVariants[baseImageIndex]; + * } + * } + * } + * + * @see java.awt.Image + * @see java.awt.image.MultiResolutionImage + * + * @since 1.9 + */ +public abstract class AbstractMultiResolutionImage extends java.awt.Image + implements MultiResolutionImage { + + /** + * @inheritDoc + */ + @Override + public int getWidth(ImageObserver observer) { + return getBaseImage().getWidth(null); + } + + /** + * @inheritDoc + */ + @Override + public int getHeight(ImageObserver observer) { + return getBaseImage().getHeight(null); + } + + /** + * @inheritDoc + */ + @Override + public ImageProducer getSource() { + return getBaseImage().getSource(); + } + + /** + * @inheritDoc + */ + @Override + public Graphics getGraphics() { + return getBaseImage().getGraphics(); + + } + + /** + * @inheritDoc + */ + @Override + public Object getProperty(String name, ImageObserver observer) { + return getBaseImage().getProperty(name, observer); + } + + /** + * @return base image + */ + protected abstract Image getBaseImage(); +} diff --git a/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java b/jdk/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java similarity index 80% rename from jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java rename to jdk/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java index 74db8273416..376827c0885 100644 --- a/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java +++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java @@ -26,9 +26,7 @@ package sun.awt.image; import java.awt.Dimension; import java.awt.Image; -import java.awt.Graphics; import java.awt.geom.Dimension2D; -import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.util.Arrays; import java.util.List; @@ -36,50 +34,39 @@ import java.util.function.Function; import java.util.function.BiFunction; import java.util.stream.Collectors; -public class MultiResolutionBufferedImage extends BufferedImage - implements MultiResolutionImage { +public class MultiResolutionCachedImage extends AbstractMultiResolutionImage { - private final BiFunction mapper; + private final int baseImageWidth; + private final int baseImageHeight; private final Dimension2D[] sizes; + private final BiFunction mapper; private int availableInfo; - public MultiResolutionBufferedImage(Image baseImage, + public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, BiFunction mapper) { - this(baseImage, new Dimension[]{new Dimension( - baseImage.getWidth(null), baseImage.getHeight(null)) + this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension( + baseImageWidth, baseImageHeight) }, mapper); } - public MultiResolutionBufferedImage(Image baseImage, + public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, Dimension2D[] sizes, BiFunction mapper) { - super(baseImage.getWidth(null), baseImage.getHeight(null), - BufferedImage.TYPE_INT_ARGB_PRE); + this.baseImageWidth = baseImageWidth; + this.baseImageHeight = baseImageHeight; this.sizes = sizes; this.mapper = mapper; - this.availableInfo = getInfo(baseImage); - Graphics g = getGraphics(); - g.drawImage(baseImage, 0, 0, null); - g.dispose(); } @Override public Image getResolutionVariant(int width, int height) { - int baseWidth = getWidth(); - int baseHeight = getHeight(); - - if (baseWidth == width && baseHeight == height) { - return this; - } - ImageCache cache = ImageCache.getInstance(); ImageCacheKey key = new ImageCacheKey(this, width, height); Image resolutionVariant = cache.getImage(key); if (resolutionVariant == null) { resolutionVariant = mapper.apply(width, height); cache.setImage(key, resolutionVariant); - preload(resolutionVariant, availableInfo); } - + preload(resolutionVariant, availableInfo); return resolutionVariant; } @@ -90,30 +77,39 @@ public class MultiResolutionBufferedImage extends BufferedImage (int) size.getHeight())).collect(Collectors.toList()); } - public MultiResolutionBufferedImage map(Function mapper) { - return new MultiResolutionBufferedImage(mapper.apply(this), sizes, - (width, height) -> + public MultiResolutionCachedImage map(Function mapper) { + return new MultiResolutionCachedImage(baseImageWidth, baseImageHeight, + sizes, (width, height) -> mapper.apply(getResolutionVariant(width, height))); } @Override public int getWidth(ImageObserver observer) { - availableInfo |= ImageObserver.WIDTH; + updateInfo(observer, ImageObserver.WIDTH); return super.getWidth(observer); } @Override public int getHeight(ImageObserver observer) { - availableInfo |= ImageObserver.HEIGHT; + updateInfo(observer, ImageObserver.HEIGHT); return super.getHeight(observer); } @Override public Object getProperty(String name, ImageObserver observer) { - availableInfo |= ImageObserver.PROPERTIES; + updateInfo(observer, ImageObserver.PROPERTIES); return super.getProperty(name, observer); } + @Override + protected Image getBaseImage() { + return getResolutionVariant(baseImageWidth, baseImageHeight); + } + + private void updateInfo(ImageObserver observer, int info) { + availableInfo |= (observer == null) ? ImageObserver.ALLBITS : info; + } + private static int getInfo(Image image) { if (image instanceof ToolkitImage) { return ((ToolkitImage) image).getImageRep().check( diff --git a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java index 5cb1dc5047f..2d36db7a171 100644 --- a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java +++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java @@ -28,7 +28,7 @@ import javax.swing.JMenuBar; import javax.swing.SwingUtilities; /* @test - * @bug 8031573 + * @bug 8031573 8040279 * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered * in high resolution on Retina * @author Alexander Scherbatiy diff --git a/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java index 42f976b03c0..185537f3b5b 100644 --- a/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java +++ b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java @@ -31,7 +31,7 @@ import sun.awt.OSInfo; /** * @test - * @bug 8024926 + * @bug 8024926 8040279 * @summary [macosx] AquaIcon HiDPI support * @author Alexander Scherbatiy * @run applet/manual=yesno bug8024926.html From 7059ba15c3e1fbfffcb883b96cbbca5574507fcd Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Thu, 24 Apr 2014 20:22:58 +0400 Subject: [PATCH 024/185] 7124250: [macosx] JOptionPane dialogs show wrong icons Reviewed-by: serb, leonidr --- .../com/apple/laf/AquaImageFactory.java | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java index 9e0f34f7a4c..4838ba48879 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java @@ -55,7 +55,7 @@ public class AquaImageFactory { return new IconUIResource(new AquaIcon.CachingScalingIcon(kAlertIconSize, kAlertIconSize) { Image createImage() { - return getThisApplicationsIcon(kAlertIconSize, kAlertIconSize); + return getGenericJavaIcon(); } }); } @@ -81,24 +81,6 @@ public class AquaImageFactory { return getAppIconCompositedOn(lockIcon); } - static Image getThisApplicationsIcon(final int width, final int height) { - final String path = getPathToThisApplication(); - - if (path == null) { - return getGenericJavaIcon(); - } - - if (path.endsWith("/Home/bin")) { - return getGenericJavaIcon(); - } - - if (path.startsWith("/usr/bin")) { - return getGenericJavaIcon(); - } - - return AquaUtils.getCImageCreator().createImageOfFile(path, height, width); - } - static Image getGenericJavaIcon() { return java.security.AccessController.doPrivileged(new PrivilegedAction() { public Image run() { @@ -142,7 +124,7 @@ public class AquaImageFactory { final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon( kAlertSubIconSize, kAlertSubIconSize) { Image createImage() { - return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize); + return getGenericJavaIcon(); } }; @@ -514,4 +496,4 @@ public class AquaImageFactory { public static Color getSelectionInactiveForegroundColorUIResource() { return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR)); } -} \ No newline at end of file +} From c25473bb3827e3b8e53694d148a615c7cd14e6ae Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 25 Apr 2014 16:27:30 +0400 Subject: [PATCH 025/185] 8041572: [macosx] huge native memory leak in AWTWindow.m Reviewed-by: serb, anthony --- jdk/src/macosx/native/sun/awt/AWTWindow.m | 9 ++++++--- jdk/src/macosx/native/sun/awt/CGraphicsDevice.m | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTWindow.m b/jdk/src/macosx/native/sun/awt/AWTWindow.m index c2577584886..6a9c1166e84 100644 --- a/jdk/src/macosx/native/sun/awt/AWTWindow.m +++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m @@ -261,7 +261,8 @@ AWT_ASSERT_APPKIT_THREAD; // returns id for the topmost window under mouse + (NSInteger) getTopmostWindowUnderMouseID { - + NSInteger result = -1; + NSRect screenRect = [[NSScreen mainScreen] frame]; NSPoint nsMouseLocation = [NSEvent mouseLocation]; CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y); @@ -274,11 +275,13 @@ AWT_ASSERT_APPKIT_THREAD; CGRect rect; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect); if (CGRectContainsPoint(rect, cgMouseLocation)) { - return [[window objectForKey:(id)kCGWindowNumber] integerValue]; + result = [[window objectForKey:(id)kCGWindowNumber] integerValue]; + break; } } } - return -1; + [windows release]; + return result; } // checks that this window is under the mouse cursor and this point is not overlapped by others windows diff --git a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m index 9b94b82abbc..4d3b587c174 100644 --- a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m +++ b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m @@ -66,7 +66,8 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){ CFArrayAppendValue(validModes, cRef); } } - + CFRelease(allModes); + CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID); BOOL containsCurrentMode = NO; @@ -81,6 +82,7 @@ static CFMutableArrayRef getAllValidDisplayModes(jint displayID){ if (!containsCurrentMode) { CFArrayAppendValue(validModes, currentMode); } + CGDisplayModeRelease(currentMode); return validModes; } From 844cf2d704ada1bbf613504d6c2d21c058b9af44 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Fri, 25 Apr 2014 16:39:13 +0400 Subject: [PATCH 026/185] 8041490: PIT: [macosx] Crash in system tray functionality check test Reviewed-by: anthony, serb --- .../sun/lwawt/macosx/CWarningWindow.java | 4 ++ .../WarningWindowDisposeCrashTest.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java index fc72ef79474..0acc67feed6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java @@ -309,6 +309,10 @@ public final class CWarningWindow extends CPlatformWindow @Override public void dispose() { cancelTasks(); + SurfaceData surfaceData = contentView.getSurfaceData(); + if (surfaceData != null) { + surfaceData.invalidate(); + } super.dispose(); } diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java new file mode 100644 index 00000000000..298059054d9 --- /dev/null +++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014, 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 8041490 + @summary tests that the WarningWindow's surface is invalidated on dispose + @author Petr Pchelko + @run main/othervm WarningWindowDisposeCrashTest +*/ + + +import sun.applet.AppletSecurity; +import sun.awt.SunToolkit; + +import java.awt.*; + +public class WarningWindowDisposeCrashTest { + public static void main(String[] args) throws Exception { + System.setSecurityManager(new AppletSecurity() { + @Override + public void checkPackageAccess (String s){ + } + }); + + Frame f = new Frame(); + f.setVisible(true); + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + Thread.sleep(1000); + f.dispose(); + // If the bug is present VM could crash after this call + for (int i = 0; i < 1000; i++) Toolkit.getDefaultToolkit().sync(); + } +} From 01e8b57668fb27fbc9ef52627db027d5edcf5ab4 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 28 Apr 2014 16:45:43 +0400 Subject: [PATCH 027/185] 8041987: [macosx] setDisplayMode crashes Reviewed-by: anthony, serb --- .../macosx/native/sun/awt/CGraphicsDevice.m | 9 +- .../DisplayChangeVITest.java | 245 ++++++++++++++++++ 2 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 jdk/test/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java diff --git a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m index 4d3b587c174..e20792a231d 100644 --- a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m +++ b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m @@ -237,17 +237,19 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode { JNF_COCOA_ENTER(env); CFArrayRef allModes = getAllValidDisplayModes(displayID); - CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate); + __block CGError retCode = kCGErrorSuccess; if (closestMatch != NULL) { - [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + CGDisplayModeRetain(closestMatch); + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ CGDisplayConfigRef config; retCode = CGBeginDisplayConfiguration(&config); if (retCode == kCGErrorSuccess) { CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL); retCode = CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly); } + CGDisplayModeRelease(closestMatch); }]; } else { [JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"]; @@ -255,8 +257,7 @@ Java_sun_awt_CGraphicsDevice_nativeSetDisplayMode if (retCode != kCGErrorSuccess){ [JNFException raise:env as:kIllegalArgumentException reason:"Unable to set display mode!"]; - } - + } CFRelease(allModes); JNF_COCOA_EXIT(env); } diff --git a/jdk/test/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java b/jdk/test/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java new file mode 100644 index 00000000000..ae7ab9f1908 --- /dev/null +++ b/jdk/test/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006, 2014, 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 6366359 + * @summary Test that we don't crash when changing from 8 to 16/32 bit modes + * @author Dmitri.Trembovetski@Sun.COM area=FullScreen + * @run main/othervm/timeout=200 DisplayChangeVITest + * @run main/othervm/timeout=200 -Dsun.java2d.d3d=false DisplayChangeVITest + * @run main/othervm/timeout=200 -Dsun.java2d.opengl=true DisplayChangeVITest + */ + +import java.awt.Color; +import java.awt.DisplayMode; +import java.awt.Graphics; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; +import java.lang.Exception; +import java.lang.Thread; +import java.util.ArrayList; +import java.util.Random; +import javax.swing.JFrame; + +/** + * The test enters fullscreen mode (if it's supported) and then tries + * to switch between display moes with different depths and dimensions + * while doing both rendering to the screen (via a VolatileImage) + * and Swing repainting just to make things more chaotic. + * + * The procedure is repeated TEST_REPS times (3 by default). + * + * Don't pay attention to what happens on the screen, it won't be pretty. + * If the test doesn't crash or throw exceptions, it passes, otherwise + * it fails. + */ +public class DisplayChangeVITest extends JFrame implements Runnable { + + private final Random rnd = new Random(); + private VolatileImage bb; + private BufferedImage sprite; + private VolatileImage volSprite; + + private static boolean done = false; + private static final Object lock = new Object(); + private static final int TEST_REPS = 3; + + private ArrayList dms; + + DisplayChangeVITest() { + selectDisplayModes(); + addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + synchronized (lock) { + done = true; + } + } + } + }); + sprite = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); + sprite.getRaster().getDataBuffer(); + Graphics g = sprite.getGraphics(); + g.setColor(Color.yellow); + g.fillRect(0, 0, sprite.getWidth(), sprite.getHeight()); + } + + void render(Graphics g) { + do { + // volatile images validated here + initBackbuffer(); + + g.setColor(Color.black); + g.fillRect(0, 0, getWidth(), getHeight()); + + Graphics gg = bb.getGraphics(); + gg.setColor(new Color(rnd.nextInt(0x00ffffff))); + gg.fillRect(0, 0, bb.getWidth(), bb.getHeight()); + for (int x = 0; x < 10; x++) { + gg.drawImage(sprite, x*200, 0, null); + gg.drawImage(volSprite, x*200, 500, null); + } + + g.drawImage(bb, 0, 0, null); + } while (bb.contentsLost()); + } + + private static void sleep(long msec) { + try { Thread.sleep(msec); } catch (InterruptedException e) {} + } + + private int reps = 0; + public void run() { + GraphicsDevice gd = getGraphicsConfiguration().getDevice(); + if (gd.isDisplayChangeSupported() && dms.size() > 0) { + while (!done && reps++ < TEST_REPS) { + for (DisplayMode dm : dms) { + System.err.printf("Entering DisplayMode[%dx%dx%d]\n", + dm.getWidth(), dm.getHeight(), dm.getBitDepth()); + gd.setDisplayMode(dm); + + initBackbuffer(); + for (int i = 0; i < 10; i++) { + // render to the screen + render(getGraphics()); + // ask Swing to repaint + repaint(); + sleep(100); + } + sleep(1500); + } + } + } else { + System.err.println("Display mode change " + + "not supported. Test passed."); + } + dispose(); + synchronized (lock) { + done = true; + lock.notify(); + } + } + + private void createBackbuffer() { + if (bb == null || + bb.getWidth() != getWidth() || bb.getHeight() != getHeight()) + { + bb = createVolatileImage(getWidth(), getHeight()); + } + } + + private void initBackbuffer() { + createBackbuffer(); + + int res = bb.validate(getGraphicsConfiguration()); + if (res == VolatileImage.IMAGE_INCOMPATIBLE) { + bb = null; + createBackbuffer(); + bb.validate(getGraphicsConfiguration()); + res = VolatileImage.IMAGE_RESTORED; + } + if (res == VolatileImage.IMAGE_RESTORED) { + Graphics g = bb.getGraphics(); + g.setColor(new Color(rnd.nextInt(0x00ffffff))); + g.fillRect(0, 0, bb.getWidth(), bb.getHeight()); + + volSprite = createVolatileImage(100, 100); + } + volSprite.validate(getGraphicsConfiguration()); + } + + private void selectDisplayModes() { + GraphicsDevice gd = + GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice(); + dms = new ArrayList(); + DisplayMode dmArray[] = gd.getDisplayModes(); + boolean found8 = false, found16 = false, + found24 = false, found32 = false; + for (DisplayMode dm : dmArray) { + if (!found8 && + (dm.getBitDepth() == 8 || + dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) && + (dm.getWidth() >= 800 && dm.getWidth() < 1024)) + { + dms.add(dm); + found8 = true; + continue; + } + if (!found32 && + (dm.getBitDepth() == 32 || + dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) && + dm.getWidth() >= 1280) + { + dms.add(dm); + found32 = true; + continue; + } + if (!found16 && + dm.getBitDepth() == 16 && + (dm.getWidth() >= 1024 && dm.getWidth() < 1280)) + { + dms.add(dm); + found16 = true; + continue; + } + if (found8 && found16 && found32) { + break; + } + } + System.err.println("Found display modes:"); + for (DisplayMode dm : dms) { + System.err.printf("DisplayMode[%dx%dx%d]\n", + dm.getWidth(), dm.getHeight(), dm.getBitDepth()); + } + } + + public static void main(String[] args) throws Exception { + DisplayChangeVITest test = new DisplayChangeVITest(); + GraphicsDevice gd = + GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice(); + if (gd.isFullScreenSupported()) { + gd.setFullScreenWindow(test); + Thread t = new Thread(test); + t.run(); + synchronized (lock) { + while (!done) { + try { + lock.wait(50); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } + System.err.println("Test Passed."); + } else { + System.err.println("Full screen not supported. Test passed."); + } + } +} From c7f7685c508af7155e1abf6405e4730d6780e1c6 Mon Sep 17 00:00:00 2001 From: Vivi An Date: Mon, 28 Apr 2014 11:03:52 -0700 Subject: [PATCH 028/185] 8036819: JAB: mneumonics not read for textboxes Reviewed-by: alexsch --- .../share/classes/javax/swing/JComponent.java | 13 +- .../swing/JTextField/8036819/bug8036819.java | 132 ++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/swing/JTextField/8036819/bug8036819.java diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 98c4d7fb5dd..2d2745957e7 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -3986,7 +3986,18 @@ public abstract class JComponent extends Container implements Serializable, * @see AccessibleKeyBinding * @since 1.4 */ - public AccessibleKeyBinding getAccessibleKeyBinding() { + public AccessibleKeyBinding getAccessibleKeyBinding(){ + // Try to get the linked label's mnemonic if it exists + Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY); + if (o instanceof Accessible){ + AccessibleContext ac = ((Accessible) o).getAccessibleContext(); + if (ac != null){ + AccessibleComponent comp = ac.getAccessibleComponent(); + if (! (comp instanceof AccessibleExtendedComponent)) + return null; + return ((AccessibleExtendedComponent)comp).getAccessibleKeyBinding(); + } + } return null; } } // inner class AccessibleJComponent diff --git a/jdk/test/javax/swing/JTextField/8036819/bug8036819.java b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java new file mode 100644 index 00000000000..558be4c9769 --- /dev/null +++ b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2014, 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 + * @library ../../regtesthelpers + * @build Util + * @bug 8036819 + * @summary JAB: mnemonics not read for textboxes + * @author Vivi An + * @run main bug8036819 + */ + +import javax.swing.*; +import javax.swing.event.*; +import java.awt.event.*; +import java.awt.*; +import sun.awt.SunToolkit; +import javax.accessibility.*; + +public class bug8036819 { + + public static volatile Boolean passed = false; + + public static void main(String args[]) throws Throwable { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + createAndShowGUI(); + } + }); + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + toolkit.realSync(); + + Robot robo = new Robot(); + robo.setAutoDelay(300); + + // Using mnemonic key to focus on the textfield + Util.hitMnemonics(robo, KeyEvent.VK_P); + toolkit.realSync(); + + if (!passed){ + throw new RuntimeException("Test failed."); + } + } + + private static void createAndShowGUI() { + JFrame mainFrame = new JFrame("bug 8036819"); + + JLabel usernameLabel = new JLabel("Username: "); + JTextField usernameField = new JTextField(20); + usernameLabel.setDisplayedMnemonic(KeyEvent.VK_U); + usernameLabel.setLabelFor(usernameField); + + JLabel pwdLabel = new JLabel("Password: "); + JTextField pwdField = new JTextField(20); + pwdLabel.setDisplayedMnemonic(KeyEvent.VK_P); + pwdLabel.setLabelFor(pwdField); + + pwdField.addKeyListener( + new KeyListener(){ + @Override + public void keyPressed(KeyEvent keyEvent) { + } + + @Override + public void keyTyped(KeyEvent keyEvent) { + } + + @Override + public void keyReleased(KeyEvent keyEvent){ + JComponent comp = (JComponent) pwdField; + AccessibleContext ac = comp.getAccessibleContext(); + AccessibleExtendedComponent aec = (AccessibleExtendedComponent)ac.getAccessibleComponent(); + AccessibleKeyBinding akb = aec.getAccessibleKeyBinding(); + if (akb != null){ + int count = akb.getAccessibleKeyBindingCount(); + if (count != 1){ + passed = false; + return; + } + + // there is 1 accessible key for the text field + System.out.println("Retrieved AccessibleKeyBinding for textfield " + count); + + // the key code is KeyEvent.VK_P + Object o = akb.getAccessibleKeyBinding(0); + if (o instanceof KeyStroke){ + javax.swing.KeyStroke key = (javax.swing.KeyStroke)o; + System.out.println("keystroke is " + key.getKeyCode()); + if (key.getKeyCode() == KeyEvent.VK_P) + passed = true; + } + } + } + } + ); + + mainFrame.getContentPane().add(usernameLabel); + mainFrame.getContentPane().add(usernameField); + mainFrame.getContentPane().add(pwdLabel); + mainFrame.getContentPane().add(pwdField); + + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.setLayout(new FlowLayout(FlowLayout.LEFT)); + + mainFrame.setSize(200, 200); + mainFrame.setLocation(200, 200); + mainFrame.setVisible(true); + mainFrame.toFront(); + } + } From cb91afdb8cb3561f6bbf68ab116d5732f4139dc4 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Mon, 28 Apr 2014 19:05:49 -0700 Subject: [PATCH 029/185] 8039642: Fix raw and unchecked warnings in sun.awt.* Reviewed-by: darcy, prr, flar --- jdk/src/share/classes/java/awt/Menu.java | 8 +- .../share/classes/sun/awt/AWTAccessor.java | 4 +- jdk/src/share/classes/sun/awt/AppContext.java | 1 + .../classes/sun/awt/FontConfiguration.java | 44 ++++----- jdk/src/share/classes/sun/awt/HToolkit.java | 3 +- .../classes/sun/awt/HeadlessToolkit.java | 3 +- .../share/classes/sun/awt/PlatformFont.java | 11 +-- jdk/src/share/classes/sun/awt/SunToolkit.java | 2 + .../sun/awt/datatransfer/DataTransferer.java | 45 ++++----- .../sun/awt/datatransfer/SunClipboard.java | 6 +- .../awt/datatransfer/TransferableProxy.java | 20 ++-- .../sun/awt/dnd/SunDragSourceContextPeer.java | 2 +- .../sun/awt/dnd/SunDropTargetContextPeer.java | 8 +- .../share/classes/sun/awt/geom/AreaOp.java | 56 +++++------ .../share/classes/sun/awt/geom/Crossings.java | 16 ++-- jdk/src/share/classes/sun/awt/geom/Curve.java | 8 +- .../share/classes/sun/awt/geom/Order2.java | 4 +- .../share/classes/sun/awt/geom/Order3.java | 4 +- .../sun/awt/image/BufImgSurfaceData.java | 2 +- .../sun/awt/image/GifImageDecoder.java | 2 +- .../classes/sun/awt/image/ImageDecoder.java | 4 +- .../classes/sun/awt/image/ImageFetcher.java | 41 ++++---- .../sun/awt/image/ImageRepresentation.java | 2 +- .../classes/sun/awt/image/ImagingLib.java | 4 +- .../sun/awt/image/JPEGImageDecoder.java | 6 +- .../sun/awt/image/OffScreenImageSource.java | 6 +- .../sun/awt/image/PNGImageDecoder.java | 4 +- .../classes/sun/awt/image/ToolkitImage.java | 6 +- .../classes/sun/awt/shell/ShellFolder.java | 12 ++- .../sun/awt/shell/ShellFolderColumnInfo.java | 10 +- .../sun/awt/util/IdentityArrayList.java | 7 +- .../sun/awt/util/IdentityLinkedList.java | 11 ++- .../classes/sun/awt/X11/InfoWindow.java | 5 +- .../classes/sun/awt/X11/ListHelper.java | 16 ++-- .../awt/X11/MotifDnDDragSourceProtocol.java | 3 +- .../solaris/classes/sun/awt/X11/Native.java | 21 ++--- .../classes/sun/awt/X11/XAWTXSettings.java | 8 +- .../classes/sun/awt/X11/XAtomList.java | 2 +- .../classes/sun/awt/X11/XAwtState.java | 12 +-- .../classes/sun/awt/X11/XBaseMenuWindow.java | 6 +- .../classes/sun/awt/X11/XComponentPeer.java | 14 +-- .../sun/awt/X11/XCreateWindowParams.java | 6 +- .../classes/sun/awt/X11/XDataTransferer.java | 3 +- .../sun/awt/X11/XDnDDragSourceProtocol.java | 3 +- .../sun/awt/X11/XDragAndDropProtocols.java | 24 ++--- .../sun/awt/X11/XDragSourceContextPeer.java | 24 +++-- .../sun/awt/X11/XDragSourceProtocol.java | 6 +- .../sun/awt/X11/XDropTargetContextPeer.java | 17 ++-- .../awt/X11/XDropTargetEventProcessor.java | 5 +- .../sun/awt/X11/XDropTargetProtocol.java | 6 +- .../sun/awt/X11/XDropTargetRegistry.java | 53 +++++------ .../sun/awt/X11/XEmbeddingContainer.java | 2 +- .../classes/sun/awt/X11/XFileDialogPeer.java | 6 +- .../classes/sun/awt/X11/XListPeer.java | 16 ++-- .../classes/sun/awt/X11/XMSelection.java | 24 ++--- .../classes/sun/awt/X11/XMenuBarPeer.java | 6 +- .../classes/sun/awt/X11/XMenuPeer.java | 2 +- .../classes/sun/awt/X11/XMenuWindow.java | 4 +- .../classes/sun/awt/X11/XPopupMenuPeer.java | 4 +- .../classes/sun/awt/X11/XSelection.java | 6 +- .../solaris/classes/sun/awt/X11/XToolkit.java | 94 +++++++++---------- .../classes/sun/awt/X11/XTrayIconPeer.java | 2 +- jdk/src/solaris/classes/sun/awt/X11/XWM.java | 5 +- .../solaris/classes/sun/awt/X11/XWindow.java | 8 +- .../classes/sun/awt/X11/XWindowPeer.java | 2 +- .../classes/sun/awt/X11CustomCursor.java | 6 +- .../classes/sun/awt/X11FontManager.java | 42 ++++----- .../classes/sun/awt/X11GraphicsDevice.java | 8 +- .../sun/awt/X11GraphicsEnvironment.java | 14 +-- .../classes/sun/awt/X11InputMethod.java | 28 +++--- .../solaris/classes/sun/awt/XSettings.java | 8 +- .../sun/awt/motif/MFontConfiguration.java | 6 +- 72 files changed, 452 insertions(+), 437 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Menu.java b/jdk/src/share/classes/java/awt/Menu.java index 629371868d1..ae8e50ea7e1 100644 --- a/jdk/src/share/classes/java/awt/Menu.java +++ b/jdk/src/share/classes/java/awt/Menu.java @@ -66,7 +66,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { AWTAccessor.setMenuAccessor( new AWTAccessor.MenuAccessor() { - public Vector getItems(Menu menu) { + public Vector getItems(Menu menu) { return menu.items; } }); @@ -78,7 +78,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * @serial * @see #countItems() */ - Vector items = new Vector<>(); + Vector items = new Vector<>(); /** * This field indicates whether the menu has the @@ -252,7 +252,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { * be called on the toolkit thread. */ final MenuItem getItemImpl(int index) { - return (MenuItem)items.elementAt(index); + return items.elementAt(index); } /** @@ -544,7 +544,7 @@ public class Menu extends MenuItem implements MenuContainer, Accessible { // HeadlessException will be thrown from MenuComponent's readObject s.defaultReadObject(); for(int i = 0; i < items.size(); i++) { - MenuItem item = (MenuItem)items.elementAt(i); + MenuItem item = items.elementAt(i); item.parent = this; } } diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index b99ccdfe2ee..1d60a1c332d 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -621,7 +621,7 @@ public final class AWTAccessor { /** * Returns menus */ - Vector getMenus(MenuBar menuBar); + Vector getMenus(MenuBar menuBar); } /** @@ -663,7 +663,7 @@ public final class AWTAccessor { /** * Returns vector of the items that are part of the Menu */ - Vector getItems(Menu menu); + Vector getItems(Menu menu); } /** diff --git a/jdk/src/share/classes/sun/awt/AppContext.java b/jdk/src/share/classes/sun/awt/AppContext.java index 5959e54dea4..23653ba7387 100644 --- a/jdk/src/share/classes/sun/awt/AppContext.java +++ b/jdk/src/share/classes/sun/awt/AppContext.java @@ -890,6 +890,7 @@ public final class AppContext { Supplier supplier) { final AppContext appContext = AppContext.getAppContext(); + @SuppressWarnings("unchecked") SoftReference ref = (SoftReference) appContext.get(key); if (ref != null) { final T object = ref.get(); diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java index f95b36805df..c234b534633 100644 --- a/jdk/src/share/classes/sun/awt/FontConfiguration.java +++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java @@ -64,7 +64,7 @@ public abstract class FontConfiguration { protected static String osName; protected static String encoding; // canonical name of default nio charset protected static Locale startupLocale = null; - protected static Hashtable localeMap = null; + protected static Hashtable localeMap = null; private static FontConfiguration fontConfig; private static PlatformLogger logger; protected static boolean isProperties = true; @@ -159,15 +159,15 @@ public abstract class FontConfiguration { short fontNameID = compFontNameIDs[0][0][0]; short fileNameID = getComponentFileID(fontNameID); final String fileName = mapFileName(getComponentFileName(fileNameID)); - Boolean exists = (Boolean)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + Boolean exists = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Boolean run() { try { File f = new File(fileName); return Boolean.valueOf(f.exists()); } catch (Exception e) { - return false; + return Boolean.FALSE; } } }); @@ -534,11 +534,11 @@ public abstract class FontConfiguration { private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) { String scriptName = getString(table_scriptIDs[scriptID]); - String value = (String)localeMap.get(scriptName); + String value = localeMap.get(scriptName); if (value == null) { String fontName = fontNames[fontIndex]; String styleName = styleNames[styleIndex]; - value = (String)localeMap.get(fontName + "." + styleName + "." + scriptName); + value = localeMap.get(fontName + "." + styleName + "." + scriptName); } if (value == null) { return fontID; @@ -746,7 +746,7 @@ public abstract class FontConfiguration { /* Mappings from file encoding to font config name for font supporting * the corresponding language. This is filled in by initReorderMap() */ - protected HashMap reorderMap = null; + protected HashMap reorderMap = null; /* Platform-specific mappings */ protected abstract void initReorderMap(); @@ -777,7 +777,7 @@ public abstract class FontConfiguration { if (fontConfig.reorderMap == null) { fontConfig.initReorderMap(); } - HashMap reorderMap = fontConfig.reorderMap; + HashMap reorderMap = fontConfig.reorderMap; /* Find the most specific mapping */ String language = startupLocale.getLanguage(); @@ -817,9 +817,9 @@ public abstract class FontConfiguration { } } - private static Vector splitSequence(String sequence) { + private static Vector splitSequence(String sequence) { //String.split would be more convenient, but incurs big performance penalty - Vector parts = new Vector(); + Vector parts = new Vector<>(); int start = 0; int end; while ((end = sequence.indexOf(',', start)) >= 0) { @@ -833,14 +833,14 @@ public abstract class FontConfiguration { } protected String[] split(String sequence) { - Vector v = splitSequence(sequence); - return (String[])v.toArray(new String[0]); + Vector v = splitSequence(sequence); + return v.toArray(new String[0]); } //////////////////////////////////////////////////////////////////////// // Methods for extracting information from the fontconfig data for AWT// //////////////////////////////////////////////////////////////////////// - private Hashtable charsetRegistry = new Hashtable(5); + private Hashtable charsetRegistry = new Hashtable<>(5); /** * Returns FontDescriptors describing the physical fonts used for the @@ -932,9 +932,9 @@ public abstract class FontConfiguration { Charset fc = null; if (charsetName.equals("default")) { - fc = (Charset) charsetRegistry.get(fontName); + fc = charsetRegistry.get(fontName); } else { - fc = (Charset) charsetRegistry.get(charsetName); + fc = charsetRegistry.get(charsetName); } if (fc != null) { return fc.newEncoder(); @@ -943,8 +943,8 @@ public abstract class FontConfiguration { if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) { fc = Charset.forName(charsetName); } else { - Class fcc = (Class) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Class fcc = AccessController.doPrivileged(new PrivilegedAction>() { + public Class run() { try { return Class.forName(charsetName, true, ClassLoader.getSystemClassLoader()); @@ -1377,9 +1377,9 @@ public abstract class FontConfiguration { //This method will only be called during build time, do we //need do PrivilegedAction? - String osName = (String)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + String osName = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public String run() { return System.getProperty("os.name"); } }); @@ -2139,7 +2139,7 @@ public abstract class FontConfiguration { boolean has1252 = false; //get the scriptID list - String[] ss = (String[])splitSequence(value).toArray(EMPTY_STRING_ARRAY); + String[] ss = splitSequence(value).toArray(EMPTY_STRING_ARRAY); short [] sa = new short[ss.length]; for (int i = 0; i < ss.length; i++) { if ("alphabetic/default".equals(ss[i])) { diff --git a/jdk/src/share/classes/sun/awt/HToolkit.java b/jdk/src/share/classes/sun/awt/HToolkit.java index fdce8ccdcfc..81edd5ef641 100644 --- a/jdk/src/share/classes/sun/awt/HToolkit.java +++ b/jdk/src/share/classes/sun/awt/HToolkit.java @@ -214,7 +214,8 @@ public class HToolkit extends SunToolkit throw new HeadlessException(); } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) + public Map mapInputMethodHighlight( + InputMethodHighlight highlight) throws HeadlessException { throw new HeadlessException(); } diff --git a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java index 9d68bd48b1e..08890486486 100644 --- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java +++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java @@ -29,6 +29,7 @@ import java.awt.*; import java.awt.dnd.*; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.event.*; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.image.*; import java.awt.datatransfer.Clipboard; @@ -224,7 +225,7 @@ public class HeadlessToolkit extends Toolkit throw new HeadlessException(); } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) + public Map mapInputMethodHighlight(InputMethodHighlight highlight) throws HeadlessException { throw new HeadlessException(); } diff --git a/jdk/src/share/classes/sun/awt/PlatformFont.java b/jdk/src/share/classes/sun/awt/PlatformFont.java index f88b192715f..02596457d6f 100644 --- a/jdk/src/share/classes/sun/awt/PlatformFont.java +++ b/jdk/src/share/classes/sun/awt/PlatformFont.java @@ -143,7 +143,7 @@ public abstract class PlatformFont implements FontPeer { if (len < 1) { return new CharsetString[0]; } - Vector mcs = null; + Vector mcs = null; char[] tmpStr = new char[len]; char tmpChar = defaultChar; boolean encoded = false; @@ -198,7 +198,7 @@ public abstract class PlatformFont implements FontPeer { } if (currentFont != fd){ if (mcs == null) { - mcs = new Vector(3); + mcs = new Vector<>(3); } mcs.addElement(new CharsetString(tmpStr, lastIndex, i-lastIndex, currentFont)); @@ -209,16 +209,13 @@ public abstract class PlatformFont implements FontPeer { } CharsetString[] result; CharsetString cs = new CharsetString(tmpStr, lastIndex, - len-lastIndex, currentFont); + len-lastIndex, currentFont); if (mcs == null) { result = new CharsetString[1]; result[0] = cs; } else { mcs.addElement(cs); - result = new CharsetString[mcs.size()]; - for (int i = 0; i < mcs.size(); i++){ - result[i] = (CharsetString)mcs.elementAt(i); - } + result = mcs.toArray(new CharsetString[mcs.size()]); } return result; } diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index 1cb15b78a01..6739a603c5d 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -1915,6 +1915,7 @@ public abstract class SunToolkit extends Toolkit public synchronized void setWindowDeactivationTime(Window w, long time) { AppContext ctx = getAppContext(w); + @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { map = new WeakHashMap(); @@ -1925,6 +1926,7 @@ public abstract class SunToolkit extends Toolkit public synchronized long getWindowDeactivationTime(Window w) { AppContext ctx = getAppContext(w); + @SuppressWarnings("unchecked") WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); if (map == null) { return -1; diff --git a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java index d9c8334df8a..367d90e0b90 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -324,7 +324,7 @@ public abstract class DataTransferer { return false; } - Class rep_class = flavor.getRepresentationClass(); + Class rep_class = flavor.getRepresentationClass(); if (flavor.isRepresentationClassReader() || String.class.equals(rep_class) || @@ -696,7 +696,7 @@ public abstract class DataTransferer { * DataFlavors and data formats * @throws NullPointerException if formats or map is null */ - public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) { + public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) { Set flavorSet = new HashSet<>(formats.length); for (long format : formats) { @@ -1085,7 +1085,7 @@ search: throw new IOException("data translation failed"); } - final List list = (List)obj; + final List list = (List)obj; final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents); @@ -1113,7 +1113,7 @@ search: if (targetCharset == null) { targetCharset = "UTF-8"; } - final List list = (List)obj; + final List list = (List)obj; final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents); final ArrayList fileList = castToFiles(list, userProtectionDomain); final ArrayList uriList = new ArrayList<>(fileList.size()); @@ -1258,7 +1258,7 @@ search: return true; } - private ArrayList castToFiles(final List files, + private ArrayList castToFiles(final List files, final ProtectionDomain userProtectionDomain) throws IOException { try { return AccessController.doPrivileged((PrivilegedExceptionAction>) () -> { @@ -1636,7 +1636,7 @@ search: * instance of the Class as its sole parameter. */ private Object constructFlavoredObject(Object arg, DataFlavor flavor, - Class clazz) + Class clazz) throws IOException { final Class dfrc = flavor.getRepresentationClass(); @@ -1644,19 +1644,19 @@ search: if (clazz.equals(dfrc)) { return arg; // simple case } else { - Constructor[] constructors; + Constructor[] constructors; try { constructors = AccessController.doPrivileged( - (PrivilegedAction) dfrc::getConstructors); + (PrivilegedAction[]>) dfrc::getConstructors); } catch (SecurityException se) { throw new IOException(se.getMessage()); } - Constructor constructor = Stream.of(constructors) + Constructor constructor = Stream.of(constructors) .filter(c -> Modifier.isPublic(c.getModifiers())) .filter(c -> { - Class[] ptypes = c.getParameterTypes(); + Class[] ptypes = c.getParameterTypes(); return ptypes != null && ptypes.length == 1 && clazz.equals(ptypes[0]); @@ -1865,7 +1865,8 @@ search: byte[] bytes, String mimeType) throws IOException { - Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType); + Iterator readerIterator = + ImageIO.getImageReadersByMIMEType(mimeType); if (!readerIterator.hasNext()) { throw new IOException("No registered service provider can decode " + @@ -1875,7 +1876,7 @@ search: IOException ioe = null; while (readerIterator.hasNext()) { - ImageReader imageReader = (ImageReader)readerIterator.next(); + ImageReader imageReader = readerIterator.next(); try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) { try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) { ImageReadParam param = imageReader.getDefaultReadParam(); @@ -1918,7 +1919,8 @@ search: throws IOException { IOException originalIOE = null; - Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType); + Iterator writerIterator = + ImageIO.getImageWritersByMIMEType(mimeType); if (!writerIterator.hasNext()) { throw new IOException("No registered service provider can encode " + @@ -1977,7 +1979,8 @@ search: String mimeType) throws IOException { - Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType); + Iterator writerIterator = + ImageIO.getImageWritersByMIMEType(mimeType); ImageTypeSpecifier typeSpecifier = new ImageTypeSpecifier(renderedImage); @@ -1986,7 +1989,7 @@ search: IOException ioe = null; while (writerIterator.hasNext()) { - ImageWriter imageWriter = (ImageWriter)writerIterator.next(); + ImageWriter imageWriter = writerIterator.next(); ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider(); if (!writerSpi.canEncodeImage(typeSpecifier)) { @@ -2070,7 +2073,7 @@ search: public byte[] convertData(final Object source, final Transferable contents, final long format, - final Map formatMap, + final Map formatMap, final boolean isToolkitThread) throws IOException { @@ -2093,7 +2096,7 @@ search: } byte[] data = null; try { - DataFlavor flavor = (DataFlavor)formatMap.get(format); + DataFlavor flavor = formatMap.get(format); if (flavor != null) { data = translateTransferable(contents, flavor, format); } @@ -2134,7 +2137,7 @@ search: } finally { getToolkitThreadBlockedHandler().unlock(); } else { - DataFlavor flavor = (DataFlavor)formatMap.get(format); + DataFlavor flavor = formatMap.get(format); if (flavor != null) { ret = translateTransferable(contents, flavor, format); } @@ -2183,7 +2186,7 @@ search: * Helper function to convert a Set of DataFlavors to a sorted array. * The array will be sorted according to DataFlavorComparator. */ - public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) { + public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) { DataFlavor[] flavors = new DataFlavor[flavorsSet.size()]; flavorsSet.toArray(flavors); final Comparator comparator = @@ -2544,12 +2547,12 @@ search: String primaryType1 = flavor1.getPrimaryType(); String subType1 = flavor1.getSubType(); String mimeType1 = primaryType1 + "/" + subType1; - Class class1 = flavor1.getRepresentationClass(); + Class class1 = flavor1.getRepresentationClass(); String primaryType2 = flavor2.getPrimaryType(); String subType2 = flavor2.getSubType(); String mimeType2 = primaryType2 + "/" + subType2; - Class class2 = flavor2.getRepresentationClass(); + Class class2 = flavor2.getRepresentationClass(); if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) { // First, compare MIME types diff --git a/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java b/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java index 77162cbadd3..258a298adbe 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java @@ -78,7 +78,7 @@ public abstract class SunClipboard extends Clipboard * this clipboard. It is used for tracking changes * of DataFlavors available on this clipboard. */ - private volatile Set currentDataFlavors; + private volatile Set currentDataFlavors; public SunClipboard(String name) { @@ -338,7 +338,7 @@ public abstract class SunClipboard extends Clipboard protected abstract byte[] getClipboardData(long format) throws IOException; - private static Set formatArrayAsDataFlavorSet(long[] formats) { + private static Set formatArrayAsDataFlavorSet(long[] formats) { return (formats == null) ? null : DataTransferer.getInstance(). getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable()); @@ -417,7 +417,7 @@ public abstract class SunClipboard extends Clipboard * this clipboard */ public void checkChange(long[] formats) { - Set prevDataFlavors = currentDataFlavors; + Set prevDataFlavors = currentDataFlavors; currentDataFlavors = formatArrayAsDataFlavorSet(formats); if (Objects.equals(prevDataFlavors, currentDataFlavors)) { diff --git a/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java b/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java index ac79ecf7127..39ba273ec54 100644 --- a/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java +++ b/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java @@ -111,9 +111,9 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream { } protected void annotateClass(final Class cl) throws IOException { - ClassLoader classLoader = - (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + ClassLoader classLoader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { return cl.getClassLoader(); } }); @@ -124,14 +124,14 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream { map.put(s, classLoader); } protected void annotateProxyClass(final Class cl) throws IOException { - ClassLoader classLoader = - (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + ClassLoader classLoader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { return cl.getClassLoader(); } }); - Class[] interfaces = cl.getInterfaces(); + Class[] interfaces = cl.getInterfaces(); Set s = new HashSet(interfaces.length); for (int i = 0; i < interfaces.length; i++) { s.add(interfaces[i].getName()); @@ -141,7 +141,7 @@ final class ClassLoaderObjectOutputStream extends ObjectOutputStream { } Map, ClassLoader> getClassLoaderMap() { - return new HashMap(map); + return new HashMap<>(map); } } @@ -191,9 +191,9 @@ final class ClassLoaderObjectInputStream extends ObjectInputStream { boolean hasNonPublicInterface = false; // define proxy in class loader of non-public interface(s), if any - Class[] classObjs = new Class[interfaces.length]; + Class[] classObjs = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { - Class cl = Class.forName(interfaces[i], false, classLoader); + Class cl = Class.forName(interfaces[i], false, classLoader); if ((cl.getModifiers() & Modifier.PUBLIC) == 0) { if (hasNonPublicInterface) { if (nonPublicLoader != cl.getClassLoader()) { diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java index ae0a642dcb2..8baa689296f 100644 --- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java +++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java @@ -146,7 +146,7 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer } protected abstract void startDrag(Transferable trans, - long[] formats, Map formatMap); + long[] formats, Map formatMap); /** * set cursor diff --git a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java index 842b387f6f4..a880f1235f6 100644 --- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java +++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java @@ -252,11 +252,11 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, throw new InvalidDnDOperationException("No drop current"); } - Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats - (currentT, DataTransferer.adaptFlavorMap + Map flavorMap = DataTransferer.getInstance() + .getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap (currentDT.getFlavorMap())); - lFormat = (Long)flavorMap.get(df); + lFormat = flavorMap.get(df); if (lFormat == null) { throw new UnsupportedFlavorException(df); } @@ -745,7 +745,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, // dispatcher state fields private int returnValue = 0; // set of events to be dispatched by this dispatcher - private final HashSet eventSet = new HashSet(3); + private final HashSet eventSet = new HashSet<>(3); static final ToolkitThreadBlockedHandler handler = DataTransferer.getInstance().getToolkitThreadBlockedHandler(); diff --git a/jdk/src/share/classes/sun/awt/geom/AreaOp.java b/jdk/src/share/classes/sun/awt/geom/AreaOp.java index dd9e957cc28..bdbf2cb2b7e 100644 --- a/jdk/src/share/classes/sun/awt/geom/AreaOp.java +++ b/jdk/src/share/classes/sun/awt/geom/AreaOp.java @@ -152,36 +152,36 @@ public abstract class AreaOp { public abstract int getState(); - public Vector calculate(Vector left, Vector right) { - Vector edges = new Vector(); + public Vector calculate(Vector left, Vector right) { + Vector edges = new Vector<>(); addEdges(edges, left, AreaOp.CTAG_LEFT); addEdges(edges, right, AreaOp.CTAG_RIGHT); - edges = pruneEdges(edges); + Vector curves = pruneEdges(edges); if (false) { System.out.println("result: "); - int numcurves = edges.size(); - Curve[] curvelist = (Curve[]) edges.toArray(new Curve[numcurves]); + int numcurves = curves.size(); + Curve[] curvelist = curves.toArray(new Curve[numcurves]); for (int i = 0; i < numcurves; i++) { System.out.println("curvelist["+i+"] = "+curvelist[i]); } } - return edges; + return curves; } - private static void addEdges(Vector edges, Vector curves, int curvetag) { - Enumeration enum_ = curves.elements(); + private static void addEdges(Vector edges, Vector curves, int curvetag) { + Enumeration enum_ = curves.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.getOrder() > 0) { edges.add(new Edge(c, curvetag)); } } } - private static Comparator YXTopComparator = new Comparator() { - public int compare(Object o1, Object o2) { - Curve c1 = ((Edge) o1).getCurve(); - Curve c2 = ((Edge) o2).getCurve(); + private static Comparator YXTopComparator = new Comparator() { + public int compare(Edge o1, Edge o2) { + Curve c1 = o1.getCurve(); + Curve c2 = o2.getCurve(); double v1, v2; if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) { if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) { @@ -195,12 +195,13 @@ public abstract class AreaOp { } }; - private Vector pruneEdges(Vector edges) { + private Vector pruneEdges(Vector edges) { int numedges = edges.size(); if (numedges < 2) { - return edges; + // empty vector is expected with less than 2 edges + return new Vector<>(); } - Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]); + Edge[] edgelist = edges.toArray(new Edge[numedges]); Arrays.sort(edgelist, YXTopComparator); if (false) { System.out.println("pruning: "); @@ -214,9 +215,9 @@ public abstract class AreaOp { int cur = 0; int next = 0; double yrange[] = new double[2]; - Vector subcurves = new Vector(); - Vector chains = new Vector(); - Vector links = new Vector(); + Vector subcurves = new Vector<>(); + Vector chains = new Vector<>(); + Vector links = new Vector<>(); // Active edges are between left (inclusive) and right (exclusive) while (left < numedges) { double y = yrange[0]; @@ -385,7 +386,7 @@ public abstract class AreaOp { if (false) { System.out.println("new links:"); for (int i = 0; i < links.size(); i++) { - CurveLink link = (CurveLink) links.elementAt(i); + CurveLink link = links.elementAt(i); System.out.println(" "+link.getSubCurve()); } } @@ -396,10 +397,10 @@ public abstract class AreaOp { yrange[0] = yend; } finalizeSubCurves(subcurves, chains); - Vector ret = new Vector(); - Enumeration enum_ = subcurves.elements(); + Vector ret = new Vector<>(); + Enumeration enum_ = subcurves.elements(); while (enum_.hasMoreElements()) { - CurveLink link = (CurveLink) enum_.nextElement(); + CurveLink link = enum_.nextElement(); ret.add(link.getMoveto()); CurveLink nextlink = link; while ((nextlink = nextlink.getNext()) != null) { @@ -413,7 +414,8 @@ public abstract class AreaOp { return ret; } - public static void finalizeSubCurves(Vector subcurves, Vector chains) { + public static void finalizeSubCurves(Vector subcurves, + Vector chains) { int numchains = chains.size(); if (numchains == 0) { return; @@ -437,9 +439,9 @@ public abstract class AreaOp { private static CurveLink[] EmptyLinkList = new CurveLink[2]; private static ChainEnd[] EmptyChainList = new ChainEnd[2]; - public static void resolveLinks(Vector subcurves, - Vector chains, - Vector links) + public static void resolveLinks(Vector subcurves, + Vector chains, + Vector links) { int numlinks = links.size(); CurveLink[] linklist; diff --git a/jdk/src/share/classes/sun/awt/geom/Crossings.java b/jdk/src/share/classes/sun/awt/geom/Crossings.java index 7ab97bce80c..76a29a15d45 100644 --- a/jdk/src/share/classes/sun/awt/geom/Crossings.java +++ b/jdk/src/share/classes/sun/awt/geom/Crossings.java @@ -77,14 +77,14 @@ public abstract class Crossings { public abstract boolean covers(double ystart, double yend); - public static Crossings findCrossings(Vector curves, + public static Crossings findCrossings(Vector curves, double xlo, double ylo, double xhi, double yhi) { Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi); - Enumeration enum_ = curves.elements(); + Enumeration enum_ = curves.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(cross)) { return null; } @@ -237,7 +237,7 @@ public abstract class Crossings { return false; } - private Vector tmp = new Vector(); + private Vector tmp = new Vector<>(); public boolean accumulateQuad(double x0, double y0, double coords[]) { if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) { @@ -258,9 +258,9 @@ public abstract class Crossings { return false; } Curve.insertQuad(tmp, x0, y0, coords); - Enumeration enum_ = tmp.elements(); + Enumeration enum_ = tmp.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(this)) { return true; } @@ -296,9 +296,9 @@ public abstract class Crossings { return false; } Curve.insertCubic(tmp, x0, y0, coords); - Enumeration enum_ = tmp.elements(); + Enumeration enum_ = tmp.elements(); while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); if (c.accumulateCrossings(this)) { return true; } diff --git a/jdk/src/share/classes/sun/awt/geom/Curve.java b/jdk/src/share/classes/sun/awt/geom/Curve.java index 871be17f4c8..bc478da02b3 100644 --- a/jdk/src/share/classes/sun/awt/geom/Curve.java +++ b/jdk/src/share/classes/sun/awt/geom/Curve.java @@ -38,11 +38,11 @@ public abstract class Curve { protected int direction; - public static void insertMove(Vector curves, double x, double y) { + public static void insertMove(Vector curves, double x, double y) { curves.add(new Order0(x, y)); } - public static void insertLine(Vector curves, + public static void insertLine(Vector curves, double x0, double y0, double x1, double y1) { @@ -59,7 +59,7 @@ public abstract class Curve { } } - public static void insertQuad(Vector curves, + public static void insertQuad(Vector curves, double x0, double y0, double coords[]) { @@ -82,7 +82,7 @@ public abstract class Curve { } } - public static void insertCubic(Vector curves, + public static void insertCubic(Vector curves, double x0, double y0, double coords[]) { diff --git a/jdk/src/share/classes/sun/awt/geom/Order2.java b/jdk/src/share/classes/sun/awt/geom/Order2.java index 69218f5a95e..64d37c88e27 100644 --- a/jdk/src/share/classes/sun/awt/geom/Order2.java +++ b/jdk/src/share/classes/sun/awt/geom/Order2.java @@ -47,7 +47,7 @@ final class Order2 extends Curve { private double ycoeff1; private double ycoeff2; - public static void insert(Vector curves, double tmp[], + public static void insert(Vector curves, double tmp[], double x0, double y0, double cx0, double cy0, double x1, double y1, @@ -74,7 +74,7 @@ final class Order2 extends Curve { tmp[i1 + 4], tmp[i1 + 5], direction); } - public static void addInstance(Vector curves, + public static void addInstance(Vector curves, double x0, double y0, double cx0, double cy0, double x1, double y1, diff --git a/jdk/src/share/classes/sun/awt/geom/Order3.java b/jdk/src/share/classes/sun/awt/geom/Order3.java index ad49c676db3..9c9e5962aea 100644 --- a/jdk/src/share/classes/sun/awt/geom/Order3.java +++ b/jdk/src/share/classes/sun/awt/geom/Order3.java @@ -53,7 +53,7 @@ final class Order3 extends Curve { private double ycoeff2; private double ycoeff3; - public static void insert(Vector curves, double tmp[], + public static void insert(Vector curves, double tmp[], double x0, double y0, double cx0, double cy0, double cx1, double cy1, @@ -105,7 +105,7 @@ final class Order3 extends Curve { } } - public static void addInstance(Vector curves, + public static void addInstance(Vector curves, double x0, double y0, double cx0, double cy0, double cx1, double cy1, diff --git a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java index efc4bc97ec4..ac26802b027 100644 --- a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java +++ b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java @@ -51,7 +51,7 @@ public class BufImgSurfaceData extends SurfaceData { private BufferedImageGraphicsConfig graphicsConfig; RenderLoops solidloops; - private static native void initIDs(Class ICM, Class ICMColorData); + private static native void initIDs(Class ICM, Class ICMColorData); private static final int DCM_RGBX_RED_MASK = 0xff000000; private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000; diff --git a/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java b/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java index bd8efa8d1a3..33640165fb2 100644 --- a/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java +++ b/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java @@ -61,7 +61,7 @@ public class GifImageDecoder extends ImageDecoder { int trans_pixel = -1; IndexColorModel global_model; - Hashtable props = new Hashtable(); + Hashtable props = new Hashtable<>(); byte[] saved_image; IndexColorModel saved_model; diff --git a/jdk/src/share/classes/sun/awt/image/ImageDecoder.java b/jdk/src/share/classes/sun/awt/image/ImageDecoder.java index 643ec638f11..7f4bbd85efa 100644 --- a/jdk/src/share/classes/sun/awt/image/ImageDecoder.java +++ b/jdk/src/share/classes/sun/awt/image/ImageDecoder.java @@ -83,7 +83,7 @@ public abstract class ImageDecoder { return count; } - protected int setProperties(Hashtable props) { + protected int setProperties(Hashtable props) { ImageConsumerQueue cq = null; int count = 0; while ((cq = nextConsumer(cq)) != null) { @@ -164,7 +164,7 @@ public abstract class ImageDecoder { source.doneDecoding(this); close(); java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { feeder.interrupt(); return null; diff --git a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java index a5af63512c7..eaccf335db0 100644 --- a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java +++ b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java @@ -152,7 +152,7 @@ class ImageFetcher extends Thread { info.numWaiting--; } } - src = (ImageFetchable) info.waitList.elementAt(0); + src = info.waitList.elementAt(0); info.waitList.removeElement(src); } return src; @@ -303,26 +303,25 @@ class ImageFetcher extends Thread { final ThreadGroup fetcherGroup = fetcherThreadGroup; java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - for (int i = 0; i < info.fetchers.length; i++) { - if (info.fetchers[i] == null) { - ImageFetcher f = new ImageFetcher( - fetcherGroup, i); - try { - f.start(); - info.fetchers[i] = f; - info.numFetchers++; - break; - } catch (Error e) { + new java.security.PrivilegedAction() { + public Object run() { + for (int i = 0; i < info.fetchers.length; i++) { + if (info.fetchers[i] == null) { + ImageFetcher f = new ImageFetcher(fetcherGroup, i); + try { + f.start(); + info.fetchers[i] = f; + info.numFetchers++; + break; + } catch (Error e) { + } } + } + return null; } - } - return null; - } - }); - return; - } + }); + return; + } } @@ -337,13 +336,13 @@ class FetcherInfo { Thread[] fetchers; int numFetchers; int numWaiting; - Vector waitList; + Vector waitList; private FetcherInfo() { fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT]; numFetchers = 0; numWaiting = 0; - waitList = new Vector(); + waitList = new Vector<>(); } /* The key to put()/get() the FetcherInfo into/from the AppContext. */ diff --git a/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java b/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java index 77ee7339a59..90bb2ac6388 100644 --- a/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java +++ b/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java @@ -185,7 +185,7 @@ public class ImageRepresentation extends ImageWatched implements ImageConsumer protected BufferedImage createImage(ColorModel cm, WritableRaster raster, boolean isRasterPremultiplied, - Hashtable properties) + Hashtable properties) { BufferedImage bi = new BufferedImage(cm, raster, isRasterPremultiplied, null); diff --git a/jdk/src/share/classes/sun/awt/image/ImagingLib.java b/jdk/src/share/classes/sun/awt/image/ImagingLib.java index 90ad81836c8..683b8fe7e75 100644 --- a/jdk/src/share/classes/sun/awt/image/ImagingLib.java +++ b/jdk/src/share/classes/sun/awt/image/ImagingLib.java @@ -61,7 +61,7 @@ public class ImagingLib { private static final int AFFINE_OP = 1; private static final int CONVOLVE_OP = 2; - private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS]; + private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS]; /** * Returned value indicates whether the library initailization was @@ -134,7 +134,7 @@ public class ImagingLib { } - private static int getNativeOpIndex(Class opClass) { + private static int getNativeOpIndex(Class opClass) { // // Search for this class in cached list of // classes supplying native acceleration diff --git a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java index 872ffc01974..70dacb195c3 100644 --- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java +++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java @@ -47,8 +47,8 @@ public class JPEGImageDecoder extends ImageDecoder { private static ColorModel ARGBcolormodel; private static ColorModel Graycolormodel; - private static final Class InputStreamClass = InputStream.class; - private static native void initIDs(Class InputStreamClass); + private static final Class InputStreamClass = InputStream.class; + private static native void initIDs(Class InputStreamClass); private ColorModel colormodel; @@ -73,7 +73,7 @@ public class JPEGImageDecoder extends ImageDecoder { private native void readImage(InputStream is, byte buf[]) throws ImageFormatException, IOException; - Hashtable props = new Hashtable(); + Hashtable props = new Hashtable<>(); public JPEGImageDecoder(InputStreamImageSource src, InputStream is) { super(src, is); diff --git a/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java b/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java index c1b0453a65b..3dcdde01574 100644 --- a/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java +++ b/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java @@ -40,15 +40,15 @@ public class OffScreenImageSource implements ImageProducer { BufferedImage image; int width; int height; - Hashtable properties; + Hashtable properties; public OffScreenImageSource(BufferedImage image, - Hashtable properties) { + Hashtable properties) { this.image = image; if (properties != null) { this.properties = properties; } else { - this.properties = new Hashtable(); + this.properties = new Hashtable(); } width = image.getWidth(); height = image.getHeight(); diff --git a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java index adbdb766da1..7f78de6e982 100644 --- a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java +++ b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java @@ -68,7 +68,7 @@ public class PNGImageDecoder extends ImageDecoder private int filterMethod; private int interlaceMethod; private int gamma = 100000; - private java.util.Hashtable properties; + private java.util.Hashtable properties; /* this is not needed ImageConsumer target; */ @@ -83,7 +83,7 @@ public class PNGImageDecoder extends ImageDecoder private void property(String key,Object value) { if(value==null) return; - if(properties==null) properties=new java.util.Hashtable(); + if(properties==null) properties=new java.util.Hashtable<>(); properties.put(key,value); } private void property(String key,float value) { diff --git a/jdk/src/share/classes/sun/awt/image/ToolkitImage.java b/jdk/src/share/classes/sun/awt/image/ToolkitImage.java index 885648d2265..b1f5873f106 100644 --- a/jdk/src/share/classes/sun/awt/image/ToolkitImage.java +++ b/jdk/src/share/classes/sun/awt/image/ToolkitImage.java @@ -79,7 +79,7 @@ public class ToolkitImage extends Image { private int width = -1; private int height = -1; - private Hashtable properties; + private Hashtable properties; private int availinfo; @@ -254,9 +254,9 @@ public class ToolkitImage extends Image { addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT); } - void setProperties(Hashtable props) { + void setProperties(Hashtable props) { if (props == null) { - props = new Hashtable(); + props = new Hashtable(); } properties = props; addInfo(ImageObserver.PROPERTIES); diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java index e8a9407276d..3795e146f2a 100644 --- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java +++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java @@ -127,14 +127,14 @@ public abstract class ShellFolder extends File { File[] files = super.listFiles(); if (!includeHiddenFiles) { - Vector v = new Vector(); + Vector v = new Vector<>(); int nameCount = (files == null) ? 0 : files.length; for (int i = 0; i < nameCount; i++) { if (!files[i].isHidden()) { v.addElement(files[i]); } } - files = (File[])v.toArray(new File[v.size()]); + files = v.toArray(new File[v.size()]); } return files; @@ -208,7 +208,7 @@ public abstract class ShellFolder extends File { static { String managerClassName = (String)Toolkit.getDefaultToolkit(). getDesktopProperty("Shell.shellFolderManager"); - Class managerClass = null; + Class managerClass = null; try { managerClass = ReflectUtil.forName(managerClassName); // swallow the exceptions below and use default shell folder @@ -554,7 +554,7 @@ public abstract class ShellFolder extends File { /** * Provides a default comparator for the default column set */ - private static final Comparator DEFAULT_COMPARATOR = new Comparator() { + private static final Comparator DEFAULT_COMPARATOR = new Comparator() { public int compare(Object o1, Object o2) { int gt; @@ -565,7 +565,9 @@ public abstract class ShellFolder extends File { } else if (o1 == null && o2 != null) { gt = -1; } else if (o1 instanceof Comparable) { - gt = ((Comparable) o1).compareTo(o2); + @SuppressWarnings("unchecked") + Comparable o = (Comparable) o1; + gt = o.compareTo(o2); } else { gt = 0; } diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java b/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java index 3836b04eb32..88dffacec2b 100644 --- a/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java +++ b/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java @@ -38,7 +38,7 @@ public class ShellFolderColumnInfo { */ private Integer alignment; private SortOrder sortOrder; - private Comparator comparator; + private Comparator comparator; /** * false (default) if the {@link comparator} expects folders as arguments, * and true if folder's column values. The first option is used default for comparison @@ -49,7 +49,7 @@ public class ShellFolderColumnInfo { public ShellFolderColumnInfo(String title, Integer width, Integer alignment, boolean visible, - SortOrder sortOrder, Comparator comparator, + SortOrder sortOrder, Comparator comparator, boolean compareByColumn) { this.title = title; this.width = width; @@ -62,7 +62,7 @@ public class ShellFolderColumnInfo { public ShellFolderColumnInfo(String title, Integer width, Integer alignment, boolean visible, - SortOrder sortOrder, Comparator comparator) { + SortOrder sortOrder, Comparator comparator) { this(title, width, alignment, visible, sortOrder, comparator, false); } @@ -115,11 +115,11 @@ public class ShellFolderColumnInfo { this.sortOrder = sortOrder; } - public Comparator getComparator() { + public Comparator getComparator() { return comparator; } - public void setComparator(Comparator comparator) { + public void setComparator(Comparator comparator) { this.comparator = comparator; } diff --git a/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java b/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java index bf66f427d72..c88452289cb 100644 --- a/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java +++ b/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java @@ -285,6 +285,7 @@ public class IdentityArrayList extends AbstractList * this list * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) // Make a new array of a's runtime type, but my contents: @@ -307,7 +308,9 @@ public class IdentityArrayList extends AbstractList public E get(int index) { rangeCheck(index); - return (E) elementData[index]; + @SuppressWarnings("unchecked") + E rv = (E) elementData[index]; + return rv; } /** @@ -322,6 +325,7 @@ public class IdentityArrayList extends AbstractList public E set(int index, E element) { rangeCheck(index); + @SuppressWarnings("unchecked") E oldValue = (E) elementData[index]; elementData[index] = element; return oldValue; @@ -371,6 +375,7 @@ public class IdentityArrayList extends AbstractList rangeCheck(index); modCount++; + @SuppressWarnings("unchecked") E oldValue = (E) elementData[index]; int numMoved = size - index - 1; diff --git a/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java b/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java index 77e0f0062aa..690264ab4d9 100644 --- a/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java +++ b/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java @@ -280,7 +280,9 @@ public class IdentityLinkedList Entry successor = (index==size ? header : entry(index)); Entry predecessor = successor.previous; for (int i=0; i e = new Entry((E)a[i], successor, predecessor); + @SuppressWarnings("unchecked") + E tmp = (E) a[i]; + Entry e = new Entry(tmp, successor, predecessor); predecessor.next = e; predecessor = e; } @@ -396,7 +398,7 @@ public class IdentityLinkedList */ public int indexOf(Object o) { int index = 0; - for (Entry e = header.next; e != header; e = e.next) { + for (Entry e = header.next; e != header; e = e.next) { if (o == e.element) { return index; } @@ -418,7 +420,7 @@ public class IdentityLinkedList */ public int lastIndexOf(Object o) { int index = size; - for (Entry e = header.previous; e != header; e = e.previous) { + for (Entry e = header.previous; e != header; e = e.previous) { index--; if (o == e.element) { return index; @@ -787,7 +789,7 @@ public class IdentityLinkedList } /** Adapter to provide descending iterators via ListItr.previous */ - private class DescendingIterator implements Iterator { + private class DescendingIterator implements Iterator { final ListItr itr = new ListItr(size()); public boolean hasNext() { return itr.hasPrevious(); @@ -860,6 +862,7 @@ public class IdentityLinkedList * this list * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance( diff --git a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java index 334d1d1c036..fb8b050a7e8 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java @@ -207,8 +207,9 @@ public abstract class InfoWindow extends Window { textLabel.setText(tooltipString); } - Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Point pointer = AccessController.doPrivileged( + new PrivilegedAction() { + public Point run() { if (!isPointerOverTrayIcon(liveArguments.getBounds())) { return null; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java index 0a83eaaf829..caf1c2df5ae 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java @@ -55,10 +55,10 @@ public class ListHelper implements XScrollbarClient { private final int SCROLLBAR_WIDTH; // Width of a scrollbar - private java.util.List items; // List of items + private java.util.List items; // List of items // TODO: maybe this would be better as a simple int[] - private java.util.List selected; // List of selected items + private java.util.List selected; // List of selected items private boolean multiSelect; // Can multiple items be selected // at once? private int focusedIndex; @@ -100,8 +100,8 @@ public class ListHelper implements XScrollbarClient { this.peer = peer; this.colors = colors; this.multiSelect = multiSelect; - items = new ArrayList(initialSize); - selected = new ArrayList(1); + items = new ArrayList<>(initialSize); + selected = new ArrayList<>(1); selected.add(Integer.valueOf(-1)); this.maxVisItems = maxVisItems; @@ -190,7 +190,7 @@ public class ListHelper implements XScrollbarClient { /* if called for multiselect, return -1 */ public int getSelectedIndex() { if (!multiSelect) { - Integer val = (Integer)selected.get(0); + Integer val = selected.get(0); return val.intValue(); } return -1; @@ -217,7 +217,7 @@ public class ListHelper implements XScrollbarClient { } public String getItem(int index) { - return (String) items.get(index); + return items.get(index); } /**********************************************************************/ @@ -576,9 +576,9 @@ public class ListHelper implements XScrollbarClient { } boolean isItemSelected(int index) { - Iterator itr = selected.iterator(); + Iterator itr = selected.iterator(); while (itr.hasNext()) { - Integer val = (Integer)itr.next(); + Integer val = itr.next(); if (val.intValue() == index) { return true; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java index 35109ebac70..6acc9d683ea 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -65,7 +66,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol } protected void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { diff --git a/jdk/src/solaris/classes/sun/awt/X11/Native.java b/jdk/src/solaris/classes/sun/awt/X11/Native.java index 14628b833ec..f61654643f2 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/Native.java +++ b/jdk/src/solaris/classes/sun/awt/X11/Native.java @@ -43,13 +43,12 @@ class Native { static int dataModel; static { - String dataModelProp = (String)AccessController. - doPrivileged( - new PrivilegedAction() { - public Object run() { - return System.getProperty("sun.arch.data.model"); - } - }); + String dataModelProp = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { + return System.getProperty("sun.arch.data.model"); + } + }); try { dataModel = Integer.parseInt(dataModelProp); } catch (Exception e) { @@ -333,9 +332,9 @@ class Native { * Stores Java Vector of Longs into memory. Memory location is treated as array * of native longs */ - static void putLong(long ptr, Vector arr) { + static void putLong(long ptr, Vector arr) { for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) { - putLong(ptr, ((Long)arr.elementAt(i)).longValue()); + putLong(ptr, arr.elementAt(i).longValue()); } } @@ -343,9 +342,9 @@ class Native { * Stores Java Vector of Longs into memory. Memory location is treated as array * of native longs. Array is stored in reverse order */ - static void putLongReverse(long ptr, Vector arr) { + static void putLongReverse(long ptr, Vector arr) { for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) { - putLong(ptr, ((Long)arr.elementAt(i)).longValue()); + putLong(ptr, arr.elementAt(i).longValue()); } } /** diff --git a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java index 48fcae52f0b..4c7b19c14cc 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java @@ -98,7 +98,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { * should be "good enough" for most cases. */ - Map updatedSettings = null; + Map updatedSettings = null; XToolkit.awtLock(); try { long display = XToolkit.getDisplay(); @@ -112,7 +112,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } private void updateXSettings(int screen, long owner) { - final Map updatedSettings = getUpdatedSettings(owner); + final Map updatedSettings = getUpdatedSettings(owner); // this method is called under awt lock and usually on toolkit thread // but parseXSettings() causes public code execution, so we need to transfer // this to EDT @@ -123,7 +123,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { }); } - private Map getUpdatedSettings(final long owner) { + private Map getUpdatedSettings(final long owner) { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("owner =" + owner); } @@ -131,7 +131,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { return null; } - Map settings = null; + Map settings = null; try { WindowPropertyGetter getter = new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH, diff --git a/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java b/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java index 7b53b6d2e95..a998850eb4c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java @@ -157,7 +157,7 @@ class XAtomList { public String toString() { StringBuffer buf = new StringBuffer(); buf.append("["); - Iterator iter = atoms.iterator(); + Iterator iter = atoms.iterator(); while (iter.hasNext()) { buf.append(iter.next().toString()); if (iter.hasNext()) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java b/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java index 872f9ea851b..b0a8186c77a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java @@ -40,7 +40,7 @@ class XAwtState { * The mouse is over this component. * If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED. */ - private static WeakReference componentMouseEnteredRef = null; + private static WeakReference componentMouseEnteredRef = null; static void setComponentMouseEntered(Component component) { XToolkit.awtLock(); @@ -50,7 +50,7 @@ class XAwtState { return; } if (component != getComponentMouseEntered()) { - componentMouseEnteredRef = new WeakReference(component); + componentMouseEnteredRef = new WeakReference<>(component); } } finally { XToolkit.awtUnlock(); @@ -63,7 +63,7 @@ class XAwtState { if (componentMouseEnteredRef == null) { return null; } - return (Component)componentMouseEnteredRef.get(); + return componentMouseEnteredRef.get(); } finally { XToolkit.awtUnlock(); } @@ -83,7 +83,7 @@ class XAwtState { return inManualGrab; } - private static WeakReference grabWindowRef = null; + private static WeakReference grabWindowRef = null; /** * The X Active Grab overrides any other active grab by the same @@ -112,7 +112,7 @@ class XAwtState { return; } if (grabWindow != getGrabWindow()) { - grabWindowRef = new WeakReference(grabWindow); + grabWindowRef = new WeakReference<>(grabWindow); } } finally { XToolkit.awtUnlock(); @@ -125,7 +125,7 @@ class XAwtState { if (grabWindowRef == null) { return null; } - XBaseWindow xbw = (XBaseWindow)grabWindowRef.get(); + XBaseWindow xbw = grabWindowRef.get(); if( xbw != null && xbw.isDisposed() ) { xbw = null; grabWindowRef = null; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java index 1d82f04a78c..53aae040883 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java @@ -231,7 +231,7 @@ abstract public class XBaseMenuWindow extends XWindow { */ void instantPreInit(XCreateWindowParams params) { super.instantPreInit(params); - items = new ArrayList(); + items = new ArrayList<>(); } /************************************************ @@ -367,10 +367,10 @@ abstract public class XBaseMenuWindow extends XWindow { * Clears items vector and loads specified vector * @param items vector to be loaded */ - public void reloadItems(Vector items) { + public void reloadItems(Vector items) { synchronized(getMenuTreeLock()) { this.items.clear(); - MenuItem[] itemArray = (MenuItem[])items.toArray(new MenuItem[] {}); + MenuItem[] itemArray = items.toArray(new MenuItem[] {}); int itemCnt = itemArray.length; for(int i = 0; i < itemCnt; i++) { addItem(itemArray[i]); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java index 6d3385cef46..6cc706278fc 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java @@ -236,8 +236,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget return false; } - private static Class seClass; - private static Constructor seCtor; + private static Class seClass; + private static Constructor seCtor; final static AWTEvent wrapInSequenced(AWTEvent event) { try { @@ -246,9 +246,11 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } if (seCtor == null) { - seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { - Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class }); + seCtor = AccessController.doPrivileged(new + PrivilegedExceptionAction>() { + public Constructor run() throws Exception { + Constructor ctor = seClass.getConstructor( + new Class[] { AWTEvent.class }); ctor.setAccessible(true); return ctor; } @@ -1322,7 +1324,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } } - private void addTree(Collection order, Set set, Container cont) { + private void addTree(Collection order, Set set, Container cont) { for (int i = 0; i < cont.getComponentCount(); i++) { Component comp = cont.getComponent(i); ComponentPeer peer = comp.getPeer(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java b/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java index 32d83f193ce..da263eb4890 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java @@ -30,7 +30,7 @@ import java.util.Iterator; import java.util.Map; @SuppressWarnings("serial") // JDK-implementation class -public class XCreateWindowParams extends HashMap { +public class XCreateWindowParams extends HashMap { public XCreateWindowParams() { } public XCreateWindowParams(Object[] map) { @@ -82,9 +82,9 @@ public class XCreateWindowParams extends HashMap { } public String toString() { StringBuffer buf = new StringBuffer(); - Iterator eIter = entrySet().iterator(); + Iterator> eIter = entrySet().iterator(); while (eIter.hasNext()) { - Map.Entry entry = (Map.Entry)eIter.next(); + Map.Entry entry = eIter.next(); buf.append(entry.getKey() + ": " + entry.getValue() + "\n"); } return buf.toString(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java index fd9cbb8f13c..36204203c23 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java @@ -49,6 +49,7 @@ import java.util.LinkedHashSet; import java.util.List; import javax.imageio.ImageIO; +import javax.imageio.ImageReader; import javax.imageio.ImageTypeSpecifier; import javax.imageio.ImageWriter; import javax.imageio.spi.ImageWriterSpi; @@ -333,7 +334,7 @@ public class XDataTransferer extends DataTransferer { // flavors to enable dynamic text native-to-flavor mapping generation. // See SystemFlavorMap.getFlavorsForNative() for details. if ("image".equals(primaryType)) { - Iterator readers = ImageIO.getImageReadersByMIMEType(baseType); + Iterator readers = ImageIO.getImageReadersByMIMEType(baseType); if (readers.hasNext()) { flavors.add(DataFlavor.imageFlavor); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java index b1e6f2ad041..4648a836679 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -70,7 +71,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { * @returns true if the initialized successfully. */ protected void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { assert XToolkit.isAWTLockHeldByCurrentThread(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java b/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java index b236881aec4..161fc285a02 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java @@ -36,8 +36,8 @@ import java.util.List; * @since 1.5 */ final class XDragAndDropProtocols { - private final static List dragProtocols; - private final static List dropProtocols; + private final static List dragProtocols; + private final static List dropProtocols; public static final String XDnD = "XDnD"; public static final String MotifDnD = "MotifDnD"; @@ -50,7 +50,7 @@ final class XDragAndDropProtocols { XDropTargetProtocolListener dropTargetProtocolListener = XDropTargetContextPeer.getXDropTargetProtocolListener(); - List tDragSourceProtocols = new ArrayList(); + List tDragSourceProtocols = new ArrayList<>(); XDragSourceProtocol xdndDragSourceProtocol = XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener); tDragSourceProtocols.add(xdndDragSourceProtocol); @@ -58,7 +58,7 @@ final class XDragAndDropProtocols { MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener); tDragSourceProtocols.add(motifdndDragSourceProtocol); - List tDropTargetProtocols = new ArrayList(); + List tDropTargetProtocols = new ArrayList<>(); XDropTargetProtocol xdndDropTargetProtocol = XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener); tDropTargetProtocols.add(xdndDropTargetProtocol); @@ -70,11 +70,11 @@ final class XDragAndDropProtocols { dropProtocols = Collections.unmodifiableList(tDropTargetProtocols); } - static Iterator getDragSourceProtocols() { + static Iterator getDragSourceProtocols() { return dragProtocols.iterator(); } - static Iterator getDropTargetProtocols() { + static Iterator getDropTargetProtocols() { return dropProtocols.iterator(); } @@ -88,10 +88,10 @@ final class XDragAndDropProtocols { return null; } - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = - (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.getProtocolName().equals(name)) { return dragProtocol; } @@ -110,10 +110,10 @@ final class XDragAndDropProtocols { return null; } - Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols(); + Iterator dropProtocols = + XDragAndDropProtocols.getDropTargetProtocols(); while (dropProtocols.hasNext()) { - XDropTargetProtocol dropProtocol = - (XDropTargetProtocol)dropProtocols.next(); + XDropTargetProtocol dropProtocol = dropProtocols.next(); if (dropProtocol.getProtocolName().equals(name)) { return dropProtocol; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java index f376b395823..2d67a31a036 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java @@ -29,6 +29,7 @@ import java.awt.Component; import java.awt.Cursor; import java.awt.Window; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -110,7 +111,7 @@ public final class XDragSourceContextPeer } protected void startDrag(Transferable transferable, - long[] formats, Map formatMap) { + long[] formats, Map formatMap) { Component component = getTrigger().getComponent(); Component c = null; XWindowPeer wpeer = null; @@ -161,9 +162,10 @@ public final class XDragSourceContextPeer int dropActions = getDragSourceContext().getSourceActions(); - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); try { dragProtocol.initializeDrag(dropActions, transferable, formatMap, formats); @@ -313,9 +315,10 @@ public final class XDragSourceContextPeer dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot); } - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); try { dragProtocol.cleanup(); } catch (XException xe) { @@ -418,9 +421,10 @@ public final class XDragSourceContextPeer } if (clientWindow != 0) { - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.attachTargetWindow(clientWindow, time)) { protocol = dragProtocol; break; @@ -550,10 +554,10 @@ public final class XDragSourceContextPeer XClientMessageEvent xclient = ev.get_xclient(); - Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols(); + Iterator dragProtocols = + XDragAndDropProtocols.getDragSourceProtocols(); while (dragProtocols.hasNext()) { - XDragSourceProtocol dragProtocol = - (XDragSourceProtocol)dragProtocols.next(); + XDragSourceProtocol dragProtocol = dragProtocols.next(); if (dragProtocol.processProxyModeEvent(xclient, getProxyModeSourceWindow())) { return true; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java index 6779a156688..20e16f4954e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java @@ -26,6 +26,7 @@ package sun.awt.X11; import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.InvalidDnDOperationException; @@ -84,7 +85,7 @@ abstract class XDragSourceProtocol { * @throws XException if some X call failed. */ public final void initializeDrag(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException { XToolkit.awtLock(); @@ -110,7 +111,8 @@ abstract class XDragSourceProtocol { /* The caller must hold AWT_LOCK. */ protected abstract void initializeDragImpl(int actions, Transferable contents, - Map formatMap, long[] formats) + Map formatMap, + long[] formats) throws InvalidDnDOperationException, IllegalArgumentException, XException; /** diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java index 4b5818ab9de..26daceff51a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java @@ -89,12 +89,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { /* If the event was not consumed, send a response to the source. */ try { if (ctxt != 0 && !e.isConsumed()) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.sendResponse(ctxt, e.getID(), returnValue)) { break; @@ -116,12 +116,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { if (ctxt != 0) { try { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.sendDropDone(ctxt, success, dropAction)) { break; @@ -140,12 +140,12 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { long ctxt = getNativeDragContext(); if (ctxt != 0) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); // getData throws IAE if ctxt is not for this protocol. try { return dropTargetProtocol.getData(ctxt, format); @@ -221,12 +221,11 @@ final class XDropTargetContextPeer extends SunDropTargetContextPeer { public void forwardEventToEmbedded(long embedded, long ctxt, int eventID) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt, eventID)) { break; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java index 26a4941788d..a3d9e2fec1c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java @@ -79,12 +79,11 @@ final class XDropTargetEventProcessor { } if (protocol == null) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); // Don't try to process it again with the current protocol. if (dropTargetProtocol == curProtocol) { continue; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java index 2ba4cf2af8d..d4526c993fe 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java @@ -295,7 +295,8 @@ abstract class XDropTargetProtocol { } /* Access to HashMap is synchronized on this XDropTargetProtocol instance. */ - private final HashMap embedderRegistry = new HashMap(); + private final HashMap embedderRegistry = + new HashMap<>(); protected final void putEmbedderRegistryEntry(long embedder, boolean overriden, @@ -310,8 +311,7 @@ abstract class XDropTargetProtocol { protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) { synchronized (this) { - return - (EmbedderRegistryEntry)embedderRegistry.get(Long.valueOf(embedder)); + return embedderRegistry.get(Long.valueOf(embedder)); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java index b8a8441379e..aa3d2da55bb 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java @@ -141,10 +141,10 @@ final class XDropTargetRegistry { } public long[] getSites() { long[] ret = new long[sites.size()]; - Iterator iter = sites.iterator(); + Iterator iter = sites.iterator(); int index = 0; while (iter.hasNext()) { - Long l = (Long)iter.next(); + Long l = iter.next(); ret[index++] = l.longValue(); } return ret; @@ -199,14 +199,13 @@ final class XDropTargetRegistry { private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) { assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // The list of protocols supported by the embedder. - List embedderProtocols = new ArrayList(); + List embedderProtocols = new ArrayList<>(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.isProtocolSupported(embedder)) { embedderProtocols.add(dropTargetProtocol); } @@ -262,7 +261,7 @@ final class XDropTargetRegistry { private void registerProtocols(long embedder, boolean protocols, List supportedProtocols) { - Iterator dropTargetProtocols = null; + Iterator dropTargetProtocols = null; /* * By default, we register a drop site that supports all dnd @@ -289,8 +288,7 @@ final class XDropTargetRegistry { XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if ((protocols == XEMBED_PROTOCOLS) == dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(embedder); @@ -310,14 +308,13 @@ final class XDropTargetRegistry { assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // The list of protocols supported by the embedder. - List embedderProtocols = new ArrayList(); + List embedderProtocols = new ArrayList<>(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (dropTargetProtocol.isProtocolSupported(embedder)) { embedderProtocols.add(dropTargetProtocol); } @@ -361,8 +358,7 @@ final class XDropTargetRegistry { XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(embedder); } @@ -376,7 +372,7 @@ final class XDropTargetRegistry { EmbeddedDropSiteEntry entry) { assert XToolkit.isAWTLockHeldByCurrentThread(); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); /* Grab server, since we are working with the window that belongs to @@ -384,8 +380,7 @@ final class XDropTargetRegistry { XlibWrapper.XGrabServer(XToolkit.getDisplay()); try { while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.unregisterEmbedderDropSite(embedder); } @@ -470,14 +465,14 @@ final class XDropTargetRegistry { registerProtocols(toplevel, XEMBED_PROTOCOLS, entry.getSupportedProtocols()); } else { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); // Register the embedded window as a plain drop site with // all DnD protocols that are supported by XEmbed. while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); if (dropTargetProtocol.isXEmbedSupported()) { dropTargetProtocol.registerEmbedderDropSite(window); } @@ -558,12 +553,12 @@ final class XDropTargetRegistry { } if (toplevel == window) { - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + dropTargetProtocols.next(); dropTargetProtocol.registerDropTarget(toplevel); } } else { @@ -584,13 +579,13 @@ final class XDropTargetRegistry { long toplevel = getToplevelWindow(window); if (toplevel == window) { - Iterator dropProtocols = + Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols(); removeDelayedRegistrationEntry(window); while (dropProtocols.hasNext()) { - XDropTargetProtocol dropProtocol = (XDropTargetProtocol)dropProtocols.next(); + XDropTargetProtocol dropProtocol = dropProtocols.next(); dropProtocol.unregisterDropTarget(window); } } else { @@ -615,12 +610,11 @@ final class XDropTargetRegistry { } registerEmbeddedDropSite(canvasWindow, clientWindow); - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.registerEmbeddedDropSite(clientWindow); } @@ -634,12 +628,11 @@ final class XDropTargetRegistry { if (logger.isLoggable(PlatformLogger.Level.FINE)) { logger.fine(" XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow)); } - Iterator dropTargetProtocols = + Iterator dropTargetProtocols = XDragAndDropProtocols.getDropTargetProtocols(); while (dropTargetProtocols.hasNext()) { - XDropTargetProtocol dropTargetProtocol = - (XDropTargetProtocol)dropTargetProtocols.next(); + XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next(); dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java index e23fb93aef8..4096f435e33 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java @@ -32,7 +32,7 @@ import java.lang.reflect.*; import sun.awt.AWTAccessor; public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher { - HashMap children = new HashMap(); + HashMap children = new HashMap<>(); XEmbeddingContainer() { } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index b3d0731d5f0..bb13ffda5df 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -146,9 +146,9 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe savedDir = target.getDirectory(); // Shouldn't save 'user.dir' to 'savedDir' // since getDirectory() will be incorrect after handleCancel - userDir = (String)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + userDir = AccessController.doPrivileged( + new PrivilegedAction() { + public String run() { return System.getProperty("user.dir"); } }); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java index 91b02d797b8..77545589889 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java @@ -70,7 +70,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { ListPainter painter; // TODO: ick - Vector? - Vector items; + Vector items; boolean multipleSelections; int active = NONE; @@ -139,7 +139,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { super.preInit(params); // Stuff that must be initialized before layout() is called - items = new Vector(); + items = new Vector<>(); createVerScrollbar(); createHorScrollbar(); @@ -281,7 +281,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { int m = 0; int end = items.size(); for(int i = 0 ; i < end ; i++) { - int l = fm.stringWidth(((String)items.elementAt(i))); + int l = fm.stringWidth(items.elementAt(i)); m = Math.max(m, l); } return m; @@ -292,7 +292,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { */ int getItemWidth(int i) { FontMetrics fm = getFontMetrics(getFont()); - return fm.stringWidth((String)items.elementAt(i)); + return fm.stringWidth(items.elementAt(i)); } /** @@ -659,7 +659,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { ( clickCount % 2 == 0 ) ) { postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED, - (String)items.elementAt(currentIndex), + items.elementAt(currentIndex), mouseEvent.getWhen(), mouseEvent.getModifiers())); // No ext mods } else if (active == WINDOW) { @@ -986,7 +986,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { if (selected.length > 0) { postEvent(new ActionEvent((List)target, ActionEvent.ACTION_PERFORMED, - (String)items.elementAt(getFocusIndex()), + items.elementAt(getFocusIndex()), e.getWhen(), e.getModifiers())); // ActionEvent doesn't have // extended modifiers. @@ -1343,7 +1343,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { */ public void clear() { selected = new int[0]; - items = new Vector(); + items = new Vector<>(); currentIndex = -1; // Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit // We should update 'focusIndex' variable more carefully @@ -1926,7 +1926,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } else { g.setColor(getListForeground()); } - String str = (String)items.elementAt(index); + String str = items.elementAt(index); g.drawString(str, x - hsb.getValue(), y + fontAscent); } else { // Clear the remaining area around the item - focus area and the rest of border diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java index a74dad630e7..066a83aae8c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java @@ -60,7 +60,7 @@ public class XMSelection { String selectionName; /* list of listeners to be called for events */ - Vector listeners; + Vector listeners; /* X atom array (one per screen) for this selection */ XAtom atoms[]; @@ -75,7 +75,7 @@ public class XMSelection { static XAtom XA_MANAGER; - static HashMap selectionMap; + static HashMap selectionMap; static { long display = XToolkit.getDisplay(); @@ -90,7 +90,7 @@ public class XMSelection { initScreen(display,screen); } - selectionMap = new HashMap(); + selectionMap = new HashMap<>(); } static void initScreen(long display, final int screen) { @@ -227,7 +227,7 @@ public class XMSelection { static XMSelection getInstance(long selection) { - return (XMSelection) selectionMap.get(Long.valueOf(selection)); + return selectionMap.get(Long.valueOf(selection)); } @@ -259,7 +259,7 @@ public class XMSelection { public synchronized void addSelectionListener(XMSelectionListener listener) { if (listeners == null) { - listeners = new Vector(); + listeners = new Vector<>(); } listeners.add(listener); } @@ -270,7 +270,7 @@ public class XMSelection { } } - synchronized Collection getListeners() { + synchronized Collection getListeners() { return listeners; } @@ -310,9 +310,9 @@ public class XMSelection { log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); } if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.selectionChanged(screen, this, ev.get_window(), ev); } } @@ -323,9 +323,9 @@ public class XMSelection { log.fine("Owner dead : Screen = " + screen + "Event =" + de); } if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.ownerDeath(screen, this, de.get_window()); } @@ -349,9 +349,9 @@ public class XMSelection { synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) { if (listeners != null) { - Iterator iter = listeners.iterator(); + Iterator iter = listeners.iterator(); while (iter.hasNext()) { - XMSelectionListener disp = (XMSelectionListener) iter.next(); + XMSelectionListener disp = iter.next(); disp.ownerChanged(screen,this, owner, data, timestamp); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java index c1b568bc0fb..d8f3f17655b 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java @@ -195,10 +195,10 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { void postInit(XCreateWindowParams params) { super.postInit(params); // Get menus from the target. - Vector targetMenuVector = AWTAccessor.getMenuBarAccessor() - .getMenus(menuBarTarget); + Vector targetMenuVector = AWTAccessor.getMenuBarAccessor() + .getMenus(menuBarTarget); Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor() - .getHelpMenu(menuBarTarget); + .getHelpMenu(menuBarTarget); reloadItems(targetMenuVector); if (targetHelpMenu != null) { addHelpMenu(targetHelpMenu); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java index 067efa13d3a..6aea4c9eacc 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java @@ -143,7 +143,7 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { * Access to target's fields * ************************************************/ - Vector getTargetItems() { + Vector getTargetItems() { return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget()); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java index 9863c983873..b5fbfca919c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java @@ -164,7 +164,7 @@ public class XMenuWindow extends XBaseMenuWindow { this.menuPeer = menuPeer; this.target = menuPeer.getContainer().target; // Get menus from the target. - Vector targetItemVector = null; + Vector targetItemVector = null; targetItemVector = getMenuTargetItems(); reloadItems(targetItemVector); } @@ -356,7 +356,7 @@ public class XMenuWindow extends XBaseMenuWindow { * Reads vector of items from target * This function is overriden in XPopupMenuPeer */ - Vector getMenuTargetItems() { + Vector getMenuTargetItems() { return menuPeer.getTargetItems(); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java index 81c60dd55b2..03a4db3f9f9 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java @@ -134,7 +134,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { public void show(Event e) { target = (Component)e.target; // Get menus from the target. - Vector targetItemVector = getMenuTargetItems(); + Vector targetItemVector = getMenuTargetItems(); if (targetItemVector != null) { reloadItems(targetItemVector); //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang @@ -188,7 +188,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget); } - Vector getMenuTargetItems() { + Vector getMenuTargetItems() { if (popupMenuTarget == null) { return null; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java index 36ebc8e6dba..33f792d7a0b 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java @@ -25,6 +25,7 @@ package sun.awt.X11; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.io.ByteArrayOutputStream; @@ -87,7 +88,7 @@ public final class XSelection { /* The contents supplied by the current owner. */ private Transferable contents = null; /* The format-to-flavor map for the current owner. */ - private Map formatMap = null; + private Map formatMap = null; /* The formats supported by the current owner was set. */ private long[] formats = null; /* The AppContext in which the current owner was set. */ @@ -134,7 +135,8 @@ public final class XSelection { return selectionAtom; } - public synchronized boolean setOwner(Transferable contents, Map formatMap, + public synchronized boolean setOwner(Transferable contents, + Map formatMap, long[] formats, long time) { long owner = XWindow.getXAWTRootWindow().getWindow(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index 3648e874b6a..6ae75161b10 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -36,6 +36,7 @@ import java.awt.dnd.DragGestureRecognizer; import java.awt.dnd.MouseDragGestureRecognizer; import java.awt.dnd.InvalidDnDOperationException; import java.awt.dnd.peer.DragSourceContextPeer; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.im.spi.InputMethodDescriptor; import java.awt.image.ColorModel; @@ -99,9 +100,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { private FontConfigManager fcManager = new FontConfigManager(); static int arrowCursor; - static TreeMap winMap = new TreeMap(); - static HashMap specialPeerMap = new HashMap(); - static HashMap winToDispatcher = new HashMap(); + static TreeMap winMap = new TreeMap<>(); + static HashMap specialPeerMap = new HashMap<>(); + static HashMap> winToDispatcher = new HashMap<>(); private static long _display; static UIDefaults uidefaults; static X11GraphicsEnvironment localEnv; @@ -358,16 +359,16 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } static XBaseWindow windowToXWindow(long window) { synchronized(winMap) { - return (XBaseWindow) winMap.get(Long.valueOf(window)); + return winMap.get(Long.valueOf(window)); } } static void addEventDispatcher(long window, XEventDispatcher dispatcher) { synchronized(winToDispatcher) { Long key = Long.valueOf(window); - Collection dispatchers = (Collection)winToDispatcher.get(key); + Collection dispatchers = winToDispatcher.get(key); if (dispatchers == null) { - dispatchers = new Vector(); + dispatchers = new Vector<>(); winToDispatcher.put(key, dispatchers); } dispatchers.add(dispatcher); @@ -376,7 +377,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { static void removeEventDispatcher(long window, XEventDispatcher dispatcher) { synchronized(winToDispatcher) { Long key = Long.valueOf(window); - Collection dispatchers = (Collection)winToDispatcher.get(key); + Collection dispatchers = winToDispatcher.get(key); if (dispatchers != null) { dispatchers.remove(dispatcher); } @@ -493,18 +494,18 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } XBaseWindow.dispatchToWindow(ev); - Collection dispatchers = null; + Collection dispatchers = null; synchronized(winToDispatcher) { Long key = Long.valueOf(xany.get_window()); - dispatchers = (Collection)winToDispatcher.get(key); + dispatchers = winToDispatcher.get(key); if (dispatchers != null) { // Clone it to avoid synchronization during dispatching - dispatchers = new Vector(dispatchers); + dispatchers = new Vector<>(dispatchers); } } if (dispatchers != null) { - Iterator iter = dispatchers.iterator(); + Iterator iter = dispatchers.iterator(); while (iter.hasNext()) { - XEventDispatcher disp = (XEventDispatcher)iter.next(); + XEventDispatcher disp = iter.next(); disp.dispatchEvent(ev); } } @@ -764,7 +765,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { Insets insets = new Insets(0, 0, 0, 0); - java.util.List search = new LinkedList(); + java.util.List search = new LinkedList<>(); search.add(root); search.add(0); while (!search.isEmpty()) @@ -929,6 +930,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { return XDragSourceContextPeer.createDragSourceContextPeer(dge); } + @SuppressWarnings("unchecked") public T createDragGestureRecognizer(Class recognizerClass, DragSource ds, @@ -1147,7 +1149,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { return 2; // Black and white. } - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public Map mapInputMethodHighlight( InputMethodHighlight highlight) { return XInputMethod.mapInputMethodHighlight(highlight); } @Override @@ -1338,31 +1340,25 @@ public final class XToolkit extends UNIXToolkit implements Runnable { static void dumpPeers() { if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("Mapped windows:"); - Iterator iter = winMap.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - if (entry.getValue() instanceof XComponentPeer) { - Component target = (Component)((XComponentPeer)entry.getValue()).getTarget(); + winMap.forEach((k, v) -> { + log.fine(k + "->" + v); + if (v instanceof XComponentPeer) { + Component target = (Component)((XComponentPeer)v).getTarget(); log.fine("\ttarget: " + target); } - } + }); SunToolkit.dumpPeers(log); log.fine("Mapped special peers:"); - iter = specialPeerMap.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - } + specialPeerMap.forEach((k, v) -> { + log.fine(k + "->" + v); + }); log.fine("Mapped dispatchers:"); - iter = winToDispatcher.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next(); - log.fine(entry.getKey() + "->" + entry.getValue()); - } + winToDispatcher.forEach((k, v) -> { + log.fine(k + "->" + v); + }); } } @@ -1586,16 +1582,16 @@ public final class XToolkit extends UNIXToolkit implements Runnable { * loadXSettings. It is called from the System EDT * if triggered by an XSETTINGS change. */ - void parseXSettings(int screen_XXX_ignored,Map updatedSettings) { + void parseXSettings(int screen_XXX_ignored,Map updatedSettings) { if (updatedSettings == null || updatedSettings.isEmpty()) { return; } - Iterator i = updatedSettings.entrySet().iterator(); + Iterator> i = updatedSettings.entrySet().iterator(); while (i.hasNext()) { - Map.Entry e = (Map.Entry)i.next(); - String name = (String)e.getKey(); + Map.Entry e = i.next(); + String name = e.getKey(); name = "gnome." + name; setDesktopProperty(name, e.getValue()); @@ -1692,7 +1688,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { long window = 0; try{ // get any application window - window = ((Long)(winMap.firstKey())).longValue(); + window = winMap.firstKey().longValue(); }catch(NoSuchElementException nex) { // get root window window = getDefaultRootWindow(); @@ -1798,7 +1794,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } - private static SortedMap timeoutTasks; + private static SortedMap> timeoutTasks; /** * Removed the task from the list of waiting-to-be called tasks. @@ -1819,10 +1815,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } return; } - Collection values = timeoutTasks.values(); - Iterator iter = values.iterator(); + Collection> values = timeoutTasks.values(); + Iterator> iter = values.iterator(); while (iter.hasNext()) { - java.util.List list = (java.util.List)iter.next(); + java.util.List list = iter.next(); boolean removed = false; if (list.contains(task)) { list.remove(task); @@ -1869,13 +1865,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } if (timeoutTasks == null) { - timeoutTasks = new TreeMap(); + timeoutTasks = new TreeMap<>(); } Long time = Long.valueOf(System.currentTimeMillis() + interval); - java.util.List tasks = (java.util.List)timeoutTasks.get(time); + java.util.List tasks = timeoutTasks.get(time); if (tasks == null) { - tasks = new ArrayList(1); + tasks = new ArrayList<>(1); timeoutTasks.put(time, tasks); } tasks.add(task); @@ -1897,7 +1893,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { if (timeoutTasks == null || timeoutTasks.isEmpty()) { return -1L; } - return (Long)timeoutTasks.firstKey(); + return timeoutTasks.firstKey(); } finally { awtUnlock(); } @@ -1918,13 +1914,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } Long currentTime = Long.valueOf(System.currentTimeMillis()); - Long time = (Long)timeoutTasks.firstKey(); + Long time = timeoutTasks.firstKey(); while (time.compareTo(currentTime) <= 0) { - java.util.List tasks = (java.util.List)timeoutTasks.remove(time); + java.util.List tasks = timeoutTasks.remove(time); - for (Iterator iter = tasks.iterator(); iter.hasNext();) { - Runnable task = (Runnable)iter.next(); + for (Iterator iter = tasks.iterator(); iter.hasNext();) { + Runnable task = iter.next(); if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) { timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" + @@ -1943,7 +1939,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { if (timeoutTasks.isEmpty()) { break; } - time = (Long)timeoutTasks.firstKey(); + time = timeoutTasks.firstKey(); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java index 86e6e064fc0..4b0a1aec85d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java @@ -85,7 +85,7 @@ public class XTrayIconPeer implements TrayIconPeer, // Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked // by modal dialogs, but in the case of TrayIcon it shouldn't. So we // set ModalExclusion property on it. - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE); return null; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWM.java b/jdk/src/solaris/classes/sun/awt/X11/XWM.java index 26c4b472883..dd98eb01279 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java @@ -1072,6 +1072,7 @@ final class XWM * Returns all protocols supporting given protocol interface */ Collection getProtocols(Class protocolInterface) { + @SuppressWarnings("unchecked") Collection res = (Collection) protocolsMap.get(protocolInterface); if (res != null) { return res; @@ -1322,9 +1323,9 @@ final class XWM } } - HashMap storedInsets = new HashMap(); + HashMap, Insets> storedInsets = new HashMap<>(); Insets guessInsets(XDecoratedPeer window) { - Insets res = (Insets)storedInsets.get(window.getClass()); + Insets res = storedInsets.get(window.getClass()); if (res == null) { switch (WMID) { case ENLIGHTEN_WM: diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java index d59ac88d3a0..b7d2a7488f4 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java @@ -59,7 +59,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { static int lastX = 0, lastY = 0; static long lastTime = 0; static long lastButton = 0; - static WeakReference lastWindowRef = null; + static WeakReference lastWindowRef = null; static int clickCount = 0; // used to check if we need to re-create surfaceData. @@ -692,7 +692,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if (type == XConstants.ButtonPress) { //Allow this mouse button to generate CLICK event on next ButtonRelease mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton); - XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); + XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null); /* multiclick checking */ @@ -705,7 +705,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { clickCount++; } else { clickCount = 1; - lastWindowRef = new WeakReference(this); + lastWindowRef = new WeakReference<>(this); lastButton = lbutton; lastX = x; lastY = y; @@ -820,7 +820,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { */ int x = xme.get_x(); int y = xme.get_y(); - XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); + XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null); if (!(lastWindow == this && (xme.get_time() - lastTime) < XToolkit.getMultiClickTime() && diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java index 521bbc145b3..bebd7212e9e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java @@ -950,7 +950,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // make new hash of toplevels of all windows from 'windows' hash. // FIXME: do not call them "toplevel" as it is misleading. // - HashSet toplevels = new HashSet(); + HashSet toplevels = new HashSet<>(); long topl = 0, mytopl = 0; for (XWindowPeer xp : windows) { diff --git a/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java b/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java index 969e7c5116e..c39fcbacda7 100644 --- a/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java +++ b/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java @@ -47,7 +47,7 @@ public abstract class X11CustomCursor extends CustomCursor { protected void createNativeCursor(Image im, int[] pixels, int width, int height, int xHotSpot, int yHotSpot) { - class CCount implements Comparable { + class CCount implements Comparable { int color; int count; @@ -56,8 +56,8 @@ public abstract class X11CustomCursor extends CustomCursor { count = ct; } - public int compareTo(Object cc) { - return ((CCount)cc).count - count; + public int compareTo(CCount cc) { + return cc.count - count; } } diff --git a/jdk/src/solaris/classes/sun/awt/X11FontManager.java b/jdk/src/solaris/classes/sun/awt/X11FontManager.java index c9d2ebc9ba4..987f669cc38 100644 --- a/jdk/src/solaris/classes/sun/awt/X11FontManager.java +++ b/jdk/src/solaris/classes/sun/awt/X11FontManager.java @@ -59,7 +59,7 @@ public class X11FontManager extends SunFontManager { * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font * configuration files. We need to remove that part for comparisons. */ - private static Map fontNameMap = new HashMap(); + private static Map fontNameMap = new HashMap<>(); /* * xlfdMap is a map from a platform path like @@ -72,7 +72,7 @@ public class X11FontManager extends SunFontManager { * the full XLFD string like :- * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0" */ - private static Map xlfdMap = new HashMap(); + private static Map> xlfdMap = new HashMap<>(); /* xFontDirsMap is also a map from a font ID to a font filepath. * The difference from fontNameMap is just that it does not have @@ -88,7 +88,7 @@ public class X11FontManager extends SunFontManager { * X11 font directory, then precautions must be taken to include both * directories. */ - private static Map xFontDirsMap; + private static Map xFontDirsMap; /* * This is the set of font directories needed to be on the X font path @@ -121,7 +121,7 @@ public class X11FontManager extends SunFontManager { * of the singleton GE instance is already synchronised and that is * the only code path that accesses this map. */ - private static HashMap registeredDirs = new HashMap(); + private static HashMap registeredDirs = new HashMap<>(); /* Array of directories to be added to the X11 font path. * Used by static method called from Toolkits which use X11 fonts. @@ -183,7 +183,7 @@ public class X11FontManager extends SunFontManager { * Add this XLFD (platform name) to the list of known * ones for this file. */ - Vector xVal = (Vector) xlfdMap.get(fileName); + Vector xVal = xlfdMap.get(fileName); if (xVal == null) { /* Try to be robust on Linux distros which move fonts * around by verifying that the fileName represents a @@ -194,7 +194,7 @@ public class X11FontManager extends SunFontManager { fileName = null; } if (fileName != null) { - xVal = new Vector(); + xVal = new Vector<>(); xVal.add(platName); xlfdMap.put(fileName, xVal); } @@ -211,7 +211,7 @@ public class X11FontManager extends SunFontManager { } if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); /* On Linux check for the Lucida Oblique fonts */ if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) { if (oblmap == null) { @@ -235,7 +235,7 @@ public class X11FontManager extends SunFontManager { FontUtilities.getLogger() .warning("** Finished registering all font paths"); } - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName == null && !isHeadless()) { /* Query X11 directly to see if this font is available @@ -245,7 +245,7 @@ public class X11FontManager extends SunFontManager { } if (fileName == null) { fontID = switchFontIDForName(platName); - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName != null) { fontNameMap.put(fontID, fileName); @@ -257,8 +257,8 @@ public class X11FontManager extends SunFontManager { @Override protected String[] getNativeNames(String fontFileName, String platformName) { - Vector nativeNames; - if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) { + Vector nativeNames; + if ((nativeNames=xlfdMap.get(fontFileName))==null) { if (platformName == null) { return null; } else { @@ -271,7 +271,7 @@ public class X11FontManager extends SunFontManager { } } else { int len = nativeNames.size(); - return (String[])nativeNames.toArray(new String[len]); + return nativeNames.toArray(new String[len]); } } @@ -366,7 +366,7 @@ public class X11FontManager extends SunFontManager { } String fontPart = st.sval.substring(breakPos+1); String fontID = specificFontIDForName(fontPart); - String sVal = (String) fontNameMap.get(fontID); + String sVal = fontNameMap.get(fontID); if (FontUtilities.debugFonts()) { PlatformLogger logger = FontUtilities.getLogger(); @@ -386,14 +386,14 @@ public class X11FontManager extends SunFontManager { * wants to use the native rasteriser. */ if (xFontDirsMap == null) { - xFontDirsMap = new HashMap(); + xFontDirsMap = new HashMap<>(); } xFontDirsMap.put(fontID, path); fullPath = file.getCanonicalPath(); } catch (IOException e) { fullPath = path + File.separator + fileName; } - Vector xVal = (Vector) xlfdMap.get(fullPath); + Vector xVal = xlfdMap.get(fullPath); if (FontUtilities.debugFonts()) { FontUtilities.getLogger() .info("fullPath=" + fullPath + @@ -408,7 +408,7 @@ public class X11FontManager extends SunFontManager { } fontNameMap.put(fontID, fullPath); if (xVal == null) { - xVal = new Vector(); + xVal = new Vector<>(); xlfdMap.put (fullPath, xVal); } xVal.add(fontPart); @@ -447,8 +447,8 @@ public class X11FontManager extends SunFontManager { * will typically not ever need to initialise it so it can be null. */ xFontDirsMap = null; - xlfdMap = new HashMap(1); - fontNameMap = new HashMap(1); + xlfdMap = new HashMap<>(1); + fontNameMap = new HashMap<>(1); } private String getObliqueLucidaFontID(String fontID) { @@ -579,10 +579,10 @@ public class X11FontManager extends SunFontManager { String fileName = null; String fontID = specificFontIDForName(name); if (fontID != null) { - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); if (fileName == null) { fontID = switchFontIDForName(name); - fileName = (String)fontNameMap.get(fontID); + fileName = fontNameMap.get(fontID); } if (fileName == null) { fileName = getDefaultFontFile(); @@ -685,7 +685,7 @@ public class X11FontManager extends SunFontManager { getPlatformFontPathFromFontConfig(); if (xFontDirsMap != null) { String fontID = specificFontIDForName(platformName); - String dirName = (String)xFontDirsMap.get(fontID); + String dirName = xFontDirsMap.get(fontID); if (dirName != null) { fontConfigDirs.add(dirName); } diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java index 10365f9a647..4e5bb1bd3d9 100644 --- a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java +++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java @@ -56,7 +56,7 @@ public class X11GraphicsDevice implements DisplayChangedListener { int screen; - HashMap x11ProxyKeyMap = new HashMap(); + HashMap x11ProxyKeyMap = new HashMap<>(); private static AWTPermission fullScreenExclusivePermission; private static Boolean xrandrExtSupported; @@ -127,7 +127,7 @@ public class X11GraphicsDevice GraphicsConfiguration[] configs; GraphicsConfiguration defaultConfig; - HashSet doubleBufferVisuals; + HashSet doubleBufferVisuals; /** * Returns all of the graphics @@ -159,7 +159,7 @@ public class X11GraphicsDevice boolean dbeSupported = isDBESupported(); if (dbeSupported && doubleBufferVisuals == null) { - doubleBufferVisuals = new HashSet(); + doubleBufferVisuals = new HashSet<>(); getDoubleBufferVisuals(screen); } for ( ; i < num; i++) { @@ -249,7 +249,7 @@ public class X11GraphicsDevice int depth = getConfigDepth(0, screen); boolean doubleBuffer = false; if (isDBESupported() && doubleBufferVisuals == null) { - doubleBufferVisuals = new HashSet(); + doubleBufferVisuals = new HashSet<>(); getDoubleBufferVisuals(screen); doubleBuffer = doubleBufferVisuals.contains(Integer.valueOf(visNum)); diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java index 547af9c3bed..02f491d6707 100644 --- a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java +++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java @@ -72,7 +72,7 @@ public class X11GraphicsEnvironment static { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { System.loadLibrary("awt"); @@ -254,12 +254,12 @@ public class X11GraphicsEnvironment return true; } - Boolean result = (Boolean)java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + Boolean result = java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public Boolean run() { InetAddress remAddr[] = null; - Enumeration locals = null; - Enumeration interfaces = null; + Enumeration locals = null; + Enumeration interfaces = null; try { interfaces = NetworkInterface.getNetworkInterfaces(); remAddr = InetAddress.getAllByName(hostName); @@ -275,7 +275,7 @@ public class X11GraphicsEnvironment } for (; interfaces.hasMoreElements();) { - locals = ((NetworkInterface)interfaces.nextElement()).getInetAddresses(); + locals = interfaces.nextElement().getInetAddresses(); for (; locals.hasMoreElements();) { for (int i = 0; i < remAddr.length; i++) { if (locals.nextElement().equals(remAddr[i])) { diff --git a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java index 29135e1a37c..444a2a66aaf 100644 --- a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java @@ -100,7 +100,7 @@ public abstract class X11InputMethod extends InputMethodAdapter { private boolean isLastTemporary = false; private boolean isActive = false; private boolean isActiveClient = false; - private static Map[] highlightStyles; + private static Map[] highlightStyles; private boolean disposed = false; //reset the XIC if necessary @@ -136,31 +136,29 @@ public abstract class X11InputMethod extends InputMethodAdapter { // Initialize highlight mapping table static { - Map styles[] = new Map[4]; - HashMap map; + @SuppressWarnings({"unchecked", "rawtypes"}) + Map styles[] = new Map[4]; + HashMap map; // UNSELECTED_RAW_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.WEIGHT, - TextAttribute.WEIGHT_BOLD); + map = new HashMap<>(1); + map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); styles[0] = Collections.unmodifiableMap(map); // SELECTED_RAW_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.SWAP_COLORS, - TextAttribute.SWAP_COLORS_ON); + map = new HashMap<>(1); + map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON); styles[1] = Collections.unmodifiableMap(map); // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT - map = new HashMap(1); + map = new HashMap<>(1); map.put(TextAttribute.INPUT_METHOD_UNDERLINE, - TextAttribute.UNDERLINE_LOW_ONE_PIXEL); + TextAttribute.UNDERLINE_LOW_ONE_PIXEL); styles[2] = Collections.unmodifiableMap(map); // SELECTED_CONVERTED_TEXT_HIGHLIGHT - map = new HashMap(1); - map.put(TextAttribute.SWAP_COLORS, - TextAttribute.SWAP_COLORS_ON); + map = new HashMap<>(1); + map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON); styles[3] = Collections.unmodifiableMap(map); highlightStyles = styles; @@ -433,7 +431,7 @@ public abstract class X11InputMethod extends InputMethodAdapter { /** * @see java.awt.Toolkit#mapInputMethodHighlight */ - public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { int index; int state = highlight.getState(); if (state == InputMethodHighlight.RAW_TEXT) { diff --git a/jdk/src/solaris/classes/sun/awt/XSettings.java b/jdk/src/solaris/classes/sun/awt/XSettings.java index 987b80ba778..59fb9a08ad2 100644 --- a/jdk/src/solaris/classes/sun/awt/XSettings.java +++ b/jdk/src/solaris/classes/sun/awt/XSettings.java @@ -52,7 +52,7 @@ public class XSettings { * settings manager. * @return a Map of changed settings. */ - public Map update(byte[] data) { + public Map update(byte[] data) { return (new Update(data)).update(); } @@ -79,7 +79,7 @@ public class XSettings { private int nsettings = 0; private boolean isValid; - private HashMap updatedSettings; + private HashMap updatedSettings; /** @@ -113,7 +113,7 @@ public class XSettings { idx = 8; nsettings = getINT32(); - updatedSettings = new HashMap(); + updatedSettings = new HashMap<>(); isValid = true; } @@ -213,7 +213,7 @@ public class XSettings { /** * Update settings. */ - public Map update() { + public Map update() { if (!isValid) { return null; } diff --git a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java index 6c28d201779..b1d05fa671a 100644 --- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java +++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java @@ -67,7 +67,7 @@ public class MFontConfiguration extends FontConfiguration { * the fontconfig files. */ protected void initReorderMap() { - reorderMap = new HashMap(); + reorderMap = new HashMap<>(); if (osName == null) { /* null means SunOS */ initReorderMapForSolaris(); } else { @@ -240,7 +240,7 @@ public class MFontConfiguration extends FontConfiguration { return "sun.awt.Symbol"; } } - String encoding = (String) encodingMap.get(xlfdEncoding); + String encoding = encodingMap.get(xlfdEncoding); if (encoding == null) { encoding = "default"; } @@ -288,7 +288,7 @@ public class MFontConfiguration extends FontConfiguration { /* methods for table setup ***********************************************/ - private static HashMap encodingMap = new HashMap(); + private static HashMap encodingMap = new HashMap<>(); private void initTables() { // encodingMap maps XLFD encoding component to From 0224281ecb9eeb69639851c53592c664e51798f4 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Tue, 29 Apr 2014 14:32:38 +0400 Subject: [PATCH 030/185] 8041592: [TEST_BUG] Move 42 AWT hw/lw mixing tests to jdk Reviewed-by: anthony, pchelko --- .../Mixing/AWT_Mixing/FrameBorderCounter.java | 95 +++ .../GlassPaneOverlappingTestBase.java | 144 ++++ .../HierarchyBoundsListenerMixingTest.java | 692 +++++++++++++++ .../JButtonInGlassPaneOverlapping.java | 51 ++ .../Mixing/AWT_Mixing/JButtonOverlapping.java | 51 ++ .../AWT_Mixing/JColorChooserOverlapping.java | 54 ++ .../AWT_Mixing/JComboBoxOverlapping.java | 99 +++ .../JEditorPaneInGlassPaneOverlapping.java | 53 ++ .../AWT_Mixing/JEditorPaneOverlapping.java | 50 ++ .../JGlassPaneInternalFrameOverlapping.java | 127 +++ .../AWT_Mixing/JGlassPaneMoveOverlapping.java | 167 ++++ .../JInternalFrameMoveOverlapping.java | 124 +++ .../AWT_Mixing/JInternalFrameOverlapping.java | 102 +++ .../JLabelInGlassPaneOverlapping.java | 53 ++ .../Mixing/AWT_Mixing/JLabelOverlapping.java | 52 ++ .../JListInGlassPaneOverlapping.java | 50 ++ .../Mixing/AWT_Mixing/JListOverlapping.java | 49 ++ .../AWT_Mixing/JMenuBarOverlapping.java | 149 ++++ .../JPanelInGlassPaneOverlapping.java | 53 ++ .../Mixing/AWT_Mixing/JPanelOverlapping.java | 52 ++ .../AWT_Mixing/JPopupMenuOverlapping.java | 124 +++ .../JProgressBarInGlassPaneOverlapping.java | 53 ++ .../AWT_Mixing/JProgressBarOverlapping.java | 52 ++ .../JScrollBarInGlassPaneOverlapping.java | 67 ++ .../AWT_Mixing/JScrollBarOverlapping.java | 66 ++ .../AWT_Mixing/JScrollPaneOverlapping.java | 129 +++ .../JSliderInGlassPaneOverlapping.java | 52 ++ .../Mixing/AWT_Mixing/JSliderOverlapping.java | 51 ++ .../JSpinnerInGlassPaneOverlapping.java | 67 ++ .../AWT_Mixing/JSpinnerOverlapping.java | 64 ++ .../AWT_Mixing/JSplitPaneOverlapping.java | 130 +++ .../JTableInGlassPaneOverlapping.java | 87 ++ .../Mixing/AWT_Mixing/JTableOverlapping.java | 73 ++ .../JTextAreaInGlassPaneOverlapping.java | 53 ++ .../AWT_Mixing/JTextAreaOverlapping.java | 52 ++ .../JTextFieldInGlassPaneOverlapping.java | 53 ++ .../AWT_Mixing/JTextFieldOverlapping.java | 52 ++ .../JToggleButtonInGlassPaneOverlapping.java | 51 ++ .../AWT_Mixing/JToggleButtonOverlapping.java | 50 ++ .../AWT_Mixing/MixingFrameResizing.java | 127 +++ .../AWT_Mixing/MixingPanelsResizing.java | 462 ++++++++++ .../Mixing/AWT_Mixing/OpaqueOverlapping.java | 164 ++++ .../AWT_Mixing/OpaqueOverlappingChoice.java | 48 ++ .../AWT_Mixing/OverlappingTestBase.java | 800 ++++++++++++++++++ .../AWT_Mixing/SimpleOverlappingTestBase.java | 160 ++++ jdk/test/java/awt/Mixing/AWT_Mixing/Util.java | 601 +++++++++++++ .../AWT_Mixing/ViewportOverlapping.java | 151 ++++ 47 files changed, 6106 insertions(+) create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/Util.java create mode 100644 jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java b/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java new file mode 100644 index 00000000000..a7380cece35 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2014, 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. + */ +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowAdapter; + +public class FrameBorderCounter { + + private static Frame frame; + private static Frame background; + private static Dimension size; + private static Point location; + private static Point entered; + + public static void main(String[] args) throws Exception { + final Robot robot = new Robot(); + EventQueue.invokeAndWait(new Runnable() { + public void run() { + robot.mouseMove(0, 0); + } + }); + EventQueue.invokeAndWait(new Runnable() { + public void run() { + background = new Frame(); + background.setBounds(100, 100, 300, 300); + background.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + entered = e.getLocationOnScreen(); + System.err.println("[ENTERED] : " + entered); + } + }); + background.setVisible(true); + } + }); + EventQueue.invokeAndWait(new Runnable() { + public void run() { + frame = new Frame("Frame"); + frame.setBounds(200, 200, 100, 100); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + }); + frame.setVisible(true); + } + }); + Thread.sleep(1000); + EventQueue.invokeAndWait(new Runnable() { + public void run() { + location = frame.getLocationOnScreen(); + size = frame.getSize(); + } + }); + int out = 20; + for (int x = location.x + size.width - out; x <= location.x + size.width + out; ++x) { + robot.mouseMove(x, location.y + size.height / 2); + Thread.sleep(50); + } + System.err.println("[LOCATION] : " + location); + System.err.println("[SIZE] : " + size); + Thread.sleep(250); + int shift = entered.x - location.x - size.width - 1; + System.err.println("Done"); + System.out.println(shift); + frame.dispose(); + background.dispose(); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java new file mode 100644 index 00000000000..6b7ba1cc60e --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Container; +import java.awt.Point; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.InputEvent; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JFrame; +import javax.swing.SpringLayout; +import javax.swing.SwingUtilities; + +/** + * Base class for testing overlapping of Swing and AWT component put into GlassPane. + * Validates drawing and event delivery at the components intersection. + *

    See {@link OverlappingTestBase} for usage + * + * @author Sergey Grinev + */ +public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTestBase { + + /** + * If true components is additionally tested to be correctly drawn after resize. + */ + protected boolean testResize = true; + private JFrame f = null; + private volatile Point ancestorLoc; + + /** + * Setups GlassPane with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() } + * Called by base class. + */ + @Override + protected void prepareControls() { + wasLWClicked = false; + + if(f != null) { + f.setVisible(false); + } + f = new JFrame("Mixing : GlassPane Overlapping test"); + f.setLayout(new SpringLayout()); + f.setSize(200, 200); + + propagateAWTControls(f); + + f.getGlassPane().setVisible(true); + Container glassPane = (Container) f.getGlassPane(); + glassPane.setLayout(null); + + testedComponent = getSwingComponent(); + if (useDefaultClickValidation) { + testedComponent.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + //System.err.println("lw mouse clicked"); + wasLWClicked = true; + } + }); + } + testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height); + glassPane.add(testedComponent); + + f.setVisible(true); + } + + public GlassPaneOverlappingTestBase() { + super(); + } + + public GlassPaneOverlappingTestBase(boolean defaultClickValidation) { + super(defaultClickValidation); + } + + /** + * Run test by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } validation for current lightweight component. + *

    Also resize component and repeat validation in the resized area. + *

    Called by base class. + * @return true if test passed + * @see GlassPaneOverlappingTestBase#testResize + */ + @Override + protected boolean performTest() { + if (!super.performTest()) { + return false; + } + if (testResize) { + wasLWClicked = false; + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height + 20); + ancestorLoc = f.getLocationOnScreen(); + } + }); + } catch (InterruptedException ex) { + fail(ex.getMessage()); + } catch (InvocationTargetException ex) { + fail(ex.getMessage()); + } + Point lLoc = testedComponent.getLocationOnScreen(); + lLoc.translate(1, testedComponent.getPreferredSize().height + 1); + + /* this is a workaround for certain jtreg(?) focus issue: + tests fail starting after failing mixing tests but always pass alone. + */ + Util.waitForIdle(robot); + ancestorLoc.translate(f.getWidth()/2-15, 2); + robot.mouseMove(ancestorLoc.x, ancestorLoc.y); + Util.waitForIdle(robot); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(50); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + clickAndBlink(robot, lLoc); + return wasLWClicked; + } else { + return true; + } + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java b/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java new file mode 100644 index 00000000000..13e600b30e5 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java @@ -0,0 +1,692 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.InvocationTargetException; +import javax.swing.SwingUtilities; +import java.io.*; + +/** + * AWT Mixing test for HierarchyBoundsListener ancestors. + *

    See CR6768230 for details. + */ +/* +@test +@bug 6768230 +@summary Mixing test for HierarchyBoundsListener ancestors +@build FrameBorderCounter +@run main HierarchyBoundsListenerMixingTest + */ +public class HierarchyBoundsListenerMixingTest { + + protected void prepareControls() { + dummy = new Frame(); + dummy.setSize(100, 100); + dummy.setLocation(0, 350); + dummy.setVisible(true); + + frame = new Frame("Test Frame"); + frame.setLayout(new FlowLayout()); + + panel = new Panel(); + button = new Button("Button"); + label = new Label("Label"); + list = new List(); + list.add("One"); + list.add("Two"); + list.add("Three"); + choice = new Choice(); + choice.add("Red"); + choice.add("Orange"); + choice.add("Yellow"); + checkbox = new Checkbox("Checkbox"); + scrollbar = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255); + textfield = new TextField(15); + textarea = new TextArea(5, 15); + + components = new Component[] { + panel, button, label, list, choice, checkbox, scrollbar, textfield, textarea + }; + ancestorResized = new boolean[components.length]; + ancestorMoved = new boolean[components.length]; + + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent event) { + System.err.println("User closed the window"); + System.exit(1); + } + }); + + HierarchyBoundsListener listener = new HierarchyBoundsListenerImpl(); + for (int i = 0; i < components.length; i++) { + components[i].addHierarchyBoundsListener(listener); + frame.add(components[i]); + } + frame.setSize(300, 300); + frame.setVisible(true); + } + + private int frameBorderCounter() { + String JAVA_HOME = System.getProperty("java.home"); + + try { + Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter"); + try { + p.waitFor(); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + if (p.exitValue() != 0) { + throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream())); + } + return Integer.parseInt(readInputStream(p.getInputStream()).trim()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + private String readInputStream(InputStream is) throws IOException { + byte[] buffer = new byte[4096]; + int len = 0; + StringBuilder sb = new StringBuilder(); + try (InputStreamReader isr = new InputStreamReader(is)) { + while ((len = is.read(buffer)) > 0) { + sb.append(new String(buffer, 0, len)); + } + } + return sb.toString(); + } + + protected boolean performTest() { + int BORDER_SHIFT = frameBorderCounter(); + BORDER_SHIFT = Math.abs(BORDER_SHIFT) == 1 ? BORDER_SHIFT : BORDER_SHIFT / 2; + Robot robot = null; + try { + robot = new Robot(); + Thread.sleep(delay * 10); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + + robot.mouseMove((int) components[0].getLocationOnScreen().x + components[0].getSize().width / 2, + (int) components[0].getLocationOnScreen().y + components[0].getSize().height / 2); + robot.delay(delay); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(delay); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.delay(delay); + + resetValues(); + try { + EventQueue.invokeAndWait(new Runnable() { + public void run() { + frame.setSize(new Dimension(frame.getSize().width + 10, frame.getSize().height + 10)); + frame.invalidate(); + frame.validate(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + passed = false; + } + if (! resizeTriggered) { + synchronized (resizeLock) { + try { + resizeLock.wait(delay * 10); + } catch (Exception e) { + } + } + } + for (int i = 0; i < components.length; i++) { + if (! ancestorResized[i]) { + System.err.println("FAIL: Frame resized using API call. " + + "Ancestor resized event did not occur for " + components[i].getClass()); + passed = false; + } + } + if (moveCount > 0) { + System.err.println("FAIL: Ancestor moved event occured when Frame resized using API"); + passed = false; + } + robot.delay(delay * 5); + + resetValues(); + int x = (int) frame.getLocationOnScreen().x; + int y = (int) frame.getLocationOnScreen().y; + int w = frame.getSize().width; + int h = frame.getSize().height; + + robot.mouseMove(x + w + BORDER_SHIFT, y + h / 2); + robot.delay(delay); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(delay); + for (int i = 0; i < 20; i++) { + robot.mouseMove(x + w + i + BORDER_SHIFT, y + h / 2); + robot.delay(50); + } + robot.delay(delay); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + if (! resizeTriggered) { + synchronized (resizeLock) { + try { + resizeLock.wait(delay * 10); + } catch (Exception e) { + } + } + } + + for (int i = 0; i < components.length; i++) { + if (! ancestorResized[i]) { + System.err.println("FAIL: Frame resized using mouse action. " + + "Ancestor resized event did not occur for " + + components[i].getClass()); + passed = false; + } + } + if (moveCount > 0) { + System.err.println("FAIL: Ancestor moved event occured when Frame resized using mouse"); + passed = false; + } + + resetValues(); + try { + EventQueue.invokeAndWait(new Runnable() { + public void run() { + frame.setLocation(frame.getLocation().x + 20, frame.getLocation().y + 20); + frame.invalidate(); + frame.validate(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + passed = false; + } + if (! moveTriggered) { + synchronized (moveLock) { + try { + moveLock.wait(delay * 10); + } catch (Exception e) { + } + } + } + for (int i = 0; i < components.length; i++) { + if (! ancestorMoved[i]) { + System.err.println("FAIL: Frame moved using API call. " + + "Ancestor moved event did not occur for " + components[i].getClass()); + passed = false; + } + } + if (resizeCount > 0) { + System.err.println("FAIL: Ancestor resized event occured when Frame moved using API"); + passed = false; + } + robot.delay(delay * 10); + + resetValues(); + x = (int) frame.getLocationOnScreen().x; + y = (int) frame.getLocationOnScreen().y; + w = frame.getSize().width; + h = frame.getSize().height; + + //Click on the dummy frame so that the test frame loses focus. This is to workaround + //a bug in Linux AS. + robot.mouseMove((int) dummy.getLocationOnScreen().x + dummy.getSize().width / 2, + (int) dummy.getLocationOnScreen().y + dummy.getSize().height / 2); + robot.delay(delay); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(delay); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.delay(delay); + + robot.mouseMove(x + w / 2, y + 10); + robot.delay(delay); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(delay); + for (int i = 1; i <= 20; i++) { + robot.mouseMove(x + w / 2 + i, y + 10); + robot.delay(50); + } + robot.delay(delay); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + if (! moveTriggered) { + synchronized (moveLock) { + try { + moveLock.wait(delay * 10); + } catch (Exception e) { + } + } + } + + for (int i = 0; i < components.length; i++) { + if (! ancestorMoved[i]) { + System.err.println("FAIL: Frame moved using mouse action. " + + "Ancestor moved event did not occur for " + components[i].getClass()); + passed = false; + } + } + if (resizeCount > 0) { + System.err.println("FAIL: Ancestor resized event occured when Frame moved using mouse"); + passed = false; + } + + return passed; + } + + private void resetValues() { + moveTriggered = false; + resizeTriggered = false; + moveCount = 0; + resizeCount = 0; + for (int i = 0; i < ancestorResized.length; i++) { + ancestorResized[i] = false; + ancestorMoved[i] = false; + } + } + + private void keyType(int key, Robot robot) throws Exception { + robot.keyPress(key); + robot.delay(keyDelay); + robot.keyRelease(key); + robot.delay(keyDelay); + } + + class HierarchyBoundsListenerImpl implements HierarchyBoundsListener { + // checks for Ancestor_Moved events + public void ancestorMoved(HierarchyEvent ce) { + if (check) { + System.out.println("Moved " + ce.getComponent()); + } + for (int i = 0; i < components.length; i++) { + if (components[i].equals(ce.getComponent())) { + //setting this array for purpose of checking ancestor_moved. + ancestorMoved[i] = true; + moveCount++; + if (moveCount == components.length) { + moveTriggered = true; + synchronized (moveLock) { + try { + moveLock.notifyAll(); + } catch (Exception e) { + } + } + } + } + } + } + // checks for Ancestor_Moved events + public void ancestorResized(HierarchyEvent ce) { + if (check) { + System.out.println("Resized " + ce.getComponent()); + } + for (int i = 0; i < components.length; i++) { + if (components[i].equals(ce.getComponent())) { + if (! frame.equals(ce.getChanged()) || ce.getChangedParent() != null) { + System.err.println("FAIL: Invalid value of HierarchyEvent.getXXX"); + System.err.println("ce.getChanged() : " + ce.getChanged()); + System.err.println("ce.getChangedParent() : " + ce.getChangedParent()); + passed = false; + } + //setting this array for purpose of checking ancestor_resized + ancestorResized[i] = true; + resizeCount++; + if (resizeCount == components.length) { + resizeTriggered = true; + synchronized (resizeLock) { + try { + resizeLock.notifyAll(); + } catch (Exception e) { + } + } + } + } + } + } + } + + private Frame frame, dummy; + private Panel panel; + private Button button; + private Label label; + private List list; + private Choice choice; + private Checkbox checkbox; + private Scrollbar scrollbar; + private TextField textfield; + private TextArea textarea; + private Component[] components; + private boolean[] ancestorResized; + private boolean[] ancestorMoved; + + private int delay = 500; + private int keyDelay = 50; + private int moveCount = 0; + private int resizeCount = 0; + + private boolean passed = true; + private boolean moveTriggered = false; + private boolean resizeTriggered = false; + private final Object moveLock = new Object(); + private final Object resizeLock = new Object(); + + private boolean check = false; + + private void invoke() throws InterruptedException { + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + prepareControls(); + } + }); + try { + Thread.sleep(1000); // wait for graphic effects on systems like Win7 + } catch (InterruptedException ex) { + } + if (!performTest()) { + fail("Test failed"); + } + } catch (InvocationTargetException ex) { + fail(ex.getMessage()); + } + } + + /***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test- + * classes + ******************************************************/ + private static void init() throws InterruptedException { + //*** Create instructions for the user here *** + //System.setProperty("sun.awt.disableMixing", "true"); + + String[] instructions = { + "This is an AUTOMATIC test, simply wait until it is done.", + "The result (passed or failed) will be shown in the", + "message window below." + }; + Sysout.createDialog(); + Sysout.printInstructions(instructions); + + HierarchyBoundsListenerMixingTest instance = new HierarchyBoundsListenerMixingTest(); + + instance.invoke(); + + pass(); + }//End init() + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + private static Thread mainThread = null; + private static int sleepTime = 300000; + + // Not sure about what happens if multiple of this test are + // instantiated in the same VM. Being static (and using + // static vars), it aint gonna work. Not worrying about + // it for now. + public static void main(String args[]) throws InterruptedException { + mainThread = Thread.currentThread(); + try { + init(); + } catch (TestPassedException e) { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test pass nor test fail has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try { + Thread.sleep(sleepTime); + //Timed out, so fail the test + throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds"); + } catch (InterruptedException e) { + //The test harness may have interrupted the test. If so, rethrow the exception + // so that the harness gets it and deals with it. + if (!testGeneratedInterrupt) { + throw e; + } + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + + if (theTestPassed == false) { + throw new RuntimeException(failureMessage); + } + } + + }//main + + public static synchronized void setTimeoutTo(int seconds) { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() { + Sysout.println("The test passed."); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //first check if this is executing in main thread + if (mainThread == Thread.currentThread()) { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + }//pass() + + public static synchronized void fail() { + //test writer didn't specify why test failed, so give generic + fail("it just plain failed! :-)"); + } + + public static synchronized void fail(String whyFailed) { + Sysout.println("The test failed: " + whyFailed); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //check if this called from main thread + if (mainThread == Thread.currentThread()) { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException(whyFailed); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + }//fail() +}// class LWComboBox +class TestPassedException extends RuntimeException { +} + +//*********** End Standard Test Machinery Section ********** +//************ Begin classes defined for the test **************** +// if want to make listeners, here is the recommended place for them, then instantiate +// them in init() + +/* Example of a class which may be written as part of a test +class NewClass implements anInterface +{ +static int newVar = 0; + +public void eventDispatched(AWTEvent e) +{ +//Counting events to see if we get enough +eventCount++; + +if( eventCount == 20 ) +{ +//got enough events, so pass + +LWComboBox.pass(); +} +else if( tries == 20 ) +{ +//tried too many times without getting enough events so fail + +LWComboBox.fail(); +} + +}// eventDispatched() + +}// NewClass class + + */ +//************** End classes defined for the test ******************* +/**************************************************** +Standard Test Machinery +DO NOT modify anything below -- it's a standard +chunk of code whose purpose is to make user +interaction uniform, and thereby make it simpler +to read and understand someone else's test. + ****************************************************/ +/** +This is part of the standard test machinery. +It creates a dialog (with the instructions), and is the interface +for sending text messages to the user. +To print the instructions, send an array of strings to Sysout.createDialog +WithInstructions method. Put one line of instructions per array entry. +To display a message for the tester to see, simply call Sysout.println +with the string to be displayed. +This mimics System.out.println but works within the test harness as well +as standalone. + */ +class Sysout { + + private static TestDialog dialog; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + public static void println(String messageIn) { + dialog.displayMessage(messageIn); + System.out.println(messageIn); + } +}// Sysout class + +/** +This is part of the standard test machinery. It provides a place for the +test instructions to be displayed, and a place for interactive messages +to the user to be displayed. +To have the test instructions displayed, see Sysout. +To have a message to the user be displayed, see Sysout. +Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) { + posOfSpace = maxStringLength - 1; + } + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + System.out.println(messageIn); + } +}// TestDialog class + diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java new file mode 100644 index 00000000000..11aef8209bd --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JButton } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JButton +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JButtonInGlassPaneOverlapping + */ +public class JButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JButton ch = new JButton(); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JButtonInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java new file mode 100644 index 00000000000..119c131cc85 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JButton } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JButton +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JButtonOverlapping + */ +public class JButtonOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JButton ch = new JButton(); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JButtonOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java new file mode 100644 index 00000000000..c756041db65 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014, 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. + */ + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JColorChooser } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JColorChooser +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JColorChooserOverlapping + */ +public class JColorChooserOverlapping extends SimpleOverlappingTestBase { + + public JColorChooserOverlapping() { + super(false); + } + + @Override + protected JComponent getSwingComponent() { + wasLWClicked = true; + JColorChooser ch = new JColorChooser(); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JColorChooserOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java new file mode 100644 index 00000000000..b0887068a09 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BoxLayout; +import javax.swing.JComboBox; +import javax.swing.JFrame; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JCombobox } component. + *

    This test creates combobox and test if heavyweight component is drawn correctly then dropdown is shown. + *

    See base class for details. + */ +/* +@test +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JComboBoxOverlapping + */ +public class JComboBoxOverlapping extends OverlappingTestBase { + + private boolean lwClicked = false; + private Point loc; + private Point loc2; + + {testEmbeddedFrame = true;} + + protected void prepareControls() { + final JFrame frame = new JFrame("Mixing : Dropdown Overlapping test"); + frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); + frame.setSize(200, 200); + frame.setVisible(true); + + final JComboBox cb = new JComboBox(petStrings); + cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20)); + cb.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == cb) { + lwClicked = true; + } + } + }); + + frame.add(cb); + propagateAWTControls(frame); + frame.setVisible(true); + loc = cb.getLocationOnScreen(); + loc2 = frame.getContentPane().getLocationOnScreen(); + } + + @Override + protected boolean performTest() { + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + loc2.translate(75, 75); + pixelPreCheck(robot, loc2, currentAwtControl); + + loc.translate(3, 3); + clickAndBlink(robot, loc, false); + + clickAndBlink(robot, loc2, false); + + return lwClicked; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JComboBoxOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java new file mode 100644 index 00000000000..d14f078aa2d --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Point; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JBEditorPane } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JEditorPaneInGlassPaneOverlapping + */ +public class JEditorPaneInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JEditorPane ch = new JEditorPane(); + ch.setText("Swing component"); + OverlappingTestBase.shift = new Point(12, 12); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JEditorPaneInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java new file mode 100644 index 00000000000..513ca0dce7f --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 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. + */ + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JEditorPane } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JEditorPaneOverlapping + */ +public class JEditorPaneOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JEditorPane ch = new JEditorPane(); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JEditorPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java new file mode 100644 index 00000000000..3e2575375e8 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test with JInternalFrame being put in GlassPane. + * See JDK-6637655 and + * JDK-6985776. + *

    See base class for details. + */ +/* +@test +@bug 6637655 6985776 +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JGlassPaneInternalFrameOverlapping + */ +public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase { + + private boolean lwClicked = true; + private Point lLoc; + private Point lLoc2; + private JInternalFrame internalFrame; + + protected boolean performTest() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + lLoc = internalFrame.getContentPane().getLocationOnScreen(); + lLoc2 = lLoc.getLocation(); + lLoc2.translate(0, internalFrame.getContentPane().getHeight() + 10); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + clickAndBlink(robot, lLoc); + + Color c = robot.getPixelColor(lLoc2.x, lLoc2.y); + robot.mouseMove(lLoc2.x, lLoc2.y); + if (!c.equals(AWT_BACKGROUND_COLOR) && + currentAwtControl.getClass() != java.awt.Scrollbar.class && + currentAwtControl.getClass() != java.awt.Choice.class) { + fail("The HW component did not pass pixel color check and is not drawn correctly"); + } + + return lwClicked; + } + + // {debugClassName = "Choice";} + + @Override + protected void prepareControls() { + JFrame frame = new JFrame("Glass Pane children test"); + frame.setLayout(null); + + Container contentPane = frame.getContentPane(); + contentPane.setLayout(new BorderLayout()); + super.propagateAWTControls(contentPane); + + Container glassPane = (Container) frame.getRootPane().getGlassPane(); + glassPane.setVisible(true); + glassPane.setLayout(null); + + internalFrame = new JInternalFrame("Internal Frame", true); + internalFrame.setBounds(50, 0, 200, 100); + internalFrame.setVisible(true); + glassPane.add(internalFrame); + + internalFrame.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + lwClicked = true; + } + }); + + frame.setSize(300, 180); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + if (System.getProperty("os.name").toLowerCase().contains("os x")) { + System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X."); + return; + } + instance = new JGlassPaneInternalFrameOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java new file mode 100644 index 00000000000..43e060a2438 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test with JInternalFrame being moved in GlassPane. + * See JDK-6637655 and + * JDK-6981919. + *

    See base class for details. + */ +/* +@test +@bug 6637655 6981919 +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JGlassPaneMoveOverlapping + */ +public class JGlassPaneMoveOverlapping extends OverlappingTestBase { + + private boolean lwClicked = true; + private volatile Point lLoc; + private volatile Point lLoc2; + + private JInternalFrame internalFrame; + private JFrame frame = null; + private volatile Point frameLoc; + + protected boolean performTest() { + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + lLoc = internalFrame.getContentPane().getLocationOnScreen(); + lLoc2 = lLoc.getLocation(); + lLoc2.translate(0, internalFrame.getHeight()); + frameLoc = frame.getLocationOnScreen(); + frameLoc.translate(frame.getWidth()/2, 3); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + // force focus on JFrame (jtreg workaround) + robot.mouseMove(frameLoc.x, frameLoc.y); + Util.waitForIdle(robot); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(50); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + + //slow move + robot.mouseMove(lLoc.x + 25, lLoc.y - 5); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(100); + robot.mouseMove(lLoc.x + 45, lLoc.y - 5); + robot.delay(100); + robot.mouseMove(lLoc.x + internalWidth - 75, lLoc.y - 5); + robot.delay(100); + robot.mouseMove(lLoc.x + internalWidth - 55, lLoc.y - 5); + robot.delay(100); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + Color c2 = robot.getPixelColor(lLoc.x + internalWidth + 15, lLoc.y - 5); + if (c2.equals(AWT_BACKGROUND_COLOR)) { + error("Foreground frame is not drawn properly"); + } + Color c = robot.getPixelColor(lLoc.x + internalWidth - 95, lLoc.y + 5); + robot.mouseMove(lLoc.x + internalWidth - 95, lLoc.y + 5); + System.out.println("color: " + c + " " + AWT_BACKGROUND_COLOR); + if (!c.equals(AWT_BACKGROUND_COLOR) && currentAwtControl.getClass() != java.awt.Scrollbar.class) { + error("Background AWT component is not drawn properly"); + } + + return true; + } + + // {debugClassName = "Choice";} + + private static void error(String st) { + //System.out.println(st); + fail(st); + } + + private static final int internalWidth = 200; + + @Override + protected void prepareControls() { + if(frame != null) { + frame.setVisible(false); + } + frame = new JFrame("Glass Pane children test"); + frame.setLayout(null); + + Container contentPane = frame.getContentPane(); + contentPane.setLayout(new BorderLayout()); + super.propagateAWTControls(contentPane); + + Container glassPane = (Container) frame.getRootPane().getGlassPane(); + glassPane.setVisible(true); + glassPane.setLayout(null); + + internalFrame = new JInternalFrame("Internal Frame", true); + internalFrame.setBounds(50, 0, internalWidth, 100); + internalFrame.setVisible(true); + glassPane.add(internalFrame); + + internalFrame.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + lwClicked = true; + } + }); + + frame.setSize(400, 180); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + if (System.getProperty("os.name").toLowerCase().contains("os x")) { + System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X."); + return; + } + instance = new JGlassPaneMoveOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java new file mode 100644 index 00000000000..99a9e015921 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JButton; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component during move. + *

    See CR6768230 for details and base class for test info. + */ +/* +@test +@bug 6985399 +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JInternalFrameMoveOverlapping + */ +public class JInternalFrameMoveOverlapping extends OverlappingTestBase { + + private boolean lwClicked = true; + private Point locTopFrame; + private Point locTarget; + + protected boolean performTest() { + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + robot.mouseMove(locTopFrame.x + 25, locTopFrame.y + 25); + robot.mousePress(InputEvent.BUTTON1_MASK); + try { + Thread.sleep(500); + } catch (InterruptedException ex) { + } + robot.mouseMove(locTopFrame.x + (locTarget.x - locTopFrame.x)/2, locTopFrame.y + (locTarget.y - locTopFrame.y)/2); + try { + Thread.sleep(500); + } catch (InterruptedException ex) { + } + robot.mouseMove(locTarget.x, locTarget.y); + try { + Thread.sleep(500); + } catch (InterruptedException ex) { + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + clickAndBlink(robot, locTarget); + + return lwClicked; + } + + //static {debugClassName = "Choice";} + + @Override + protected void prepareControls() { + + + JDesktopPane desktopPane = new JDesktopPane(); + + JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false); + bottomFrame.setSize(220, 220); + super.propagateAWTControls(bottomFrame); + desktopPane.add(bottomFrame); + bottomFrame.setVisible(true); + + JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false); + topFrame.setSize(200, 200); + topFrame.add(new JButton("LW Button") { + + { + addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + lwClicked = true; + } + }); + } + }); + desktopPane.add(topFrame); + topFrame.setVisible(true); + + JFrame frame = new JFrame("Test Window"); + frame.setSize(300, 300); + frame.setContentPane(desktopPane); + frame.setVisible(true); + + locTopFrame = topFrame.getLocationOnScreen(); + locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2); + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JInternalFrameMoveOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java new file mode 100644 index 00000000000..320a82adcce --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JButton; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component. + *

    See base class for test info. + */ +/* +@test +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JInternalFrameOverlapping + */ +public class JInternalFrameOverlapping extends OverlappingTestBase { + + private boolean lwClicked = true; + private Point lLoc; + + protected boolean performTest() { + + + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + clickAndBlink(robot, lLoc); + + return lwClicked; + } + + /** + * Creating two JInternalFrames in JDesktopPanes. Put lightweight component into one frame and heavyweight into another. + */ + @Override + protected void prepareControls() { + JDesktopPane desktopPane = new JDesktopPane(); + + JFrame frame = new JFrame("Test Window"); + frame.setSize(300, 300); + frame.setContentPane(desktopPane); + frame.setVisible(true); + JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false); + bottomFrame.setSize(220, 220); + desktopPane.add(bottomFrame); + bottomFrame.setVisible(true); + + super.propagateAWTControls(bottomFrame); + JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false); + topFrame.setSize(200, 200); + JButton jbutton = new JButton("LW Button") {{ + addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + lwClicked = true; + } + }); + }}; + topFrame.add(jbutton); + desktopPane.add(topFrame); + topFrame.setVisible(true); + lLoc = jbutton.getLocationOnScreen(); + lLoc.translate(jbutton.getWidth()/2, jbutton.getWidth()/2); //click at middle of the button + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JInternalFrameOverlapping(); + OverlappingTestBase.doMain(args); + } + +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java new file mode 100644 index 00000000000..bdde7409344 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JLabel } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JLabelInGlassPaneOverlapping + */ +public class JLabelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JLabel ch = new JLabel(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JLabelInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java new file mode 100644 index 00000000000..e6038bc8038 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JLabel } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JLabelOverlapping + */ +public class JLabelOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JLabel ch = new JLabel(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JLabelOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java new file mode 100644 index 00000000000..4a2e1419bae --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JList } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JList +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JListInGlassPaneOverlapping + */ +public class JListInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JList ch = new JList(new String[] {"one", "two", "three"}); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JListInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java new file mode 100644 index 00000000000..76ee46ccbfa --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014, 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. + */ + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JList } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JList +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JListOverlapping + */ +public class JListOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JList ch = new JList(new String[] {"one", "two", "three", "four"}); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JListOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java new file mode 100644 index 00000000000..5ae75bd55b7 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Color; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JSeparator; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JMenuBar } and {@link javax.swing.JSeparator} components. + *

    This test creates menu bar and test if heavyweight component is drawn correctly then menu dropdown is shown. + *

    See base class for test info. + */ +/* +@test +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JMenuBarOverlapping + */ +public class JMenuBarOverlapping extends OverlappingTestBase { + + {testEmbeddedFrame = true;} + + private boolean lwClicked = false; + private boolean spClicked = false; + private Point loc; + private Point loc2; + private Point sepLoc; + private JFrame frame; + private JMenuBar menuBar; + JSeparator separator; + + protected void prepareControls() { + frame = new JFrame("Mixing : Dropdown Overlapping test"); + frame.setLayout(new GridLayout(0,1)); + frame.setSize(200, 200); + frame.setVisible(true); + + menuBar = new JMenuBar(); + JMenu menu = new JMenu("Test Menu"); + ActionListener menuListener = new ActionListener() { + + public void actionPerformed(ActionEvent event) { + lwClicked = true; + } + }; + + JMenuItem item; + menu.add(item = new JMenuItem("first")); + item.addActionListener(menuListener); + separator = new JSeparator(); + separator.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + spClicked = true; + } + }); + menu.add(separator); + + for (int i = 0; i < petStrings.length; i++) { + menu.add(item = new JMenuItem(petStrings[i])); + item.addActionListener(menuListener); + } + menuBar.add(menu); + frame.setJMenuBar(menuBar); + + propagateAWTControls(frame); + frame.setVisible(true); + } + + @Override + protected boolean performTest() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + loc = menuBar.getLocationOnScreen(); + loc2 = frame.getContentPane().getLocationOnScreen(); + } + }); + } catch (Exception e) { + } + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + loc2.translate(75, 75); + pixelPreCheck(robot, loc2, currentAwtControl); + + loc.translate(3, 3); + clickAndBlink(robot, loc, false); + + clickAndBlink(robot, loc2, false); + + clickAndBlink(robot, loc, false); + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + sepLoc = separator.getLocationOnScreen(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + sepLoc.translate(20, 1); + clickAndBlink(robot, sepLoc, false); + + clickAndBlink(robot, loc, false); // close menu before running next step + return lwClicked && spClicked; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JMenuBarOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java new file mode 100644 index 00000000000..189a17b000f --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JPanel } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JPanel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JPanelInGlassPaneOverlapping + */ +public class JPanelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JPanel ch = new JPanel(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setBorder(BorderFactory.createTitledBorder("Swing Component")); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JPanelInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java new file mode 100644 index 00000000000..5decd49d461 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JPanel } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JPanel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JPanelOverlapping + */ +public class JPanelOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JPanel ch = new JPanel(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setBorder(BorderFactory.createTitledBorder("Swing Component")); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JPanelOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java new file mode 100644 index 00000000000..fead4e441fd --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Color; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JFrame; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.SpringLayout; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JPopupMenu } component. + *

    This test creates menu and test if heavyweight component is drawn correctly then menu dropdown is shown. + *

    See base class for test info. + */ +/* +@test +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JPopupMenuOverlapping + */ +public class JPopupMenuOverlapping extends OverlappingTestBase { + + {testEmbeddedFrame = true;} + + private boolean lwClicked = false; + private Point loc; + private JPopupMenu popup; + private JFrame frame=null; + + protected void prepareControls() { + if(frame != null) { + frame.setVisible(false); + } + frame = new JFrame("Mixing : Dropdown Overlapping test"); + frame.setLayout(new SpringLayout()); + frame.setSize(200, 200); + + popup = new JPopupMenu(); + ActionListener menuListener = new ActionListener() { + + public void actionPerformed(ActionEvent event) { + lwClicked = true; + } + }; + JMenuItem item; + for (int i = 0; i < petStrings.length; i++) { + popup.add(item = new JMenuItem(petStrings[i])); + item.addActionListener(menuListener); + } + propagateAWTControls(frame); + frame.setVisible(true); + loc = frame.getContentPane().getLocationOnScreen(); + } + + @Override + protected boolean performTest() { + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + loc.translate(75, 75); + + pixelPreCheck(robot, loc, currentAwtControl); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + popup.show(frame.getContentPane(), 15, 15); + } + }); + + robot.waitForIdle(); + + clickAndBlink(robot, loc, false); + + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + popup.setVisible(false); + } + }); + } catch (InterruptedException ex) { + fail(ex.getMessage()); + } catch (InvocationTargetException ex) { + fail(ex.getMessage()); + } + + return lwClicked; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JPopupMenuOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java new file mode 100644 index 00000000000..1f60eefe5d6 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JProgressBar } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JProgressBar +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JProgressBarInGlassPaneOverlapping + */ +public class JProgressBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JProgressBar ch = new JProgressBar(); + ch.setValue(50); + ch.setPreferredSize(new Dimension(50, 50)); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JProgressBarInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java new file mode 100644 index 00000000000..3db75cc6e4d --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JProgressBar } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JProgressBar +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JProgressBarOverlapping + */ +public class JProgressBarOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JProgressBar ch = new JProgressBar(); + ch.setValue(50); + ch.setPreferredSize(new Dimension(50, 50)); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JProgressBarOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java new file mode 100644 index 00000000000..a12a6f8b5af --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Point; +import java.awt.Dimension; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JScrollBar } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JScrollBar +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JScrollBarInGlassPaneOverlapping + */ +public class JScrollBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + public JScrollBarInGlassPaneOverlapping() { + super(false); + } + + @Override + protected JComponent getSwingComponent() { + JScrollBar ch = new JScrollBar(JScrollBar.VERTICAL); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setValue(50); + ch.addAdjustmentListener(new AdjustmentListener() { + + public void adjustmentValueChanged(AdjustmentEvent e) { + wasLWClicked = true; + } + }); + OverlappingTestBase.shift = new Point(20, 16); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JScrollBarInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java new file mode 100644 index 00000000000..9a3dd8e0a8a --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Point; +import java.awt.Dimension; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JScrollBar } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JScrollBar +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JScrollBarOverlapping + */ +public class JScrollBarOverlapping extends SimpleOverlappingTestBase { + + public JScrollBarOverlapping() { + super(false); + } + + @Override + protected JComponent getSwingComponent() { + JScrollBar ch = new JScrollBar(JScrollBar.VERTICAL); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setValue(50); + ch.addAdjustmentListener(new AdjustmentListener() { + + public void adjustmentValueChanged(AdjustmentEvent e) { + wasLWClicked = true; + } + }); + OverlappingTestBase.shift = new Point(20, 16); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JScrollBarOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java new file mode 100644 index 00000000000..d4ae51d38e4 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JScrollPane } component. + *

    See base class for test info. + */ +/* +@test +@summary Overlapping test for javax.swing.JScrollPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JScrollPaneOverlapping + */ +public class JScrollPaneOverlapping extends OverlappingTestBase { + +// {testEmbeddedFrame = true;} + + private boolean horizontalClicked = false; + private boolean verticalClicked = false; + private Point hLoc; + private Point vLoc; + + private JFrame f; + private JPanel p; + private JScrollPane scrollPane; + + protected void prepareControls() { + + f = new JFrame("JScrollPane"); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setSize(120, 120); + + p = new JPanel(new GridLayout(0, 1)); + + scrollPane = new JScrollPane(p); + scrollPane.setPreferredSize(new Dimension(300,300)); + scrollPane.setHorizontalScrollBarPolicy( + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setVerticalScrollBarPolicy( + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + scrollPane.getHorizontalScrollBar().setValue(1); + scrollPane.getHorizontalScrollBar().addAdjustmentListener(new AdjustmentListener() { + + public void adjustmentValueChanged(AdjustmentEvent e) { + horizontalClicked = true; + } + }); + + scrollPane.getVerticalScrollBar().setValue(1); + scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { + + public void adjustmentValueChanged(AdjustmentEvent e) { + verticalClicked = true; + } + }); + + f.getContentPane().add(scrollPane); + f.setVisible(true); + propagateAWTControls(p); +// JButton b = new JButton("Space extender"); +// b.setPreferredSize(new Dimension(150,150)); +// p.add( b ); + + //b.requestFocus(); // to change the look of AWT component, especially Choice + } + + @Override + protected boolean performTest() { + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen(); + vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen(); + } + }); + } catch (Exception e) { + } + hLoc.translate(2, 2); + vLoc.translate(2, 2); + + clickAndBlink(robot, hLoc, false); + clickAndBlink(robot, vLoc, false); + + return horizontalClicked && verticalClicked; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JScrollPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java new file mode 100644 index 00000000000..8cdafc17903 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JSlider } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JSlider +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JSliderInGlassPaneOverlapping + */ +public class JSliderInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JSlider ch = new JSlider(); + ch.setPreferredSize(new Dimension(50, 50)); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JSliderInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java new file mode 100644 index 00000000000..f6553db0311 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JSlider } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JSlider +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JSliderOverlapping + */ +public class JSliderOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JSlider ch = new JSlider(); + ch.setPreferredSize(new Dimension(50, 50)); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JSliderOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java new file mode 100644 index 00000000000..1c60597c5a2 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.event.ChangeEvent; +import javax.swing.*; +import javax.swing.event.ChangeListener; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JSpinner } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JSpinner +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JSpinnerInGlassPaneOverlapping + */ +public class JSpinnerInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + {testResize = false;} + + public JSpinnerInGlassPaneOverlapping() { + super(false); + } + +// static {debugClassName = "Choice";} + @Override + protected JComponent getSwingComponent() { + JSpinner ch = new JSpinner(); + ch.setPreferredSize(new Dimension(30, 50)); + ch.addChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + wasLWClicked = true; + } + }); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JSpinnerInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java new file mode 100644 index 00000000000..90e4e5b85e9 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.event.ChangeEvent; +import javax.swing.*; +import javax.swing.event.ChangeListener; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JSpinner } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JSpinner +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JSpinnerOverlapping + */ +public class JSpinnerOverlapping extends SimpleOverlappingTestBase { + + public JSpinnerOverlapping() { + super(false); + } + +// static {debugClassName = "Choice";} + @Override + protected JComponent getSwingComponent() { + JSpinner ch = new JSpinner(); + ch.setPreferredSize(new Dimension(30, 50)); + ch.addChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + wasLWClicked = true; + } + }); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JSpinnerOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java new file mode 100644 index 00000000000..c4f2265824a --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JSplitPane } component. + *

    This test creates puts heavyweight and lightweight components into different panels and test if splitter image and components itself are drawn correctly. + *

    See base class for test info. + */ +/* +@test +@bug 6986109 +@summary Overlapping test for javax.swing.JSplitPane +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JSplitPaneOverlapping + */ +public class JSplitPaneOverlapping extends OverlappingTestBase { + + private boolean clicked = false; + private Point splitterLoc; + private JScrollPane sp1; + private JScrollPane sp2; + + protected void prepareControls() { + JFrame frame = new JFrame("SplitPane Mixing"); + JPanel p = new JPanel(new GridLayout()); + p.setPreferredSize(new Dimension(500, 500)); + propagateAWTControls(p); + sp1 = new JScrollPane(p); + + JButton button = new JButton("JButton"); + button.setBackground(Color.RED); + button.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + clicked = true; + } + }); + sp2 = new JScrollPane(button); + + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, sp2); + splitPane.setOneTouchExpandable(false); + splitPane.setDividerLocation(150); + + splitPane.setPreferredSize(new Dimension(400, 200)); + + frame.getContentPane().add(splitPane); + frame.pack(); + frame.setVisible(true); + } + + private static final boolean ignoreFail = false; + + @Override + protected boolean performTest() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + splitterLoc = sp2.getLocationOnScreen(); + Point leftLoc = sp1.getLocationOnScreen(); + leftLoc.translate(sp1.getWidth(), 0); + splitterLoc.translate(-(splitterLoc.x - leftLoc.x) / 2, 30); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + robot.mouseMove(splitterLoc.x, splitterLoc.y); + Util.waitForIdle(robot); + + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseMove(splitterLoc.x - 50, splitterLoc.y); + Color c = robot.getPixelColor(splitterLoc.x - 50, splitterLoc.y); + System.out.println("Actual: "+c+", (not) expected: "+AWT_VERIFY_COLOR+" at "+(splitterLoc.x - 50)+", "+ splitterLoc.y); + if (!ignoreFail && c.equals(AWT_VERIFY_COLOR)) { + fail("The JSplitPane drag-n-drop image did not pass pixel color check and is overlapped"); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + clickAndBlink(robot, splitterLoc); + + return clicked; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JSplitPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java new file mode 100644 index 00000000000..af4803b9c50 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import javax.swing.JComponent; +import javax.swing.JTable; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTable } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for JTable +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTableInGlassPaneOverlapping + */ +public class JTableInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + { + testResize = false; + } + + @Override + protected JComponent getSwingComponent() { + // Create columns names + String columnNames[] = {"Column 1", "Column 2", "Column 3"}; + + // Create some data + String dataValues[][] = { + {"12", "234", "67"}, + {"-123", "43", "853"}, + {"93", "89.2", "109"}, + {"279", "9033", "3092"}, + {"12", "234", "67"}, + {"-123", "43", "853"}, + {"93", "89.2", "109"}, + {"279", "9033", "3092"}, + {"12", "234", "67"}, + {"-123", "43", "853"}, + {"93", "89.2", "109"}, + {"279", "9033", "3092"}, + {"12", "234", "67"}, + {"-123", "43", "853"}, + {"93", "89.2", "109"}, + {"279", "9033", "3092"} + }; + + // Create a new table instance + JTable jt = new JTable(dataValues, columnNames); + jt.getModel().addTableModelListener(new TableModelListener() { + + public void tableChanged(TableModelEvent e) { + System.err.println("table changed"); + } + }); + return jt; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTableInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java new file mode 100644 index 00000000000..d96732feedc --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2014, 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. + */ + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTable } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for JTable +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTableOverlapping + */ +public class JTableOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + // Create columns names + String columnNames[] = { "Column 1", "Column 2", "Column 3" }; + + // Create some data + String dataValues[][] = + { + { "12", "234", "67" }, + { "-123", "43", "853" }, + { "93", "89.2", "109" }, + { "279", "9033", "3092" }, + { "12", "234", "67" }, + { "-123", "43", "853" }, + { "93", "89.2", "109" }, + { "279", "9033", "3092" }, + { "12", "234", "67" }, + { "-123", "43", "853" }, + { "93", "89.2", "109" }, + { "279", "9033", "3092" }, + { "12", "234", "67" }, + { "-123", "43", "853" }, + { "93", "89.2", "109" }, + { "279", "9033", "3092" } + }; + + // Create a new table instance + return new JTable( dataValues, columnNames ); + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTableOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java new file mode 100644 index 00000000000..dba86e2747f --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTextArea } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTextAreaInGlassPaneOverlapping + */ +public class JTextAreaInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JTextArea ch = new JTextArea(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTextAreaInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java new file mode 100644 index 00000000000..51f2b5ffddb --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTextArea } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTextAreaOverlapping + */ +public class JTextAreaOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JTextArea ch = new JTextArea(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTextAreaOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java new file mode 100644 index 00000000000..d6dd69436ea --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTextField } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTextFieldInGlassPaneOverlapping + */ +public class JTextFieldInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JTextField ch = new JTextField(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTextFieldInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java new file mode 100644 index 00000000000..ffaecdcb589 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Dimension; +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JTextField } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JLabel +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JTextFieldOverlapping + */ +public class JTextFieldOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JTextField ch = new JTextField(); + ch.setPreferredSize(new Dimension(50, 50)); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JTextFieldOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java new file mode 100644 index 00000000000..3c4a62d9f50 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JToggleButton } component in GlassPane. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JToggleButton +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JToggleButtonInGlassPaneOverlapping + */ +public class JToggleButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JToggleButton ch = new JToggleButton(); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JToggleButtonInGlassPaneOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java new file mode 100644 index 00000000000..3b311d71e10 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, 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. + */ + +import javax.swing.*; + +/** + * AWT/Swing overlapping test for {@link javax.swing.JToggleButton } component. + *

    See base class for details. + */ +/* +@test +@summary Simple Overlapping test for javax.swing.JToggleButton +@author sergey.grinev@oracle.com: area=awt.mixing +@run main JToggleButtonOverlapping + */ +public class JToggleButtonOverlapping extends SimpleOverlappingTestBase { + + @Override + protected JComponent getSwingComponent() { + JToggleButton ch = new JToggleButton(); + ch.setText("Swing component"); + return ch; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new JToggleButtonOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java new file mode 100644 index 00000000000..fd15ca1dc85 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.JFrame; +import javax.swing.SpringLayout; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test. + *

    This test puts heavyweight component into JFrame and verifies that it's being drawn correctly after resizing the frame. + *

    See base class for test info. + */ +/* +@test +@bug 6777370 +@summary Issues when resizing the JFrame with HW components +@author sergey.grinev@oracle.com: area=awt.mixing +@run main MixingFrameResizing + */ +public class MixingFrameResizing extends OverlappingTestBase { + + {testEmbeddedFrame = true;} + + private JFrame frame = null; + private Point lLoc; + private Point lLoc2; + private Dimension size; + + protected void prepareControls() { + if(frame != null) { + frame.setVisible(false); + } + frame = new JFrame("Mixing : Frame Resizing test"); + frame.setLayout(new SpringLayout()); + frame.setSize(50, 50); + frame.setVisible(true); + propagateAWTControls(frame); + Util.waitTillShown(frame); + } + + @Override + protected boolean performTest() { + int BORDER_SHIFT = frameBorderCounter(); + BORDER_SHIFT = Math.abs(BORDER_SHIFT) == 1 ? BORDER_SHIFT : (BORDER_SHIFT / 2); + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + lLoc = frame.getLocationOnScreen(); + size = frame.getSize(); + lLoc2 = frame.getContentPane().getLocationOnScreen(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY/2); + + // resize window + robot.mouseMove(lLoc.x + size.width / 2 + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT); + Util.waitForIdle(robot); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (int i = 0; i < 10; i++) { + robot.mouseMove(lLoc.x + size.width / 2 + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT + 20 * i); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + robot.mouseMove(lLoc.x + size.width + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT); + Util.waitForIdle(robot); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (int i = 0; i < 10; i++) { + robot.mouseMove(lLoc.x + size.width + BORDER_SHIFT + 20 * i, lLoc.y + size.height + BORDER_SHIFT); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + Util.waitForIdle(robot); + // check if component is visible on the opened space + try { + Thread.sleep(300); //some more wait for Solaris (for some reason) + }catch(Exception ex) {} + lLoc2.translate(75, 75); + Color c = robot.getPixelColor(lLoc2.x, lLoc2.y); + System.out.println("Actual: "+c+", expected: "+AWT_VERIFY_COLOR); + + if (!c.equals(AWT_VERIFY_COLOR)) { + fail("HW component is not visible after resizing"); + } + + return true; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + if (System.getProperty("os.name").toLowerCase().contains("os x")) { + System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X."); + return; + } + instance = new MixingFrameResizing(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java new file mode 100644 index 00000000000..d7e46b9ffc6 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java @@ -0,0 +1,462 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.*; +import java.awt.event.InputEvent; +import javax.swing.*; +import java.io.*; + +/** + * AWT/Swing overlapping test for Panel and JPanel behavior during resizing. + *

    See JDK-6786219 for details + */ +/* +@test +@bug 6786219 +@summary Issues when resizing the frame after mixing of heavy weight & light weight components +@author sergey.grinev@oracle.com: area=awt.mixing +@build FrameBorderCounter +@run main MixingPanelsResizing + */ +public class MixingPanelsResizing { + + static volatile boolean failed = false; + + private static JFrame frame; + private static JButton jbutton; + private static Button awtButton; + private static JButton jbutton2; + private static Button awtButton2; + private static final Color jbColor = Color.RED; + private static final Color awtColor = Color.ORANGE; + private static final Color jb2Color = Color.BLUE; + private static final Color awt2Color = Color.CYAN; + private static final int ROBOT_DELAY = 500; + + private static Point lLoc; + private static int borderShift; + + private static int frameBorderCounter() { + String JAVA_HOME = System.getProperty("java.home"); + try { + Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter"); + try { + p.waitFor(); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + if (p.exitValue() != 0) { + throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream())); + } + return Integer.parseInt(readInputStream(p.getInputStream()).trim()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + private static String readInputStream(InputStream is) throws IOException { + byte[] buffer = new byte[4096]; + int len = 0; + StringBuilder sb = new StringBuilder(); + try (InputStreamReader isr = new InputStreamReader(is)) { + while ((len = is.read(buffer)) > 0) { + sb.append(new String(buffer, 0, len)); + } + } + return sb.toString(); + } + + private static void init() throws Exception { + //*** Create instructions for the user here *** + + borderShift = frameBorderCounter(); + borderShift = Math.abs(borderShift) == 1 ? borderShift : (borderShift / 2); + String[] instructions = { + "This is an AUTOMATIC test, simply wait until it is done.", + "The result (passed or failed) will be shown in the", + "message window below." + }; + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + Sysout.createDialog(); + Sysout.printInstructions(instructions); + + // prepare controls + + frame = new JFrame(); + + Panel awtPanel = new Panel(); + awtPanel.setBackground(Color.GREEN); + awtButton = new Button("AWTButton"); + awtPanel.add(awtButton); + awtButton.setForeground(awtColor); + awtButton.setBackground(awtColor); + jbutton = new JButton("SwingButton"); + awtPanel.add(jbutton); + jbutton.setForeground(jbColor); + jbutton.setBackground(jbColor); + + JPanel jPanel = new JPanel(); + jbutton2 = new JButton("SwingButton2"); + jPanel.add(jbutton2); + jbutton2.setForeground(jb2Color); + jbutton2.setBackground(jb2Color); + awtButton2 = new Button("AWT Button2"); + jPanel.add(awtButton2); + awtButton2.setForeground(awt2Color); + awtButton2.setBackground(awt2Color); + jPanel.setBackground(Color.YELLOW); + + frame.add(awtPanel, BorderLayout.SOUTH); + frame.add(jPanel, BorderLayout.NORTH); + + frame.pack(); + frame.setVisible(true); + } + }); + + ///////////////////////// + + final Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + Util.waitForIdle(robot); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + lLoc = frame.getLocationOnScreen(); + lLoc.translate(frame.getWidth() + borderShift, frame.getHeight() + borderShift); + } + }); + + //grow + robot.mouseMove(lLoc.x, lLoc.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + + Runnable test = new Runnable() { + + public void run() { + Point btnLoc = jbutton.getLocationOnScreen(); + Color c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5); + if (!c.equals(jbColor)) { + fail("JButton was not redrawn properly on AWT Panel during move"); + } + + btnLoc = awtButton.getLocationOnScreen(); + c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5); + if (!c.equals(awtColor)) { + fail("AWT Button was not redrawn properly on AWT Panel during move"); + } + + btnLoc = jbutton2.getLocationOnScreen(); + c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5); + if (!c.equals(jb2Color)) { + fail("JButton was not redrawn properly on JPanel during move"); + } + + btnLoc = awtButton2.getLocationOnScreen(); + c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5); + if (!c.equals(awt2Color)) { + fail("ATW Button was not redrawn properly on JPanel during move"); + } + } + }; + + for (int i = 0; i < 30; i++) { + test.run(); + robot.mouseMove(lLoc.x + 20 * i, lLoc.y + 10 * i); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + //back + System.out.println("fast back"); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (int i = 5; i >= 0; i--) { + test.run(); + robot.mouseMove(lLoc.x + 120 * i, lLoc.y + 60 * i); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + pass(); + }//End init() + /***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test- + * classes + ******************************************************/ + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + private static Thread mainThread = null; + private static int sleepTime = 300000; + + // Not sure about what happens if multiple of this test are + // instantiated in the same VM. Being static (and using + // static vars), it aint gonna work. Not worrying about + // it for now. + public static void main(String args[]) throws Exception { + if (!Toolkit.getDefaultToolkit().isDynamicLayoutActive()) { + System.out.println("Dynamic layout is not active. Test passes."); + return; + } + mainThread = Thread.currentThread(); + try { + init(); + } catch (TestPassedException e) { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test pass nor test fail has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try { + Thread.sleep(sleepTime); + //Timed out, so fail the test + throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds"); + } catch (InterruptedException e) { + //The test harness may have interrupted the test. If so, rethrow the exception + // so that the harness gets it and deals with it. + if (!testGeneratedInterrupt) { + throw e; + } + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + + if (theTestPassed == false) { + throw new RuntimeException(failureMessage); + } + } + + }//main + + public static synchronized void setTimeoutTo(int seconds) { + sleepTime = seconds * 1000; + } + + public static synchronized void pass() { + Sysout.println("The test passed."); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //first check if this is executing in main thread + if (mainThread == Thread.currentThread()) { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + }//pass() + + public static synchronized void fail() { + //test writer didn't specify why test failed, so give generic + fail("it just plain failed! :-)"); + } + + public static synchronized void fail(String whyFailed) { + Sysout.println("The test failed: " + whyFailed); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //check if this called from main thread + if (mainThread == Thread.currentThread()) { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException(whyFailed); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + }//fail() +}// class JButtonInGlassPane +class TestPassedException extends RuntimeException { +} + +//*********** End Standard Test Machinery Section ********** +//************ Begin classes defined for the test **************** +// if want to make listeners, here is the recommended place for them, then instantiate +// them in init() + +/* Example of a class which may be written as part of a test +class NewClass implements anInterface +{ +static int newVar = 0; + +public void eventDispatched(AWTEvent e) +{ +//Counting events to see if we get enough +eventCount++; + +if( eventCount == 20 ) +{ +//got enough events, so pass + +JButtonInGlassPane.pass(); +} +else if( tries == 20 ) +{ +//tried too many times without getting enough events so fail + +JButtonInGlassPane.fail(); +} + +}// eventDispatched() + +}// NewClass class + + */ +//************** End classes defined for the test ******************* +/**************************************************** +Standard Test Machinery +DO NOT modify anything below -- it's a standard +chunk of code whose purpose is to make user +interaction uniform, and thereby make it simpler +to read and understand someone else's test. + ****************************************************/ +/** +This is part of the standard test machinery. +It creates a dialog (with the instructions), and is the interface +for sending text messages to the user. +To print the instructions, send an array of strings to Sysout.createDialog +WithInstructions method. Put one line of instructions per array entry. +To display a message for the tester to see, simply call Sysout.println +with the string to be displayed. +This mimics System.out.println but works within the test harness as well +as standalone. + */ +class Sysout { + + private static TestDialog dialog; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + public static void println(String messageIn) { + dialog.displayMessage(messageIn); + System.out.println(messageIn); + } +}// Sysout class + +/** +This is part of the standard test machinery. It provides a place for the +test instructions to be displayed, and a place for interactive messages +to the user to be displayed. +To have the test instructions displayed, see Sysout. +To have a message to the user be displayed, see Sysout. +Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("Center", messageText); + + pack(); + + setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) { + posOfSpace = maxStringLength - 1; + } + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + System.out.println(messageIn); + } +}// TestDialog class + diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java new file mode 100644 index 00000000000..fcfd9ce12be --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import com.sun.awt.AWTUtilities; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.JButton; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for opaque Swing components. + *

    This test verify if AWT components are drawn correctly under opaque components. + *

    See JDK-6776743 for details + *

    See base class for test info. + */ +/* +@test +@bug 6776743 +@summary Opaque overlapping test for each AWT component +@run main OpaqueOverlapping + */ +public class OpaqueOverlapping extends OverlappingTestBase { + + { + useClickValidation = false; + failMessage = "Opacity test mismatchs"; + + // CR 6994264 (Choice autohides dropdown on Solaris 10) + skipClassNames = new String[] { "Choice" }; + } + private String testSeq; + private final static String checkSeq = "010000101"; + private Point heavyLoc; + private JButton light; + private Frame frame = null; + + protected void prepareControls() { + testSeq = ""; + // Create components + if(frame != null) { + frame.setVisible(false); + } + frame = new Frame("OpaqueOverlapping mixing test"); + final Panel panel = new Panel(); + panel.setLayout(null); + + propagateAWTControls(panel); + + // Overlap the buttons + currentAwtControl.setBounds(30, 30, 200, 200); + + light = new JButton(" LW Button "); + light.setBounds(10, 10, 50, 50); + + // Put the components into the frame + panel.add(light); + frame.add(panel); + frame.setBounds(50, 50, 400, 400); + frame.setVisible(true); + + currentAwtControl.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + panel.setComponentZOrder(light, 0); + frame.validate(); + testSeq = testSeq + "0"; + } + }); + light.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + panel.setComponentZOrder(currentAwtControl, 0); + frame.validate(); + testSeq = testSeq + "1"; + } + }); + } + + @Override + protected boolean performTest() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + heavyLoc = currentAwtControl.getLocationOnScreen(); + } + }); + } catch (Exception e) { + } + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + Util.waitForIdle(robot); + + // Move the mouse pointer to the position where both + // components overlap + robot.mouseMove(heavyLoc.x + 5, heavyLoc.y + 5); + + // Now perform the click at this point for 9 times + // In the middle of the process toggle the opaque + // flag value. + for (int i = 0; i < 9; ++i) { + if (i == 3) { + AWTUtilities.setComponentMixingCutoutShape(light, + new Rectangle()); + } + if (i == 6) { + AWTUtilities.setComponentMixingCutoutShape(light, + null); + } + + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + if (currentAwtControl.getClass() == java.awt.Choice.class && i != 1 && i != 6 && i != 8) { + // due to the fact that Choice doesn't get mouseClicked event if its dropdown is shown + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + } + } + + Util.waitForIdle(robot); + + boolean result = testSeq.equals(checkSeq); + if (!result) { + System.err.println("Expected: " + checkSeq); + System.err.println("Observed: " + testSeq); + } + return result; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new OpaqueOverlapping(); + OverlappingTestBase.doMain(args); + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java new file mode 100644 index 00000000000..896b096b4bb --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, 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. + */ + + +/** + * AWT/Swing overlapping test for opaque Choice. + * + * This test case was separated from {@link OpaqueOverlapping} due to CR 6994264 (Choice autohides dropdown on Solaris 10) + */ +/* +@test +@bug 6994264 +@summary Opaque overlapping test for Choice AWT component +@run main OpaqueOverlappingChoice + */ +public class OpaqueOverlappingChoice extends OpaqueOverlapping { + { + onlyClassName = "Choice"; + skipClassNames = null; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new OpaqueOverlappingChoice(); + OverlappingTestBase.doMain(args); + } +} + diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java new file mode 100644 index 00000000000..f3730b89302 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java @@ -0,0 +1,800 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.*; +import java.awt.event.*; +import java.awt.peer.ComponentPeer; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import javax.swing.*; +import sun.awt.*; +import java.io.*; + +/** + *

    This class provides basis for AWT Mixing testing. + *

    It provides all standard test machinery and should be used by + * extending and overriding next methods: + *

  • {@link OverlappingTestBase#prepareControls()} - setup UI components + *
  • {@link OverlappingTestBase#performTest()} - run particular test + * Those methods would be run in the loop for each AWT component. + *

    Current AWT component should be added to the tested UI by {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) ()}. + * There AWT components are prepared to be tested as being overlayed by other (e.g. Swing) components - they are colored to + * {@link OverlappingTestBase#AWT_BACKGROUND_COLOR} and throws failure on catching mouse event. + *

    Validation of component being overlayed should be tested by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } + * See each method javadoc for more details. + * + *

    Due to test machinery limitations all test should be run from their own main() by calling next coe + * + * public static void main(String args[]) throws InterruptedException { + * instance = new YourTestInstance(); + * OverlappingTestBase.doMain(args); + * } + * + * + * @author Sergey Grinev + */ +public abstract class OverlappingTestBase { + // working variables + private static volatile boolean wasHWClicked = false; + private static volatile boolean passed = true; + // constants + /** + * Default color for AWT component used for validate correct drawing of overlapping. Never use it for lightweight components. + */ + protected static final Color AWT_BACKGROUND_COLOR = new Color(21, 244, 54); + protected static Color AWT_VERIFY_COLOR = AWT_BACKGROUND_COLOR; + protected static final int ROBOT_DELAY = 500; + private static final String[] simpleAwtControls = {"Button", "Checkbox", "Label", "TextArea"}; + /** + * Generic strings array. To be used for population of List based controls. + */ + protected static final String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Rhynocephalia Granda", "Bear", "Tiger", "Mustang"}; + // "properties" + /** + * Tests customization. Set this variable to test only control from java.awt + *

    Usage of this variable should be marked with CR being the reason. + *

    Do not use this variable simultaneously with {@link OverlappingTestBase#skipClassNames} + */ + protected String onlyClassName = null; + /** + * For customizing tests. List classes' simple names to skip them from testings. + *

    Usage of this variable should be marked with CR being the reason. + */ + protected String[] skipClassNames = null; + /** + * Set to false to avoid event delivery validation + * @see OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean) + */ + protected boolean useClickValidation = true; + /** + * Set to false if test doesn't supposed to verify EmbeddedFrame + */ + protected boolean testEmbeddedFrame = false; + /** + * Set this variable to true if testing embedded frame is impossible (on Mac, for instance, for now). + * The testEmbeddedFrame is explicitly set to true in dozen places. + */ + protected boolean skipTestingEmbeddedFrame = false; + + public static final boolean isMac = System.getProperty("os.name").toLowerCase().contains("os x"); + private boolean isFrameBorderCalculated; + private int borderShift; + + { if (Toolkit.getDefaultToolkit().getClass().getName().matches(".*L.*Toolkit")) { + // No EmbeddedFrame in LWToolkit/LWCToolkit, yet + // And it should be programmed some other way, too, in any case + System.err.println("skipTestingEmbeddedFrame"); + skipTestingEmbeddedFrame = true; + }else { + System.err.println("do not skipTestingEmbeddedFrame"); + } + } + + protected int frameBorderCounter() { + if (!isFrameBorderCalculated) { + try { + new FrameBorderCounter(); // force compilation by jtreg + String JAVA_HOME = System.getProperty("java.home"); + Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter"); + try { + p.waitFor(); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + if (p.exitValue() != 0) { + throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream())); + } + borderShift = Integer.parseInt(readInputStream(p.getInputStream()).trim()); + isFrameBorderCalculated = true; + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } + } + return borderShift; + } + + public void getVerifyColor() { + try { + final int size = 200; + final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + final Point[] p = new Point[1]; + SwingUtilities.invokeAndWait(new Runnable() { + public void run(){ + JFrame frame = new JFrame("set back"); + frame.getContentPane().setBackground(AWT_BACKGROUND_COLOR); + frame.setSize(size, size); + frame.setUndecorated(true); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + p[0] = frame.getLocation(); + } + }); + Robot robot = new Robot(); + toolkit.realSync(); + Thread.sleep(ROBOT_DELAY); + AWT_VERIFY_COLOR = robot.getPixelColor(p[0].x+size/2, p[0].y+size/2); + System.out.println("Color will be compared with " + AWT_VERIFY_COLOR + " instead of " + AWT_BACKGROUND_COLOR); + } catch (Exception e) { + System.err.println("Cannot get verify color: "+e.getMessage()); + } + } + + private String readInputStream(InputStream is) throws IOException { + byte[] buffer = new byte[4096]; + int len = 0; + StringBuilder sb = new StringBuilder(); + try (InputStreamReader isr = new InputStreamReader(is)) { + while ((len = is.read(buffer)) > 0) { + sb.append(new String(buffer, 0, len)); + } + } + return sb.toString(); + } + + private void setupControl(final Component control) { + if (useClickValidation) { + control.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.err.println("ERROR: " + control.getClass() + " received mouse click."); + wasHWClicked = true; + } + }); + } + control.setBackground(AWT_BACKGROUND_COLOR); + control.setForeground(AWT_BACKGROUND_COLOR); + control.setPreferredSize(new Dimension(150, 150)); + control.setFocusable(false); + } + + private void addAwtControl(java.util.List container, final Component control) { + String simpleName = control.getClass().getSimpleName(); + if (onlyClassName != null && !simpleName.equals(onlyClassName)) { + return; + } + if (skipClassNames != null) { + for (String skipMe : skipClassNames) { + if (simpleName.equals(skipMe)) { + return; + } + } + } + setupControl(control); + container.add(control); + } + + private void addSimpleAwtControl(java.util.List container, String className) { + try { + Class definition = Class.forName("java.awt." + className); + Constructor constructor = definition.getConstructor(new Class[]{String.class}); + java.awt.Component component = (java.awt.Component) constructor.newInstance(new Object[]{"AWT Component " + className}); + addAwtControl(container, component); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + fail("Setup error, this jdk doesn't have awt conrol " + className); + } + } + + /** + * Adds current AWT control to container + *

    N.B.: if testEmbeddedFrame == true this method will also add EmbeddedFrame over Canvas + * and it should be called after Frame.setVisible(true) call + * @param container container to hold AWT component + */ + protected final void propagateAWTControls(Container container) { + if (currentAwtControl != null) { + container.add(currentAwtControl); + } else { // embedded frame + try { + + //create embedder + Canvas embedder = new Canvas(); + embedder.setBackground(Color.RED); + embedder.setPreferredSize(new Dimension(150, 150)); + container.add(embedder); + container.setVisible(true); // create peer + + long frameWindow = 0; + String getWindowMethodName = "getHWnd"; + if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) { + getWindowMethodName = "getWindow"; + } + ComponentPeer peer = embedder.getPeer(); +// System.err.println("Peer: " + peer); + Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName); + frameWindow = (Long) getWindowMethod.invoke(peer); +// System.err.println("frame peer ID: " + frameWindow); + + String eframeClassName = "sun.awt.windows.WEmbeddedFrame"; + if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) { + eframeClassName = "sun.awt.X11.XEmbeddedFrame"; + } + Class eframeClass = Class.forName(eframeClassName); + Constructor eframeCtor = eframeClass.getConstructor(long.class); + EmbeddedFrame eframe = (EmbeddedFrame) eframeCtor.newInstance(frameWindow); + setupControl(eframe); + eframe.setSize(new Dimension(150, 150)); + eframe.setVisible(true); +// System.err.println(eframe.getSize()); + } catch (Exception ex) { + ex.printStackTrace(); + fail("Failed to instantiate EmbeddedFrame: " + ex.getMessage()); + } + } + } + private static final Font hugeFont = new Font("Arial", Font.BOLD, 70); + + private java.util.List getAWTControls() { + java.util.List components = new ArrayList(); + + for (String clazz : simpleAwtControls) { + addSimpleAwtControl(components, clazz); + } + + TextField tf = new TextField(); + tf.setFont(hugeFont); + addAwtControl(components, tf); + + // more complex controls + Choice c = new Choice(); + for (int i = 0; i < petStrings.length; i++) { + c.add(petStrings[i]); + } + addAwtControl(components, c); + c.setPreferredSize(null); + c.setFont(hugeFont); // to make control bigger as setPrefferedSize don't do his job here + + List l = new List(petStrings.length); + for (int i = 0; i < petStrings.length; i++) { + l.add(petStrings[i]); + } + addAwtControl(components, l); + + Canvas canvas = new Canvas(); + canvas.setSize(100, 200); + addAwtControl(components, canvas); + + Scrollbar sb = new Scrollbar(Scrollbar.VERTICAL, 500, 1, 0, 500); + addAwtControl(components, sb); + + Scrollbar sb2 = new Scrollbar(Scrollbar.HORIZONTAL, 500, 1, 0, 500); + addAwtControl(components, sb2); + + return components; + } + /** + * Default shift for {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } + */ + protected static Point shift = new Point(16, 16); + + /** + * Verifies point using specified AWT Robot. Supposes defaultShift == true for {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean) }. + * This method is used to verify controls by providing just their plain screen coordinates. + * @param robot AWT Robot. Usually created by {@link Util#createRobot() } + * @param lLoc point to verify + * @see OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean) + */ + protected void clickAndBlink(Robot robot, Point lLoc) { + clickAndBlink(robot, lLoc, true); + } + /** + * Default failure message for color check + * @see OverlappingTestBase#performTest() + */ + protected String failMessageColorCheck = "The LW component did not pass pixel color check and is overlapped"; + /** + * Default failure message event check + * @see OverlappingTestBase#performTest() + */ + protected String failMessage = "The LW component did not received the click."; + + private static boolean isValidForPixelCheck(Component component) { + if ((component instanceof java.awt.Scrollbar) || isMac && (component instanceof java.awt.Button)) { + return false; + } + return true; + } + + /** + * Preliminary validation - should be run before overlapping happens to ensure test is correct. + * @param robot AWT Robot. Usually created by {@link Util#createRobot() } + * @param lLoc point to validate to be of {@link OverlappingTestBase#AWT_BACKGROUND_COLOR} + * @param component tested component, should be pointed out as not all components are valid for pixel check. + */ + protected void pixelPreCheck(Robot robot, Point lLoc, Component component) { + if (isValidForPixelCheck(component)) { + int tries = 10; + Color c = null; + while (tries-- > 0) { + c = robot.getPixelColor(lLoc.x, lLoc.y); + System.out.println("Precheck. color: "+c+" compare with "+AWT_VERIFY_COLOR); + if (c.equals(AWT_VERIFY_COLOR)) { + return; + } + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } + } + System.err.println(lLoc + ": " + c); + fail("Dropdown test setup failure, colored part of AWT component is not located at click area"); + } + } + + /** + * Verifies point using specified AWT Robot. + *

    Firstly, verifies point by color pixel check + *

    Secondly, verifies event delivery by mouse click + * @param robot AWT Robot. Usually created by {@link Util#createRobot() } + * @param lLoc point to verify + * @param defaultShift if true verified position will be shifted by {@link OverlappingTestBase#shift }. + */ + protected void clickAndBlink(Robot robot, Point lLoc, boolean defaultShift) { + Point loc = lLoc.getLocation(); + //check color + Util.waitForIdle(robot); + try{ + Thread.sleep(500); + }catch(Exception exx){ + exx.printStackTrace(); + } + + if (defaultShift) { + loc.translate(shift.x, shift.y); + } + if (!(System.getProperty("os.name").toLowerCase().contains("os x"))) { + Color c = robot.getPixelColor(loc.x, loc.y); + System.out.println("C&B. color: "+c+" compare with "+AWT_VERIFY_COLOR); + if (c.equals(AWT_VERIFY_COLOR)) { + fail(failMessageColorCheck); + passed = false; + } + + // perform click + Util.waitForIdle(robot); + } + + robot.mouseMove(loc.x, loc.y); + + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + } + + /** + * This method should be overriden with code which setups UI for testing. + * Code in this method will be called only from AWT thread so Swing operations can be called directly. + * + * @see {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) } for instructions about adding tested AWT control to UI + */ + protected abstract void prepareControls(); + + /** + * This method should be overriden with test execution. It will not be called from AWT thread so all Swing operations should be treated accordingly. + * @return true if test passed. Otherwise fail with default fail message. + * @see {@link OverlappingTestBase#failMessage} default fail message + */ + protected abstract boolean performTest(); + /** + * This method can be overriden with cleanup routines. It will be called from AWT thread so all Swing operations should be treated accordingly. + */ + protected void cleanup() { + // intentionally do nothing + } + /** + * Currect tested AWT Control. Usually shouldn't be accessed directly. + * + * @see {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) } for instructions about adding tested AWT control to UI + */ + protected Component currentAwtControl; + + private void testComponent(Component component) throws InterruptedException, InvocationTargetException { + currentAwtControl = component; + System.out.println("Testing " + currentAwtControl.getClass().getSimpleName()); + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + prepareControls(); + } + }); + if (component != null) { + Util.waitTillShown(component); + } + Util.waitForIdle(null); + try { + Thread.sleep(500); // wait for graphic effects on systems like Win7 + } catch (InterruptedException ex) { + } + if (!instance.performTest()) { + fail(failMessage); + passed = false; + } + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + cleanup(); + } + }); + } + + private void testEmbeddedFrame() throws InvocationTargetException, InterruptedException { + System.out.println("Testing EmbeddedFrame"); + currentAwtControl = null; + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + prepareControls(); + } + }); + Util.waitForIdle(null); + try { + Thread.sleep(500); // wait for graphic effects on systems like Win7 + } catch (InterruptedException ex) { + } + if (!instance.performTest()) { + fail(failMessage); + passed = false; + } + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + cleanup(); + } + }); + } + + private void testAwtControls() throws InterruptedException { + try { + for (Component component : getAWTControls()) { + testComponent(component); + } + if (testEmbeddedFrame && !skipTestingEmbeddedFrame) { + testEmbeddedFrame(); + } + } catch (InvocationTargetException ex) { + ex.printStackTrace(); + fail(ex.getMessage()); + } + } + /** + * Used by standard test machinery. See usage at {@link OverlappingTestBase } + */ + protected static OverlappingTestBase instance; + + protected OverlappingTestBase() { + getVerifyColor(); + } + + /***************************************************** + * Standard Test Machinery Section + * DO NOT modify anything in this section -- it's a + * standard chunk of code which has all of the + * synchronisation necessary for the test harness. + * By keeping it the same in all tests, it is easier + * to read and understand someone else's test, as + * well as insuring that all tests behave correctly + * with the test harness. + * There is a section following this for test- + * classes + ******************************************************/ + private static void init() throws InterruptedException { + //*** Create instructions for the user here *** + //System.setProperty("sun.awt.disableMixing", "true"); + + String[] instructions = { + "This is an AUTOMATIC test, simply wait until it is done.", + "The result (passed or failed) will be shown in the", + "message window below." + }; + Sysout.createDialog(); + Sysout.printInstructions(instructions); + + instance.testAwtControls(); + + if (wasHWClicked) { + fail("HW component received the click."); + passed = false; + } + if (passed) { + pass(); + } + }//End init() + private static boolean theTestPassed = false; + private static boolean testGeneratedInterrupt = false; + private static String failureMessage = ""; + private static Thread mainThread = null; + private static int sleepTime = 300000; + + // Not sure about what happens if multiple of this test are + // instantiated in the same VM. Being static (and using + // static vars), it aint gonna work. Not worrying about + // it for now. + /** + * Starting point for test runs. See usage at {@link OverlappingTestBase } + * @param args regular main args, not used. + * @throws InterruptedException + */ + public static void doMain(String args[]) throws InterruptedException { + mainThread = Thread.currentThread(); + try { + init(); + } catch (TestPassedException e) { + //The test passed, so just return from main and harness will + // interepret this return as a pass + return; + } + //At this point, neither test pass nor test fail has been + // called -- either would have thrown an exception and ended the + // test, so we know we have multiple threads. + + //Test involves other threads, so sleep and wait for them to + // called pass() or fail() + try { + Thread.sleep(sleepTime); + //Timed out, so fail the test + throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds"); + } catch (InterruptedException e) { + //The test harness may have interrupted the test. If so, rethrow the exception + // so that the harness gets it and deals with it. + if (!testGeneratedInterrupt) { + throw e; + } + + //reset flag in case hit this code more than once for some reason (just safety) + testGeneratedInterrupt = false; + + if (theTestPassed == false) { + throw new RuntimeException(failureMessage); + } + } + + }//main + + /** + * Test will fail if not passed after this timeout. Default timeout is 300 seconds. + * @param seconds timeout in seconds + */ + public static synchronized void setTimeoutTo(int seconds) { + sleepTime = seconds * 1000; + } + + /** + * Set test as passed. Usually shoudn't be called directly. + */ + public static synchronized void pass() { + Sysout.println("The test passed."); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //first check if this is executing in main thread + if (mainThread == Thread.currentThread()) { + //Still in the main thread, so set the flag just for kicks, + // and throw a test passed exception which will be caught + // and end the test. + theTestPassed = true; + throw new TestPassedException(); + } + theTestPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + }//pass() + + /** + * Fail test generic message. + */ + public static synchronized void fail() { + //test writer didn't specify why test failed, so give generic + fail("it just plain failed! :-)"); + } + + /** + * Fail test providing specific reason. + * @param whyFailed reason + */ + public static synchronized void fail(String whyFailed) { + Sysout.println("The test failed: " + whyFailed); + Sysout.println("The test is over, hit Ctl-C to stop Java VM"); + //check if this called from main thread + if (mainThread == Thread.currentThread()) { + //If main thread, fail now 'cause not sleeping + throw new RuntimeException(whyFailed); + } + theTestPassed = false; + testGeneratedInterrupt = true; + failureMessage = whyFailed; + mainThread.interrupt(); + }//fail() +}// class LWComboBox +class TestPassedException extends RuntimeException { +} + +//*********** End Standard Test Machinery Section ********** +//************ Begin classes defined for the test **************** +// if want to make listeners, here is the recommended place for them, then instantiate +// them in init() + +/* Example of a class which may be written as part of a test +class NewClass implements anInterface +{ +static int newVar = 0; + +public void eventDispatched(AWTEvent e) +{ +//Counting events to see if we get enough +eventCount++; + +if( eventCount == 20 ) +{ +//got enough events, so pass + +LWComboBox.pass(); +} +else if( tries == 20 ) +{ +//tried too many times without getting enough events so fail + +LWComboBox.fail(); +} + +}// eventDispatched() + +}// NewClass class + + */ +//************** End classes defined for the test ******************* +/**************************************************** +Standard Test Machinery +DO NOT modify anything below -- it's a standard +chunk of code whose purpose is to make user +interaction uniform, and thereby make it simpler +to read and understand someone else's test. + ****************************************************/ +/** +This is part of the standard test machinery. +It creates a dialog (with the instructions), and is the interface +for sending text messages to the user. +To print the instructions, send an array of strings to Sysout.createDialog +WithInstructions method. Put one line of instructions per array entry. +To display a message for the tester to see, simply call Sysout.println +with the string to be displayed. +This mimics System.out.println but works within the test harness as well +as standalone. + */ +class Sysout { + private static TestDialog dialog; + + public static void createDialogWithInstructions(String[] instructions) { + dialog = new TestDialog(new Frame(), "Instructions"); + dialog.printInstructions(instructions); + //dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void createDialog() { + dialog = new TestDialog(new Frame(), "Instructions"); + String[] defInstr = {"Instructions will appear here. ", ""}; + dialog.printInstructions(defInstr); + //dialog.setVisible(true); + println("Any messages for the tester will display here."); + } + + public static void printInstructions(String[] instructions) { + dialog.printInstructions(instructions); + } + + public static void println(String messageIn) { + dialog.displayMessage(messageIn); + System.out.println(messageIn); + } +}// Sysout class + +/** +This is part of the standard test machinery. It provides a place for the +test instructions to be displayed, and a place for interactive messages +to the user to be displayed. +To have the test instructions displayed, see Sysout. +To have a message to the user be displayed, see Sysout. +Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog { + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog(Frame frame, String name) { + super(frame, name); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea("", 15, maxStringLength, scrollBoth); + add("North", instructionsText); + + messageText = new TextArea("", 5, maxStringLength, scrollBoth); + add("Center", messageText); + + pack(); + + //setVisible(true); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions(String[] instructions) { + //Clear out any current instructions + instructionsText.setText(""); + + //Go down array of instruction strings + + String printStr, remainingStr; + for (int i = 0; i < instructions.length; i++) { + //chop up each into pieces maxSringLength long + remainingStr = instructions[i]; + while (remainingStr.length() > 0) { + //if longer than max then chop off first max chars to print + if (remainingStr.length() >= maxStringLength) { + //Try to chop on a word boundary + int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1); + + if (posOfSpace <= 0) { + posOfSpace = maxStringLength - 1; + } + + printStr = remainingStr.substring(0, posOfSpace + 1); + remainingStr = remainingStr.substring(posOfSpace + 1); + } //else just print + else { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append(printStr + "\n"); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage(String messageIn) { + messageText.append(messageIn + "\n"); + System.out.println(messageIn); + } +}// TestDialog class + diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java new file mode 100644 index 00000000000..4d81127a772 --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +/** + * Base class for testing overlapping of Swing and AWT component put into one frame. + * Validates drawing and event delivery at the components intersection. + *

    See base class for usage + * + * @author Sergey Grinev +*/ +public abstract class SimpleOverlappingTestBase extends OverlappingTestBase { + + { + testEmbeddedFrame = true; + } + + /** + * Event delivery validation. If set to true (default) tested lightweight component will be provided + * with mouse listener which should be called in order for test to pass. + */ + protected final boolean useDefaultClickValidation; + + /** + * Constructor which sets {@link SimpleOverlappingTestBase#useDefaultClickValidation } + * @param defaultClickValidation + */ + protected SimpleOverlappingTestBase(boolean defaultClickValidation) { + super(); + this.useDefaultClickValidation = defaultClickValidation; + } + + public SimpleOverlappingTestBase() { + this(true); + } + + //overridables + /** + * Successors override this method providing swing component for testing + * @return swing component to test + */ + protected abstract JComponent getSwingComponent(); + + /** + * For tests debugging. Please, ignore. + */ + protected static final boolean debug = false; + + /** + * Should be set to true if test isn't using {@link SimpleOverlappingTestBase#useDefaultClickValidation } + */ + protected volatile boolean wasLWClicked = false; + + /** + * Current tested lightweight component + * @see SimpleOverlappingTestBase#getSwingComponent() + */ + protected JComponent testedComponent; + + /** + * Setups simple frame with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() } + * Called by base class. + */ + protected void prepareControls() { + wasLWClicked = false; + + final JFrame f = new JFrame("Mixing : Simple Overlapping test"); + f.setLayout(new SpringLayout()); + f.setSize(200, 200); + + testedComponent = getSwingComponent(); + + if (useDefaultClickValidation) { + testedComponent.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + wasLWClicked = true; + f.setVisible(false); + } + }); + } + + if (!debug) { + f.add(testedComponent); + } else { + System.err.println("Warning: DEBUG MODE"); + } + + propagateAWTControls(f); + + f.setVisible(true); + } + + /** + * AWT Robot instance. Shouldn't be used in most cases. + */ + protected Robot robot; + + /** + * Run test by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } validation for current lightweight component. + *

    Called by base class. + * @return true if test passed + */ + protected boolean performTest() { + testedComponent.requestFocus(); + + // run robot + robot = Util.createRobot(); + robot.setAutoDelay(20); + + // get coord + Point lLoc = !debug ? testedComponent.getLocationOnScreen() : new Point(70, 30); + Util.waitForIdle(null); + /* this is a workaround for certain jtreg(?) focus issue: + tests fail starting after failing mixing tests but always pass alone. + */ + JFrame ancestor = (JFrame)(testedComponent.getTopLevelAncestor()); + if( ancestor != null ) { + Point ancestorLoc = ancestor.getLocationOnScreen(); + ancestorLoc.translate(ancestor.getWidth()/2-15, 2); + robot.mouseMove(ancestorLoc.x, ancestorLoc.y); + Util.waitForIdle(robot); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(50); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + } + + clickAndBlink(robot, lLoc); + Util.waitForIdle(null); + + return wasLWClicked; + } + +} + diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/Util.java b/jdk/test/java/awt/Mixing/AWT_Mixing/Util.java new file mode 100644 index 00000000000..6bebdc881dc --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/Util.java @@ -0,0 +1,601 @@ +/* + * Copyright (c) 2014, 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. + */ + +import java.awt.Component; +import java.awt.Frame; +import java.awt.Dialog; +import java.awt.Window; +import java.awt.Button; +import java.awt.Point; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.IllegalComponentStateException; +import java.awt.AWTException; +import java.awt.AWTEvent; + +import java.awt.event.InputEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.ActionEvent; +import java.awt.event.FocusEvent; +import java.awt.event.WindowListener; +import java.awt.event.WindowFocusListener; +import java.awt.event.FocusListener; +import java.awt.event.ActionListener; + +import java.awt.peer.FramePeer; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import java.security.PrivilegedAction; +import java.security.AccessController; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** + *

    This class contains utilities useful for regression testing. + *

    When using jtreg you would include this class into the build + * list via something like: + *

    +     &library ../../../../share/lib/AWT_Mixing/src/regtesthelpers/
    +     &build Util
    +     &run main YourTest
    +   
    + * Note that if you are about to create a test based on + * Applet-template, then put those lines into html-file, not in java-file. + *

    And put an + * import regtesthelpers.Util; + * into the java source of test. +*/ +public final class Util { + private Util() {} // this is a helper class with static methods :) + + /* + * @throws RuntimeException when creation failed + */ + public static Robot createRobot() { + try { + return new Robot(); + } catch (AWTException e) { + throw new RuntimeException("Error: unable to create robot", e); + } + } + + public static Frame createEmbeddedFrame(final Frame embedder) + throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, + InstantiationException, InvocationTargetException + { + Toolkit tk = Toolkit.getDefaultToolkit(); + FramePeer frame_peer = (FramePeer) embedder.getPeer(); + System.out.println("frame's peer = " + frame_peer); + if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) { + Class comp_peer_class = + Class.forName("sun.awt.windows.WComponentPeer"); + System.out.println("comp peer class = " + comp_peer_class); + Field hwnd_field = comp_peer_class.getDeclaredField("hwnd"); + hwnd_field.setAccessible(true); + System.out.println("hwnd_field =" + hwnd_field); + long hwnd = hwnd_field.getLong(frame_peer); + System.out.println("hwnd = " + hwnd); + + Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame"); + Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE}); + return (Frame) constructor.newInstance (new Object[] {hwnd}); + } else if ("sun.awt.X11.XToolkit".equals(tk.getClass().getName())) { + Class x_base_window_class = Class.forName("sun.awt.X11.XBaseWindow"); + System.out.println("x_base_window_class = " + x_base_window_class); + Method get_window = x_base_window_class.getMethod("getWindow", new Class[0]); + System.out.println("get_window = " + get_window); + long window = (Long) get_window.invoke(frame_peer, new Object[0]); + System.out.println("window = " + window); + Class clazz = Class.forName("sun.awt.X11.XEmbeddedFrame"); + Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE, Boolean.TYPE}); + return (Frame) constructor.newInstance (new Object[] {window, true}); + } + + throw new RuntimeException("Unexpected toolkit - " + tk); + } + + /** + * Makes the window visible and waits until it's shown. + */ + public static void showWindowWait(Window win) { + win.setVisible(true); + waitTillShown(win); + } + + /** + * Moves mouse pointer in the center of given {@code comp} component + * using {@code robot} parameter. + */ + public static void pointOnComp(final Component comp, final Robot robot) { + Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize()); + robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2); + } + + /** + * Moves mouse pointer in the center of a given {@code comp} component + * and performs a left mouse button click using the {@code robot} parameter + * with the {@code delay} delay between press and release. + */ + public static void clickOnComp(final Component comp, final Robot robot, int delay) { + pointOnComp(comp, robot); + robot.delay(delay); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(delay); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + } + + /** + * Moves mouse pointer in the center of a given {@code comp} component + * and performs a left mouse button click using the {@code robot} parameter + * with the default delay between press and release. + */ + public static void clickOnComp(final Component comp, final Robot robot) { + clickOnComp(comp, robot, 50); + } + + /* + * Clicks on a title of Frame/Dialog. + * WARNING: it may fail on some platforms when the window is not wide enough. + */ + public static void clickOnTitle(final Window decoratedWindow, final Robot robot) { + Point p = decoratedWindow.getLocationOnScreen(); + Dimension d = decoratedWindow.getSize(); + + if (decoratedWindow instanceof Frame || decoratedWindow instanceof Dialog) { + robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)decoratedWindow.getInsets().top/2); + robot.delay(50); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.delay(50); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + } + } + + public static void waitForIdle(final Robot robot) { + // we do not use robot for now, use SunToolkit.realSync() instead + ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); + } + + public static Field getField(final Class klass, final String fieldName) { + return AccessController.doPrivileged(new PrivilegedAction() { + public Field run() { + try { + Field field = klass.getDeclaredField(fieldName); + assert (field != null); + field.setAccessible(true); + return field; + } catch (SecurityException se) { + throw new RuntimeException("Error: unexpected exception caught!", se); + } catch (NoSuchFieldException nsfe) { + throw new RuntimeException("Error: unexpected exception caught!", nsfe); + } + } + }); + } + + /* + * Waits for a notification and for a boolean condition to become true. + * The method returns when the above conditions are fullfilled or when the timeout + * occurs. + * + * @param condition the object to be notified and the booelan condition to wait for + * @param timeout the maximum time to wait in milliseconds + * @param catchExceptions if {@code true} the method catches InterruptedException + * @return the final boolean value of the {@code condition} + * @throws InterruptedException if the awaiting proccess has been interrupted + */ + public static boolean waitForConditionEx(final AtomicBoolean condition, long timeout) + throws InterruptedException + { + synchronized (condition) { + long startTime = System.currentTimeMillis(); + while (!condition.get()) { + condition.wait(timeout); + if (System.currentTimeMillis() - startTime >= timeout ) { + break; + } + } + } + return condition.get(); + } + + /* + * The same as {@code waitForConditionEx(AtomicBoolean, long)} except that it + * doesn't throw InterruptedException. + */ + public static boolean waitForCondition(final AtomicBoolean condition, long timeout) { + try { + return waitForConditionEx(condition, timeout); + } catch (InterruptedException e) { + throw new RuntimeException("Error: unexpected exception caught!", e); + } + } + + /* + * The same as {@code waitForConditionEx(AtomicBoolean, long)} but without a timeout. + */ + public static void waitForConditionEx(final AtomicBoolean condition) + throws InterruptedException + { + synchronized (condition) { + while (!condition.get()) { + condition.wait(); + } + } + } + + /* + * The same as {@code waitForConditionEx(AtomicBoolean)} except that it + * doesn't throw InterruptedException. + */ + public static void waitForCondition(final AtomicBoolean condition) { + try { + waitForConditionEx(condition); + } catch (InterruptedException e) { + throw new RuntimeException("Error: unexpected exception caught!", e); + } + } + + public static void waitTillShownEx(final Component comp) throws InterruptedException { + while (true) { + try { + Thread.sleep(100); + comp.getLocationOnScreen(); + break; + } catch (IllegalComponentStateException e) {} + } + } + public static void waitTillShown(final Component comp) { + try { + waitTillShownEx(comp); + } catch (InterruptedException e) { + throw new RuntimeException("Error: unexpected exception caught!", e); + } + } + + /** + * Drags from one point to another with the specified mouse button pressed. + * + * @param robot a robot to use for moving the mouse, etc. + * @param startPoint a start point of the drag + * @param endPoint an end point of the drag + * @param button one of {@code InputEvent.BUTTON1_MASK}, + * {@code InputEvent.BUTTON2_MASK}, {@code InputEvent.BUTTON3_MASK} + * + * @throws IllegalArgumentException if {@code button} is not one of + * {@code InputEvent.BUTTON1_MASK}, {@code InputEvent.BUTTON2_MASK}, + * {@code InputEvent.BUTTON3_MASK} + */ + public static void drag(Robot robot, Point startPoint, Point endPoint, int button) { + if (!(button == InputEvent.BUTTON1_MASK || button == InputEvent.BUTTON2_MASK + || button == InputEvent.BUTTON3_MASK)) + { + throw new IllegalArgumentException("invalid mouse button"); + } + + robot.mouseMove(startPoint.x, startPoint.y); + robot.mousePress(button); + try { + mouseMove(robot, startPoint, endPoint); + } finally { + robot.mouseRelease(button); + } + } + + /** + * Moves the mouse pointer from one point to another. + * Uses Bresenham's algorithm. + * + * @param robot a robot to use for moving the mouse + * @param startPoint a start point of the drag + * @param endPoint an end point of the drag + */ + public static void mouseMove(Robot robot, Point startPoint, Point endPoint) { + int dx = endPoint.x - startPoint.x; + int dy = endPoint.y - startPoint.y; + + int ax = Math.abs(dx) * 2; + int ay = Math.abs(dy) * 2; + + int sx = signWOZero(dx); + int sy = signWOZero(dy); + + int x = startPoint.x; + int y = startPoint.y; + + int d = 0; + + if (ax > ay) { + d = ay - ax/2; + while (true){ + robot.mouseMove(x, y); + robot.delay(50); + + if (x == endPoint.x){ + return; + } + if (d >= 0){ + y = y + sy; + d = d - ax; + } + x = x + sx; + d = d + ay; + } + } else { + d = ax - ay/2; + while (true){ + robot.mouseMove(x, y); + robot.delay(50); + + if (y == endPoint.y){ + return; + } + if (d >= 0){ + x = x + sx; + d = d - ay; + } + y = y + sy; + d = d + ax; + } + } + } + + private static int signWOZero(int i){ + return (i > 0)? 1: -1; + } + + private static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } + + /** Returns {@code WindowListener} instance that diposes {@code Window} on + * "window closing" event. + * + * @return the {@code WindowListener} instance that could be set + * on a {@code Window}. After that + * the {@code Window} is disposed when "window closed" + * event is sent to the {@code Window} + */ + public static WindowListener getClosingWindowAdapter() { + return new WindowAdapter () { + public void windowClosing(WindowEvent e) { + e.getWindow().dispose(); + } + }; + } + + /* + * The values directly map to the ones of + * sun.awt.X11.XWM & sun.awt.motif.MToolkit classes. + */ + public final static int + UNDETERMINED_WM = 1, + NO_WM = 2, + OTHER_WM = 3, + OPENLOOK_WM = 4, + MOTIF_WM = 5, + CDE_WM = 6, + ENLIGHTEN_WM = 7, + KDE2_WM = 8, + SAWFISH_WM = 9, + ICE_WM = 10, + METACITY_WM = 11, + COMPIZ_WM = 12, + LG3D_WM = 13; + + /* + * Returns -1 in case of not X Window or any problems. + */ + public static int getWMID() { + Class clazz = null; + try { + if ("sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) { + clazz = Class.forName("sun.awt.X11.XWM"); + } else if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) { + clazz = Class.forName("sun.awt.motif.MToolkit"); + } + } catch (ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + } + if (clazz == null) { + return -1; + } + + try { + final Class _clazz = clazz; + Method m_getWMID = (Method)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + Method method = _clazz.getDeclaredMethod("getWMID", new Class[] {}); + if (method != null) { + method.setAccessible(true); + } + return method; + } catch (NoSuchMethodException e) { + assert false; + } catch (SecurityException e) { + assert false; + } + return null; + } + }); + return ((Integer)m_getWMID.invoke(null, new Object[] {})).intValue(); + } catch (IllegalAccessException iae) { + iae.printStackTrace(); + } catch (InvocationTargetException ite) { + ite.printStackTrace(); + } + return -1; + } + + + //////////////////////////// + // Some stuff to test focus. + //////////////////////////// + + private static WindowGainedFocusListener wgfListener = new WindowGainedFocusListener(); + private static FocusGainedListener fgListener = new FocusGainedListener(); + private static ActionPerformedListener apListener = new ActionPerformedListener(); + + private abstract static class EventListener { + AtomicBoolean notifier = new AtomicBoolean(false); + Component comp; + boolean printEvent; + + public void listen(Component comp, boolean printEvent) { + this.comp = comp; + this.printEvent = printEvent; + notifier.set(false); + setListener(comp); + } + + public AtomicBoolean getNotifier() { + return notifier; + } + + abstract void setListener(Component comp); + + void printAndNotify(AWTEvent e) { + if (printEvent) { + System.err.println(e); + } + synchronized (notifier) { + notifier.set(true); + notifier.notifyAll(); + } + } + } + + private static class WindowGainedFocusListener extends EventListener implements WindowFocusListener { + + void setListener(Component comp) { + ((Window)comp).addWindowFocusListener(this); + } + + public void windowGainedFocus(WindowEvent e) { + + ((Window)comp).removeWindowFocusListener(this); + printAndNotify(e); + } + + public void windowLostFocus(WindowEvent e) {} + } + + private static class FocusGainedListener extends EventListener implements FocusListener { + + void setListener(Component comp) { + comp.addFocusListener(this); + } + + public void focusGained(FocusEvent e) { + comp.removeFocusListener(this); + printAndNotify(e); + } + + public void focusLost(FocusEvent e) {} + } + + private static class ActionPerformedListener extends EventListener implements ActionListener { + + void setListener(Component comp) { + ((Button)comp).addActionListener(this); + } + + public void actionPerformed(ActionEvent e) { + ((Button)comp).removeActionListener(this); + printAndNotify(e); + } + } + + private static boolean trackEvent(int eventID, Component comp, Runnable action, int time, boolean printEvent) { + EventListener listener = null; + + switch (eventID) { + case WindowEvent.WINDOW_GAINED_FOCUS: + listener = wgfListener; + break; + case FocusEvent.FOCUS_GAINED: + listener = fgListener; + break; + case ActionEvent.ACTION_PERFORMED: + listener = apListener; + break; + } + + listener.listen(comp, printEvent); + action.run(); + return Util.waitForCondition(listener.getNotifier(), time); + } + + /* + * Tracks WINDOW_GAINED_FOCUS event for a window caused by an action. + * @param window the window to track the event for + * @param action the action to perform + * @param time the max time to wait for the event + * @param printEvent should the event received be printed or doesn't + * @return true if the event has been received, otherwise false + */ + public static boolean trackWindowGainedFocus(Window window, Runnable action, int time, boolean printEvent) { + return trackEvent(WindowEvent.WINDOW_GAINED_FOCUS, window, action, time, printEvent); + } + + /* + * Tracks FOCUS_GAINED event for a component caused by an action. + * @see #trackWindowGainedFocus + */ + public static boolean trackFocusGained(Component comp, Runnable action, int time, boolean printEvent) { + return trackEvent(FocusEvent.FOCUS_GAINED, comp, action, time, printEvent); + } + + /* + * Tracks ACTION_PERFORMED event for a button caused by an action. + * @see #trackWindowGainedFocus + */ + public static boolean trackActionPerformed(Button button, Runnable action, int time, boolean printEvent) { + return trackEvent(ActionEvent.ACTION_PERFORMED, button, action, time, printEvent); + } + + /* + * Requests focus on the component provided and waits for the result. + * @return true if the component has been focused, false otherwise. + */ + public static boolean focusComponent(Component comp, int time) { + return focusComponent(comp, time, false); + } + public static boolean focusComponent(final Component comp, int time, boolean printEvent) { + return trackFocusGained(comp, + new Runnable() { + public void run() { + comp.requestFocus(); + } + }, + time, printEvent); + + } +} diff --git a/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java b/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java new file mode 100644 index 00000000000..22e1e7730cd --- /dev/null +++ b/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2014, 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. + */ + + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; + +/** + * AWT/Swing overlapping test for viewport + *

    This test verify if AWT components are drawn correctly being partially shown through viewport + *

    See CR6778882 for details + *

    See base class for test info. + */ +/* +@test +@bug 6778882 +@summary Viewport overlapping test for each AWT component +@author sergey.grinev@oracle.com: area=awt.mixing +@run main ViewportOverlapping + */ +public class ViewportOverlapping extends OverlappingTestBase { + + private volatile int frameClicked; + private Point hLoc; + private Point vLoc; + private Point testLoc; + private Point resizeLoc; + + private JFrame f; + private JPanel p; + private JButton b; + private JScrollPane scrollPane; + + protected void prepareControls() { + p = new JPanel(new GridLayout(0, 1)); + propagateAWTControls(p); + b = new JButton("Space extender"); + p.add(b); + p.setPreferredSize(new Dimension(500, 500)); + scrollPane = new JScrollPane(p); + + f = new JFrame(); + f.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + frameClicked++; + } + }); + f.getContentPane().add(scrollPane, BorderLayout.CENTER); + ((JComponent) f.getContentPane()).setBorder( + BorderFactory.createEmptyBorder(50, 50, 50, 50)); + f.setSize(400, 400); + f.setLocationRelativeTo(null); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setVisible(true); + } + + @Override + protected boolean performTest() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + // prepare test data + frameClicked = 0; + + b.requestFocus(); + + scrollPane.getHorizontalScrollBar().setUnitIncrement(40); + scrollPane.getVerticalScrollBar().setUnitIncrement(40); + + hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen(); + hLoc.translate(scrollPane.getHorizontalScrollBar().getWidth() - 3, 3); + vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen(); + vLoc.translate(3, scrollPane.getVerticalScrollBar().getHeight() - 3); + + testLoc = p.getLocationOnScreen(); + testLoc.translate(-3, -3); + + resizeLoc = f.getLocationOnScreen(); + resizeLoc.translate(f.getWidth() - 1, f.getHeight() - 1); + } + }); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + // run robot + Robot robot = Util.createRobot(); + robot.setAutoDelay(ROBOT_DELAY); + + robot.mouseMove(hLoc.x, hLoc.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + robot.mouseMove(vLoc.x, vLoc.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + clickAndBlink(robot, testLoc, false); + robot.mouseMove(resizeLoc.x, resizeLoc.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseMove(resizeLoc.x + 5, resizeLoc.y + 5); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + clickAndBlink(robot, testLoc, false); + return frameClicked == 2; + } + + // this strange plumbing stuff is required due to "Standard Test Machinery" in base class + public static void main(String args[]) throws InterruptedException { + instance = new ViewportOverlapping(); + OverlappingTestBase.doMain(args); + } +} From 05e0c63b32610ec88656441ea8d3ab4db895e42b Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 29 Apr 2014 15:44:14 -0400 Subject: [PATCH 031/185] 8042159: Allow using a system-installed lcms2 Reviewed-by: andrew, ihse, prr --- common/autoconf/generated-configure.sh | 121 ++++++++++++++++++++++++- common/autoconf/libraries.m4 | 36 ++++++++ common/autoconf/spec.gmk.in | 4 + 3 files changed, 160 insertions(+), 1 deletion(-) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index fdf1c6dc829..2588a2cbfda 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -656,6 +656,9 @@ USE_EXTERNAL_LIBZ USE_EXTERNAL_LIBPNG PNG_LIBS PNG_CFLAGS +USE_EXTERNAL_LCMS +LCMS_LIBS +LCMS_CFLAGS USE_EXTERNAL_LIBGIF USE_EXTERNAL_LIBJPEG ALSA_LIBS @@ -1079,6 +1082,7 @@ with_alsa with_alsa_include with_alsa_lib with_giflib +with_lcms with_libpng with_zlib with_stdc__lib @@ -1192,6 +1196,8 @@ FREETYPE_CFLAGS FREETYPE_LIBS ALSA_CFLAGS ALSA_LIBS +LCMS_CFLAGS +LCMS_LIBS PNG_CFLAGS PNG_LIBS LIBFFI_CFLAGS @@ -1934,6 +1940,8 @@ Optional Packages: --with-alsa-lib specify directory for the alsa library --with-giflib use giflib from build system or OpenJDK source (system, bundled) [bundled] + --with-lcms use lcms2 from build system or OpenJDK source + (system, bundled) [bundled] --with-libpng use libpng from build system or OpenJDK source (system, bundled) [bundled] --with-zlib use zlib from build system or OpenJDK source @@ -2060,6 +2068,8 @@ Some influential environment variables: linker flags for FREETYPE, overriding pkg-config ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config ALSA_LIBS linker flags for ALSA, overriding pkg-config + LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config + LCMS_LIBS linker flags for LCMS, overriding pkg-config PNG_CFLAGS C compiler flags for PNG, overriding pkg-config PNG_LIBS linker flags for PNG, overriding pkg-config LIBFFI_CFLAGS @@ -4243,7 +4253,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++" #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1396624161 +DATE_WHEN_GENERATED=1398799568 ############################################################################### # @@ -47297,6 +47307,115 @@ fi fi + ############################################################################### + # + # Check for the lcms2 library + # + + +# Check whether --with-lcms was given. +if test "${with_lcms+set}" = set; then : + withval=$with_lcms; +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which lcms to use" >&5 +$as_echo_n "checking for which lcms to use... " >&6; } + + DEFAULT_LCMS=bundled + + # + # If user didn't specify, use DEFAULT_LCMS + # + if test "x${with_lcms}" = "x"; then + with_lcms=${DEFAULT_LCMS} + fi + + if test "x${with_lcms}" = "xbundled"; then + USE_EXTERNAL_LCMS=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5 +$as_echo "bundled" >&6; } + elif test "x${with_lcms}" = "xsystem"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5 +$as_echo "system" >&6; } + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5 +$as_echo_n "checking for LCMS... " >&6; } + +if test -n "$LCMS_CFLAGS"; then + pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LCMS_LIBS"; then + pkg_cv_LCMS_LIBS="$LCMS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "lcms2" 2>&1` + else + LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors "lcms2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LCMS_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LCMS_FOUND=no +elif test $pkg_failed = untried; then + LCMS_FOUND=no +else + LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS + LCMS_LIBS=$pkg_cv_LCMS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + LCMS_FOUND=yes +fi + if test "x${LCMS_FOUND}" = "xyes"; then + USE_EXTERNAL_LCMS=true + else + as_fn_error $? "--with-lcms=system specified, but no lcms found!" "$LINENO" 5 + fi + else + as_fn_error $? "Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'" "$LINENO" 5 + fi + + + ############################################################################### # # Check for the png library diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4 index 1546529ce80..274c13a0582 100644 --- a/common/autoconf/libraries.m4 +++ b/common/autoconf/libraries.m4 @@ -663,6 +663,42 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], fi AC_SUBST(USE_EXTERNAL_LIBGIF) + ############################################################################### + # + # Check for the lcms2 library + # + + AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms], + [use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])]) + + AC_MSG_CHECKING([for which lcms to use]) + + DEFAULT_LCMS=bundled + + # + # If user didn't specify, use DEFAULT_LCMS + # + if test "x${with_lcms}" = "x"; then + with_lcms=${DEFAULT_LCMS} + fi + + if test "x${with_lcms}" = "xbundled"; then + USE_EXTERNAL_LCMS=false + AC_MSG_RESULT([bundled]) + elif test "x${with_lcms}" = "xsystem"; then + AC_MSG_RESULT([system]) + PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no]) + if test "x${LCMS_FOUND}" = "xyes"; then + USE_EXTERNAL_LCMS=true + else + AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!]) + fi + else + AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled']) + fi + + AC_SUBST(USE_EXTERNAL_LCMS) + ############################################################################### # # Check for the png library diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index c793d0e5c63..8b03cd980c6 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -651,6 +651,10 @@ INSTALL_SYSCONFDIR=@sysconfdir@ # Libraries # +USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@ +LCMS_CFLAGS:=@LCMS_CFLAGS@ +LCMS_LIBS:=@LCMS_LIBS@ + USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@ PNG_LIBS:=@PNG_LIBS@ PNG_CFLAGS:=@PNG_CFLAGS@ From 536ad9409e3bd922738d629c9608400aec5da041 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 29 Apr 2014 15:46:16 -0400 Subject: [PATCH 032/185] 8042159: Allow using a system-installed lcms2 Reviewed-by: andrew, ihse, prr --- jdk/make/lib/Awt2dLibraries.gmk | 29 +++++++++++++++---- .../share/native/sun/java2d/cmm/lcms/LCMS.c | 2 +- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index de86e3f86a4..6d1cf628c65 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -657,17 +657,34 @@ endif ########################################################################################## +LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms + +ifeq ($(USE_EXTERNAL_LCMS), true) + # If we're using an external library, we'll just need the wrapper part. + # By including it explicitely, all other files will be excluded. + BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c + BUILD_LIBLCMS_HEADERS := +else + BUILD_LIBLCMS_INCLUDE_FILES := + # If we're using the bundled library, we'll need to include it in the + # include path explicitly. Otherwise the system headers will be used. + BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR) +endif + # TODO: Update awt lib path when awt is converted $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \ LIBRARY := lcms, \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \ + SRC := $(LIBLCMS_DIR), \ + INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \ LANG := C, \ OPTIMIZATION := HIGHEST, \ CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \ $(SHARED_LIBRARY_FLAGS) \ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \ - -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \ + -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \ + $(BUILD_LIBLCMS_HEADERS) \ + $(LCMS_CFLAGS), \ CFLAGS_solaris := -xc99=no_lib, \ CFLAGS_windows := -DCMS_IS_WINDOWS_, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \ @@ -675,10 +692,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \ LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \ - LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \ - LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \ - LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \ - LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\ + LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \ + LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \ + LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \ + LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ RC_FLAGS := $(RC_FLAGS) \ -D "JDK_FNAME=lcms.dll" \ diff --git a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c index 8e687de0cdf..0939b00a761 100644 --- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c +++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c @@ -30,7 +30,7 @@ #include "jni_util.h" #include "Trace.h" #include "Disposer.h" -#include "lcms2.h" +#include #include "jlong.h" From bb2698cfa6f2bdc92c197f17a7d2f90003db05fa Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 30 Apr 2014 12:41:38 +0400 Subject: [PATCH 033/185] 8042087: [macosx] LWCToolkit.inokeAndWait is calling EventQueue.invokeLater Reviewed-by: anthony, serb --- .../classes/sun/lwawt/macosx/LWCToolkit.java | 69 ++++++++----------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 4a153fc94d4..d0b6882b9a3 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -611,19 +611,20 @@ public final class LWCToolkit extends LWToolkit { } /** - * Kicks an event over to the appropriate eventqueue and waits for it to + * Kicks an event over to the appropriate event queue and waits for it to * finish To avoid deadlocking, we manually run the NSRunLoop while waiting * Any selector invoked using ThreadUtilities performOnMainThread will be * processed in doAWTRunLoop The InvocationEvent will call * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual - * runloop Does not dispatch native events while in the loop + * run loop. Does not dispatch native events while in the loop */ public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException { - final long mediator = createAWTRunLoopMediator(); + Objects.requireNonNull(component, "Null component provided to invokeAndWait"); + long mediator = createAWTRunLoopMediator(); InvocationEvent invocationEvent = - new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), + new InvocationEvent(component, runnable, () -> { if (mediator != 0) { @@ -632,49 +633,42 @@ public final class LWCToolkit extends LWToolkit { }, true); - if (component != null) { - AppContext appContext = SunToolkit.targetToAppContext(component); - SunToolkit.postEvent(appContext, invocationEvent); - - // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock - SunToolkit.flushPendingEvents(appContext); - } else { - // This should be the equivalent to EventQueue.invokeAndWait - ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent); - } - + AppContext appContext = SunToolkit.targetToAppContext(component); + SunToolkit.postEvent(appContext, invocationEvent); + // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock + SunToolkit.flushPendingEvents(appContext); doAWTRunLoop(mediator, false); - Throwable eventException = invocationEvent.getException(); - if (eventException != null) { - if (eventException instanceof UndeclaredThrowableException) { - eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable(); - } - throw new InvocationTargetException(eventException); - } + checkException(invocationEvent); } public static void invokeLater(Runnable event, Component component) throws InvocationTargetException { - final InvocationEvent invocationEvent = - new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event); + Objects.requireNonNull(component, "Null component provided to invokeLater"); - if (component != null) { - final AppContext appContext = SunToolkit.targetToAppContext(component); - SunToolkit.postEvent(appContext, invocationEvent); + InvocationEvent invocationEvent = new InvocationEvent(component, event); - // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock - SunToolkit.flushPendingEvents(appContext); - } else { - // This should be the equivalent to EventQueue.invokeAndWait - ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent); - } + AppContext appContext = SunToolkit.targetToAppContext(component); + SunToolkit.postEvent(SunToolkit.targetToAppContext(component), invocationEvent); + // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock + SunToolkit.flushPendingEvents(appContext); - final Throwable eventException = invocationEvent.getException(); + checkException(invocationEvent); + } + + /** + * Checks if exception occurred while {@code InvocationEvent} was processed and rethrows it as + * an {@code InvocationTargetException} + * + * @param event the event to check for an exception + * @throws InvocationTargetException if exception occurred when event was processed + */ + private static void checkException(InvocationEvent event) throws InvocationTargetException { + Throwable eventException = event.getException(); if (eventException == null) return; if (eventException instanceof UndeclaredThrowableException) { - throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable()); + eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable(); } throw new InvocationTargetException(eventException); } @@ -686,11 +680,6 @@ public final class LWCToolkit extends LWToolkit { */ native static void performOnMainThreadAfterDelay(Runnable r, long delay); - // This exists purely to get around permissions issues with getSystemEventQueueImpl - EventQueue getSystemEventQueueForInvokeAndWait() { - return getSystemEventQueueImpl(); - } - // DnD support @Override From b8cc933de8e73c5737be9cbc7d71a3cd386d671f Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Wed, 30 Apr 2014 11:29:29 +0200 Subject: [PATCH 034/185] 8042090: Fix invalid variable names sun/java2d/loops/ProcessPath.c Reviewed-by: prr --- .../native/sun/java2d/loops/ProcessPath.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c index 52d8dddb3d3..07eb3468926 100644 --- a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c +++ b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c @@ -189,34 +189,34 @@ #define PROCESS_POINT(hnd, fX, fY, checkBounds, pixelInfo) \ do { \ - jint _X = (fX)>> MDP_PREC; \ - jint _Y = (fY)>> MDP_PREC; \ + jint X_ = (fX)>> MDP_PREC; \ + jint Y_ = (fY)>> MDP_PREC; \ if (checkBounds && \ - (hnd->dhnd->yMin > _Y || \ - hnd->dhnd->yMax <= _Y || \ - hnd->dhnd->xMin > _X || \ - hnd->dhnd->xMax <= _X)) break; \ + (hnd->dhnd->yMin > Y_ || \ + hnd->dhnd->yMax <= Y_ || \ + hnd->dhnd->xMin > X_ || \ + hnd->dhnd->xMax <= X_)) break; \ /* \ - * (_X,_Y) should be inside boundaries \ + * (X_,Y_) should be inside boundaries \ * \ - * assert(hnd->dhnd->yMin <= _Y && \ - * hnd->dhnd->yMax > _Y && \ - * hnd->dhnd->xMin <= _X && \ - * hnd->dhnd->xMax > _X); \ + * assert(hnd->dhnd->yMin <= Y_ && \ + * hnd->dhnd->yMax > Y_ && \ + * hnd->dhnd->xMin <= X_ && \ + * hnd->dhnd->xMax > X_); \ * \ */ \ if (pixelInfo[0] == 0) { \ pixelInfo[0] = 1; \ - pixelInfo[1] = _X; \ - pixelInfo[2] = _Y; \ - pixelInfo[3] = _X; \ - pixelInfo[4] = _Y; \ - hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y); \ - } else if ((_X != pixelInfo[3] || _Y != pixelInfo[4]) && \ - (_X != pixelInfo[1] || _Y != pixelInfo[2])) { \ - hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y); \ - pixelInfo[3] = _X; \ - pixelInfo[4] = _Y; \ + pixelInfo[1] = X_; \ + pixelInfo[2] = Y_; \ + pixelInfo[3] = X_; \ + pixelInfo[4] = Y_; \ + hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_); \ + } else if ((X_ != pixelInfo[3] || Y_ != pixelInfo[4]) && \ + (X_ != pixelInfo[1] || Y_ != pixelInfo[2])) { \ + hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_); \ + pixelInfo[3] = X_; \ + pixelInfo[4] = Y_; \ } \ } while(0) From e787680bf15e351d63cd8a3453f6e618f4980abf Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 30 Apr 2014 19:28:05 +0400 Subject: [PATCH 035/185] 8041917: unexcepted behavior of LineBorder while using Boolean variable true Reviewed-by: alexsch, serb --- jdk/src/share/classes/javax/swing/border/LineBorder.java | 4 ++-- jdk/test/javax/swing/border/Test4252164.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/border/LineBorder.java b/jdk/src/share/classes/javax/swing/border/LineBorder.java index 1e083c1164f..f29a244d2e8 100644 --- a/jdk/src/share/classes/javax/swing/border/LineBorder.java +++ b/jdk/src/share/classes/javax/swing/border/LineBorder.java @@ -134,8 +134,8 @@ public class LineBorder extends AbstractBorder int offs = this.thickness; int size = offs + offs; if (this.roundedCorners) { - int arc = offs + size; - outer = new RoundRectangle2D.Float(x, y, width, height, arc, arc); + float arc = .2f * offs; + outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs); inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc); } else { diff --git a/jdk/test/javax/swing/border/Test4252164.java b/jdk/test/javax/swing/border/Test4252164.java index 007e732cf2a..923df715054 100644 --- a/jdk/test/javax/swing/border/Test4252164.java +++ b/jdk/test/javax/swing/border/Test4252164.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4252164 + * @bug 4252164 8041917 * @summary Tests rounded LineBorder for components * @author Sergey Malenkov * @run applet/manual=yesno Test4252164.html From 6289e6c7e82943fdf88071f41422e79b0353416e Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Mon, 5 May 2014 19:42:11 +0400 Subject: [PATCH 036/185] 8042212: [macosx] Toolkit.getScreenResolution() can return incorrect resolution Reviewed-by: anthony, pchelko --- jdk/src/macosx/native/sun/awt/CGraphicsDevice.m | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m index e20792a231d..a1813b6154d 100644 --- a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m +++ b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -156,14 +156,12 @@ JNIEXPORT jdouble JNICALL Java_sun_awt_CGraphicsDevice_nativeGetXResolution (JNIEnv *env, jclass class, jint displayID) { - // TODO: this is the physically correct answer, but we probably want - // to use NSScreen API instead... + // CGDisplayScreenSize can return 0 if displayID is invalid CGSize size = CGDisplayScreenSize(displayID); CGRect rect = CGDisplayBounds(displayID); // 1 inch == 25.4 mm jfloat inches = size.width / 25.4f; - jfloat dpi = rect.size.width / inches; - return dpi; + return inches > 0 ? rect.size.width / inches : 72; } /* @@ -175,14 +173,12 @@ JNIEXPORT jdouble JNICALL Java_sun_awt_CGraphicsDevice_nativeGetYResolution (JNIEnv *env, jclass class, jint displayID) { - // TODO: this is the physically correct answer, but we probably want - // to use NSScreen API instead... + // CGDisplayScreenSize can return 0 if displayID is invalid CGSize size = CGDisplayScreenSize(displayID); CGRect rect = CGDisplayBounds(displayID); // 1 inch == 25.4 mm jfloat inches = size.height / 25.4f; - jfloat dpi = rect.size.height / inches; - return dpi; + return inches > 0 ? rect.size.height / inches : 72; } /* From ac82d17097982c45994c6ac3bf6c631669844bf6 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 5 May 2014 09:41:41 -0700 Subject: [PATCH 037/185] 8038838: Totally remove all vestiges of com.sun.image.codec.jpeg from JDK 9 Reviewed-by: bae, vadim --- jdk/make/mapfiles/libjpeg/mapfile-vers-closed | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jdk/make/mapfiles/libjpeg/mapfile-vers-closed b/jdk/make/mapfiles/libjpeg/mapfile-vers-closed index 9b3724c4994..6f84d2da352 100644 --- a/jdk/make/mapfiles/libjpeg/mapfile-vers-closed +++ b/jdk/make/mapfiles/libjpeg/mapfile-vers-closed @@ -31,10 +31,6 @@ SUNWprivate_1.1 { Java_sun_awt_image_JPEGImageDecoder_initIDs; Java_sun_awt_image_JPEGImageDecoder_readImage; - Java_sun_awt_image_codec_JPEGImageDecoderImpl_initDecoder; - Java_sun_awt_image_codec_JPEGImageDecoderImpl_readJPEGStream; - Java_sun_awt_image_codec_JPEGImageEncoderImpl_initEncoder; - Java_sun_awt_image_codec_JPEGImageEncoderImpl_writeJPEGStream; Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs; Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader; From 1a24f81c1bd5da50fe5b96aa7b052da4387664dd Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 5 May 2014 23:19:00 -0700 Subject: [PATCH 038/185] 8042256: Fix raw and unchecked lint warnings in com.sun.media.sound Reviewed-by: prr --- .../com/sun/media/sound/AbstractLine.java | 2 +- .../sun/media/sound/AbstractMidiDevice.java | 8 ++++--- .../com/sun/media/sound/AbstractMixer.java | 22 ++++++++++--------- .../com/sun/media/sound/AlawCodec.java | 4 ++-- .../sound/AudioSynthesizerPropertyInfo.java | 2 +- .../sun/media/sound/DirectAudioDevice.java | 10 ++++----- .../com/sun/media/sound/EventDispatcher.java | 8 +++---- .../com/sun/media/sound/JDK13Services.java | 6 ++--- .../sun/media/sound/MidiInDeviceProvider.java | 4 ++-- .../media/sound/MidiOutDeviceProvider.java | 4 ++-- .../com/sun/media/sound/MidiUtils.java | 6 ++--- .../com/sun/media/sound/PCMtoPCMCodec.java | 8 +++---- .../com/sun/media/sound/PortMixer.java | 5 +++-- .../sun/media/sound/RealTimeSequencer.java | 22 +++++++++---------- .../com/sun/media/sound/SoftSynthesizer.java | 2 +- .../com/sun/media/sound/UlawCodec.java | 4 ++-- 16 files changed, 61 insertions(+), 56 deletions(-) diff --git a/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java b/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java index e6a7ba2d9cb..1d0393d35eb 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java +++ b/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java @@ -48,7 +48,7 @@ abstract class AbstractLine implements Line { protected Control[] controls; AbstractMixer mixer; private boolean open = false; - private final Vector listeners = new Vector(); + private final Vector listeners = new Vector<>(); /** * Contains event dispatcher per thread group. diff --git a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java index 4323970cafa..93c3926aaed 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java +++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java @@ -70,7 +70,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice /** List of Receivers and Transmitters that opened the device implicitely. */ - private List openKeepingObjects; + private List openKeepingObjects; /** * This is the device handle returned from native code @@ -284,6 +284,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice } + @SuppressWarnings("unchecked") // Cast of result of clone public final List getReceivers() { List recs; synchronized (traRecLock) { @@ -313,6 +314,7 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice } + @SuppressWarnings("unchecked") // Cast of result of clone public final List getTransmitters() { List tras; synchronized (traRecLock) { @@ -372,9 +374,9 @@ abstract class AbstractMidiDevice implements MidiDevice, ReferenceCountingDevice /** Return the list of objects that have opened the device implicitely. */ - private synchronized List getOpenKeepingObjects() { + private synchronized List getOpenKeepingObjects() { if (openKeepingObjects == null) { - openKeepingObjects = new ArrayList(); + openKeepingObjects = new ArrayList<>(); } return openKeepingObjects; } diff --git a/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java b/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java index 1055fc6859e..83378615b77 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java +++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java @@ -90,13 +90,13 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { /** * Source lines (ports) currently open */ - private final Vector sourceLines = new Vector(); + private final Vector sourceLines = new Vector<>(); /** * Target lines currently open. */ - private final Vector targetLines = new Vector(); + private final Vector targetLines = new Vector<>(); /** @@ -151,7 +151,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { public final Line.Info[] getSourceLineInfo(Line.Info info) { int i; - Vector vec = new Vector(); + Vector vec = new Vector<>(); for (i = 0; i < sourceLineInfo.length; i++) { @@ -162,7 +162,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { Line.Info[] returnedArray = new Line.Info[vec.size()]; for (i = 0; i < returnedArray.length; i++) { - returnedArray[i] = (Line.Info)vec.elementAt(i); + returnedArray[i] = vec.elementAt(i); } return returnedArray; @@ -172,7 +172,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { public final Line.Info[] getTargetLineInfo(Line.Info info) { int i; - Vector vec = new Vector(); + Vector vec = new Vector<>(); for (i = 0; i < targetLineInfo.length; i++) { @@ -183,7 +183,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { Line.Info[] returnedArray = new Line.Info[vec.size()]; for (i = 0; i < returnedArray.length; i++) { - returnedArray[i] = (Line.Info)vec.elementAt(i); + returnedArray[i] = vec.elementAt(i); } return returnedArray; @@ -231,7 +231,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { localLines = new Line[sourceLines.size()]; for (int i = 0; i < localLines.length; i++) { - localLines[i] = (Line)sourceLines.elementAt(i); + localLines[i] = sourceLines.elementAt(i); } } @@ -248,7 +248,7 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { localLines = new Line[targetLines.size()]; for (int i = 0; i < localLines.length; i++) { - localLines[i] = (Line)targetLines.elementAt(i); + localLines[i] = targetLines.elementAt(i); } } @@ -453,7 +453,8 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { return; } - Vector localSourceLines = (Vector)sourceLines.clone(); + @SuppressWarnings("unchecked") + Vector localSourceLines = (Vector)sourceLines.clone(); for (int i = 0; i < localSourceLines.size(); i++) { // if any other open line is running, return @@ -468,7 +469,8 @@ abstract class AbstractMixer extends AbstractLine implements Mixer { } } - Vector localTargetLines = (Vector)targetLines.clone(); + @SuppressWarnings("unchecked") + Vector localTargetLines = (Vector)targetLines.clone(); for (int i = 0; i < localTargetLines.size(); i++) { // if any other open line is running, return diff --git a/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java b/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java index 367f318b06a..fbe63f6ff16 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java +++ b/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java @@ -213,7 +213,7 @@ public final class AlawCodec extends SunCodec { private AudioFormat[] getOutputFormats(AudioFormat inputFormat) { - Vector formats = new Vector(); + Vector formats = new Vector<>(); AudioFormat format; if ( AudioFormat.Encoding.PCM_SIGNED.equals(inputFormat.getEncoding())) { @@ -248,7 +248,7 @@ public final class AlawCodec extends SunCodec { AudioFormat[] formatArray = new AudioFormat[formats.size()]; for (int i = 0; i < formatArray.length; i++) { - formatArray[i] = (AudioFormat)(formats.elementAt(i)); + formatArray[i] = formats.elementAt(i); } return formatArray; } diff --git a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java index d4305523526..16bfaa20790 100644 --- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java +++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java @@ -68,7 +68,7 @@ public final class AudioSynthesizerPropertyInfo { * The valueClass field specifies class * used in value field. */ - public Class valueClass = null; + public Class valueClass = null; /** * An array of possible values if the value for the field * AudioSynthesizerPropertyInfo.value may be selected diff --git a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java index 7c938bbb1c4..becf4981ba7 100644 --- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java +++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java @@ -94,7 +94,7 @@ final class DirectAudioDevice extends AbstractMixer { } private DirectDLI createDataLineInfo(boolean isSource) { - Vector formats = new Vector(); + Vector formats = new Vector<>(); AudioFormat[] hardwareFormatArray = null; AudioFormat[] formatArray = null; @@ -107,7 +107,7 @@ final class DirectAudioDevice extends AbstractMixer { int formatArraySize = size; hardwareFormatArray = new AudioFormat[size]; for (int i = 0; i < size; i++) { - AudioFormat format = (AudioFormat)formats.elementAt(i); + AudioFormat format = formats.elementAt(i); hardwareFormatArray[i] = format; int bits = format.getSampleSizeInBits(); boolean isSigned = format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED); @@ -265,7 +265,7 @@ final class DirectAudioDevice extends AbstractMixer { return ((DirectAudioDeviceProvider.DirectAudioDeviceInfo) getMixerInfo()).getMaxSimulLines(); } - private static void addFormat(Vector v, int bits, int frameSizeInBytes, int channels, float sampleRate, + private static void addFormat(Vector v, int bits, int frameSizeInBytes, int channels, float sampleRate, int encoding, boolean signed, boolean bigEndian) { AudioFormat.Encoding enc = null; switch (encoding) { @@ -338,7 +338,7 @@ final class DirectAudioDevice extends AbstractMixer { private static final class DirectDLI extends DataLine.Info { final AudioFormat[] hardwareFormats; - private DirectDLI(Class clazz, AudioFormat[] formatArray, + private DirectDLI(Class clazz, AudioFormat[] formatArray, AudioFormat[] hardwareFormatArray, int minBuffer, int maxBuffer) { super(clazz, formatArray, minBuffer, maxBuffer); @@ -1457,7 +1457,7 @@ final class DirectAudioDevice extends AbstractMixer { } // class DirectBAOS - + @SuppressWarnings("rawtypes") private static native void nGetFormats(int mixerIndex, int deviceID, boolean isSource, Vector formats); diff --git a/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java b/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java index 54b948af168..49709891bd0 100644 --- a/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java +++ b/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java @@ -57,7 +57,7 @@ final class EventDispatcher implements Runnable { /** * List of events */ - private final ArrayList eventQueue = new ArrayList(); + private final ArrayList eventQueue = new ArrayList<>(); /** @@ -186,7 +186,7 @@ final class EventDispatcher implements Runnable { } if (eventQueue.size() > 0) { // Remove the event from the queue and dispatch it to the listeners. - eventInfo = (EventInfo) eventQueue.remove(0); + eventInfo = eventQueue.remove(0); } } // end of synchronized @@ -230,7 +230,7 @@ final class EventDispatcher implements Runnable { /** * Send audio and MIDI events. */ - void sendAudioEvents(Object event, List listeners) { + void sendAudioEvents(Object event, List listeners) { if ((listeners == null) || (listeners.size() == 0)) { // nothing to do @@ -392,7 +392,7 @@ final class EventDispatcher implements Runnable { * @param event the event to be dispatched * @param listeners listener list; will be copied */ - EventInfo(Object event, List listeners) { + EventInfo(Object event, List listeners) { this.event = event; this.listeners = listeners.toArray(); } diff --git a/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java b/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java index 9f19a8734e3..9c93d06dc23 100644 --- a/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java +++ b/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java @@ -118,7 +118,7 @@ public final class JDK13Services { (the part before the hash sign), if available. If the property is not set or the value has no provider class name part, null is returned. */ - public static synchronized String getDefaultProviderClassName(Class typeClass) { + public static synchronized String getDefaultProviderClassName(Class typeClass) { String value = null; String defaultProviderSpec = getDefaultProvider(typeClass); if (defaultProviderSpec != null) { @@ -144,7 +144,7 @@ public final class JDK13Services { part after the hash sign), if available. If the property is not set or the value has no instance name part, null is returned. */ - public static synchronized String getDefaultInstanceName(Class typeClass) { + public static synchronized String getDefaultInstanceName(Class typeClass) { String value = null; String defaultProviderSpec = getDefaultProvider(typeClass); if (defaultProviderSpec != null) { @@ -165,7 +165,7 @@ public final class JDK13Services { @return The complete value of the property, if available. If the property is not set, null is returned. */ - private static synchronized String getDefaultProvider(Class typeClass) { + private static synchronized String getDefaultProvider(Class typeClass) { if (!SourceDataLine.class.equals(typeClass) && !TargetDataLine.class.equals(typeClass) && !Clip.class.equals(typeClass) diff --git a/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java b/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java index 1f397724e3f..5044dfeaa17 100644 --- a/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java +++ b/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java @@ -106,9 +106,9 @@ public final class MidiInDeviceProvider extends AbstractMidiDeviceProvider { * the new instance will not reflect that state... */ static final class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info { - private final Class providerClass; + private final Class providerClass; - private MidiInDeviceInfo(int index, Class providerClass) { + private MidiInDeviceInfo(int index, Class providerClass) { super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index); this.providerClass = providerClass; } diff --git a/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java b/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java index 75583ab1e65..eaacf0991be 100644 --- a/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java +++ b/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java @@ -104,9 +104,9 @@ public final class MidiOutDeviceProvider extends AbstractMidiDeviceProvider { * the new instance will not reflect that state... */ static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info { - private final Class providerClass; + private final Class providerClass; - private MidiOutDeviceInfo(int index, Class providerClass) { + private MidiOutDeviceInfo(int index, Class providerClass) { super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index); this.providerClass = providerClass; } diff --git a/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java b/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java index a3f62efd29e..eecd33fe0b5 100644 --- a/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java +++ b/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java @@ -295,7 +295,7 @@ public final class MidiUtils { public synchronized void refresh(Sequence seq) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); Track[] tracks = seq.getTracks(); if (tracks.length > 0) { // tempo events only occur in track 0 @@ -313,7 +313,7 @@ public final class MidiUtils { int size = list.size() + 1; firstTempoIsFake = true; if ((size > 1) - && (((MidiEvent) list.get(0)).getTick() == 0)) { + && (list.get(0).getTick() == 0)) { // do not need to add an initial tempo event at the beginning size--; firstTempoIsFake = false; @@ -328,7 +328,7 @@ public final class MidiUtils { e++; } for (int i = 0; i < list.size(); i++, e++) { - MidiEvent evt = (MidiEvent) list.get(i); + MidiEvent evt = list.get(i); ticks[e] = evt.getTick(); tempos[e] = getTempoMPQ(evt.getMessage()); } diff --git a/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java b/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java index 9a4f1a874b3..dbed920e6fa 100644 --- a/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java +++ b/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java @@ -91,7 +91,7 @@ public final class PCMtoPCMCodec extends SunCodec { // filter out targetEncoding from the old getOutputFormats( sourceFormat ) method AudioFormat[] formats = getOutputFormats( sourceFormat ); - Vector newFormats = new Vector(); + Vector newFormats = new Vector<>(); for(int i=0; i formats = new Vector<>(); AudioFormat format; int sampleSize = inputFormat.getSampleSizeInBits(); @@ -335,7 +335,7 @@ public final class PCMtoPCMCodec extends SunCodec { for (int i = 0; i < formatArray.length; i++) { - formatArray[i] = (AudioFormat)(formats.elementAt(i)); + formatArray[i] = formats.elementAt(i); } } diff --git a/jdk/src/share/classes/com/sun/media/sound/PortMixer.java b/jdk/src/share/classes/com/sun/media/sound/PortMixer.java index 705648004ff..ee0fbd064ae 100644 --- a/jdk/src/share/classes/com/sun/media/sound/PortMixer.java +++ b/jdk/src/share/classes/com/sun/media/sound/PortMixer.java @@ -253,12 +253,12 @@ final class PortMixer extends AbstractMixer { long newID = ((PortMixer) mixer).getID(); if ((id == 0) || (newID != id) || (controls.length == 0)) { id = newID; - Vector vector = new Vector(); + Vector vector = new Vector<>(); synchronized (vector) { nGetControls(id, portIndex, vector); controls = new Control[vector.size()]; for (int i = 0; i < controls.length; i++) { - controls[i] = (Control) vector.elementAt(i); + controls[i] = vector.elementAt(i); } } } else { @@ -494,6 +494,7 @@ final class PortMixer extends AbstractMixer { private static native String nGetPortName(long id, int portIndex); // fills the vector with the controls for this port + @SuppressWarnings("rawtypes") private static native void nGetControls(long id, int portIndex, Vector vector); // getters/setters for controls diff --git a/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java b/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java index 6ea2ec4b3c6..7252723e776 100644 --- a/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java +++ b/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java @@ -122,7 +122,7 @@ final class RealTimeSequencer extends AbstractMidiDevice /** * List of tracks to which we're recording */ - private final List recordingTracks = new ArrayList(); + private final List recordingTracks = new ArrayList<>(); private long loopStart = 0; @@ -133,13 +133,13 @@ final class RealTimeSequencer extends AbstractMidiDevice /** * Meta event listeners */ - private final ArrayList metaEventListeners = new ArrayList(); + private final ArrayList metaEventListeners = new ArrayList<>(); /** * Control change listeners */ - private final ArrayList controllerEventListeners = new ArrayList(); + private final ArrayList controllerEventListeners = new ArrayList<>(); /** automatic connection support */ @@ -645,7 +645,7 @@ final class RealTimeSequencer extends AbstractMidiDevice boolean flag = false; for(int i=0; i < controllerEventListeners.size(); i++) { - cve = (ControllerListElement) controllerEventListeners.get(i); + cve = controllerEventListeners.get(i); if (cve.listener.equals(listener)) { cve.addControllers(controllers); @@ -669,7 +669,7 @@ final class RealTimeSequencer extends AbstractMidiDevice ControllerListElement cve = null; boolean flag = false; for (int i=0; i < controllerEventListeners.size(); i++) { - cve = (ControllerListElement) controllerEventListeners.get(i); + cve = controllerEventListeners.get(i); if (cve.listener.equals(listener)) { cve.removeControllers(controllers); flag = true; @@ -940,9 +940,9 @@ final class RealTimeSequencer extends AbstractMidiDevice } ShortMessage msg = (ShortMessage) message; int controller = msg.getData1(); - List sendToListeners = new ArrayList(); + List sendToListeners = new ArrayList<>(); for (int i = 0; i < size; i++) { - ControllerListElement cve = (ControllerListElement) controllerEventListeners.get(i); + ControllerListElement cve = controllerEventListeners.get(i); for(int j = 0; j < cve.controllers.length; j++) { if (cve.controllers[j] == controller) { sendToListeners.add(cve.listener); @@ -1213,13 +1213,13 @@ final class RealTimeSequencer extends AbstractMidiDevice this.channel = channel; } - static RecordingTrack get(List recordingTracks, Track track) { + static RecordingTrack get(List recordingTracks, Track track) { synchronized(recordingTracks) { int size = recordingTracks.size(); for (int i = 0; i < size; i++) { - RecordingTrack current = (RecordingTrack)recordingTracks.get(i); + RecordingTrack current = recordingTracks.get(i); if (current.track == track) { return current; } @@ -1228,12 +1228,12 @@ final class RealTimeSequencer extends AbstractMidiDevice return null; } - static Track get(List recordingTracks, int channel) { + static Track get(List recordingTracks, int channel) { synchronized(recordingTracks) { int size = recordingTracks.size(); for (int i = 0; i < size; i++) { - RecordingTrack current = (RecordingTrack)recordingTracks.get(i); + RecordingTrack current = recordingTracks.get(i); if ((current.channel == channel) || (current.channel == -1)) { return current.track; } diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java b/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java index 01a64c2dddf..2c6dff99fea 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java @@ -949,7 +949,7 @@ public final class SoftSynthesizer implements AudioSynthesizer, Object v = (info == null) ? null : info.get(item2.name); v = (v != null) ? v : storedProperties.getProperty(item2.name); if (v != null) { - Class c = (item2.valueClass); + Class c = (item2.valueClass); if (c.isInstance(v)) item2.value = v; else if (v instanceof String) { diff --git a/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java b/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java index 7dda283a0da..337fe199788 100644 --- a/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java +++ b/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java @@ -198,7 +198,7 @@ public final class UlawCodec extends SunCodec { /* public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */ private AudioFormat[] getOutputFormats(AudioFormat inputFormat) { - Vector formats = new Vector(); + Vector formats = new Vector<>(); AudioFormat format; if ((inputFormat.getSampleSizeInBits() == 16) @@ -235,7 +235,7 @@ public final class UlawCodec extends SunCodec { AudioFormat[] formatArray = new AudioFormat[formats.size()]; for (int i = 0; i < formatArray.length; i++) { - formatArray[i] = (AudioFormat)(formats.elementAt(i)); + formatArray[i] = formats.elementAt(i); } return formatArray; } From 860e8d8ac711723a2c48893a3719144466532ec9 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Mon, 5 May 2014 23:38:30 -0700 Subject: [PATCH 039/185] 8039109: Fix unchecked and raw lint warnings in java.awt Reviewed-by: pchelko, forax, flar, prr --- .../share/classes/java/awt/AWTKeyStroke.java | 15 ++++--- .../share/classes/java/awt/CardLayout.java | 1 + jdk/src/share/classes/java/awt/Component.java | 2 +- .../classes/java/awt/GraphicsEnvironment.java | 10 ++--- .../java/awt/KeyboardFocusManager.java | 14 ++++--- .../share/classes/java/awt/SystemTray.java | 6 ++- .../datatransfer/MimeTypeParameterList.java | 4 +- .../java/awt/dnd/DragGestureEvent.java | 3 +- jdk/src/share/classes/java/awt/geom/Area.java | 42 +++++++++---------- .../classes/java/awt/image/BufferedImage.java | 6 +-- .../java/awt/image/CropImageFilter.java | 3 +- .../java/awt/image/FilteredImageSource.java | 14 +++---- .../classes/java/awt/image/ImageFilter.java | 3 +- .../java/awt/image/MemoryImageSource.java | 22 +++++----- .../java/awt/image/ReplicateScaleFilter.java | 3 +- .../awt/image/renderable/ParameterBlock.java | 13 +++--- .../image/renderable/RenderableImageOp.java | 14 +++---- .../renderable/RenderableImageProducer.java | 12 +++--- .../share/classes/java/awt/print/Book.java | 8 ++-- .../classes/java/awt/print/PrinterJob.java | 8 ++-- 20 files changed, 109 insertions(+), 94 deletions(-) diff --git a/jdk/src/share/classes/java/awt/AWTKeyStroke.java b/jdk/src/share/classes/java/awt/AWTKeyStroke.java index c4e07b45530..4be729b8c89 100644 --- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java +++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java @@ -86,7 +86,8 @@ public class AWTKeyStroke implements Serializable { * Must be called under locked AWTKeyStro */ private static Class getAWTKeyStrokeClass() { - Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + @SuppressWarnings("unchecked") + Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (clazz == null) { clazz = AWTKeyStroke.class; AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class); @@ -182,6 +183,7 @@ public class AWTKeyStroke implements Serializable { throw new IllegalArgumentException("subclass cannot be null"); } synchronized (AWTKeyStroke.class) { + @SuppressWarnings("unchecked") Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){ // Already registered @@ -192,7 +194,7 @@ public class AWTKeyStroke implements Serializable { throw new ClassCastException("subclass is not derived from AWTKeyStroke"); } - Constructor ctor = getCtor(subclass); + Constructor ctor = getCtor(subclass); String couldNotInstantiate = "subclass could not be instantiated"; @@ -227,12 +229,12 @@ public class AWTKeyStroke implements Serializable { threat as accessible flag is set only for this Constructor object, not for Class constructor. */ - private static Constructor getCtor(final Class clazz) + private static Constructor getCtor(final Class clazz) { - Constructor ctor = AccessController.doPrivileged(new PrivilegedAction() { - public Constructor run() { + Constructor ctor = AccessController.doPrivileged(new PrivilegedAction>() { + public Constructor run() { try { - Constructor ctor = clazz.getDeclaredConstructor((Class[]) null); + Constructor ctor = clazz.getDeclaredConstructor((Class[]) null); if (ctor != null) { ctor.setAccessible(true); } @@ -249,6 +251,7 @@ public class AWTKeyStroke implements Serializable { private static synchronized AWTKeyStroke getCachedStroke (char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { + @SuppressWarnings("unchecked") Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY); diff --git a/jdk/src/share/classes/java/awt/CardLayout.java b/jdk/src/share/classes/java/awt/CardLayout.java index 3ffb19fbee7..5e813fffbe9 100644 --- a/jdk/src/share/classes/java/awt/CardLayout.java +++ b/jdk/src/share/classes/java/awt/CardLayout.java @@ -560,6 +560,7 @@ public class CardLayout implements LayoutManager2, /** * Reads serializable fields from stream. */ + @SuppressWarnings("unchecked") private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java index a7573c09a3c..cd6ae69de1d 100644 --- a/jdk/src/share/classes/java/awt/Component.java +++ b/jdk/src/share/classes/java/awt/Component.java @@ -6184,7 +6184,7 @@ public abstract class Component implements ImageObserver, MenuContainer, /** * Parameter types of coalesceEvents(AWTEvent,AWTEVent). */ - private static final Class[] coalesceEventsParams = { + private static final Class[] coalesceEventsParams = { AWTEvent.class, AWTEvent.class }; diff --git a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java index 66ab39a45b1..e9e9080dba6 100644 --- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java +++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -95,18 +95,18 @@ public abstract class GraphicsEnvironment { String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); try { // long t0 = System.currentTimeMillis(); - Class geCls; + Class geCls; try { // First we try if the bootclassloader finds the requested // class. This way we can avoid to run in a privileged block. - geCls = (Class)Class.forName(nm); + geCls = Class.forName(nm); } catch (ClassNotFoundException ex) { // If the bootclassloader fails, we try again with the // application classloader. ClassLoader cl = ClassLoader.getSystemClassLoader(); - geCls = (Class)Class.forName(nm, true, cl); + geCls = Class.forName(nm, true, cl); } - ge = geCls.newInstance(); + ge = (GraphicsEnvironment)geCls.newInstance(); // long t1 = System.currentTimeMillis(); // System.out.println("GE creation took " + (t1-t0)+ "ms."); if (isHeadless()) { diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index b02bb5b0dba..8758a2b50e3 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -348,6 +348,7 @@ public abstract class KeyboardFocusManager * Component of those Windows that has no such array of its own explicitly * set. */ + @SuppressWarnings({"unchecked", "rawtypes"}) private Set[] defaultFocusTraversalKeys = new Set[4]; /** @@ -422,7 +423,7 @@ public abstract class KeyboardFocusManager targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken())); } return (targetSet.isEmpty()) - ? Collections.EMPTY_SET + ? Collections.emptySet() : Collections.unmodifiableSet(targetSet); } @@ -436,7 +437,7 @@ public abstract class KeyboardFocusManager work_set.add(defaultFocusTraversalKeyStrokes[i][j]); } defaultFocusTraversalKeys[i] = (work_set.isEmpty()) - ? Collections.EMPTY_SET + ? Collections.emptySet() : Collections.unmodifiableSet(work_set); } initPeer(); @@ -1750,11 +1751,12 @@ public abstract class KeyboardFocusManager * @see #addKeyEventDispatcher * @see #removeKeyEventDispatcher */ + @SuppressWarnings("unchecked") // Cast of result of clone protected synchronized java.util.List getKeyEventDispatchers() { return (keyEventDispatchers != null) - ? (java.util.List)keyEventDispatchers.clone() + ? (java.util.List)keyEventDispatchers.clone() : null; } @@ -1841,11 +1843,12 @@ public abstract class KeyboardFocusManager * @see #addKeyEventPostProcessor * @see #removeKeyEventPostProcessor */ + @SuppressWarnings("unchecked") // Cast of result of clone protected java.util.List getKeyEventPostProcessors() { return (keyEventPostProcessors != null) - ? (java.util.List)keyEventPostProcessors.clone() + ? (java.util.List)keyEventPostProcessors.clone() : null; } @@ -1907,8 +1910,7 @@ public abstract class KeyboardFocusManager * javax.swing.JComponent.runInputVerifier() using reflection. */ static synchronized Component getMostRecentFocusOwner(Window window) { - WeakReference weakValue = - (WeakReference)mostRecentFocusOwners.get(window); + WeakReference weakValue = mostRecentFocusOwners.get(window); return weakValue == null ? null : weakValue.get(); } diff --git a/jdk/src/share/classes/java/awt/SystemTray.java b/jdk/src/share/classes/java/awt/SystemTray.java index 7f3a5c31893..e542dfc1712 100644 --- a/jdk/src/share/classes/java/awt/SystemTray.java +++ b/jdk/src/share/classes/java/awt/SystemTray.java @@ -259,7 +259,9 @@ public class SystemTray { Vector icons = null; synchronized (this) { oldArray = systemTray.getTrayIcons(); - icons = (Vector)AppContext.getAppContext().get(TrayIcon.class); + @SuppressWarnings("unchecked") + Vector tmp = (Vector)AppContext.getAppContext().get(TrayIcon.class); + icons = tmp; if (icons == null) { icons = new Vector(3); AppContext.getAppContext().put(TrayIcon.class, icons); @@ -304,6 +306,7 @@ public class SystemTray { TrayIcon[] oldArray = null, newArray = null; synchronized (this) { oldArray = systemTray.getTrayIcons(); + @SuppressWarnings("unchecked") Vector icons = (Vector)AppContext.getAppContext().get(TrayIcon.class); // TrayIcon with no peer is not contained in the array. if (icons == null || !icons.remove(trayIcon)) { @@ -335,6 +338,7 @@ public class SystemTray { * @see TrayIcon */ public TrayIcon[] getTrayIcons() { + @SuppressWarnings("unchecked") Vector icons = (Vector)AppContext.getAppContext().get(TrayIcon.class); if (icons != null) { return icons.toArray(new TrayIcon[icons.size()]); diff --git a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java index f4816b65d87..3a79886c2b4 100644 --- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java +++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java @@ -296,14 +296,14 @@ class MimeTypeParameterList implements Cloneable { /** * @return a clone of this object */ - + @SuppressWarnings("unchecked") // Cast from clone public Object clone() { MimeTypeParameterList newObj = null; try { newObj = (MimeTypeParameterList)super.clone(); } catch (CloneNotSupportedException cannotHappen) { } - newObj.parameters = (Hashtable)parameters.clone(); + newObj.parameters = (Hashtable)parameters.clone(); return newObj; } diff --git a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java index e8827f44358..3dff336a794 100644 --- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java +++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -357,6 +357,7 @@ public class DragGestureEvent extends EventObject { action = newAction; // Pre-1.4 support. 'events' was previously non-transient + @SuppressWarnings("rawtypes") List newEvents; try { newEvents = (List)f.get("events", null); diff --git a/jdk/src/share/classes/java/awt/geom/Area.java b/jdk/src/share/classes/java/awt/geom/Area.java index 507f212b4ea..ae5ab2f683b 100644 --- a/jdk/src/share/classes/java/awt/geom/Area.java +++ b/jdk/src/share/classes/java/awt/geom/Area.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -97,9 +97,9 @@ import sun.awt.geom.AreaOp; * @since 1.2 */ public class Area implements Shape, Cloneable { - private static Vector EmptyCurves = new Vector(); + private static Vector EmptyCurves = new Vector<>(); - private Vector curves; + private Vector curves; /** * Default constructor which creates an empty area. @@ -127,8 +127,8 @@ public class Area implements Shape, Cloneable { } } - private static Vector pathToCurves(PathIterator pi) { - Vector curves = new Vector(); + private static Vector pathToCurves(PathIterator pi) { + Vector curves = new Vector<>(); int windingRule = pi.getWindingRule(); // coords array is big enough for holding: // coordinates returned from currentSegment (6) @@ -334,7 +334,7 @@ public class Area implements Shape, Cloneable { * @since 1.2 */ public void reset() { - curves = new Vector(); + curves = new Vector<>(); invalidateBounds(); } @@ -357,9 +357,9 @@ public class Area implements Shape, Cloneable { * @since 1.2 */ public boolean isPolygonal() { - Enumeration enum_ = curves.elements(); + Enumeration enum_ = curves.elements(); while (enum_.hasMoreElements()) { - if (((Curve) enum_.nextElement()).getOrder() > 1) { + if (enum_.nextElement().getOrder() > 1) { return false; } } @@ -381,8 +381,8 @@ public class Area implements Shape, Cloneable { if (size > 3) { return false; } - Curve c1 = (Curve) curves.get(1); - Curve c2 = (Curve) curves.get(2); + Curve c1 = curves.get(1); + Curve c2 = curves.get(2); if (c1.getOrder() != 1 || c2.getOrder() != 1) { return false; } @@ -411,10 +411,10 @@ public class Area implements Shape, Cloneable { if (curves.size() < 3) { return true; } - Enumeration enum_ = curves.elements(); + Enumeration enum_ = curves.elements(); enum_.nextElement(); // First Order0 "moveto" while (enum_.hasMoreElements()) { - if (((Curve) enum_.nextElement()).getOrder() == 0) { + if (enum_.nextElement().getOrder() == 0) { return false; } } @@ -431,11 +431,11 @@ public class Area implements Shape, Cloneable { } Rectangle2D r = new Rectangle2D.Double(); if (curves.size() > 0) { - Curve c = (Curve) curves.get(0); + Curve c = curves.get(0); // First point is always an order 0 curve (moveto) r.setRect(c.getX0(), c.getY0(), 0, 0); for (int i = 1; i < curves.size(); i++) { - ((Curve) curves.get(i)).enlarge(r); + curves.get(i).enlarge(r); } } return (cachedBounds = r); @@ -507,7 +507,7 @@ public class Area implements Shape, Cloneable { if (other == null) { return false; } - Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves); + Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves); return c.isEmpty(); } @@ -555,10 +555,10 @@ public class Area implements Shape, Cloneable { if (!getCachedBounds().contains(x, y)) { return false; } - Enumeration enum_ = curves.elements(); + Enumeration enum_ = curves.elements(); int crossings = 0; while (enum_.hasMoreElements()) { - Curve c = (Curve) enum_.nextElement(); + Curve c = enum_.nextElement(); crossings += c.crossingsFor(x, y); } return ((crossings & 1) == 1); @@ -658,16 +658,16 @@ public class Area implements Shape, Cloneable { class AreaIterator implements PathIterator { private AffineTransform transform; - private Vector curves; + private Vector curves; private int index; private Curve prevcurve; private Curve thiscurve; - public AreaIterator(Vector curves, AffineTransform at) { + public AreaIterator(Vector curves, AffineTransform at) { this.curves = curves; this.transform = at; if (curves.size() >= 1) { - thiscurve = (Curve) curves.get(0); + thiscurve = curves.get(0); } } @@ -689,7 +689,7 @@ class AreaIterator implements PathIterator { prevcurve = thiscurve; index++; if (index < curves.size()) { - thiscurve = (Curve) curves.get(index); + thiscurve = curves.get(index); if (thiscurve.getOrder() != 0 && prevcurve.getX1() == thiscurve.getX0() && prevcurve.getY1() == thiscurve.getY0()) diff --git a/jdk/src/share/classes/java/awt/image/BufferedImage.java b/jdk/src/share/classes/java/awt/image/BufferedImage.java index bb272aacf69..0c819349135 100644 --- a/jdk/src/share/classes/java/awt/image/BufferedImage.java +++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -76,7 +76,7 @@ public class BufferedImage extends java.awt.Image ColorModel colorModel; WritableRaster raster; OffScreenImageSource osis; - Hashtable properties; + Hashtable properties; boolean isAlphaPremultiplied;// If true, alpha has been premultiplied in // color channels @@ -1106,7 +1106,7 @@ public class BufferedImage extends java.awt.Image public ImageProducer getSource() { if (osis == null) { if (properties == null) { - properties = new Hashtable(); + properties = new Hashtable<>(); } osis = new OffScreenImageSource(this, properties); } diff --git a/jdk/src/share/classes/java/awt/image/CropImageFilter.java b/jdk/src/share/classes/java/awt/image/CropImageFilter.java index 4d75c9e0427..a1d241d33ed 100644 --- a/jdk/src/share/classes/java/awt/image/CropImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/CropImageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, 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 @@ -79,6 +79,7 @@ public class CropImageFilter extends ImageFilter { * with the filtering operation. */ public void setProperties(Hashtable props) { + @SuppressWarnings("unchecked") Hashtable p = (Hashtable)props.clone(); p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH)); super.setProperties(p); diff --git a/jdk/src/share/classes/java/awt/image/FilteredImageSource.java b/jdk/src/share/classes/java/awt/image/FilteredImageSource.java index 2f58c096474..a7013159008 100644 --- a/jdk/src/share/classes/java/awt/image/FilteredImageSource.java +++ b/jdk/src/share/classes/java/awt/image/FilteredImageSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, 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 @@ -68,7 +68,7 @@ public class FilteredImageSource implements ImageProducer { filter = imgf; } - private Hashtable proxies; + private Hashtable proxies; /** * Adds the specified ImageConsumer @@ -94,7 +94,7 @@ public class FilteredImageSource implements ImageProducer { */ public synchronized void addConsumer(ImageConsumer ic) { if (proxies == null) { - proxies = new Hashtable(); + proxies = new Hashtable<>(); } if (!proxies.containsKey(ic)) { ImageFilter imgf = filter.getFilterInstance(ic); @@ -137,7 +137,7 @@ public class FilteredImageSource implements ImageProducer { */ public synchronized void removeConsumer(ImageConsumer ic) { if (proxies != null) { - ImageFilter imgf = (ImageFilter) proxies.get(ic); + ImageFilter imgf = proxies.get(ic); if (imgf != null) { src.removeConsumer(imgf); proxies.remove(ic); @@ -173,9 +173,9 @@ public class FilteredImageSource implements ImageProducer { */ public void startProduction(ImageConsumer ic) { if (proxies == null) { - proxies = new Hashtable(); + proxies = new Hashtable<>(); } - ImageFilter imgf = (ImageFilter) proxies.get(ic); + ImageFilter imgf = proxies.get(ic); if (imgf == null) { imgf = filter.getFilterInstance(ic); proxies.put(ic, imgf); @@ -200,7 +200,7 @@ public class FilteredImageSource implements ImageProducer { */ public void requestTopDownLeftRightResend(ImageConsumer ic) { if (proxies != null) { - ImageFilter imgf = (ImageFilter) proxies.get(ic); + ImageFilter imgf = proxies.get(ic); if (imgf != null) { imgf.resendTopDownLeftRight(src); } diff --git a/jdk/src/share/classes/java/awt/image/ImageFilter.java b/jdk/src/share/classes/java/awt/image/ImageFilter.java index 0b64d726b8e..33198346e03 100644 --- a/jdk/src/share/classes/java/awt/image/ImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, 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 @@ -104,6 +104,7 @@ public class ImageFilter implements ImageConsumer, Cloneable { * @exception NullPointerException if props is null */ public void setProperties(Hashtable props) { + @SuppressWarnings("unchecked") Hashtable p = (Hashtable)props.clone(); Object o = p.get("filters"); if (o == null) { diff --git a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java index 7046f5e4667..501714fda1f 100644 --- a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java +++ b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, 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 @@ -111,8 +111,8 @@ public class MemoryImageSource implements ImageProducer { Object pixels; int pixeloffset; int pixelscan; - Hashtable properties; - Vector theConsumers = new Vector(); + Hashtable properties; + Vector theConsumers = new Vector<>(); boolean animating; boolean fullbuffers; @@ -197,7 +197,7 @@ public class MemoryImageSource implements ImageProducer { } private void initialize(int w, int h, ColorModel cm, - Object pix, int off, int scan, Hashtable props) { + Object pix, int off, int scan, Hashtable props) { width = w; height = h; model = cm; @@ -205,7 +205,7 @@ public class MemoryImageSource implements ImageProducer { pixeloffset = off; pixelscan = scan; if (props == null) { - props = new Hashtable(); + props = new Hashtable<>(); } properties = props; } @@ -343,9 +343,9 @@ public class MemoryImageSource implements ImageProducer { public synchronized void setAnimated(boolean animated) { this.animating = animated; if (!animating) { - Enumeration enum_ = theConsumers.elements(); + Enumeration enum_ = theConsumers.elements(); while (enum_.hasMoreElements()) { - ImageConsumer ic = (ImageConsumer) enum_.nextElement(); + ImageConsumer ic = enum_.nextElement(); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); if (isConsumer(ic)) { ic.imageComplete(ImageConsumer.IMAGEERROR); @@ -376,9 +376,9 @@ public class MemoryImageSource implements ImageProducer { } this.fullbuffers = fullbuffers; if (animating) { - Enumeration enum_ = theConsumers.elements(); + Enumeration enum_ = theConsumers.elements(); while (enum_.hasMoreElements()) { - ImageConsumer ic = (ImageConsumer) enum_.nextElement(); + ImageConsumer ic = enum_.nextElement(); ic.setHints(fullbuffers ? (ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES) @@ -474,9 +474,9 @@ public class MemoryImageSource implements ImageProducer { if ((w <= 0 || h <= 0) && !framenotify) { return; } - Enumeration enum_ = theConsumers.elements(); + Enumeration enum_ = theConsumers.elements(); while (enum_.hasMoreElements()) { - ImageConsumer ic = (ImageConsumer) enum_.nextElement(); + ImageConsumer ic = enum_.nextElement(); if (w > 0 && h > 0) { sendPixels(ic, x, y, w, h); } diff --git a/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java b/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java index 04a6fdfe52a..7330439f2c5 100644 --- a/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java +++ b/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2014, 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 @@ -121,6 +121,7 @@ public class ReplicateScaleFilter extends ImageFilter { * with the filtering operation. */ public void setProperties(Hashtable props) { + @SuppressWarnings("unchecked") Hashtable p = (Hashtable)props.clone(); String key = "rescale"; String val = destWidth + "x" + destHeight; diff --git a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java index ca12bfc4c4b..bf14e8ce2d3 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java +++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java @@ -153,6 +153,7 @@ public class ParameterBlock implements Cloneable, Serializable { * * @return an Object clone of the ParameterBlock. */ + @SuppressWarnings("unchecked") // casts from clone public Object clone() { ParameterBlock theClone; @@ -164,10 +165,10 @@ public class ParameterBlock implements Cloneable, Serializable { } if (sources != null) { - theClone.setSources((Vector)sources.clone()); + theClone.setSources((Vector)sources.clone()); } if (parameters != null) { - theClone.setParameters((Vector)parameters.clone()); + theClone.setParameters((Vector)parameters.clone()); } return (Object) theClone; } @@ -280,7 +281,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** Clears the list of source images. */ public void removeSources() { - sources = new Vector(); + sources = new Vector<>(); } /** @@ -313,7 +314,7 @@ public class ParameterBlock implements Cloneable, Serializable { /** Clears the list of parameters. */ public void removeParameters() { - parameters = new Vector(); + parameters = new Vector<>(); } /** @@ -696,9 +697,9 @@ public class ParameterBlock implements Cloneable, Serializable { * of the parameters. * @return an array of Class objects. */ - public Class [] getParamClasses() { + public Class[] getParamClasses() { int numParams = getNumParameters(); - Class [] classes = new Class[numParams]; + Class[] classes = new Class[numParams]; int i; for (i = 0; i < numParams; i++) { diff --git a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java index 6c51f65a8bf..9d5aaa954a8 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -87,11 +87,11 @@ public class RenderableImageOp implements RenderableImage { return getRenderableSources(); } - private Vector getRenderableSources() { - Vector sources = null; + private Vector getRenderableSources() { + Vector sources = null; if (paramBlock.getNumSources() > 0) { - sources = new Vector(); + sources = new Vector<>(); int i = 0; while (i < paramBlock.getNumSources()) { Object o = paramBlock.getSource(i); @@ -314,19 +314,19 @@ public class RenderableImageOp implements RenderableImage { // contains RenderableImage sources, they will be replaced by // RenderedImages. ParameterBlock renderedParamBlock = (ParameterBlock)paramBlock.clone(); - Vector sources = getRenderableSources(); + Vector sources = getRenderableSources(); try { // This assumes that if there is no renderable source, that there // is a rendered source in paramBlock if (sources != null) { - Vector renderedSources = new Vector(); + Vector renderedSources = new Vector<>(); for (int i = 0; i < sources.size(); i++) { rcOut = myCRIF.mapRenderContext(i, renderContext, paramBlock, this); RenderedImage rdrdImage = - ((RenderableImage)sources.elementAt(i)).createRendering(rcOut); + ((RenderableImage)sources.elementAt(i)).createRendering(rcOut); if (rdrdImage == null) { return null; } diff --git a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java index c5e357a28c2..206869ae1bf 100644 --- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java +++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -68,7 +68,7 @@ public class RenderableImageProducer implements ImageProducer, Runnable { RenderContext rc; /** A Vector of image consumers. */ - Vector ics = new Vector(); + Vector ics = new Vector<>(); /** * Constructs a new RenderableImageProducer from a RenderableImage @@ -177,12 +177,12 @@ public class RenderableImageProducer implements ImageProducer, Runnable { int width = raster.getWidth(); int height = raster.getHeight(); - Enumeration icList; + Enumeration icList; ImageConsumer ic; // Set up the ImageConsumers icList = ics.elements(); while (icList.hasMoreElements()) { - ic = (ImageConsumer)icList.nextElement(); + ic = icList.nextElement(); ic.setDimensions(width,height); ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES | @@ -204,7 +204,7 @@ public class RenderableImageProducer implements ImageProducer, Runnable { // Now send the scanline to the Consumers icList = ics.elements(); while (icList.hasMoreElements()) { - ic = (ImageConsumer)icList.nextElement(); + ic = icList.nextElement(); ic.setPixels(0, j, width, 1, colorModel, pix, 0, width); } } @@ -212,7 +212,7 @@ public class RenderableImageProducer implements ImageProducer, Runnable { // Now tell the consumers we're done. icList = ics.elements(); while (icList.hasMoreElements()) { - ic = (ImageConsumer)icList.nextElement(); + ic = icList.nextElement(); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } } diff --git a/jdk/src/share/classes/java/awt/print/Book.java b/jdk/src/share/classes/java/awt/print/Book.java index 672b842e8e7..eaab083789c 100644 --- a/jdk/src/share/classes/java/awt/print/Book.java +++ b/jdk/src/share/classes/java/awt/print/Book.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -47,7 +47,7 @@ public class Book implements Pageable { /** * The set of pages that make up the Book. */ - private Vector mPages; + private Vector mPages; /* Instance Methods */ @@ -55,7 +55,7 @@ public class Book implements Pageable { * Creates a new, empty Book. */ public Book() { - mPages = new Vector(); + mPages = new Vector<>(); } /** @@ -167,7 +167,7 @@ public class Book implements Pageable { private BookPage getPage(int pageIndex) throws ArrayIndexOutOfBoundsException { - return (BookPage) mPages.elementAt(pageIndex); + return mPages.elementAt(pageIndex); } /** diff --git a/jdk/src/share/classes/java/awt/print/PrinterJob.java b/jdk/src/share/classes/java/awt/print/PrinterJob.java index b9b0d134d64..0c80d1490d4 100644 --- a/jdk/src/share/classes/java/awt/print/PrinterJob.java +++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -74,9 +74,9 @@ public abstract class PrinterJob { if (security != null) { security.checkPrintJobAccess(); } - return (PrinterJob) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { + return java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + public PrinterJob run() { String nm = System.getProperty("java.awt.printerjob", null); try { return (PrinterJob)Class.forName(nm).newInstance(); From 0bb0984a41a1c37fc30e14d61b451ae51c6560c2 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 7 May 2014 19:40:30 +0400 Subject: [PATCH 040/185] 8042585: [macosx] Unused code in LWCToolkit.m Reviewed-by: serb, azvegint --- jdk/src/macosx/native/sun/awt/LWCToolkit.m | 57 +--------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.m b/jdk/src/macosx/native/sun/awt/LWCToolkit.m index c78834547c3..7347ecdd251 100644 --- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m +++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -157,61 +157,6 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } -static JNF_CLASS_CACHE(jc_Component, "java/awt/Component"); -static JNF_MEMBER_CACHE(jf_Component_appContext, jc_Component, "appContext", "Lsun/awt/AppContext;"); -static JNF_CLASS_CACHE(jc_MenuComponent, "java/awt/MenuComponent"); -static JNF_MEMBER_CACHE(jf_MenuComponent_appContext, jc_MenuComponent, "appContext", "Lsun/awt/AppContext;"); - -/* - * Class: sun_awt_SunToolkit - * Method: getAppContext - * Signature: (Ljava/awt/Object;)Lsun/awt/AppContext; - */ -JNIEXPORT jobject JNICALL -Java_sun_awt_SunToolkit_getAppContext -(JNIEnv *env, jclass cls, jobject obj) -{ - jobject appContext = NULL; - -JNF_COCOA_ENTER(env); - - if (JNFIsInstanceOf(env, obj, &jc_Component)) { - appContext = JNFGetObjectField(env, obj, jf_Component_appContext); - } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) { - appContext = JNFGetObjectField(env, obj, jf_MenuComponent_appContext); - } - -JNF_COCOA_EXIT(env); - - return appContext; -} - -/* - * Class: sun_awt_SunToolkit - * Method: setAppContext - * Signature: (Ljava/lang/Object;Lsun/awt/AppContext;)Z - */ -JNIEXPORT jboolean JNICALL -Java_sun_awt_SunToolkit_setAppContext -(JNIEnv *env, jclass cls, jobject obj, jobject appContext) -{ - jboolean isComponent; - -JNF_COCOA_ENTER(env); - - if (JNFIsInstanceOf(env, obj, &jc_Component)) { - JNFSetObjectField(env, obj, jf_Component_appContext, appContext); - isComponent = JNI_TRUE; - } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) { - JNFSetObjectField(env, obj, jf_MenuComponent_appContext, appContext); - isComponent = JNI_FALSE; - } - -JNF_COCOA_EXIT(env); - - return isComponent; -} - /* * Class: sun_lwawt_macosx_LWCToolkit * Method: beep From ceed2af62067267e6607d69707748b87d14058d2 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Wed, 7 May 2014 19:47:26 +0400 Subject: [PATCH 041/185] 8042219: [macosx] LWComponentPeer should not reference classes from sun.lwawt.macosx Reviewed-by: serb, azvegint --- .../classes/sun/lwawt/LWComponentPeer.java | 12 +++-- .../macosx/classes/sun/lwawt/LWToolkit.java | 5 +++ .../classes/sun/lwawt/PlatformDropTarget.java | 34 ++++++++++++++ .../classes/sun/lwawt/macosx/CDropTarget.java | 45 ++++++------------- .../classes/sun/lwawt/macosx/LWCToolkit.java | 9 +++- jdk/src/macosx/native/sun/awt/CDropTarget.h | 2 +- jdk/src/macosx/native/sun/awt/CDropTarget.m | 6 +-- 7 files changed, 70 insertions(+), 43 deletions(-) create mode 100644 jdk/src/macosx/classes/sun/lwawt/PlatformDropTarget.java diff --git a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java index 5880d06be4d..354f2538012 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java @@ -63,8 +63,6 @@ import javax.swing.JComponent; import javax.swing.SwingUtilities; import javax.swing.RepaintManager; -import sun.lwawt.macosx.CDropTarget; - import com.sun.java.swing.SwingUtilities3; public abstract class LWComponentPeer @@ -137,7 +135,7 @@ public abstract class LWComponentPeer private final Object dropTargetLock = new Object(); private int fNumDropTargets = 0; - private CDropTarget fDropTarget = null; + private PlatformDropTarget fDropTarget = null; private final PlatformComponent platformComponent; @@ -1063,11 +1061,11 @@ public abstract class LWComponentPeer // if it's the first (or last) one for the component. Otherwise this call is a no-op. if (++fNumDropTargets == 1) { // Having a non-null drop target would be an error but let's check just in case: - if (fDropTarget != null) - System.err.println("CComponent.addDropTarget(): current drop target is non-null."); - + if (fDropTarget != null) { + throw new IllegalStateException("Current drop target is not null"); + } // Create a new drop target: - fDropTarget = CDropTarget.createDropTarget(dt, target, this); + fDropTarget = LWToolkit.getLWToolkit().createDropTarget(dt, target, this); } } } diff --git a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java index b18fdb004f1..315a19a7ff3 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java @@ -28,6 +28,7 @@ package sun.lwawt; import java.awt.*; import java.awt.List; import java.awt.datatransfer.*; +import java.awt.dnd.DropTarget; import java.awt.image.*; import java.awt.peer.*; import java.security.*; @@ -440,6 +441,10 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { protected abstract FileDialogPeer createFileDialogPeer(FileDialog target); + protected abstract PlatformDropTarget createDropTarget(DropTarget dropTarget, + Component component, + LWComponentPeer peer); + // ---- UTILITY METHODS ---- // /* diff --git a/jdk/src/macosx/classes/sun/lwawt/PlatformDropTarget.java b/jdk/src/macosx/classes/sun/lwawt/PlatformDropTarget.java new file mode 100644 index 00000000000..e2a9a70e70f --- /dev/null +++ b/jdk/src/macosx/classes/sun/lwawt/PlatformDropTarget.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.lwawt; + +public interface PlatformDropTarget { + + /** + * Release native dragging destination, if any + */ + void dispose(); +} diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java index 910e1407a36..d4f4353d9ec 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java @@ -25,54 +25,37 @@ package sun.lwawt.macosx; -import java.awt.Component; -import java.awt.peer.ComponentPeer; +import sun.lwawt.LWComponentPeer; +import sun.lwawt.PlatformDropTarget; + +import java.awt.*; import java.awt.dnd.DropTarget; -import sun.lwawt.LWComponentPeer; -import sun.lwawt.PlatformWindow; +final class CDropTarget implements PlatformDropTarget { + private long fNativeDropTarget; -public final class CDropTarget { - - Component fComponent; - ComponentPeer fPeer; - DropTarget fDropTarget; - private long fNativeDropTarget; - - public static CDropTarget createDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) { - return new CDropTarget(dropTarget, component, peer); - } - - private CDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) { - super(); - - fDropTarget = dropTarget; - fComponent = component; - fPeer = peer; - - long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow()); + CDropTarget(DropTarget dropTarget, Component component, LWComponentPeer peer) { + long nativePeer = CPlatformWindow.getNativeViewPtr(peer.getPlatformWindow()); if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin) // Create native dragging destination: - fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer); + fNativeDropTarget = createNativeDropTarget(dropTarget, component, nativePeer); if (fNativeDropTarget == 0) { throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed."); } } - public DropTarget getDropTarget() { - return fDropTarget; - } - + @Override public void dispose() { - // Release native dragging destination, if any: if (fNativeDropTarget != 0) { - this.releaseNativeDropTarget(fNativeDropTarget); + releaseNativeDropTarget(fNativeDropTarget); fNativeDropTarget = 0; } } - protected native long createNativeDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer, long nativePeer); + protected native long createNativeDropTarget(DropTarget dropTarget, + Component component, + long nativePeer); protected native void releaseNativeDropTarget(long nativeDropTarget); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index d0b6882b9a3..2bb5d4ac508 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -701,7 +701,14 @@ public final class LWCToolkit extends LWToolkit { return (T)dgr; } -// InputMethodSupport Method + @Override + protected PlatformDropTarget createDropTarget(DropTarget dropTarget, + Component component, + LWComponentPeer peer) { + return new CDropTarget(dropTarget, component, peer); + } + + // InputMethodSupport Method /** * Returns the default keyboard locale of the underlying operating system */ diff --git a/jdk/src/macosx/native/sun/awt/CDropTarget.h b/jdk/src/macosx/native/sun/awt/CDropTarget.h index b6cd156562b..3b87485add7 100644 --- a/jdk/src/macosx/native/sun/awt/CDropTarget.h +++ b/jdk/src/macosx/native/sun/awt/CDropTarget.h @@ -48,7 +48,7 @@ + (CDropTarget *) currentDropTarget; // Common methods: -- (id)init:(jobject)dropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control; +- (id)init:(jobject)dropTarget component:(jobject)jcomponent control:(id)control; - (void)controlModelControlValid; - (void)removeFromView:(JNIEnv *)env; diff --git a/jdk/src/macosx/native/sun/awt/CDropTarget.m b/jdk/src/macosx/native/sun/awt/CDropTarget.m index 41b0a192c61..7e038ab7715 100644 --- a/jdk/src/macosx/native/sun/awt/CDropTarget.m +++ b/jdk/src/macosx/native/sun/awt/CDropTarget.m @@ -65,7 +65,7 @@ extern JNFClassInfo jc_CDropTargetContextPeer; return sCurrentDropTarget; } -- (id)init:(jobject)jdropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control +- (id)init:(jobject)jdropTarget component:(jobject)jcomponent control:(id)control { self = [super init]; DLog2(@"[CDropTarget init]: %@\n", self); @@ -714,13 +714,13 @@ extern JNFClassInfo jc_CDropTargetContextPeer; * Signature: (Ljava/awt/dnd/DropTarget;Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;J)J */ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDropTarget_createNativeDropTarget - (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jobject jpeer, jlong jnativepeer) + (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jlong jnativepeer) { CDropTarget* dropTarget = nil; JNF_COCOA_ENTER(env); id controlObj = (id) jlong_to_ptr(jnativepeer); - dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent peer:jpeer control:controlObj]; + dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent control:controlObj]; JNF_COCOA_EXIT(env); return ptr_to_jlong(dropTarget); From b9113e4f414c37306bc07ccbf09abf4801d4c13b Mon Sep 17 00:00:00 2001 From: David DeHaven Date: Mon, 5 May 2014 23:21:27 -0700 Subject: [PATCH 042/185] 8042440: awt_Plugin no longer needed Reviewed-by: serb, pchelko --- jdk/make/lib/Awt2dLibraries.gmk | 1 - jdk/make/mapfiles/libawt/mapfile-mawt-vers | 7 +- jdk/make/mapfiles/libawt/mapfile-vers | 9 +- jdk/make/mapfiles/libawt/mapfile-vers-linux | 14 +- jdk/make/mapfiles/libawt_xawt/mapfile-vers | 8 +- .../solaris/native/sun/awt/awt_LoadLibrary.c | 54 ------- jdk/src/solaris/native/sun/awt/awt_Plugin.c | 149 ------------------ jdk/src/solaris/native/sun/awt/awt_Plugin.h | 54 ------- 8 files changed, 4 insertions(+), 292 deletions(-) delete mode 100644 jdk/src/solaris/native/sun/awt/awt_Plugin.c delete mode 100644 jdk/src/solaris/native/sun/awt/awt_Plugin.h diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index 00fa15c59ec..880a52ff096 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -606,7 +606,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) debug_mem.c \ debug_trace.c \ debug_util.c \ - awt_Plugin.c \ gnome_interface.c \ gtk2_interface.c \ swing_GTKEngine.c \ diff --git a/jdk/make/mapfiles/libawt/mapfile-mawt-vers b/jdk/make/mapfiles/libawt/mapfile-mawt-vers index a50c13a62e5..b8ea1636c88 100644 --- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers +++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2014, 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 @@ -249,11 +249,6 @@ SUNWprivate_1.1 { Java_sun_awt_motif_XsessionWMcommand; Java_sun_awt_motif_XsessionWMcommand_New; - # Java Plugin - getAwtLockFunctions; - getAwtData; - getAwtDisplay; - # libfontmanager entry points AWTIsHeadless; AWTCountFonts; diff --git a/jdk/make/mapfiles/libawt/mapfile-vers b/jdk/make/mapfiles/libawt/mapfile-vers index 05ca7d538dd..b1c6a39ec1e 100644 --- a/jdk/make/mapfiles/libawt/mapfile-vers +++ b/jdk/make/mapfiles/libawt/mapfile-vers @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2014, 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 @@ -173,13 +173,6 @@ SUNWprivate_1.1 { Java_sun_awt_motif_XsessionWMcommand; Java_sun_awt_motif_XsessionWMcommand_New; - # Java Plugin - # This is in awt_LoadLibrary.c and falls through to libmawt. - # Evidently plugin needs this for backward compatability. - getAwtLockFunctions; - getAwtData; - getAwtDisplay; - # libfontmanager entry points AWTIsHeadless; GrPrim_Sg2dGetCompInfo; diff --git a/jdk/make/mapfiles/libawt/mapfile-vers-linux b/jdk/make/mapfiles/libawt/mapfile-vers-linux index f8967e09462..922b015c68c 100644 --- a/jdk/make/mapfiles/libawt/mapfile-vers-linux +++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, 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 @@ -152,13 +152,6 @@ SUNWprivate_1.1 { # Evidently CDE needs this for backward compatability. Java_sun_awt_motif_XsessionWMcommand; - # Java Plugin - # This is in awt_LoadLibrary.c and falls through to libmawt. - # Evidently plugin needs this for backward compatability. - getAwtLockFunctions; - getAwtData; - getAwtDisplay; - # libfontmanager entry points AWTIsHeadless; GrPrim_Sg2dGetCompInfo; @@ -283,11 +276,6 @@ SUNWprivate_1.1 { # CDE private entry point Java_sun_awt_motif_XsessionWMcommand; - # Java Plugin - getAwtLockFunctions; - getAwtData; - getAwtDisplay; - # libfontmanager entry points AWTIsHeadless; AWTCountFonts; diff --git a/jdk/make/mapfiles/libawt_xawt/mapfile-vers b/jdk/make/mapfiles/libawt_xawt/mapfile-vers index 15089a114ca..3ae8af3ddbf 100644 --- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers +++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2014, 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 @@ -449,12 +449,6 @@ SUNWprivate_1.1 { awt_Lock; awt_GetComponent; - # Java Plugin - # This is in awt_LoadLibrary.c and falls through to libmawt. - # Evidently plugin needs this for backward compatability. - getAwtLockFunctions; - getAwtData; - getAwtDisplay; #XAWT entry point for CDE Java_sun_awt_motif_XsessionWMcommand; Java_sun_awt_motif_XsessionWMcommand_New; diff --git a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c index 362d9d70dfb..59483027131 100644 --- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c +++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c @@ -35,8 +35,6 @@ #include #include -#include "awt_Plugin.h" - #ifdef AIX #include "porting_aix.h" /* For the 'dladdr' function. */ #endif @@ -236,55 +234,3 @@ Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv) (*XsessionWMcommand)(env, jargv); } - - -#define REFLECT_VOID_FUNCTION(name, arglist, paramlist) \ -typedef void name##_type arglist; \ -void name arglist \ -{ \ - static name##_type *name##_ptr = NULL; \ - if (name##_ptr == NULL && awtHandle == NULL) { \ - return; \ - } \ - name##_ptr = (name##_type *) \ - dlsym(awtHandle, #name); \ - if (name##_ptr == NULL) { \ - return; \ - } \ - (*name##_ptr)paramlist; \ -} - -#define REFLECT_FUNCTION(return_type, name, arglist, paramlist) \ -typedef return_type name##_type arglist; \ -return_type name arglist \ -{ \ - static name##_type *name##_ptr = NULL; \ - if (name##_ptr == NULL && awtHandle == NULL) { \ - return NULL; \ - } \ - name##_ptr = (name##_type *) \ - dlsym(awtHandle, #name); \ - if (name##_ptr == NULL) { \ - return NULL; \ - } \ - return (*name##_ptr)paramlist; \ -} - - -/* - * These entry point must remain in libawt.so ***for Java Plugin ONLY*** - * Reflect this call over to the correct libawt_.so. - */ - -REFLECT_VOID_FUNCTION(getAwtLockFunctions, - (void (**AwtLock)(JNIEnv *), void (**AwtUnlock)(JNIEnv *), - void (**AwtNoFlushUnlock)(JNIEnv *), void *reserved), - (AwtLock, AwtUnlock, AwtNoFlushUnlock, reserved)) - -REFLECT_VOID_FUNCTION(getAwtData, - (int32_t *awt_depth, Colormap *awt_cmap, Visual **awt_visual, - int32_t *awt_num_colors, void *pReserved), - (awt_depth, awt_cmap, awt_visual, - awt_num_colors, pReserved)) - -REFLECT_FUNCTION(Display *, getAwtDisplay, (void), ()) diff --git a/jdk/src/solaris/native/sun/awt/awt_Plugin.c b/jdk/src/solaris/native/sun/awt/awt_Plugin.c deleted file mode 100644 index 0b33ac2b23b..00000000000 --- a/jdk/src/solaris/native/sun/awt/awt_Plugin.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -#ifdef HEADLESS - #error This file should not be included in headless library -#endif - -#include -#include -#include -#include -#include - -/* - * Fix 4221246: Provide utility function for Netscape to use to - * get AWT display, depth, colormap, and number of colors. - * - */ - -Display *getAwtDisplay(void) -{ - return awt_display; -} - -void getExtAwtData(Display *display, - int32_t screen, - int32_t *awt_depth, - Colormap *awt_cmap, - Visual **awt_visual, - int32_t *awt_num_colors, - void *pReserved) -{ - AwtGraphicsConfigDataPtr defaultConfig = NULL; - -#ifdef DEBUG - if (pReserved != NULL) { - jio_fprintf(stderr, - "getExtAwtData: warning: reserved pointer is not null\n"); - } -#endif - - if (screen >= 0) { - defaultConfig = getDefaultConfig(screen); - } - - if (defaultConfig) { - if (awt_depth != NULL) { - *awt_depth = defaultConfig->awt_depth; - } - - if (awt_cmap != NULL) { - *awt_cmap = defaultConfig->awt_cmap; - } - - if (awt_visual != NULL) { - *awt_visual = defaultConfig->awt_visInfo.visual; - } - - if (awt_num_colors != NULL) { - *awt_num_colors = defaultConfig->awt_num_colors; - } - } -} - -/* - * getAwtData provided for compatibility with Solaris 1.2 Java Plug-in - * - */ -void getAwtData(int32_t *awt_depth, - Colormap *awt_cmap, - Visual **awt_visual, - int32_t *awt_num_colors, - void *pReserved) -{ - Display *display = getAwtDisplay(); - - getExtAwtData(display, - DefaultScreen(display), - awt_depth, - awt_cmap, - awt_visual, - awt_num_colors, - pReserved); -} - -/* - * Fix 4221246: Provide utility funtion for Netscape to get - * function pointers to AWT lock functions. - * - */ - -static void awt_lock_wrapper(JNIEnv *env) { - AWT_LOCK(); -} - -static void awt_unlock_wrapper(JNIEnv *env) { - AWT_UNLOCK(); -} - -static void awt_noflush_unlock_wrapper(JNIEnv *env) { - AWT_NOFLUSH_UNLOCK(); -} - -void getAwtLockFunctions(void (**AwtLock)(JNIEnv *), - void (**AwtUnlock)(JNIEnv *), - void (**AwtNoFlushUnlock)(JNIEnv *), - void *pReserved) -{ -#ifdef DEBUG - if (pReserved != NULL) { - jio_fprintf(stderr, - "getAwtLockFunctions: warning: reserved pointer is not null\n"); - } -#endif - - if (AwtLock != NULL) { - *AwtLock = awt_lock_wrapper; - } - - if (AwtUnlock != NULL) { - *AwtUnlock = awt_unlock_wrapper; - } - - if (AwtNoFlushUnlock != NULL) { - *AwtNoFlushUnlock = awt_noflush_unlock_wrapper; - } -} diff --git a/jdk/src/solaris/native/sun/awt/awt_Plugin.h b/jdk/src/solaris/native/sun/awt/awt_Plugin.h deleted file mode 100644 index 434fabb7216..00000000000 --- a/jdk/src/solaris/native/sun/awt/awt_Plugin.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/* - * Fix 4221246: Export functions for Netscape to use to get AWT info - */ - -#ifndef _AWT_PLUGIN_H_ -#define _AWT_PLUGIN_H_ - -#include -#include -#include - -void getAwtLockFunctions(void (**AwtLock)(JNIEnv *), - void (**AwtUnlock)(JNIEnv *), - void (**AwtNoFlushUnlock)(JNIEnv *), - void *); - -void getExtAwtData(Display *, - int32_t, - int32_t *, /* awt_depth */ - Colormap *, /* awt_cmap */ - Visual **, /* awt_visInfo.visual */ - int32_t *, /* awt_num_colors */ - void *); - -void getAwtData(int32_t *, Colormap *, Visual **, int32_t *, void *); - -Display *getAwtDisplay(void); - -#endif /* _AWT_PLUGIN_H_ */ From adcde492fa7da58311e730d0f24e6228b9cc6775 Mon Sep 17 00:00:00 2001 From: Zhengyu Gu Date: Wed, 7 May 2014 06:03:31 -0700 Subject: [PATCH 043/185] 8041415: remove port.{cpp,hpp} files Hotspot should use standard headers and types Reviewed-by: coleenp, kvn --- hotspot/src/share/vm/adlc/adlc.hpp | 11 +- hotspot/src/share/vm/adlc/adlparse.hpp | 2 - hotspot/src/share/vm/adlc/filebuff.cpp | 2 - hotspot/src/share/vm/adlc/filebuff.hpp | 3 - hotspot/src/share/vm/adlc/output_h.cpp | 6 +- hotspot/src/share/vm/asm/assembler.cpp | 4 +- hotspot/src/share/vm/libadt/dict.cpp | 28 +-- hotspot/src/share/vm/libadt/dict.hpp | 21 +- hotspot/src/share/vm/libadt/port.cpp | 123 ----------- hotspot/src/share/vm/libadt/port.hpp | 208 ------------------ hotspot/src/share/vm/libadt/set.cpp | 9 - hotspot/src/share/vm/libadt/set.hpp | 3 - hotspot/src/share/vm/libadt/vectset.cpp | 67 +++--- hotspot/src/share/vm/libadt/vectset.hpp | 16 +- hotspot/src/share/vm/opto/block.cpp | 1 - hotspot/src/share/vm/opto/chaitin.hpp | 5 +- hotspot/src/share/vm/opto/compile.hpp | 1 - hotspot/src/share/vm/opto/divnode.cpp | 4 +- hotspot/src/share/vm/opto/domgraph.cpp | 5 +- hotspot/src/share/vm/opto/indexSet.cpp | 6 +- hotspot/src/share/vm/opto/indexSet.hpp | 24 +- hotspot/src/share/vm/opto/live.hpp | 1 - hotspot/src/share/vm/opto/loopnode.hpp | 10 +- hotspot/src/share/vm/opto/mulnode.cpp | 20 +- hotspot/src/share/vm/opto/node.hpp | 1 - hotspot/src/share/vm/opto/output.cpp | 6 +- hotspot/src/share/vm/opto/parse2.cpp | 10 +- hotspot/src/share/vm/opto/phase.hpp | 1 - hotspot/src/share/vm/opto/regmask.cpp | 6 +- hotspot/src/share/vm/opto/regmask.hpp | 5 +- hotspot/src/share/vm/opto/runtime.cpp | 2 +- hotspot/src/share/vm/opto/subnode.cpp | 4 +- hotspot/src/share/vm/opto/type.hpp | 1 - .../src/share/vm/precompiled/precompiled.hpp | 1 - 34 files changed, 120 insertions(+), 497 deletions(-) delete mode 100644 hotspot/src/share/vm/libadt/port.cpp delete mode 100644 hotspot/src/share/vm/libadt/port.hpp diff --git a/hotspot/src/share/vm/adlc/adlc.hpp b/hotspot/src/share/vm/adlc/adlc.hpp index 18f98884c3c..4ced0bf47bd 100644 --- a/hotspot/src/share/vm/adlc/adlc.hpp +++ b/hotspot/src/share/vm/adlc/adlc.hpp @@ -30,12 +30,13 @@ // // standard library constants -#include "stdio.h" -#include "stdlib.h" #include -#include "string.h" -#include "ctype.h" -#include "stdarg.h" + +#include +#include +#include +#include +#include #include /* Make sure that we have the intptr_t and uintptr_t definitions */ diff --git a/hotspot/src/share/vm/adlc/adlparse.hpp b/hotspot/src/share/vm/adlc/adlparse.hpp index 3ea00a24922..8907cf1754d 100644 --- a/hotspot/src/share/vm/adlc/adlparse.hpp +++ b/hotspot/src/share/vm/adlc/adlparse.hpp @@ -64,8 +64,6 @@ class PeepMatch; class PeepConstraint; class PeepReplace; -// class ostream; // ostream is a typedef in some systems - extern char *toUpper(const char *str); //---------------------------ADLParser----------------------------------------- diff --git a/hotspot/src/share/vm/adlc/filebuff.cpp b/hotspot/src/share/vm/adlc/filebuff.cpp index 71daa5cc4bd..bd4a8d161ed 100644 --- a/hotspot/src/share/vm/adlc/filebuff.cpp +++ b/hotspot/src/share/vm/adlc/filebuff.cpp @@ -25,8 +25,6 @@ // FILEBUFF.CPP - Routines for handling a parser file buffer #include "adlc.hpp" -using namespace std; - //------------------------------FileBuff--------------------------------------- // Create a new parsing buffer FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) { diff --git a/hotspot/src/share/vm/adlc/filebuff.hpp b/hotspot/src/share/vm/adlc/filebuff.hpp index 292fd1781f6..e2ed6a75665 100644 --- a/hotspot/src/share/vm/adlc/filebuff.hpp +++ b/hotspot/src/share/vm/adlc/filebuff.hpp @@ -26,9 +26,6 @@ #define SHARE_VM_ADLC_FILEBUFF_HPP // FILEBUFF.HPP - Definitions for parser file buffering routines -#include - -using namespace std; // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES diff --git a/hotspot/src/share/vm/adlc/output_h.cpp b/hotspot/src/share/vm/adlc/output_h.cpp index 2279e75ecc5..ea401fa5d90 100644 --- a/hotspot/src/share/vm/adlc/output_h.cpp +++ b/hotspot/src/share/vm/adlc/output_h.cpp @@ -211,7 +211,7 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper) const char *type = oper->ideal_type(globals); if (!strcmp(type, "ConI")) { if (i > 0) fprintf(fp,", "); - fprintf(fp," int32 _c%d;\n", i); + fprintf(fp," int32_t _c%d;\n", i); } else if (!strcmp(type, "ConP")) { if (i > 0) fprintf(fp,", "); @@ -307,7 +307,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts, assert(num_consts == 1, "Bad component list detected.\n"); switch( constant_type ) { case Form::idealI : { - fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i); + fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32_t c%d", i); break; } case Form::idealN : { fprintf(fp,"const TypeNarrowOop *c%d", i); break; } @@ -326,7 +326,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts, while((comp = lst.iter()) != NULL) { if (!strcmp(comp->base_type(globals), "ConI")) { if (i > 0) fprintf(fp,", "); - fprintf(fp,"int32 c%d", i); + fprintf(fp,"int32_t c%d", i); i++; } else if (!strcmp(comp->base_type(globals), "ConP")) { diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index 0eadb5dc273..274aa872e6f 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -119,7 +119,7 @@ void AbstractAssembler::bind(Label& L) { L.patch_instructions((MacroAssembler*)this); } -void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) { +void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) { if (UseStackBanging) { // Each code entry causes one stack bang n pages down the stack where n // is configurable by StackShadowPages. The setting depends on the maximum @@ -134,7 +134,7 @@ void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) // is greater than a page. const int page_size = os::vm_page_size(); - int bang_end = StackShadowPages*page_size; + int bang_end = StackShadowPages * page_size; // This is how far the previous frame's stack banging extended. const int bang_end_safe = bang_end; diff --git a/hotspot/src/share/vm/libadt/dict.cpp b/hotspot/src/share/vm/libadt/dict.cpp index 29c16bb41e0..4105ce15bbe 100644 --- a/hotspot/src/share/vm/libadt/dict.cpp +++ b/hotspot/src/share/vm/libadt/dict.cpp @@ -24,29 +24,17 @@ #include "precompiled.hpp" #include "libadt/dict.hpp" -#include "memory/allocation.inline.hpp" -#include "memory/resourceArea.hpp" -#include "runtime/thread.hpp" // Dictionaries - An Abstract Data Type // %%%%% includes not needed with AVM framework - Ungar -// #include "port.hpp" -//IMPLEMENTATION -// #include "dict.hpp" - #include -// The iostream is not needed and it gets confused for gcc by the -// define of bool. -// -// #include - //------------------------------data----------------------------------------- // String hash tables #define MAXID 20 -static byte initflag = 0; // True after 1st initialization +static uint8_t initflag = 0; // True after 1st initialization static const char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6}; static short xsum[MAXID]; @@ -281,7 +269,7 @@ void *Dict::operator [](const void *key) const { // CmpDict compares two dictionaries; they must have the same keys (their // keys must match using CmpKey) and they must have the same values (pointer // comparison). If so 1 is returned, if not 0 is returned. -int32 Dict::operator ==(const Dict &d2) const { +int32_t Dict::operator ==(const Dict &d2) const { if( _cnt != d2._cnt ) return 0; if( _hash != d2._hash ) return 0; if( _cmp != d2._cmp ) return 0; @@ -318,7 +306,7 @@ void Dict::print() { // C text shows excellent spreading of values for any size hash table. int hashstr(const void *t) { register char c, k = 0; - register int32 sum = 0; + register int32_t sum = 0; register const char *s = (const char *)t; while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1 @@ -332,11 +320,7 @@ int hashstr(const void *t) { // Slimey cheap hash function; no guaranteed performance. Better than the // default for pointers, especially on MS-DOS machines. int hashptr(const void *key) { -#ifdef __TURBOC__ - return ((intptr_t)key >> 16); -#else // __TURBOC__ - return ((intptr_t)key >> 2); -#endif + return ((intptr_t)key >> 2); } // Slimey cheap hash function; no guaranteed performance. @@ -345,12 +329,12 @@ int hashkey(const void *key) { } //------------------------------Key Comparator Functions--------------------- -int32 cmpstr(const void *k1, const void *k2) { +int32_t cmpstr(const void *k1, const void *k2) { return strcmp((const char *)k1,(const char *)k2); } // Cheap key comparator. -int32 cmpkey(const void *key1, const void *key2) { +int32_t cmpkey(const void *key1, const void *key2) { if (key1 == key2) return 0; intptr_t delta = (intptr_t)key1 - (intptr_t)key2; if (delta > 0) return 1; diff --git a/hotspot/src/share/vm/libadt/dict.hpp b/hotspot/src/share/vm/libadt/dict.hpp index dad45832de7..e3098dcc66c 100644 --- a/hotspot/src/share/vm/libadt/dict.hpp +++ b/hotspot/src/share/vm/libadt/dict.hpp @@ -25,11 +25,12 @@ #ifndef SHARE_VM_LIBADT_DICT_HPP #define SHARE_VM_LIBADT_DICT_HPP -#include "libadt/port.hpp" - // Dictionaries - An Abstract Data Type -//INTERFACE -class ostream; + +#include "memory/allocation.inline.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/thread.hpp" + class Dict; // These dictionaries define a key-value mapping. They can be inserted to, @@ -38,7 +39,7 @@ class Dict; // key comparison routine determines if two keys are equal or not. A hash // function can be provided; if it's not provided the key itself is used // instead. A nice string hash function is included. -typedef int32 (*CmpKey)(const void *key1, const void *key2); +typedef int32_t (*CmpKey)(const void *key1, const void *key2); typedef int (*Hash)(const void *key); typedef void (*FuncDict)(const void *key, const void *val, Dict *d); @@ -47,7 +48,7 @@ class Dict : public ResourceObj { // Dictionary structure class Arena *_arena; // Where to draw storage from class bucket *_bin; // Hash table is array of buckets uint _size; // Size (# of slots) in hash table - uint32 _cnt; // Number of key-value pairs in hash table + uint32_t _cnt; // Number of key-value pairs in hash table const Hash _hash; // Hashing function const CmpKey _cmp; // Key comparison function void doubhash( void ); // Double hash table size @@ -67,7 +68,7 @@ class Dict : public ResourceObj { // Dictionary structure void Clear(); // Return # of key-value pairs in dict - uint32 Size(void) const { return _cnt; } + uint32_t Size(void) const { return _cnt; } // Insert inserts the given key-value pair into the dictionary. The prior // value of the key is returned; NULL if the key was not previously defined. @@ -81,7 +82,7 @@ class Dict : public ResourceObj { // Dictionary structure // == compares two dictionaries; they must have the same keys (their keys // must match using CmpKey) and they must have the same values (pointer // comparison). If so 1 is returned, if not 0 is returned. - int32 operator ==(const Dict &d) const; // Compare dictionaries for equal + int32_t operator ==(const Dict &d) const; // Compare dictionaries for equal // Print out the dictionary contents as key-value pairs void print(); @@ -96,9 +97,9 @@ int hashptr(const void *key); int hashkey(const void *key); // Key comparators -int32 cmpstr(const void *k1, const void *k2); +int32_t cmpstr(const void *k1, const void *k2); // Slimey cheap key comparator. -int32 cmpkey(const void *key1, const void *key2); +int32_t cmpkey(const void *key1, const void *key2); //------------------------------Iteration-------------------------------------- // The class of dictionary iterators. Fails in the presences of modifications diff --git a/hotspot/src/share/vm/libadt/port.cpp b/hotspot/src/share/vm/libadt/port.cpp deleted file mode 100644 index 165b301846d..00000000000 --- a/hotspot/src/share/vm/libadt/port.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997, 2010, 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. - * - */ - -#include "precompiled.hpp" -#include "libadt/port.hpp" - -// Code for portable compiling - -#ifdef __GNUC__ -#pragma implementation -#endif - -// %%%%% includes not needed with AVM framework - Ungar -// #include "port.hpp" - -// This is only used if turboc is used and it causes problems with -// gcc. -#ifdef __TURBOC__ -#include -#endif - -#include - -//------------------------------gcd-------------------------------------------- -// Greatest common divisor -uint32 gcd( register uint32 x, register uint32 y ) -{ - register uint32 tmp; - while( x ) { // While not zero - tmp = x; // Hold onto smaller x value - x = y % x; // Compute modulus; since y>=x, 0 <= mod < x - y = tmp; // y = old x - } - return y; -} - -//----------------------------------------------------------------------------- -// Find first 1, or return 32 if empty -int ff1( uint32 mask ) -{ - unsigned i, n = 0; - - for( i=1, n=0; i; i<<=1, n++) - if( mask&i ) return n; - return 32; -} - -//----------------------------------------------------------------------------- -// Find highest 1, or return 32 if empty -int fh1( uint32 mask ) -{ - unsigned i, n = 0; - - for( i=((uint32)1<<31), n=31; i; i>>=1, n--) - if( mask&i ) return n; - return 32; -} - -//------------------------------rotate32--------------------------------------- -// Rotate 32bits. Postive rotates left (bits move toward high-order bit), -// negative rotates right. -uint32 rotate32( register uint32 x, register int32 cnt ) -{ - if( cnt >= 0 ) { // Positive rotates left - cnt &= 31; // Mask off extra shift bits - } else { // Negative rotates right - cnt = (-cnt)&31; // Flip sign; mask extra shift bits - cnt = 32-cnt; // Rotate right by big left rotation - } - return (x << cnt) | (x >> (32-cnt)); -} - -/* Disabled - we have another log2 in the system. - This function doesn't work if used as substitute - for the existing log2. Keep around until we have - verified all uses of log2 do the correct thing! -//------------------------------log2------------------------------------------- -// Log base 2. Might also be called 'count leading zeros'. Log2(x) returns -// an l such that (1L<= 0 ) // While high bit is clear - sx <<= 1, l--; // Shift bits left, count down log2 - return l; -} -*/ - -//------------------------------print------------------------------------------ -// Print a pointer without modifying the contents -#ifdef __TURBOC__ -ostream &ostream::operator << (const void *ptr) -{ - return (*this) << "0x" << hex << (uint)ptr << dec; -} -#else -/*ostream &operator << (ostream &os, const void *ptr) -{ - return os << "0x" << hex << (uint)ptr << dec; -}*/ -#endif diff --git a/hotspot/src/share/vm/libadt/port.hpp b/hotspot/src/share/vm/libadt/port.hpp deleted file mode 100644 index 358ab3021c1..00000000000 --- a/hotspot/src/share/vm/libadt/port.hpp +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1997, 2013, 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. - * - */ - -#ifndef SHARE_VM_LIBADT_PORT_HPP -#define SHARE_VM_LIBADT_PORT_HPP - -#include "utilities/top.hpp" - -// Typedefs for portable compiling - -#if defined(__GNUC__) - -#define INTERFACE #pragma interface -#define IMPLEMENTATION #pragma implementation -//INTERFACE -#include -#include -#include - -// Access to the C++ class virtual function pointer -// Put the class in the macro -typedef void *VPTR; -// G++ puts it at the end of the base class -#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));} - -#elif defined(__TURBOC__) - -#include -#include -extern "C" int stricmp(const char *, const char *); -inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); } -inline void bzero(void *p, int l) { memset(p,0,l); } -inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); } -inline int min( int a, int b) { return a < b ? a : b; } -inline int max( int a, int b) { return a > b ? a : b; } -//strcasecmp moved to globalDefinitions_visCPP.hpp -//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); } -inline long abs( long x ) { return x < 0 ? -x : x; } -// Access to the C++ class virtual function pointer -// Put the class in the macro -typedef void near *VPTR; -// BorlandC puts it up front -#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)this;} - -#elif defined(__hpux) - -#define INTERFACE -#define IMPLEMENTATION -#define signed -#include -#include -inline long min( long a, long b) { return a < b ? a : b; } -inline long max( long a, long b) { return a > b ? a : b; } -inline int min( int a, int b) { return a < b ? a : b; } -inline int max( int a, int b) { return a > b ? a : b; } -inline long abs( long x ) { return x < 0 ? -x : x; } - -#elif defined(__MOTO__) -// Motorola's mcc -#define INTERFACE -#define IMPLEMENTATION -#include -#include -inline int min( int a, int b) { return a < b ? a : b; } -inline int max( int a, int b) { return a > b ? a : b; } - -#elif defined(_AIX) -// IBM's xlC compiler -#define INTERFACE -#define IMPLEMENTATION -#include -#include - -#elif defined(_MSC_VER) -// Microsoft Visual C++ -//#define INTERFACE -#define IMPLEMENTATION -#include -#undef small -//strcasecmp moved to globalDefinitions_visCPP.hpp -//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); } - - -#elif defined(SPARC_WORKS) - -#define INTERFACE -#define IMPLEMENTATION - -#include -#include -#include - -#elif defined(SOLARIS) - -#define INTERFACE -#define IMPLEMENTATION - -#include -#include -#include - - -#elif defined(__TANDEM) - -// This case is for the Tandem Business Unit of Compaq Computer Corporation. -// The Tandem case must precede the AT&T case, -// because the Tandem c89 compiler also defines __cplusplus. - -#include "port_tandem.hpp" - -#elif defined(__cplusplus) -// AT&Ts cfront -#define INTERFACE -#define IMPLEMENTATION -#include -#define signed -// #include -inline int min( int a, int b) { return a < b ? a : b; } -inline int max( int a, int b) { return a > b ? a : b; } - -#else // All other machines - -#define signed -extern "C" void bcopy(void *b1, void *b2, int len); -inline int min( int a, int b) { return a < b ? a : b; } -inline int max( int a, int b) { return a > b ? a : b; } - -#endif - -//----------------------------------------------------------------------------- -// Safer memory allocations -#ifdef SAFE_MEMORY -#define malloc(size) safe_malloc(__FILE__,__LINE__,size) -#define free(ptr) safe_free(__FILE__,__LINE__,ptr) -#define realloc(ptr,size) safe_realloc(__FILE__,__LINE__,ptr,size) -#define calloc(nitems,size) safe_calloc(__FILE__,__LINE__,nitems,size) -#define strdup(ptr) safe_strdup(__FILE__,__LINE__,ptr) -extern void *safe_malloc (const char *file, unsigned line, unsigned size); -extern void safe_free (const char *file, unsigned line, void *ptr); -extern void *safe_calloc (const char *file, unsigned line, unsigned nitems, unsigned size); -extern void *safe_realloc(const char *file, unsigned line, void *ptr, unsigned size); -extern char *safe_strdup (const char *file, unsigned line, const char *src); -inline void *operator new( size_t size ) throw() { return malloc(size); } -inline void operator delete( void *ptr ) { free(ptr); } -#endif - -//----------------------------------------------------------------------------- -// And now, the bit-size-specified integer sizes -typedef signed char int8; -typedef unsigned char uint8; -typedef unsigned char byte; - -// All uses of *int16 changed to 32-bit to speed up compiler on Intel -//typedef signed short int16; // Exactly 16bits signed -//typedef unsigned short uint16; // Exactly 16bits unsigned -//const unsigned int min_uint16 = 0x0000; // smallest uint16 -//const unsigned int max_uint16 = 0xFFFF; // largest uint16 - -typedef unsigned int uint; // When you need a fast >=16bit unsigned value -/*typedef int int; */ // When you need a fast >=16bit value -const unsigned int max_uint = (uint)-1; -typedef int32_t int32; // Exactly 32bits signed -typedef uint32_t uint32; // Exactly 32bits unsigned - -// Bit-sized floating point and long thingies -#ifndef __TANDEM -// Do not define these for Tandem, because they conflict with typedefs in softieee.h. -typedef float float32; // 32-bit float -typedef double float64; // 64-bit float -#endif // __TANDEM - -typedef jlong int64; // Java long for my 64-bit type -typedef julong uint64; // Java long for my 64-bit type - -//----------------------------------------------------------------------------- -// Nice constants -uint32 gcd( uint32 x, uint32 y ); -int ff1( uint32 mask ); -int fh1( uint32 mask ); -uint32 rotate32( uint32 x, int32 cnt ); - - -//----------------------------------------------------------------------------- -extern uint32 heap_totalmem; // Current total memory allocation -extern uint32 heap_highwater; // Highwater mark to date for memory usage - -#endif // SHARE_VM_LIBADT_PORT_HPP diff --git a/hotspot/src/share/vm/libadt/set.cpp b/hotspot/src/share/vm/libadt/set.cpp index 7364795ed70..d52f5c7fb76 100644 --- a/hotspot/src/share/vm/libadt/set.cpp +++ b/hotspot/src/share/vm/libadt/set.cpp @@ -28,20 +28,11 @@ // Sets - An Abstract Data Type -// %%%%% includes not needed with AVM framework - Ungar -// #include "port.hpp" -//IMPLEMENTATION -// #include "set.hpp" - #include #include #include #include -// Not needed and it causes terouble for gcc. -// -// #include - //-------------------------Virtual Functions----------------------------------- // These functions MUST be implemented by the inheriting class. class SparseSet; diff --git a/hotspot/src/share/vm/libadt/set.hpp b/hotspot/src/share/vm/libadt/set.hpp index f3b3533eb87..3c66e561566 100644 --- a/hotspot/src/share/vm/libadt/set.hpp +++ b/hotspot/src/share/vm/libadt/set.hpp @@ -25,13 +25,10 @@ #ifndef SHARE_VM_LIBADT_SET_HPP #define SHARE_VM_LIBADT_SET_HPP -#include "libadt/port.hpp" #include "memory/allocation.hpp" // Sets - An Abstract Data Type -//INTERFACE - class SparseSet; class VectorSet; class ListSet; diff --git a/hotspot/src/share/vm/libadt/vectset.cpp b/hotspot/src/share/vm/libadt/vectset.cpp index ab80afef681..256b0a9a1a9 100644 --- a/hotspot/src/share/vm/libadt/vectset.cpp +++ b/hotspot/src/share/vm/libadt/vectset.cpp @@ -28,15 +28,10 @@ // Vector Sets - An Abstract Data Type -// %%%%% includes not needed with AVM framework - Ungar -// #include "port.hpp" -//IMPLEMENTATION -// #include "vectset.hpp" - // BitsInByte is a lookup table which tells the number of bits that // are in the looked-up number. It is very useful in VectorSet_Size. -uint8 bitsInByte[256] = { +uint8_t bitsInByte[256] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, @@ -59,7 +54,7 @@ uint8 bitsInByte[256] = { // Create a new, empty Set. VectorSet::VectorSet(Arena *arena) : Set(arena) { size = 2; // Small initial size - data = (uint32 *)_set_arena->Amalloc(size*sizeof(uint32)); + data = (uint32_t *)_set_arena->Amalloc(size*sizeof(uint32_t)); data[0] = 0; // No elements data[1] = 0; } @@ -85,8 +80,8 @@ Set &VectorSet::operator = (const Set &set) void VectorSet::slamin(const VectorSet& s) { size = s.size; // Use new size - data = (uint32*)s._set_arena->Amalloc(size*sizeof(uint32)); // Make array of required size - memcpy( data, s.data, size*sizeof(uint32) ); // Fill the array + data = (uint32_t*)s._set_arena->Amalloc(size*sizeof(uint32_t)); // Make array of required size + memcpy( data, s.data, size*sizeof(uint32_t) ); // Fill the array } //------------------------------grow------------------------------------------- @@ -96,8 +91,8 @@ void VectorSet::grow( uint newsize ) newsize = (newsize+31) >> 5; // Convert to longwords uint x = size; while( x < newsize ) x <<= 1; - data = (uint32 *)_set_arena->Arealloc(data, size*sizeof(uint32), x*sizeof(uint32)); - memset((char *)(data + size), 0, (x - size)*sizeof(uint32)); + data = (uint32_t *)_set_arena->Arealloc(data, size*sizeof(uint32_t), x*sizeof(uint32_t)); + memset((char *)(data + size), 0, (x - size)*sizeof(uint32_t)); size = x; } @@ -106,7 +101,7 @@ void VectorSet::grow( uint newsize ) Set &VectorSet::operator <<= (uint elem) { register uint word = elem >> 5; // Get the longword offset - register uint32 mask = 1L << (elem & 31); // Get bit mask + register uint32_t mask = 1L << (elem & 31); // Get bit mask if( word >= size ) // Need to grow set? grow(elem+1); // Then grow it @@ -121,7 +116,7 @@ Set &VectorSet::operator >>= (uint elem) register uint word = elem >> 5; // Get the longword offset if( word >= size ) // Beyond the last? return *this; // Then it's clear & return clear - register uint32 mask = 1L << (elem & 31); // Get bit mask + register uint32_t mask = 1L << (elem & 31); // Get bit mask data[word] &= ~mask; // Clear bit return *this; } @@ -132,8 +127,8 @@ VectorSet &VectorSet::operator &= (const VectorSet &s) { // NOTE: The intersection is never any larger than the smallest set. if( s.size < size ) size = s.size; // Get smaller size - register uint32 *u1 = data; // Pointer to the destination data - register uint32 *u2 = s.data; // Pointer to the source data + register uint32_t *u1 = data; // Pointer to the destination data + register uint32_t *u2 = s.data; // Pointer to the source data for( uint i=0; i> 5; // Get the longword offset if( word >= size ) // Beyond the last? return 0; // Then it's clear - register uint32 mask = 1L << (elem & 31); // Get bit mask + register uint32_t mask = 1L << (elem & 31); // Get bit mask return ((data[word] & mask))!=0; // Return the sense of the bit } @@ -305,7 +300,7 @@ uint VectorSet::getelem(void) const for( i=0; i>=1 ); return (i<<5)+j; @@ -316,11 +311,11 @@ uint VectorSet::getelem(void) const void VectorSet::Clear(void) { if( size > 100 ) { // Reclaim storage only if huge - FREE_RESOURCE_ARRAY(uint32,data,size); + FREE_RESOURCE_ARRAY(uint32_t,data,size); size = 2; // Small initial size - data = NEW_RESOURCE_ARRAY(uint32,size); + data = NEW_RESOURCE_ARRAY(uint32_t,size); } - memset( data, 0, size*sizeof(uint32) ); + memset( data, 0, size*sizeof(uint32_t) ); } //------------------------------Size------------------------------------------- @@ -328,8 +323,8 @@ void VectorSet::Clear(void) uint VectorSet::Size(void) const { uint sum = 0; // Cumulative size so far. - uint8 *currByte = (uint8*)data; - for( uint32 i = 0; i < (size<<2); i++) // While have bytes to process + uint8_t* currByte = (uint8_t*) data; + for( uint32_t i = 0; i < (size<<2); i++) // While have bytes to process sum += bitsInByte[*currByte++]; // Add bits in current byte to size. return sum; } @@ -343,7 +338,7 @@ void VectorSet::Sort(void) //------------------------------hash------------------------------------------- int VectorSet::hash() const { - uint32 _xor = 0; + uint32_t _xor = 0; uint lim = ((size<4)?size:4); for( uint i = 0; i < lim; i++ ) _xor ^= data[i]; diff --git a/hotspot/src/share/vm/libadt/vectset.hpp b/hotspot/src/share/vm/libadt/vectset.hpp index 552fdd17bee..d94ce44d35f 100644 --- a/hotspot/src/share/vm/libadt/vectset.hpp +++ b/hotspot/src/share/vm/libadt/vectset.hpp @@ -47,7 +47,7 @@ class VectorSet : public Set { friend class VectorSetI; // Friendly iterator class protected: uint size; // Size of data IN LONGWORDS (32bits) - uint32 *data; // The data, bit packed + uint32_t* data; // The data, bit packed void slamin( const VectorSet& s ); // Initialize one set with another int compare(const VectorSet &s) const; // Compare set contents @@ -99,7 +99,7 @@ public: void Sort(void); // Sort before iterating int hash() const; // Hash function void Reset(void) { // Reset a set - memset( data, 0, size*sizeof(uint32) ); + memset( data, 0, size*sizeof(uint32_t) ); } /* Removed for MCC BUG @@ -108,7 +108,7 @@ public: // Expose internals for speed-critical fast iterators uint word_size() const { return size; } - uint32 *EXPOSE() const { return data; } + uint32_t* EXPOSE() const { return data; } // Fast inlined "test and set". Replaces the idiom: // if( visited[idx] ) return; @@ -120,8 +120,8 @@ public: uint word = elem >> 5; // Get the longword offset if( word >= size ) // Beyond the last? return test_set_grow(elem); // Then grow; set; return 0; - uint32 mask = 1L << (elem & 31); // Get bit mask - uint32 datum = data[word] & mask;// Get bit + uint32_t mask = 1L << (elem & 31); // Get bit mask + uint32_t datum = data[word] & mask;// Get bit data[word] |= mask; // Set bit return datum; // Return bit } @@ -134,7 +134,7 @@ public: int test( uint elem ) const { uint word = elem >> 5; // Get the longword offset if( word >= size ) return 0; // Beyond the last? - uint32 mask = 1L << (elem & 31); // Get bit mask + uint32_t mask = 1L << (elem & 31); // Get bit mask return data[word] & mask; // Get bit } @@ -144,7 +144,7 @@ public: if( word >= size ) { // Beyond the last? test_set_grow(elem); // Then grow and set } else { - uint32 mask = 1L << (elem & 31); // Get bit mask + uint32_t mask = 1L << (elem & 31); // Get bit mask data[word] |= mask; // Set bit } } @@ -164,7 +164,7 @@ class VectorSetI : public StackObj { friend class VectorSet; const VectorSet *s; uint i, j; - uint32 mask; + uint32_t mask; uint next(void); public: diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index 3eaa2abcb7c..6b621f02c05 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -1268,7 +1268,6 @@ void UnionFind::extend( uint from_idx, uint to_idx ) { } void UnionFind::reset( uint max ) { - assert( max <= max_uint, "Must fit within uint" ); // Force the Union-Find mapping to be at least this large extend(max,0); // Initialize to be the ID mapping. diff --git a/hotspot/src/share/vm/opto/chaitin.hpp b/hotspot/src/share/vm/opto/chaitin.hpp index f11b5b1f416..99194cfe925 100644 --- a/hotspot/src/share/vm/opto/chaitin.hpp +++ b/hotspot/src/share/vm/opto/chaitin.hpp @@ -26,7 +26,6 @@ #define SHARE_VM_OPTO_CHAITIN_HPP #include "code/vmreg.hpp" -#include "libadt/port.hpp" #include "memory/resourceArea.hpp" #include "opto/connode.hpp" #include "opto/live.hpp" @@ -142,7 +141,7 @@ public: // Number of registers this live range uses when it colors private: - uint8 _num_regs; // 2 for Longs and Doubles, 1 for all else + uint8_t _num_regs; // 2 for Longs and Doubles, 1 for all else // except _num_regs is kill count for fat_proj public: int num_regs() const { return _num_regs; } @@ -151,7 +150,7 @@ public: private: // Number of physical registers this live range uses when it colors // Architecture and register-set dependent - uint8 _reg_pressure; + uint8_t _reg_pressure; public: void set_reg_pressure(int i) { _reg_pressure = i; } int reg_pressure() const { return _reg_pressure; } diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 76ff09226ea..5c74e931ae5 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -32,7 +32,6 @@ #include "compiler/compilerOracle.hpp" #include "compiler/compileBroker.hpp" #include "libadt/dict.hpp" -#include "libadt/port.hpp" #include "libadt/vectset.hpp" #include "memory/resourceArea.hpp" #include "opto/idealGraphPrinter.hpp" diff --git a/hotspot/src/share/vm/opto/divnode.cpp b/hotspot/src/share/vm/opto/divnode.cpp index f577c8b5125..40bd21fbc4c 100644 --- a/hotspot/src/share/vm/opto/divnode.cpp +++ b/hotspot/src/share/vm/opto/divnode.cpp @@ -514,7 +514,7 @@ const Type *DivINode::Value( PhaseTransform *phase ) const { int widen = MAX2(i1->_widen, i2->_widen); if( i2->is_con() && i2->get_con() != 0 ) { - int32 d = i2->get_con(); // Divisor + int32_t d = i2->get_con(); // Divisor jint lo, hi; if( d >= 0 ) { lo = i1->_lo/d; @@ -536,7 +536,7 @@ const Type *DivINode::Value( PhaseTransform *phase ) const { // If the dividend is a constant if( i1->is_con() ) { - int32 d = i1->get_con(); + int32_t d = i1->get_con(); if( d < 0 ) { if( d == min_jint ) { // (-min_jint) == min_jint == (min_jint / -1) diff --git a/hotspot/src/share/vm/opto/domgraph.cpp b/hotspot/src/share/vm/opto/domgraph.cpp index a7fa0532763..0be96ad7f71 100644 --- a/hotspot/src/share/vm/opto/domgraph.cpp +++ b/hotspot/src/share/vm/opto/domgraph.cpp @@ -397,8 +397,9 @@ void PhaseIdealLoop::Dominators() { ntarjan[i]._control = NULL; // Store the DFS order for the main loop + const uint fill_value = max_juint; uint *dfsorder = NEW_RESOURCE_ARRAY(uint,C->unique()+1); - memset(dfsorder, max_uint, (C->unique()+1) * sizeof(uint)); + memset(dfsorder, fill_value, (C->unique()+1) * sizeof(uint)); // Tarjan's algorithm, almost verbatim: // Step 1: @@ -419,7 +420,7 @@ void PhaseIdealLoop::Dominators() { if( whead->in(j) == NULL || !whead->in(j)->is_CFG() ) continue; // Only process control nodes uint b = dfsorder[whead->in(j)->_idx]; - if(b == max_uint) continue; + if(b == fill_value) continue; NTarjan *vx = &ntarjan[b]; NTarjan *u = vx->EVAL(); if( u->_semi < w->_semi ) diff --git a/hotspot/src/share/vm/opto/indexSet.cpp b/hotspot/src/share/vm/opto/indexSet.cpp index 4ba99e72783..d2172d157b3 100644 --- a/hotspot/src/share/vm/opto/indexSet.cpp +++ b/hotspot/src/share/vm/opto/indexSet.cpp @@ -51,7 +51,7 @@ int IndexSet::_serial_count = 1; #endif // What is the first set bit in a 5 bit integer? -const byte IndexSetIterator::_first_bit[32] = { +const uint8_t IndexSetIterator::_first_bit[32] = { 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, @@ -63,7 +63,7 @@ const byte IndexSetIterator::_first_bit[32] = { }; // What is the second set bit in a 5 bit integer? -const byte IndexSetIterator::_second_bit[32] = { +const uint8_t IndexSetIterator::_second_bit[32] = { 5, 5, 5, 1, 5, 2, 2, 1, 5, 3, 3, 1, @@ -298,7 +298,7 @@ IndexSet::IndexSet (IndexSet *set) { set_block(i, &_empty_block); } else { BitBlock *new_block = alloc_block(); - memcpy(new_block->words(), block->words(), sizeof(uint32) * words_per_block); + memcpy(new_block->words(), block->words(), sizeof(uint32_t) * words_per_block); set_block(i, new_block); } } diff --git a/hotspot/src/share/vm/opto/indexSet.hpp b/hotspot/src/share/vm/opto/indexSet.hpp index ef5aed18b67..366c9d5843b 100644 --- a/hotspot/src/share/vm/opto/indexSet.hpp +++ b/hotspot/src/share/vm/opto/indexSet.hpp @@ -106,12 +106,12 @@ class IndexSet : public ResourceObj { // is used by IndexSet to mainting this free list. union { - uint32 _words[words_per_block]; + uint32_t _words[words_per_block]; BitBlock *_next; } _data; // accessors - uint32 *words() { return _data._words; } + uint32_t* words() { return _data._words; } void set_next(BitBlock *next) { _data._next = next; } BitBlock *next() { return _data._next; } @@ -120,22 +120,22 @@ class IndexSet : public ResourceObj { // not assume that the block index has been masked out. void clear() { - memset(words(), 0, sizeof(uint32) * words_per_block); + memset(words(), 0, sizeof(uint32_t) * words_per_block); } bool member(uint element) { uint word_index = IndexSet::get_word_index(element); uint bit_index = IndexSet::get_bit_index(element); - return ((words()[word_index] & (uint32)(0x1 << bit_index)) != 0); + return ((words()[word_index] & (uint32_t)(0x1 << bit_index)) != 0); } bool insert(uint element) { uint word_index = IndexSet::get_word_index(element); uint bit_index = IndexSet::get_bit_index(element); - uint32 bit = (0x1 << bit_index); - uint32 before = words()[word_index]; + uint32_t bit = (0x1 << bit_index); + uint32_t before = words()[word_index]; words()[word_index] = before | bit; return ((before & bit) != 0); } @@ -144,8 +144,8 @@ class IndexSet : public ResourceObj { uint word_index = IndexSet::get_word_index(element); uint bit_index = IndexSet::get_bit_index(element); - uint32 bit = (0x1 << bit_index); - uint32 before = words()[word_index]; + uint32_t bit = (0x1 << bit_index); + uint32_t before = words()[word_index]; words()[word_index] = before & ~bit; return ((before & bit) != 0); } @@ -404,14 +404,14 @@ class IndexSetIterator VALUE_OBJ_CLASS_SPEC { table_size = (1 << window_size) }; // For an integer of length window_size, what is the first set bit? - static const byte _first_bit[table_size]; + static const uint8_t _first_bit[table_size]; // For an integer of length window_size, what is the second set bit? - static const byte _second_bit[table_size]; + static const uint8_t _second_bit[table_size]; private: // The current word we are inspecting - uint32 _current; + uint32_t _current; // What element number are we currently on? uint _value; @@ -420,7 +420,7 @@ class IndexSetIterator VALUE_OBJ_CLASS_SPEC { uint _next_word; // A pointer to the contents of the current block - uint32 *_words; + uint32_t *_words; // The index of the next block we will inspect uint _next_block; diff --git a/hotspot/src/share/vm/opto/live.hpp b/hotspot/src/share/vm/opto/live.hpp index 343c5c6f727..9c779b2c2f0 100644 --- a/hotspot/src/share/vm/opto/live.hpp +++ b/hotspot/src/share/vm/opto/live.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_VM_OPTO_LIVE_HPP #define SHARE_VM_OPTO_LIVE_HPP -#include "libadt/port.hpp" #include "libadt/vectset.hpp" #include "opto/block.hpp" #include "opto/indexSet.hpp" diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 59915ffed6f..5c962ae9981 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -339,11 +339,11 @@ public: Node_List _body; // Loop body for inner loops - uint8 _nest; // Nesting depth - uint8 _irreducible:1, // True if irreducible - _has_call:1, // True if has call safepoint - _has_sfpt:1, // True if has non-call safepoint - _rce_candidate:1; // True if candidate for range check elimination + uint8_t _nest; // Nesting depth + uint8_t _irreducible:1, // True if irreducible + _has_call:1, // True if has call safepoint + _has_sfpt:1, // True if has non-call safepoint + _rce_candidate:1; // True if candidate for range check elimination Node_List* _safepts; // List of safepoints in this loop Node_List* _required_safept; // A inner loop cannot delete these safepts; diff --git a/hotspot/src/share/vm/opto/mulnode.cpp b/hotspot/src/share/vm/opto/mulnode.cpp index 861149afca5..056d8c5043a 100644 --- a/hotspot/src/share/vm/opto/mulnode.cpp +++ b/hotspot/src/share/vm/opto/mulnode.cpp @@ -235,23 +235,23 @@ const Type *MulINode::mul_ring(const Type *t0, const Type *t1) const { const TypeInt *r1 = t1->is_int(); // Fetch endpoints of all ranges - int32 lo0 = r0->_lo; + int32_t lo0 = r0->_lo; double a = (double)lo0; - int32 hi0 = r0->_hi; + int32_t hi0 = r0->_hi; double b = (double)hi0; - int32 lo1 = r1->_lo; + int32_t lo1 = r1->_lo; double c = (double)lo1; - int32 hi1 = r1->_hi; + int32_t hi1 = r1->_hi; double d = (double)hi1; // Compute all endpoints & check for overflow - int32 A = lo0*lo1; + int32_t A = lo0*lo1; if( (double)A != a*c ) return TypeInt::INT; // Overflow? - int32 B = lo0*hi1; + int32_t B = lo0*hi1; if( (double)B != a*d ) return TypeInt::INT; // Overflow? - int32 C = hi0*lo1; + int32_t C = hi0*lo1; if( (double)C != b*c ) return TypeInt::INT; // Overflow? - int32 D = hi0*hi1; + int32_t D = hi0*hi1; if( (double)D != b*d ) return TypeInt::INT; // Overflow? if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints @@ -1228,12 +1228,12 @@ const Type *URShiftINode::Value( PhaseTransform *phase ) const { // // const TypeInstPtr *o = t1->is_instptr(); // if( t1->singleton() ) - // return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift ); + // return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift ); // } // else if( t1->base() == Type::KlassPtr ) { // const TypeKlassPtr *o = t1->is_klassptr(); // if( t1->singleton() ) - // return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift ); + // return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift ); // } return TypeInt::INT; diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index 0b51d04875d..67db16f154b 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_VM_OPTO_NODE_HPP #define SHARE_VM_OPTO_NODE_HPP -#include "libadt/port.hpp" #include "libadt/vectset.hpp" #include "opto/compile.hpp" #include "opto/type.hpp" diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index ede7534642d..d47912f208c 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -366,8 +366,8 @@ void Compile::shorten_branches(uint* blk_starts, int& code_size, int& reloc_size // third inserts nops where needed. // Step one, perform a pessimistic sizing pass. - uint last_call_adr = max_uint; - uint last_avoid_back_to_back_adr = max_uint; + uint last_call_adr = max_juint; + uint last_avoid_back_to_back_adr = max_juint; uint nop_size = (new (this) MachNopNode())->size(_regalloc); for (uint i = 0; i < nblocks; i++) { // For all blocks Block* block = _cfg->get_block(i); @@ -479,7 +479,7 @@ void Compile::shorten_branches(uint* blk_starts, int& code_size, int& reloc_size // Step two, replace eligible long jumps. bool progress = true; - uint last_may_be_short_branch_adr = max_uint; + uint last_may_be_short_branch_adr = max_juint; while (has_short_branch_candidate && progress) { progress = false; has_short_branch_candidate = false; diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index cce96328b9b..49396bc7dd1 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -405,9 +405,9 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) bool needs_guard = false; int default_dest; - int64 total_outlier_size = 0; - int64 hi_size = ((int64)hi->hi()) - ((int64)hi->lo()) + 1; - int64 lo_size = ((int64)lo->hi()) - ((int64)lo->lo()) + 1; + int64_t total_outlier_size = 0; + int64_t hi_size = ((int64_t)hi->hi()) - ((int64_t)hi->lo()) + 1; + int64_t lo_size = ((int64_t)lo->hi()) - ((int64_t)lo->lo()) + 1; if (lo->dest() == hi->dest()) { total_outlier_size = hi_size + lo_size; @@ -429,7 +429,7 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) } // Find the total number of cases and ranges - int64 num_cases = ((int64)hi->hi()) - ((int64)lo->lo()) + 1; + int64_t num_cases = ((int64_t)hi->hi()) - ((int64_t)lo->lo()) + 1; int num_range = hi - lo + 1; // Don't create table if: too large, too small, or too sparse. @@ -473,7 +473,7 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) // These are the switch destinations hanging off the jumpnode int i = 0; for (SwitchRange* r = lo; r <= hi; r++) { - for (int64 j = r->lo(); j <= r->hi(); j++, i++) { + for (int64_t j = r->lo(); j <= r->hi(); j++, i++) { Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval))); { PreserveJVMState pjvms(this); diff --git a/hotspot/src/share/vm/opto/phase.hpp b/hotspot/src/share/vm/opto/phase.hpp index 08e9575640e..b06e3470df4 100644 --- a/hotspot/src/share/vm/opto/phase.hpp +++ b/hotspot/src/share/vm/opto/phase.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_VM_OPTO_PHASE_HPP #define SHARE_VM_OPTO_PHASE_HPP -#include "libadt/port.hpp" #include "runtime/timer.hpp" class Compile; diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp index 07fddd151c3..45432398909 100644 --- a/hotspot/src/share/vm/opto/regmask.cpp +++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -51,7 +51,7 @@ //-------------Non-zero bit search methods used by RegMask--------------------- // Find lowest 1, or return 32 if empty -int find_lowest_bit( uint32 mask ) { +int find_lowest_bit( uint32_t mask ) { int n = 0; if( (mask & 0xffff) == 0 ) { mask >>= 16; @@ -80,7 +80,7 @@ int find_lowest_bit( uint32 mask ) { } // Find highest 1, or return 32 if empty -int find_hihghest_bit( uint32 mask ) { +int find_hihghest_bit( uint32_t mask ) { int n = 0; if( mask > 0xffff ) { mask >>= 16; @@ -395,7 +395,7 @@ bool RegMask::is_UP() const { //------------------------------Size------------------------------------------- // Compute size of register mask in bits uint RegMask::Size() const { - extern uint8 bitsInByte[256]; + extern uint8_t bitsInByte[256]; uint sum = 0; for( int i = 0; i < RM_SIZE; i++ ) sum += diff --git a/hotspot/src/share/vm/opto/regmask.hpp b/hotspot/src/share/vm/opto/regmask.hpp index 2ea6dfffdd3..ff0d0b96dc2 100644 --- a/hotspot/src/share/vm/opto/regmask.hpp +++ b/hotspot/src/share/vm/opto/regmask.hpp @@ -26,7 +26,6 @@ #define SHARE_VM_OPTO_REGMASK_HPP #include "code/vmreg.hpp" -#include "libadt/port.hpp" #include "opto/optoreg.hpp" #ifdef TARGET_ARCH_MODEL_x86_32 # include "adfiles/adGlobals_x86_32.hpp" @@ -68,9 +67,9 @@ //-------------Non-zero bit search methods used by RegMask--------------------- // Find lowest 1, or return 32 if empty -int find_lowest_bit( uint32 mask ); +int find_lowest_bit( uint32_t mask ); // Find highest 1, or return 32 if empty -int find_hihghest_bit( uint32 mask ); +int find_hihghest_bit( uint32_t mask ); //------------------------------RegMask---------------------------------------- // The ADL file describes how to print the machine-specific registers, as well diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index 877090e087a..ea277c04b85 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -960,7 +960,7 @@ JRT_LEAF(void, OptoRuntime::profile_receiver_type_C(DataLayout* data, oopDesc* r } else { // Receiver did not match any saved receiver and there is no empty row for it. // Increment total counter to indicate polymorphic case. - intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset())); + intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset())); *count_p += DataLayout::counter_increment; } JRT_END diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 469d4141e32..fd7fe8b2a2f 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -242,8 +242,8 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ const Type *SubINode::sub( const Type *t1, const Type *t2 ) const { const TypeInt *r0 = t1->is_int(); // Handy access const TypeInt *r1 = t2->is_int(); - int32 lo = r0->_lo - r1->_hi; - int32 hi = r0->_hi - r1->_lo; + int32_t lo = r0->_lo - r1->_hi; + int32_t hi = r0->_hi - r1->_lo; // We next check for 32-bit overflow. // If that happens, we just assume all integers are possible. diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 071c12bf0b6..e4340df4f9a 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_VM_OPTO_TYPE_HPP #define SHARE_VM_OPTO_TYPE_HPP -#include "libadt/port.hpp" #include "opto/adlcVMDeps.hpp" #include "runtime/handles.hpp" diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index 5118a398f13..cd1e279b27a 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -246,7 +246,6 @@ # include "utilities/yieldingWorkgroup.hpp" #ifdef COMPILER2 # include "libadt/dict.hpp" -# include "libadt/port.hpp" # include "libadt/set.hpp" # include "libadt/vectset.hpp" # include "opto/addnode.hpp" From ed9c096396c826886603284e5139760c90d26157 Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Wed, 7 May 2014 14:16:45 -0500 Subject: [PATCH 044/185] 8038654: Separate SymbolTable and StringTable code Refactor stringTable class out of symbolTable, making sure all includes are minimal set and are sorted. Reviewed-by: coleenp, stefank --- .../src/share/vm/classfile/javaClasses.cpp | 2 +- .../src/share/vm/classfile/stringTable.cpp | 531 ++++++++++++++++++ .../src/share/vm/classfile/stringTable.hpp | 162 ++++++ .../src/share/vm/classfile/symbolTable.cpp | 495 ---------------- .../src/share/vm/classfile/symbolTable.hpp | 131 ----- .../share/vm/classfile/systemDictionary.cpp | 1 + .../concurrentMarkSweepGeneration.cpp | 2 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 1 + .../parallelScavenge/psMarkSweep.cpp | 3 +- .../parallelScavenge/psParallelCompact.cpp | 2 +- .../parallelScavenge/psScavenge.cpp | 3 +- hotspot/src/share/vm/memory/genMarkSweep.cpp | 2 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 2 +- hotspot/src/share/vm/memory/universe.cpp | 2 +- hotspot/src/share/vm/oops/constantPool.cpp | 2 +- hotspot/src/share/vm/prims/jvm.cpp | 2 +- hotspot/src/share/vm/prims/methodHandles.cpp | 2 +- hotspot/src/share/vm/prims/whitebox.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 1 + hotspot/src/share/vm/runtime/init.cpp | 2 +- hotspot/src/share/vm/runtime/java.cpp | 2 +- hotspot/src/share/vm/runtime/reflection.cpp | 2 +- hotspot/src/share/vm/runtime/safepoint.cpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 1 + hotspot/src/share/vm/utilities/hashtable.cpp | 1 + 25 files changed, 716 insertions(+), 642 deletions(-) create mode 100644 hotspot/src/share/vm/classfile/stringTable.cpp create mode 100644 hotspot/src/share/vm/classfile/stringTable.hpp diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 9e17d77a55c..0a5e2d92c96 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/vmSymbols.hpp" #include "code/debugInfo.hpp" #include "code/pcDesc.hpp" diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp new file mode 100644 index 00000000000..c870d99e5e1 --- /dev/null +++ b/hotspot/src/share/vm/classfile/stringTable.cpp @@ -0,0 +1,531 @@ +/* + * Copyright (c) 1997, 2014, 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. + * + */ + +#include "precompiled.hpp" +#include "classfile/altHashing.hpp" +#include "classfile/javaClasses.hpp" +#include "classfile/stringTable.hpp" +#include "classfile/systemDictionary.hpp" +#include "gc_interface/collectedHeap.inline.hpp" +#include "memory/allocation.inline.hpp" +#include "memory/filemap.hpp" +#include "memory/gcLocker.inline.hpp" +#include "oops/oop.inline.hpp" +#include "oops/oop.inline2.hpp" +#include "runtime/mutexLocker.hpp" +#include "utilities/hashtable.inline.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/g1/g1StringDedup.hpp" +#endif + +// the number of buckets a thread claims +const int ClaimChunkSize = 32; + +#ifdef ASSERT +class StableMemoryChecker : public StackObj { + enum { _bufsize = wordSize*4 }; + + address _region; + jint _size; + u1 _save_buf[_bufsize]; + + int sample(u1* save_buf) { + if (_size <= _bufsize) { + memcpy(save_buf, _region, _size); + return _size; + } else { + // copy head and tail + memcpy(&save_buf[0], _region, _bufsize/2); + memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2); + return (_bufsize/2)*2; + } + } + + public: + StableMemoryChecker(const void* region, jint size) { + _region = (address) region; + _size = size; + sample(_save_buf); + } + + bool verify() { + u1 check_buf[sizeof(_save_buf)]; + int check_size = sample(check_buf); + return (0 == memcmp(_save_buf, check_buf, check_size)); + } + + void set_region(const void* region) { _region = (address) region; } +}; +#endif + + +// -------------------------------------------------------------------------- +StringTable* StringTable::_the_table = NULL; + +bool StringTable::_needs_rehashing = false; + +volatile int StringTable::_parallel_claimed_idx = 0; + +// Pick hashing algorithm +unsigned int StringTable::hash_string(const jchar* s, int len) { + return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) : + java_lang_String::hash_code(s, len); +} + +oop StringTable::lookup(int index, jchar* name, + int len, unsigned int hash) { + int count = 0; + for (HashtableEntry* l = bucket(index); l != NULL; l = l->next()) { + count++; + if (l->hash() == hash) { + if (java_lang_String::equals(l->literal(), name, len)) { + return l->literal(); + } + } + } + // If the bucket size is too deep check if this hash code is insufficient. + if (count >= BasicHashtable::rehash_count && !needs_rehashing()) { + _needs_rehashing = check_rehash_table(count); + } + return NULL; +} + + +oop StringTable::basic_add(int index_arg, Handle string, jchar* name, + int len, unsigned int hashValue_arg, TRAPS) { + + assert(java_lang_String::equals(string(), name, len), + "string must be properly initialized"); + // Cannot hit a safepoint in this function because the "this" pointer can move. + No_Safepoint_Verifier nsv; + + // Check if the symbol table has been rehashed, if so, need to recalculate + // the hash value and index before second lookup. + unsigned int hashValue; + int index; + if (use_alternate_hashcode()) { + hashValue = hash_string(name, len); + index = hash_to_index(hashValue); + } else { + hashValue = hashValue_arg; + index = index_arg; + } + + // Since look-up was done lock-free, we need to check if another + // thread beat us in the race to insert the symbol. + + oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int) + if (test != NULL) { + // Entry already added + return test; + } + + HashtableEntry* entry = new_entry(hashValue, string()); + add_entry(index, entry); + return string(); +} + + +oop StringTable::lookup(Symbol* symbol) { + ResourceMark rm; + int length; + jchar* chars = symbol->as_unicode(length); + return lookup(chars, length); +} + + +oop StringTable::lookup(jchar* name, int len) { + unsigned int hash = hash_string(name, len); + int index = the_table()->hash_to_index(hash); + return the_table()->lookup(index, name, len, hash); +} + + +oop StringTable::intern(Handle string_or_null, jchar* name, + int len, TRAPS) { + unsigned int hashValue = hash_string(name, len); + int index = the_table()->hash_to_index(hashValue); + oop found_string = the_table()->lookup(index, name, len, hashValue); + + // Found + if (found_string != NULL) return found_string; + + debug_only(StableMemoryChecker smc(name, len * sizeof(name[0]))); + assert(!Universe::heap()->is_in_reserved(name), + "proposed name of symbol must be stable"); + + Handle string; + // try to reuse the string if possible + if (!string_or_null.is_null()) { + string = string_or_null; + } else { + string = java_lang_String::create_from_unicode(name, len, CHECK_NULL); + } + +#if INCLUDE_ALL_GCS + if (G1StringDedup::is_enabled()) { + // Deduplicate the string before it is interned. Note that we should never + // deduplicate a string after it has been interned. Doing so will counteract + // compiler optimizations done on e.g. interned string literals. + G1StringDedup::deduplicate(string()); + } +#endif + + // Grab the StringTable_lock before getting the_table() because it could + // change at safepoint. + MutexLocker ml(StringTable_lock, THREAD); + + // Otherwise, add to symbol to table + return the_table()->basic_add(index, string, name, len, + hashValue, CHECK_NULL); +} + +oop StringTable::intern(Symbol* symbol, TRAPS) { + if (symbol == NULL) return NULL; + ResourceMark rm(THREAD); + int length; + jchar* chars = symbol->as_unicode(length); + Handle string; + oop result = intern(string, chars, length, CHECK_NULL); + return result; +} + + +oop StringTable::intern(oop string, TRAPS) +{ + if (string == NULL) return NULL; + ResourceMark rm(THREAD); + int length; + Handle h_string (THREAD, string); + jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL); + oop result = intern(h_string, chars, length, CHECK_NULL); + return result; +} + + +oop StringTable::intern(const char* utf8_string, TRAPS) { + if (utf8_string == NULL) return NULL; + ResourceMark rm(THREAD); + int length = UTF8::unicode_length(utf8_string); + jchar* chars = NEW_RESOURCE_ARRAY(jchar, length); + UTF8::convert_to_unicode(utf8_string, chars, length); + Handle string; + oop result = intern(string, chars, length, CHECK_NULL); + return result; +} + +void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { + buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed); +} + +void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { + // Readers of the table are unlocked, so we should only be removing + // entries at a safepoint. + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); + const int limit = the_table()->table_size(); + + for (;;) { + // Grab next set of buckets to scan + int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; + if (start_idx >= limit) { + // End of table + break; + } + + int end_idx = MIN2(limit, start_idx + ClaimChunkSize); + buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed); + } +} + +void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) { + const int limit = the_table()->table_size(); + + assert(0 <= start_idx && start_idx <= limit, + err_msg("start_idx (%d) is out of bounds", start_idx)); + assert(0 <= end_idx && end_idx <= limit, + err_msg("end_idx (%d) is out of bounds", end_idx)); + assert(start_idx <= end_idx, + err_msg("Index ordering: start_idx=%d, end_idx=%d", + start_idx, end_idx)); + + for (int i = start_idx; i < end_idx; i += 1) { + HashtableEntry* entry = the_table()->bucket(i); + while (entry != NULL) { + assert(!entry->is_shared(), "CDS not used for the StringTable"); + + f->do_oop((oop*)entry->literal_addr()); + + entry = entry->next(); + } + } +} + +void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) { + const int limit = the_table()->table_size(); + + assert(0 <= start_idx && start_idx <= limit, + err_msg("start_idx (%d) is out of bounds", start_idx)); + assert(0 <= end_idx && end_idx <= limit, + err_msg("end_idx (%d) is out of bounds", end_idx)); + assert(start_idx <= end_idx, + err_msg("Index ordering: start_idx=%d, end_idx=%d", + start_idx, end_idx)); + + for (int i = start_idx; i < end_idx; ++i) { + HashtableEntry** p = the_table()->bucket_addr(i); + HashtableEntry* entry = the_table()->bucket(i); + while (entry != NULL) { + assert(!entry->is_shared(), "CDS not used for the StringTable"); + + if (is_alive->do_object_b(entry->literal())) { + if (f != NULL) { + f->do_oop((oop*)entry->literal_addr()); + } + p = entry->next_addr(); + } else { + *p = entry->next(); + the_table()->free_entry(entry); + (*removed)++; + } + (*processed)++; + entry = *p; + } + } +} + +void StringTable::oops_do(OopClosure* f) { + buckets_oops_do(f, 0, the_table()->table_size()); +} + +void StringTable::possibly_parallel_oops_do(OopClosure* f) { + const int limit = the_table()->table_size(); + + for (;;) { + // Grab next set of buckets to scan + int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; + if (start_idx >= limit) { + // End of table + break; + } + + int end_idx = MIN2(limit, start_idx + ClaimChunkSize); + buckets_oops_do(f, start_idx, end_idx); + } +} + +// This verification is part of Universe::verify() and needs to be quick. +// See StringTable::verify_and_compare() below for exhaustive verification. +void StringTable::verify() { + for (int i = 0; i < the_table()->table_size(); ++i) { + HashtableEntry* p = the_table()->bucket(i); + for ( ; p != NULL; p = p->next()) { + oop s = p->literal(); + guarantee(s != NULL, "interned string is NULL"); + unsigned int h = java_lang_String::hash_string(s); + guarantee(p->hash() == h, "broken hash in string table entry"); + guarantee(the_table()->hash_to_index(h) == i, + "wrong index in string table"); + } + } +} + +void StringTable::dump(outputStream* st) { + the_table()->dump_table(st, "StringTable"); +} + +StringTable::VerifyRetTypes StringTable::compare_entries( + int bkt1, int e_cnt1, + HashtableEntry* e_ptr1, + int bkt2, int e_cnt2, + HashtableEntry* e_ptr2) { + // These entries are sanity checked by verify_and_compare_entries() + // before this function is called. + oop str1 = e_ptr1->literal(); + oop str2 = e_ptr2->literal(); + + if (str1 == str2) { + tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") " + "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]", + (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2); + return _verify_fail_continue; + } + + if (java_lang_String::equals(str1, str2)) { + tty->print_cr("ERROR: identical String values in entry @ " + "bucket[%d][%d] and entry @ bucket[%d][%d]", + bkt1, e_cnt1, bkt2, e_cnt2); + return _verify_fail_continue; + } + + return _verify_pass; +} + +StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt, + HashtableEntry* e_ptr, + StringTable::VerifyMesgModes mesg_mode) { + + VerifyRetTypes ret = _verify_pass; // be optimistic + + oop str = e_ptr->literal(); + if (str == NULL) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt, + e_cnt); + } + // NULL oop means no more verifications are possible + return _verify_fail_done; + } + + if (str->klass() != SystemDictionary::String_klass()) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]", + bkt, e_cnt); + } + // not a String means no more verifications are possible + return _verify_fail_done; + } + + unsigned int h = java_lang_String::hash_string(str); + if (e_ptr->hash() != h) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], " + "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h); + } + ret = _verify_fail_continue; + } + + if (the_table()->hash_to_index(h) != bkt) { + if (mesg_mode == _verify_with_mesgs) { + tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], " + "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h, + the_table()->hash_to_index(h)); + } + ret = _verify_fail_continue; + } + + return ret; +} + +// See StringTable::verify() above for the quick verification that is +// part of Universe::verify(). This verification is exhaustive and +// reports on every issue that is found. StringTable::verify() only +// reports on the first issue that is found. +// +// StringTable::verify_entry() checks: +// - oop value != NULL (same as verify()) +// - oop value is a String +// - hash(String) == hash in entry (same as verify()) +// - index for hash == index of entry (same as verify()) +// +// StringTable::compare_entries() checks: +// - oops are unique across all entries +// - String values are unique across all entries +// +int StringTable::verify_and_compare_entries() { + assert(StringTable_lock->is_locked(), "sanity check"); + + int fail_cnt = 0; + + // first, verify all the entries individually: + for (int bkt = 0; bkt < the_table()->table_size(); bkt++) { + HashtableEntry* e_ptr = the_table()->bucket(bkt); + for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) { + VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs); + if (ret != _verify_pass) { + fail_cnt++; + } + } + } + + // Optimization: if the above check did not find any failures, then + // the comparison loop below does not need to call verify_entry() + // before calling compare_entries(). If there were failures, then we + // have to call verify_entry() to see if the entry can be passed to + // compare_entries() safely. When we call verify_entry() in the loop + // below, we do so quietly to void duplicate messages and we don't + // increment fail_cnt because the failures have already been counted. + bool need_entry_verify = (fail_cnt != 0); + + // second, verify all entries relative to each other: + for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) { + HashtableEntry* e_ptr1 = the_table()->bucket(bkt1); + for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) { + if (need_entry_verify) { + VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1, + _verify_quietly); + if (ret == _verify_fail_done) { + // cannot use the current entry to compare against other entries + continue; + } + } + + for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) { + HashtableEntry* e_ptr2 = the_table()->bucket(bkt2); + int e_cnt2; + for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) { + if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) { + // skip the entries up to and including the one that + // we're comparing against + continue; + } + + if (need_entry_verify) { + VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2, + _verify_quietly); + if (ret == _verify_fail_done) { + // cannot compare against this entry + continue; + } + } + + // compare two entries, report and count any failures: + if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2) + != _verify_pass) { + fail_cnt++; + } + } + } + } + } + return fail_cnt; +} + +// Create a new table and using alternate hash code, populate the new table +// with the existing strings. Set flag to use the alternate hash code afterwards. +void StringTable::rehash_table() { + assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); + // This should never happen with -Xshare:dump but it might in testing mode. + if (DumpSharedSpaces) return; + StringTable* new_table = new StringTable(); + + // Rehash the table + the_table()->move_to(new_table); + + // Delete the table and buckets (entries are reused in new table). + delete _the_table; + // Don't check if we need rehashing until the table gets unbalanced again. + // Then rehash with a new global seed. + _needs_rehashing = false; + _the_table = new_table; +} diff --git a/hotspot/src/share/vm/classfile/stringTable.hpp b/hotspot/src/share/vm/classfile/stringTable.hpp new file mode 100644 index 00000000000..af6f909f200 --- /dev/null +++ b/hotspot/src/share/vm/classfile/stringTable.hpp @@ -0,0 +1,162 @@ +/* + * Copyright (c) 1997, 2013, 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. + * + */ + +#ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP +#define SHARE_VM_CLASSFILE_STRINGTABLE_HPP + +#include "memory/allocation.inline.hpp" +#include "utilities/hashtable.hpp" + +class StringTable : public Hashtable { + friend class VMStructs; + friend class Symbol; + +private: + // The string table + static StringTable* _the_table; + + // Set if one bucket is out of balance due to hash algorithm deficiency + static bool _needs_rehashing; + + // Claimed high water mark for parallel chunked scanning + static volatile int _parallel_claimed_idx; + + static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); + oop basic_add(int index, Handle string_or_null, jchar* name, int len, + unsigned int hashValue, TRAPS); + + oop lookup(int index, jchar* chars, int length, unsigned int hashValue); + + // Apply the give oop closure to the entries to the buckets + // in the range [start_idx, end_idx). + static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); + // Unlink or apply the give oop closure to the entries to the buckets + // in the range [start_idx, end_idx). + static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); + + StringTable() : Hashtable((int)StringTableSize, + sizeof (HashtableEntry)) {} + + StringTable(HashtableBucket* t, int number_of_entries) + : Hashtable((int)StringTableSize, sizeof (HashtableEntry), t, + number_of_entries) {} +public: + // The string table + static StringTable* the_table() { return _the_table; } + + // Size of one bucket in the string table. Used when checking for rollover. + static uint bucket_size() { return sizeof(HashtableBucket); } + + static void create_table() { + assert(_the_table == NULL, "One string table allowed."); + _the_table = new StringTable(); + } + + // GC support + // Delete pointers to otherwise-unreachable objects. + static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) { + int processed = 0; + int removed = 0; + unlink_or_oops_do(cl, f, &processed, &removed); + } + static void unlink(BoolObjectClosure* cl) { + int processed = 0; + int removed = 0; + unlink_or_oops_do(cl, NULL, &processed, &removed); + } + static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); + static void unlink(BoolObjectClosure* cl, int* processed, int* removed) { + unlink_or_oops_do(cl, NULL, processed, removed); + } + // Serially invoke "f->do_oop" on the locations of all oops in the table. + static void oops_do(OopClosure* f); + + // Possibly parallel versions of the above + static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); + static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) { + possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed); + } + static void possibly_parallel_oops_do(OopClosure* f); + + // Hashing algorithm, used as the hash value used by the + // StringTable for bucket selection and comparison (stored in the + // HashtableEntry structures). This is used in the String.intern() method. + static unsigned int hash_string(const jchar* s, int len); + + // Internal test. + static void test_alt_hash() PRODUCT_RETURN; + + // Probing + static oop lookup(Symbol* symbol); + static oop lookup(jchar* chars, int length); + + // Interning + static oop intern(Symbol* symbol, TRAPS); + static oop intern(oop string, TRAPS); + static oop intern(const char *utf8_string, TRAPS); + + // Debugging + static void verify(); + static void dump(outputStream* st); + + enum VerifyMesgModes { + _verify_quietly = 0, + _verify_with_mesgs = 1 + }; + + enum VerifyRetTypes { + _verify_pass = 0, + _verify_fail_continue = 1, + _verify_fail_done = 2 + }; + + static VerifyRetTypes compare_entries(int bkt1, int e_cnt1, + HashtableEntry* e_ptr1, + int bkt2, int e_cnt2, + HashtableEntry* e_ptr2); + static VerifyRetTypes verify_entry(int bkt, int e_cnt, + HashtableEntry* e_ptr, + VerifyMesgModes mesg_mode); + static int verify_and_compare_entries(); + + // Sharing + static void copy_buckets(char** top, char*end) { + the_table()->Hashtable::copy_buckets(top, end); + } + static void copy_table(char** top, char*end) { + the_table()->Hashtable::copy_table(top, end); + } + static void reverse() { + the_table()->Hashtable::reverse(); + } + + // Rehash the symbol table if it gets out of balance + static void rehash_table(); + static bool needs_rehashing() { return _needs_rehashing; } + + // Parallel chunked scanning + static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; } + static int parallel_claimed_index() { return _parallel_claimed_idx; } +}; +#endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 40a06da9b34..5867c18790c 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -35,11 +35,6 @@ #include "oops/oop.inline2.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/hashtable.inline.hpp" -#if INCLUDE_ALL_GCS -#include "gc_implementation/g1/g1StringDedup.hpp" -#endif - -// -------------------------------------------------------------------------- // the number of buckets a thread claims const int ClaimChunkSize = 32; @@ -587,493 +582,3 @@ void SymbolTable::print() { } } #endif // PRODUCT - -// -------------------------------------------------------------------------- - -#ifdef ASSERT -class StableMemoryChecker : public StackObj { - enum { _bufsize = wordSize*4 }; - - address _region; - jint _size; - u1 _save_buf[_bufsize]; - - int sample(u1* save_buf) { - if (_size <= _bufsize) { - memcpy(save_buf, _region, _size); - return _size; - } else { - // copy head and tail - memcpy(&save_buf[0], _region, _bufsize/2); - memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2); - return (_bufsize/2)*2; - } - } - - public: - StableMemoryChecker(const void* region, jint size) { - _region = (address) region; - _size = size; - sample(_save_buf); - } - - bool verify() { - u1 check_buf[sizeof(_save_buf)]; - int check_size = sample(check_buf); - return (0 == memcmp(_save_buf, check_buf, check_size)); - } - - void set_region(const void* region) { _region = (address) region; } -}; -#endif - - -// -------------------------------------------------------------------------- -StringTable* StringTable::_the_table = NULL; - -bool StringTable::_needs_rehashing = false; - -volatile int StringTable::_parallel_claimed_idx = 0; - -// Pick hashing algorithm -unsigned int StringTable::hash_string(const jchar* s, int len) { - return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) : - java_lang_String::hash_code(s, len); -} - -oop StringTable::lookup(int index, jchar* name, - int len, unsigned int hash) { - int count = 0; - for (HashtableEntry* l = bucket(index); l != NULL; l = l->next()) { - count++; - if (l->hash() == hash) { - if (java_lang_String::equals(l->literal(), name, len)) { - return l->literal(); - } - } - } - // If the bucket size is too deep check if this hash code is insufficient. - if (count >= BasicHashtable::rehash_count && !needs_rehashing()) { - _needs_rehashing = check_rehash_table(count); - } - return NULL; -} - - -oop StringTable::basic_add(int index_arg, Handle string, jchar* name, - int len, unsigned int hashValue_arg, TRAPS) { - - assert(java_lang_String::equals(string(), name, len), - "string must be properly initialized"); - // Cannot hit a safepoint in this function because the "this" pointer can move. - No_Safepoint_Verifier nsv; - - // Check if the symbol table has been rehashed, if so, need to recalculate - // the hash value and index before second lookup. - unsigned int hashValue; - int index; - if (use_alternate_hashcode()) { - hashValue = hash_string(name, len); - index = hash_to_index(hashValue); - } else { - hashValue = hashValue_arg; - index = index_arg; - } - - // Since look-up was done lock-free, we need to check if another - // thread beat us in the race to insert the symbol. - - oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int) - if (test != NULL) { - // Entry already added - return test; - } - - HashtableEntry* entry = new_entry(hashValue, string()); - add_entry(index, entry); - return string(); -} - - -oop StringTable::lookup(Symbol* symbol) { - ResourceMark rm; - int length; - jchar* chars = symbol->as_unicode(length); - return lookup(chars, length); -} - - -oop StringTable::lookup(jchar* name, int len) { - unsigned int hash = hash_string(name, len); - int index = the_table()->hash_to_index(hash); - return the_table()->lookup(index, name, len, hash); -} - - -oop StringTable::intern(Handle string_or_null, jchar* name, - int len, TRAPS) { - unsigned int hashValue = hash_string(name, len); - int index = the_table()->hash_to_index(hashValue); - oop found_string = the_table()->lookup(index, name, len, hashValue); - - // Found - if (found_string != NULL) return found_string; - - debug_only(StableMemoryChecker smc(name, len * sizeof(name[0]))); - assert(!Universe::heap()->is_in_reserved(name), - "proposed name of symbol must be stable"); - - Handle string; - // try to reuse the string if possible - if (!string_or_null.is_null()) { - string = string_or_null; - } else { - string = java_lang_String::create_from_unicode(name, len, CHECK_NULL); - } - -#if INCLUDE_ALL_GCS - if (G1StringDedup::is_enabled()) { - // Deduplicate the string before it is interned. Note that we should never - // deduplicate a string after it has been interned. Doing so will counteract - // compiler optimizations done on e.g. interned string literals. - G1StringDedup::deduplicate(string()); - } -#endif - - // Grab the StringTable_lock before getting the_table() because it could - // change at safepoint. - MutexLocker ml(StringTable_lock, THREAD); - - // Otherwise, add to symbol to table - return the_table()->basic_add(index, string, name, len, - hashValue, CHECK_NULL); -} - -oop StringTable::intern(Symbol* symbol, TRAPS) { - if (symbol == NULL) return NULL; - ResourceMark rm(THREAD); - int length; - jchar* chars = symbol->as_unicode(length); - Handle string; - oop result = intern(string, chars, length, CHECK_NULL); - return result; -} - - -oop StringTable::intern(oop string, TRAPS) -{ - if (string == NULL) return NULL; - ResourceMark rm(THREAD); - int length; - Handle h_string (THREAD, string); - jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL); - oop result = intern(h_string, chars, length, CHECK_NULL); - return result; -} - - -oop StringTable::intern(const char* utf8_string, TRAPS) { - if (utf8_string == NULL) return NULL; - ResourceMark rm(THREAD); - int length = UTF8::unicode_length(utf8_string); - jchar* chars = NEW_RESOURCE_ARRAY(jchar, length); - UTF8::convert_to_unicode(utf8_string, chars, length); - Handle string; - oop result = intern(string, chars, length, CHECK_NULL); - return result; -} - -void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { - buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed); -} - -void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) { - // Readers of the table are unlocked, so we should only be removing - // entries at a safepoint. - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); - const int limit = the_table()->table_size(); - - for (;;) { - // Grab next set of buckets to scan - int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; - if (start_idx >= limit) { - // End of table - break; - } - - int end_idx = MIN2(limit, start_idx + ClaimChunkSize); - buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed); - } -} - -void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) { - const int limit = the_table()->table_size(); - - assert(0 <= start_idx && start_idx <= limit, - err_msg("start_idx (%d) is out of bounds", start_idx)); - assert(0 <= end_idx && end_idx <= limit, - err_msg("end_idx (%d) is out of bounds", end_idx)); - assert(start_idx <= end_idx, - err_msg("Index ordering: start_idx=%d, end_idx=%d", - start_idx, end_idx)); - - for (int i = start_idx; i < end_idx; i += 1) { - HashtableEntry* entry = the_table()->bucket(i); - while (entry != NULL) { - assert(!entry->is_shared(), "CDS not used for the StringTable"); - - f->do_oop((oop*)entry->literal_addr()); - - entry = entry->next(); - } - } -} - -void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) { - const int limit = the_table()->table_size(); - - assert(0 <= start_idx && start_idx <= limit, - err_msg("start_idx (%d) is out of bounds", start_idx)); - assert(0 <= end_idx && end_idx <= limit, - err_msg("end_idx (%d) is out of bounds", end_idx)); - assert(start_idx <= end_idx, - err_msg("Index ordering: start_idx=%d, end_idx=%d", - start_idx, end_idx)); - - for (int i = start_idx; i < end_idx; ++i) { - HashtableEntry** p = the_table()->bucket_addr(i); - HashtableEntry* entry = the_table()->bucket(i); - while (entry != NULL) { - assert(!entry->is_shared(), "CDS not used for the StringTable"); - - if (is_alive->do_object_b(entry->literal())) { - if (f != NULL) { - f->do_oop((oop*)entry->literal_addr()); - } - p = entry->next_addr(); - } else { - *p = entry->next(); - the_table()->free_entry(entry); - (*removed)++; - } - (*processed)++; - entry = *p; - } - } -} - -void StringTable::oops_do(OopClosure* f) { - buckets_oops_do(f, 0, the_table()->table_size()); -} - -void StringTable::possibly_parallel_oops_do(OopClosure* f) { - const int limit = the_table()->table_size(); - - for (;;) { - // Grab next set of buckets to scan - int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; - if (start_idx >= limit) { - // End of table - break; - } - - int end_idx = MIN2(limit, start_idx + ClaimChunkSize); - buckets_oops_do(f, start_idx, end_idx); - } -} - -// This verification is part of Universe::verify() and needs to be quick. -// See StringTable::verify_and_compare() below for exhaustive verification. -void StringTable::verify() { - for (int i = 0; i < the_table()->table_size(); ++i) { - HashtableEntry* p = the_table()->bucket(i); - for ( ; p != NULL; p = p->next()) { - oop s = p->literal(); - guarantee(s != NULL, "interned string is NULL"); - unsigned int h = java_lang_String::hash_string(s); - guarantee(p->hash() == h, "broken hash in string table entry"); - guarantee(the_table()->hash_to_index(h) == i, - "wrong index in string table"); - } - } -} - -void StringTable::dump(outputStream* st) { - the_table()->dump_table(st, "StringTable"); -} - -StringTable::VerifyRetTypes StringTable::compare_entries( - int bkt1, int e_cnt1, - HashtableEntry* e_ptr1, - int bkt2, int e_cnt2, - HashtableEntry* e_ptr2) { - // These entries are sanity checked by verify_and_compare_entries() - // before this function is called. - oop str1 = e_ptr1->literal(); - oop str2 = e_ptr2->literal(); - - if (str1 == str2) { - tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") " - "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]", - (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2); - return _verify_fail_continue; - } - - if (java_lang_String::equals(str1, str2)) { - tty->print_cr("ERROR: identical String values in entry @ " - "bucket[%d][%d] and entry @ bucket[%d][%d]", - bkt1, e_cnt1, bkt2, e_cnt2); - return _verify_fail_continue; - } - - return _verify_pass; -} - -StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt, - HashtableEntry* e_ptr, - StringTable::VerifyMesgModes mesg_mode) { - - VerifyRetTypes ret = _verify_pass; // be optimistic - - oop str = e_ptr->literal(); - if (str == NULL) { - if (mesg_mode == _verify_with_mesgs) { - tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt, - e_cnt); - } - // NULL oop means no more verifications are possible - return _verify_fail_done; - } - - if (str->klass() != SystemDictionary::String_klass()) { - if (mesg_mode == _verify_with_mesgs) { - tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]", - bkt, e_cnt); - } - // not a String means no more verifications are possible - return _verify_fail_done; - } - - unsigned int h = java_lang_String::hash_string(str); - if (e_ptr->hash() != h) { - if (mesg_mode == _verify_with_mesgs) { - tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], " - "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h); - } - ret = _verify_fail_continue; - } - - if (the_table()->hash_to_index(h) != bkt) { - if (mesg_mode == _verify_with_mesgs) { - tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], " - "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h, - the_table()->hash_to_index(h)); - } - ret = _verify_fail_continue; - } - - return ret; -} - -// See StringTable::verify() above for the quick verification that is -// part of Universe::verify(). This verification is exhaustive and -// reports on every issue that is found. StringTable::verify() only -// reports on the first issue that is found. -// -// StringTable::verify_entry() checks: -// - oop value != NULL (same as verify()) -// - oop value is a String -// - hash(String) == hash in entry (same as verify()) -// - index for hash == index of entry (same as verify()) -// -// StringTable::compare_entries() checks: -// - oops are unique across all entries -// - String values are unique across all entries -// -int StringTable::verify_and_compare_entries() { - assert(StringTable_lock->is_locked(), "sanity check"); - - int fail_cnt = 0; - - // first, verify all the entries individually: - for (int bkt = 0; bkt < the_table()->table_size(); bkt++) { - HashtableEntry* e_ptr = the_table()->bucket(bkt); - for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) { - VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs); - if (ret != _verify_pass) { - fail_cnt++; - } - } - } - - // Optimization: if the above check did not find any failures, then - // the comparison loop below does not need to call verify_entry() - // before calling compare_entries(). If there were failures, then we - // have to call verify_entry() to see if the entry can be passed to - // compare_entries() safely. When we call verify_entry() in the loop - // below, we do so quietly to void duplicate messages and we don't - // increment fail_cnt because the failures have already been counted. - bool need_entry_verify = (fail_cnt != 0); - - // second, verify all entries relative to each other: - for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) { - HashtableEntry* e_ptr1 = the_table()->bucket(bkt1); - for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) { - if (need_entry_verify) { - VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1, - _verify_quietly); - if (ret == _verify_fail_done) { - // cannot use the current entry to compare against other entries - continue; - } - } - - for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) { - HashtableEntry* e_ptr2 = the_table()->bucket(bkt2); - int e_cnt2; - for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) { - if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) { - // skip the entries up to and including the one that - // we're comparing against - continue; - } - - if (need_entry_verify) { - VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2, - _verify_quietly); - if (ret == _verify_fail_done) { - // cannot compare against this entry - continue; - } - } - - // compare two entries, report and count any failures: - if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2) - != _verify_pass) { - fail_cnt++; - } - } - } - } - } - return fail_cnt; -} - -// Create a new table and using alternate hash code, populate the new table -// with the existing strings. Set flag to use the alternate hash code afterwards. -void StringTable::rehash_table() { - assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); - // This should never happen with -Xshare:dump but it might in testing mode. - if (DumpSharedSpaces) return; - StringTable* new_table = new StringTable(); - - // Rehash the table - the_table()->move_to(new_table); - - // Delete the table and buckets (entries are reused in new table). - delete _the_table; - // Don't check if we need rehashing until the table gets unbalanced again. - // Then rehash with a new global seed. - _needs_rehashing = false; - _the_table = new_table; -} diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp index b0a2fcb38b8..c5dd75b82ea 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.hpp +++ b/hotspot/src/share/vm/classfile/symbolTable.hpp @@ -42,7 +42,6 @@ class BoolObjectClosure; class outputStream; - // Class to hold a newly created or referenced Symbol* temporarily in scope. // new_symbol() and lookup() will create a Symbol* if not already in the // symbol table and add to the symbol's reference count. @@ -252,134 +251,4 @@ public: static int parallel_claimed_index() { return _parallel_claimed_idx; } }; -class StringTable : public Hashtable { - friend class VMStructs; - -private: - // The string table - static StringTable* _the_table; - - // Set if one bucket is out of balance due to hash algorithm deficiency - static bool _needs_rehashing; - - // Claimed high water mark for parallel chunked scanning - static volatile int _parallel_claimed_idx; - - static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); - oop basic_add(int index, Handle string_or_null, jchar* name, int len, - unsigned int hashValue, TRAPS); - - oop lookup(int index, jchar* chars, int length, unsigned int hashValue); - - // Apply the give oop closure to the entries to the buckets - // in the range [start_idx, end_idx). - static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx); - // Unlink or apply the give oop closure to the entries to the buckets - // in the range [start_idx, end_idx). - static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed); - - StringTable() : Hashtable((int)StringTableSize, - sizeof (HashtableEntry)) {} - - StringTable(HashtableBucket* t, int number_of_entries) - : Hashtable((int)StringTableSize, sizeof (HashtableEntry), t, - number_of_entries) {} -public: - // The string table - static StringTable* the_table() { return _the_table; } - - // Size of one bucket in the string table. Used when checking for rollover. - static uint bucket_size() { return sizeof(HashtableBucket); } - - static void create_table() { - assert(_the_table == NULL, "One string table allowed."); - _the_table = new StringTable(); - } - - // GC support - // Delete pointers to otherwise-unreachable objects. - static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) { - int processed = 0; - int removed = 0; - unlink_or_oops_do(cl, f, &processed, &removed); - } - static void unlink(BoolObjectClosure* cl) { - int processed = 0; - int removed = 0; - unlink_or_oops_do(cl, NULL, &processed, &removed); - } - static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); - static void unlink(BoolObjectClosure* cl, int* processed, int* removed) { - unlink_or_oops_do(cl, NULL, processed, removed); - } - // Serially invoke "f->do_oop" on the locations of all oops in the table. - static void oops_do(OopClosure* f); - - // Possibly parallel versions of the above - static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed); - static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) { - possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed); - } - static void possibly_parallel_oops_do(OopClosure* f); - - // Hashing algorithm, used as the hash value used by the - // StringTable for bucket selection and comparison (stored in the - // HashtableEntry structures). This is used in the String.intern() method. - static unsigned int hash_string(const jchar* s, int len); - - // Internal test. - static void test_alt_hash() PRODUCT_RETURN; - - // Probing - static oop lookup(Symbol* symbol); - static oop lookup(jchar* chars, int length); - - // Interning - static oop intern(Symbol* symbol, TRAPS); - static oop intern(oop string, TRAPS); - static oop intern(const char *utf8_string, TRAPS); - - // Debugging - static void verify(); - static void dump(outputStream* st); - - enum VerifyMesgModes { - _verify_quietly = 0, - _verify_with_mesgs = 1 - }; - - enum VerifyRetTypes { - _verify_pass = 0, - _verify_fail_continue = 1, - _verify_fail_done = 2 - }; - - static VerifyRetTypes compare_entries(int bkt1, int e_cnt1, - HashtableEntry* e_ptr1, - int bkt2, int e_cnt2, - HashtableEntry* e_ptr2); - static VerifyRetTypes verify_entry(int bkt, int e_cnt, - HashtableEntry* e_ptr, - VerifyMesgModes mesg_mode); - static int verify_and_compare_entries(); - - // Sharing - static void copy_buckets(char** top, char*end) { - the_table()->Hashtable::copy_buckets(top, end); - } - static void copy_table(char** top, char*end) { - the_table()->Hashtable::copy_table(top, end); - } - static void reverse() { - the_table()->Hashtable::reverse(); - } - - // Rehash the symbol table if it gets out of balance - static void rehash_table(); - static bool needs_rehashing() { return _needs_rehashing; } - - // Parallel chunked scanning - static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; } - static int parallel_claimed_index() { return _parallel_claimed_idx; } -}; #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 304a88f54e7..6d816427c82 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -29,6 +29,7 @@ #include "classfile/loaderConstraints.hpp" #include "classfile/placeholders.hpp" #include "classfile/resolutionErrors.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 40ff7b30e40..dc87162d864 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "classfile/classLoaderData.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 79a19976658..b6a53a40b4f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/stringTable.hpp" #include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "gc_implementation/g1/bufferingOopClosure.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index cdfc31911ee..c5819a93877 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -1,3 +1,4 @@ + /* * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -23,7 +24,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index e93f612e4bd..4654c35d98e 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index de18bd00d05..3ec667d1037 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -1,3 +1,4 @@ + /* * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -23,7 +24,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "code/codeCache.hpp" #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index 80a35d10e2c..64d7c3eaa61 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index b59635c9f33..d58c21b2d90 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "gc_interface/collectedHeap.inline.hpp" diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 63c7c005d44..7573d94b3f6 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -26,7 +26,7 @@ #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index 5f005dcb12e..2a84181a3ce 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -26,7 +26,7 @@ #include "classfile/classLoaderData.hpp" #include "classfile/javaClasses.hpp" #include "classfile/metadataOnStackMark.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "interpreter/linkResolver.hpp" diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index e6c059c0d30..e7d1d64da71 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -26,7 +26,7 @@ #include "classfile/classLoader.hpp" #include "classfile/javaAssertions.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "gc_interface/collectedHeap.inline.hpp" diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index e1fafabf54d..6af676abb97 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "compiler/compileBroker.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/oopMapCache.hpp" diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 2289618ff6d..bb09c7000c1 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -27,7 +27,7 @@ #include "memory/universe.hpp" #include "oops/oop.inline.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/classLoaderData.hpp" #include "prims/whitebox.hpp" diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 0d1655c7997..bc64080dd14 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/javaAssertions.hpp" +#include "classfile/stringTable.hpp" #include "classfile/symbolTable.hpp" #include "compiler/compilerOracle.hpp" #include "memory/allocation.inline.hpp" diff --git a/hotspot/src/share/vm/runtime/init.cpp b/hotspot/src/share/vm/runtime/init.cpp index 4533c7e8127..6c654d280e2 100644 --- a/hotspot/src/share/vm/runtime/init.cpp +++ b/hotspot/src/share/vm/runtime/init.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "code/icBuffer.hpp" #include "gc_interface/collectedHeap.hpp" #include "interpreter/bytecodes.hpp" diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index cddfd3d1ffc..6bdfb20e152 100644 --- a/hotspot/src/share/vm/runtime/java.cpp +++ b/hotspot/src/share/vm/runtime/java.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index de707164d03..c692687a3a3 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/verifier.hpp" #include "classfile/vmSymbols.hpp" diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index 7e7f36788f1..d32dbed4518 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "classfile/symbolTable.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" #include "code/icBuffer.hpp" diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 2bffd9b33db..5d8fb2e3ba3 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -27,6 +27,7 @@ #include "classfile/javaClasses.hpp" #include "classfile/loaderConstraints.hpp" #include "classfile/placeholders.hpp" +#include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "ci/ciField.hpp" #include "ci/ciInstance.hpp" diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index 8698cca914a..c0c73c425fc 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/altHashing.hpp" #include "classfile/javaClasses.hpp" +#include "classfile/stringTable.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" #include "memory/resourceArea.hpp" From 09c2deeb5aa8544896c26f2d6e60d78287fa43a7 Mon Sep 17 00:00:00 2001 From: Andreas Sjoberg Date: Thu, 8 May 2014 10:29:17 +0200 Subject: [PATCH 045/185] 8042474: Clean up duplicated code in RSHashTable Removed duplicate code in RSHashTable to fetch SparsePRTEntries Reviewed-by: tschatzl, brutisso --- .../vm/gc_implementation/g1/sparsePRT.cpp | 42 ++++--------------- .../vm/gc_implementation/g1/sparsePRT.hpp | 10 +---- 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp index 11f30c36283..fe33cef7d28 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -194,23 +194,16 @@ bool RSHashTable::add_card(RegionIdx_t region_ind, CardIdx_t card_index) { } bool RSHashTable::get_cards(RegionIdx_t region_ind, CardIdx_t* cards) { - int ind = (int) (region_ind & capacity_mask()); - int cur_ind = _buckets[ind]; - SparsePRTEntry* cur; - while (cur_ind != NullEntry && - (cur = entry(cur_ind))->r_ind() != region_ind) { - cur_ind = cur->next_index(); + SparsePRTEntry* entry = get_entry(region_ind); + if (entry == NULL) { + return false; } - - if (cur_ind == NullEntry) return false; // Otherwise... - assert(cur->r_ind() == region_ind, "Postcondition of loop + test above."); - assert(cur->num_valid_cards() > 0, "Inv"); - cur->copy_cards(cards); + entry->copy_cards(cards); return true; } -SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) { +SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) const { int ind = (int) (region_ind & capacity_mask()); int cur_ind = _buckets[ind]; SparsePRTEntry* cur; @@ -246,28 +239,9 @@ bool RSHashTable::delete_entry(RegionIdx_t region_ind) { return true; } -SparsePRTEntry* -RSHashTable::entry_for_region_ind(RegionIdx_t region_ind) const { - assert(occupied_entries() < capacity(), "Precondition"); - int ind = (int) (region_ind & capacity_mask()); - int cur_ind = _buckets[ind]; - SparsePRTEntry* cur; - while (cur_ind != NullEntry && - (cur = entry(cur_ind))->r_ind() != region_ind) { - cur_ind = cur->next_index(); - } - - if (cur_ind != NullEntry) { - assert(cur->r_ind() == region_ind, "Loop postcondition + test"); - return cur; - } else { - return NULL; - } -} - SparsePRTEntry* RSHashTable::entry_for_region_ind_create(RegionIdx_t region_ind) { - SparsePRTEntry* res = entry_for_region_ind(region_ind); + SparsePRTEntry* res = get_entry(region_ind); if (res == NULL) { int new_ind = alloc_entry(); assert(0 <= new_ind && (size_t)new_ind < capacity(), "There should be room."); @@ -365,7 +339,7 @@ bool RSHashTableIter::has_next(size_t& card_index) { } bool RSHashTable::contains_card(RegionIdx_t region_index, CardIdx_t card_index) const { - SparsePRTEntry* e = entry_for_region_ind(region_index); + SparsePRTEntry* e = get_entry(region_index); return (e != NULL && e->contains_card(card_index)); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp index 6094837d35a..a534ceca5f1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -119,12 +119,6 @@ class RSHashTable : public CHeapObj { int _free_region; int _free_list; - // Requires that the caller hold a lock preventing parallel modifying - // operations, and that the the table be less than completely full. If - // an entry for "region_ind" is already in the table, finds it and - // returns its address; otherwise returns "NULL." - SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const; - // Requires that the caller hold a lock preventing parallel modifying // operations, and that the the table be less than completely full. If // an entry for "region_ind" is already in the table, finds it and @@ -158,7 +152,7 @@ public: void add_entry(SparsePRTEntry* e); - SparsePRTEntry* get_entry(RegionIdx_t region_id); + SparsePRTEntry* get_entry(RegionIdx_t region_id) const; void clear(); From 535c74a38e4e5b6f46e0749cc7926c313f713ca0 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 8 May 2014 11:46:03 +0200 Subject: [PATCH 046/185] 8042416: X11GraphicsEnvironment.isDisplayLocal() throws NoSuchElementException if DISPLAY host has more IP addresses than a local interface Reviewed-by: anthony, azvegint --- jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java index 02f491d6707..cfa6e516dfe 100644 --- a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java +++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java @@ -277,8 +277,9 @@ public class X11GraphicsEnvironment for (; interfaces.hasMoreElements();) { locals = interfaces.nextElement().getInetAddresses(); for (; locals.hasMoreElements();) { + final InetAddress localAddr = locals.nextElement(); for (int i = 0; i < remAddr.length; i++) { - if (locals.nextElement().equals(remAddr[i])) { + if (localAddr.equals(remAddr[i])) { return Boolean.TRUE; } } From 1ec8e7aa8a6ee79c58d5c9fb5e28579cbff2a1cd Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Thu, 8 May 2014 16:50:42 +0400 Subject: [PATCH 047/185] 8036917: [macosx] Native memory leaks Reviewed-by: serb, azvegint --- jdk/src/macosx/native/sun/awt/CImage.m | 33 +++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/CImage.m b/jdk/src/macosx/native/sun/awt/CImage.m index b6db3458047..e4ef6306031 100644 --- a/jdk/src/macosx/native/sun/awt/CImage.m +++ b/jdk/src/macosx/native/sun/awt/CImage.m @@ -76,17 +76,17 @@ static void CImage_CopyNSImageIntoArray static NSBitmapImageRep* CImage_CreateImageRep(JNIEnv *env, jintArray buffer, jint width, jint height) { - NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:width - pixelsHigh:height - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSDeviceRGBColorSpace - bitmapFormat:NSAlphaFirstBitmapFormat - bytesPerRow:width*4 // TODO: use explicit scanStride - bitsPerPixel:32]; + NSBitmapImageRep* imageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL + pixelsWide:width + pixelsHigh:height + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat:NSAlphaFirstBitmapFormat + bytesPerRow:width*4 // TODO: use explicit scanStride + bitsPerPixel:32] autorelease]; jint *imgData = (jint *)[imageRep bitmapData]; if (imgData == NULL) return 0L; @@ -115,9 +115,8 @@ JNF_COCOA_ENTER(env); NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height); if (imageRep) { - NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain]; + NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)]; [nsImage addRepresentation:imageRep]; - [imageRep release]; result = ptr_to_jlong(nsImage); } @@ -160,7 +159,7 @@ JNF_COCOA_ENTER(env); (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT); } if ([reps count]) { - NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(0, 0)] retain]; + NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)]; [nsImage addRepresentations: reps]; result = ptr_to_jlong(nsImage); } @@ -184,7 +183,7 @@ JNF_COCOA_ENTER(env); IconRef iconRef; if (noErr == GetIconRef(kOnSystemDisk, kSystemIconsCreator, selector, &iconRef)) { - image = [[[NSImage alloc] initWithIconRef:iconRef] retain]; + image = [[NSImage alloc] initWithIconRef:iconRef]; ReleaseIconRef(iconRef); } @@ -206,7 +205,7 @@ JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CImage_nativeCreateNSImageFromFile JNF_COCOA_ENTER(env); NSString *path = JNFNormalizedNSStringForPath(env, file); - image = [[[NSImage alloc] initByReferencingFile:path] retain]; + image = [[NSImage alloc] initByReferencingFile:path]; JNF_COCOA_EXIT(env); @@ -435,7 +434,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_lwawt_macosx_CImage_nativeGetPlatformImage JNF_COCOA_ENTER(env); - NSBitmapImageRep* imageRep = [CImage_CreateImageRep(env, buffer, width, height) autorelease]; + NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height); if (imageRep) { NSData *tiffImage = [imageRep TIFFRepresentation]; jsize tiffSize = (jsize)[tiffImage length]; From 7ef690b2c7dfd63a5b053aa84ee44b450f72507e Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Thu, 15 May 2014 09:09:28 +0200 Subject: [PATCH 048/185] 8026694: New type profiling points break compilation replay Fixes compilation replay with new profiling points Reviewed-by: kvn, twisti --- .../classes/sun/jvm/hotspot/ci/ciEnv.java | 11 +- .../classes/sun/jvm/hotspot/ci/ciKlass.java | 5 + .../classes/sun/jvm/hotspot/ci/ciMethod.java | 30 ++- .../sun/jvm/hotspot/ci/ciMethodData.java | 185 ++++++++++++--- .../ArgInfoData.java} | 34 +-- .../sun/jvm/hotspot/oops/CallTypeData.java | 108 +++++++++ .../hotspot/oops/CallTypeDataInterface.java | 35 +++ .../sun/jvm/hotspot/oops/DataLayout.java | 17 +- .../classes/sun/jvm/hotspot/oops/Method.java | 10 +- .../sun/jvm/hotspot/oops/MethodData.java | 220 +++++++++++++++--- .../jvm/hotspot/oops/MethodDataInterface.java | 39 ++++ .../jvm/hotspot/oops/ParametersTypeData.java | 74 ++++++ .../jvm/hotspot/oops/ReceiverTypeData.java | 16 +- .../ReturnTypeEntry.java} | 39 ++-- .../jvm/hotspot/oops/SpeculativeTrapData.java | 70 ++++++ .../sun/jvm/hotspot/oops/TypeEntries.java | 97 ++++++++ .../jvm/hotspot/oops/TypeEntriesAtCall.java | 54 +++++ .../hotspot/oops/TypeStackSlotEntries.java | 91 ++++++++ .../sun/jvm/hotspot/oops/VirtualCallData.java | 6 +- .../jvm/hotspot/oops/VirtualCallTypeData.java | 108 +++++++++ hotspot/src/share/vm/ci/ciMethodData.cpp | 121 +++++++--- hotspot/src/share/vm/ci/ciMethodData.hpp | 27 ++- hotspot/src/share/vm/ci/ciReplay.cpp | 58 +++-- hotspot/src/share/vm/oops/methodData.hpp | 43 +++- hotspot/src/share/vm/runtime/vmStructs.cpp | 5 + 25 files changed, 1306 insertions(+), 197 deletions(-) rename hotspot/agent/src/share/classes/sun/jvm/hotspot/{ci/ciVirtualCallData.java => oops/ArgInfoData.java} (62%) create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java rename hotspot/agent/src/share/classes/sun/jvm/hotspot/{ci/ciReceiverTypeData.java => oops/ReturnTypeEntry.java} (62%) create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java create mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java index c0db13d1365..ca4b2f5aa34 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java @@ -64,7 +64,11 @@ public class ciEnv extends VMObject { } public Compile compilerData() { - return new Compile(compilerDataField.getValue(this.getAddress())); + Address addr = compilerDataField.getValue(this.getAddress()); + if (addr == null) { + return null; + } + return new Compile(addr); } public ciObjectFactory factory() { @@ -94,10 +98,7 @@ public class ciEnv extends VMObject { Method method = task.method(); int entryBci = task.osrBci(); int compLevel = task.compLevel(); - Klass holder = method.getMethodHolder(); - out.print("compile " + holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + + out.print("compile " + method.nameAsAscii() + " " + entryBci + " " + compLevel); Compile compiler = compilerData(); if (compiler != null) { diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java index aba64a5015e..2e03c5481aa 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java @@ -55,4 +55,9 @@ public class ciKlass extends ciType { public ciKlass(Address addr) { super(addr); } + + public void printValueOn(PrintStream tty) { + Klass k = (Klass)getMetadata(); + k.printValueOn(tty); + } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java index cdf21c946ac..ac972e97ce6 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java @@ -90,17 +90,23 @@ public class ciMethod extends ciMetadata { } public void dumpReplayData(PrintStream out) { - Method method = (Method)getMetadata(); - NMethod nm = method.getNativeMethod(); - Klass holder = method.getMethodHolder(); - out.println("ciMethod " + - holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + - method.getInvocationCount() + " " + - method.getBackedgeCount() + " " + - interpreterInvocationCount() + " " + - interpreterThrowoutCount() + " " + - instructionsSize()); + Method method = (Method)getMetadata(); + NMethod nm = method.getNativeMethod(); + out.println("ciMethod " + + nameAsAscii() + " " + + method.getInvocationCount() + " " + + method.getBackedgeCount() + " " + + interpreterInvocationCount() + " " + + interpreterThrowoutCount() + " " + + instructionsSize()); + } + + public void printValueOn(PrintStream tty) { + tty.print("ciMethod " + method().getName().asString() + method().getSignature().asString() + "@" + getAddress()); + } + + public String nameAsAscii() { + Method method = (Method)getMetadata(); + return method.nameAsAscii(); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java index 117a9488cf7..13ad04a9d30 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java @@ -31,7 +31,7 @@ import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.types.*; -public class ciMethodData extends ciMetadata { +public class ciMethodData extends ciMetadata implements MethodDataInterface { static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { @@ -54,7 +54,9 @@ public class ciMethodData extends ciMetadata { extraDataSizeField = new CIntField(type.getCIntegerField("_extra_data_size"), 0); dataSizeField = new CIntField(type.getCIntegerField("_data_size"), 0); stateField = new CIntField(type.getCIntegerField("_state"), 0); - sizeofMethodDataOopDesc = (int)db.lookupType("MethodData").getSize();; + Type typeMethodData = db.lookupType("MethodData"); + sizeofMethodDataOopDesc = (int)typeMethodData.getSize(); + parametersTypeDataDi = new CIntField(typeMethodData.getCIntegerField("_parameters_type_data_di"), 0); } private static AddressField origField; @@ -69,11 +71,28 @@ public class ciMethodData extends ciMetadata { private static CIntField dataSizeField; private static CIntField stateField; private static int sizeofMethodDataOopDesc; + private static CIntField parametersTypeDataDi; public ciMethodData(Address addr) { super(addr); } + public ciKlass getKlassAtAddress(Address addr) { + return (ciKlass)ciObjectFactory.getMetadata(addr); + } + + public ciMethod getMethodAtAddress(Address addr) { + return (ciMethod)ciObjectFactory.getMetadata(addr); + } + + public void printKlassValueOn(ciKlass klass, PrintStream st) { + klass.printValueOn(st); + } + + public void printMethodValueOn(ciMethod method, PrintStream st) { + method.printValueOn(st); + } + private byte[] fetchDataAt(Address base, long size) { byte[] result = new byte[(int)size]; for (int i = 0; i < size; i++) { @@ -110,6 +129,10 @@ public class ciMethodData extends ciMetadata { return (int)dataSizeField.getValue(getAddress()); } + int extraDataSize() { + return (int)extraDataSizeField.getValue(getAddress()); + } + int state() { return (int)stateField.getValue(getAddress()); } @@ -122,6 +145,16 @@ public class ciMethodData extends ciMetadata { return dataIndex >= dataSize(); } + ParametersTypeData parametersTypeData() { + Address base = getAddress().addOffsetTo(origField.getOffset()); + int di = (int)parametersTypeDataDi.getValue(base); + if (di == -1) { + return null; + } + DataLayout dataLayout = new DataLayout(dataField.getValue(getAddress()), di); + return new ParametersTypeData(this, dataLayout); + } + ProfileData dataAt(int dataIndex) { if (outOfBounds(dataIndex)) { return null; @@ -139,15 +172,21 @@ public class ciMethodData extends ciMetadata { case DataLayout.jumpDataTag: return new JumpData(dataLayout); case DataLayout.receiverTypeDataTag: - return new ciReceiverTypeData(dataLayout); + return new ReceiverTypeData(this, dataLayout); case DataLayout.virtualCallDataTag: - return new ciVirtualCallData(dataLayout); + return new VirtualCallData(this, dataLayout); case DataLayout.retDataTag: return new RetData(dataLayout); case DataLayout.branchDataTag: return new BranchData(dataLayout); case DataLayout.multiBranchDataTag: return new MultiBranchData(dataLayout); + case DataLayout.callTypeDataTag: + return new CallTypeData(this, dataLayout); + case DataLayout.virtualCallTypeDataTag: + return new VirtualCallTypeData(this, dataLayout); + case DataLayout.parametersTypeDataTag: + return new ParametersTypeData(this, dataLayout); } } @@ -164,7 +203,23 @@ public class ciMethodData extends ciMetadata { } boolean isValid(ProfileData current) { return current != null; } + DataLayout limitDataPosition() { + return new DataLayout(dataField.getValue(getAddress()), dataSize()); + } + DataLayout extraDataBase() { + return limitDataPosition(); + } + DataLayout extraDataLimit() { + return new DataLayout(dataField.getValue(getAddress()), dataSize() + extraDataSize()); + } + DataLayout nextExtra(DataLayout dataLayout) { + return new DataLayout(dataField.getValue(getAddress()), dataLayout.dp() + DataLayout.computeSizeInBytes(MethodData.extraNbCells(dataLayout))); + } + public void printDataOn(PrintStream st) { + if (parametersTypeData() != null) { + parametersTypeData().printDataOn(st); + } ProfileData data = firstData(); for ( ; isValid(data); data = nextData(data)) { st.print(dpToDi(data.dp())); @@ -172,16 +227,96 @@ public class ciMethodData extends ciMetadata { // st->fillTo(6); data.printDataOn(st); } + st.println("--- Extra data:"); + DataLayout dp = extraDataBase(); + DataLayout end = extraDataLimit(); + for (;; dp = nextExtra(dp)) { + switch(dp.tag()) { + case DataLayout.noTag: + continue; + case DataLayout.bitDataTag: + data = new BitData(dp); + break; + case DataLayout.speculativeTrapDataTag: + data = new SpeculativeTrapData(this, dp); + break; + case DataLayout.argInfoDataTag: + data = new ArgInfoData(dp); + dp = end; // ArgInfoData is at the end of extra data section. + break; + default: + throw new InternalError("unexpected tag " + dp.tag()); + } + st.print(dpToDi(data.dp())); + st.print(" "); + data.printDataOn(st); + if (dp == end) return; + } + } + + int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, ciKlass k) { + if (k != null) { + if (round == 0) count++; + else out.print(" " + ((pdata.dp() + pdata.cellOffset(index)) / MethodData.cellSize) + " " + k.name()); + } + return count; + } + + int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData vdata) { + for (int i = 0; i < vdata.rowLimit(); i++) { + ciKlass k = vdata.receiver(i); + count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k); + } + return count; + } + + int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface callTypeData) { + if (callTypeData.hasArguments()) { + for (int i = 0; i < callTypeData.numberOfArguments(); i++) { + count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i)); + } + } + if (callTypeData.hasReturn()) { + count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType()); + } + return count; + } + + int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) { + DataLayout dp = extraDataBase(); + DataLayout end = extraDataLimit(); + + for (;dp != end; dp = nextExtra(dp)) { + switch(dp.tag()) { + case DataLayout.noTag: + case DataLayout.argInfoDataTag: + return count; + case DataLayout.bitDataTag: + break; + case DataLayout.speculativeTrapDataTag: { + SpeculativeTrapData data = new SpeculativeTrapData(this, dp); + ciMethod m = data.method(); + if (m != null) { + if (round == 0) { + count++; + } else { + out.print(" " + (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / MethodData.cellSize) + " " + m.nameAsAscii()); + } + } + break; + } + default: + throw new InternalError("bad tag " + dp.tag()); + } + } + return count; } public void dumpReplayData(PrintStream out) { MethodData mdo = (MethodData)getMetadata(); Method method = mdo.getMethod(); - Klass holder = method.getMethodHolder(); out.print("ciMethodData " + - holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + + method.nameAsAscii() + " " + state() + " " + currentMileage()); byte[] orig = orig(); out.print(" orig " + orig.length); @@ -195,30 +330,28 @@ public class ciMethodData extends ciMetadata { out.print(" 0x" + Long.toHexString(data[i])); } int count = 0; + ParametersTypeData parameters = parametersTypeData(); for (int round = 0; round < 2; round++) { if (round == 1) out.print(" oops " + count); ProfileData pdata = firstData(); for ( ; isValid(pdata); pdata = nextData(pdata)) { - if (pdata instanceof ciReceiverTypeData) { - ciReceiverTypeData vdata = (ciReceiverTypeData)pdata; - for (int i = 0; i < vdata.rowLimit(); i++) { - ciKlass k = vdata.receiverAt(i); - if (k != null) { - if (round == 0) count++; - else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize) + " " + k.name()); - } - } - } else if (pdata instanceof ciVirtualCallData) { - ciVirtualCallData vdata = (ciVirtualCallData)pdata; - for (int i = 0; i < vdata.rowLimit(); i++) { - ciKlass k = vdata.receiverAt(i); - if (k != null) { - if (round == 0) count++; - else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize + " " + k.name())); - } - } + if (pdata instanceof ReceiverTypeData) { + count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData)pdata); + } + if (pdata instanceof CallTypeDataInterface) { + count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface)pdata); } } + if (parameters != null) { + for (int i = 0; i < parameters.numberOfParameters(); i++) { + count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i)); + } + } + } + count = 0; + for (int round = 0; round < 2; round++) { + if (round == 1) out.print(" methods " + count); + count = dumpReplayDataExtraDataHelper(out, round, count); } out.println(); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArgInfoData.java similarity index 62% rename from hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java rename to hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArgInfoData.java index 231ab844e3e..992d86a02ec 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArgInfoData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -22,31 +22,35 @@ * */ -package sun.jvm.hotspot.ci; +package sun.jvm.hotspot.oops; import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; -public class ciVirtualCallData extends VirtualCallData { - public ciVirtualCallData(DataLayout data) { - super(data); +public class ArgInfoData extends ArrayData { + + public ArgInfoData(DataLayout layout) { + super(layout); } - public Klass receiver(int row) { - throw new InternalError("should not call"); + int numberOfArgs() { + return arrayLen(); } - public ciKlass receiverAt(int row) { - //assert((uint)row < rowLimit(), "oob"); - ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row))); - if (recv != null && !(recv instanceof ciKlass)) { - System.err.println(recv); + int argModified(int arg) { + return arrayUintAt(arg); + } + + public void printDataOn(PrintStream st) { + printShared(st, "ArgInfoData"); + int nargs = numberOfArgs(); + for (int i = 0; i < nargs; i++) { + st.print(" 0x" + Integer.toHexString(argModified(i))); } - //assert(recv == NULL || recv->isKlass(), "wrong type"); - return (ciKlass)recv; + st.println(); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java new file mode 100644 index 00000000000..a0eb02946b3 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// CallTypeData +// +// A CallTypeData is used to access profiling information about a non +// virtual call for which we collect type information about arguments +// and return value. +public class CallTypeData extends CounterData implements CallTypeDataInterface { + final TypeStackSlotEntries args; + final ReturnTypeEntry ret; + + int cellCountGlobalOffset() { + return CounterData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset(); + } + + int cellCountNoHeader() { + return uintAt(cellCountGlobalOffset()); + } + + public CallTypeData(MethodDataInterface methodData, DataLayout layout) { + super(layout); + args = new TypeStackSlotEntries(methodData, this, CounterData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments()); + ret = new ReturnTypeEntry(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount()); + } + + static int staticCellCount() { + return -1; + } + + public int cellCount() { + return CounterData.staticCellCount() + + TypeEntriesAtCall.headerCellCount() + + intAt(cellCountGlobalOffset()); + } + + public int numberOfArguments() { + return cellCountNoHeader() / TypeStackSlotEntries.perArgCount(); + } + + public boolean hasArguments() { + return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount(); + } + + public K argumentType(int i) { + return args.type(i); + } + + public boolean hasReturn() { + return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0; + } + + public K returnType() { + return ret.type(); + } + + public int argumentTypeIndex(int i) { + return args.typeIndex(i); + } + + public int returnTypeIndex() { + return ret.typeIndex(); + } + + public void printDataOn(PrintStream st) { + super.printDataOn(st); + if (hasArguments()) { + tab(st); + st.print("argument types"); + args.printDataOn(st); + } + if (hasReturn()) { + tab(st); + st.print("return type"); + ret.printDataOn(st); + } + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java new file mode 100644 index 00000000000..0a8bf4721e4 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +public interface CallTypeDataInterface { + int numberOfArguments(); + boolean hasArguments(); + K argumentType(int i); + boolean hasReturn(); + K returnType(); + int argumentTypeIndex(int i); + int returnTypeIndex(); +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java index d9348507a96..4c992f176a8 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java @@ -41,6 +41,11 @@ public class DataLayout { public static final int retDataTag = 6; public static final int branchDataTag = 7; public static final int multiBranchDataTag = 8; + public static final int argInfoDataTag = 9; + public static final int callTypeDataTag = 10; + public static final int virtualCallTypeDataTag = 11; + public static final int parametersTypeDataTag = 12; + public static final int speculativeTrapDataTag = 13; // The _struct._flags word is formatted as [trapState:4 | flags:4]. // The trap state breaks down further as [recompile:1 | reason:3]. @@ -61,8 +66,6 @@ public class DataLayout { private int offset; - private boolean handlized; - public DataLayout(MethodData d, int o) { data = d.getAddress(); offset = o; @@ -71,7 +74,6 @@ public class DataLayout { public DataLayout(Address d, int o) { data = d; offset = o; - handlized = true; } public int dp() { return offset; } @@ -90,12 +92,7 @@ public class DataLayout { } public Address addressAt(int index) { - OopHandle handle; - if (handlized) { - return data.getAddressAt(offset + cellOffset(index)); - } else { - return data.getOopHandleAt(offset + cellOffset(index)); - } + return data.getAddressAt(offset + cellOffset(index)); } // Every data layout begins with a header. This header @@ -128,7 +125,7 @@ public class DataLayout { return 1; } - static int computeSizeInBytes(int cellCount) { + static public int computeSizeInBytes(int cellCount) { return headerSizeInBytes() + cellCount * MethodData.cellSize; } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java index e039470f801..2bde98074ff 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java @@ -354,9 +354,7 @@ public class Method extends Metadata { } Klass holder = getMethodHolder(); out.println("ciMethod " + - holder.getName().asString() + " " + - OopUtilities.escapeString(getName().asString()) + " " + - getSignature().asString() + " " + + nameAsAscii() + " " + getInvocationCount() + " " + getBackedgeCount() + " " + interpreterInvocationCount() + " " + @@ -371,4 +369,10 @@ public class Method extends Metadata { public int interpreterInvocationCount() { return getMethodCounters().interpreterInvocationCount(); } + + public String nameAsAscii() { + return getMethodHolder().getName().asString() + " " + + OopUtilities.escapeString(getName().asString()) + " " + + getSignature().asString(); + } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java index 41c121468ea..f07b8268873 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java @@ -33,7 +33,7 @@ import sun.jvm.hotspot.utilities.*; // A MethodData provides interpreter profiling information -public class MethodData extends Metadata { +public class MethodData extends Metadata implements MethodDataInterface { static int TypeProfileWidth = 2; static int BciProfileWidth = 2; static int CompileThreshold; @@ -152,6 +152,8 @@ public class MethodData extends Metadata { dataSize = new CIntField(type.getCIntegerField("_data_size"), 0); data = type.getAddressField("_data[0]"); + parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0); + sizeofMethodDataOopDesc = (int)type.getSize();; Reason_many = db.lookupIntConstant("Deoptimization::Reason_many").intValue(); @@ -191,6 +193,22 @@ public class MethodData extends Metadata { super(addr); } + public Klass getKlassAtAddress(Address addr) { + return (Klass)Metadata.instantiateWrapperFor(addr); + } + + public Method getMethodAtAddress(Address addr) { + return (Method)Metadata.instantiateWrapperFor(addr); + } + + public void printKlassValueOn(Klass klass, PrintStream st) { + klass.printValueOn(st); + } + + public void printMethodValueOn(Method method, PrintStream st) { + method.printValueOn(st); + } + public boolean isMethodData() { return true; } private static long baseOffset; @@ -198,7 +216,7 @@ public class MethodData extends Metadata { private static MetadataField method; private static CIntField dataSize; private static AddressField data; - + private static CIntField parametersTypeDataDi; public static int sizeofMethodDataOopDesc; public static int cellSize; @@ -225,6 +243,27 @@ public class MethodData extends Metadata { } } + int sizeInBytes() { + if (size == null) { + return 0; + } else { + return (int)size.getValue(getAddress()); + } + } + + int size() { + return (int)Oop.alignObjectSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord()); + } + + ParametersTypeData parametersTypeData() { + int di = (int)parametersTypeDataDi.getValue(getAddress()); + if (di == -1) { + return null; + } + DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset()); + return new ParametersTypeData(this, dataLayout); + } + boolean outOfBounds(int dataIndex) { return dataIndex >= dataSize(); } @@ -246,15 +285,21 @@ public class MethodData extends Metadata { case DataLayout.jumpDataTag: return new JumpData(dataLayout); case DataLayout.receiverTypeDataTag: - return new ReceiverTypeData(dataLayout); + return new ReceiverTypeData(this, dataLayout); case DataLayout.virtualCallDataTag: - return new VirtualCallData(dataLayout); + return new VirtualCallData(this, dataLayout); case DataLayout.retDataTag: return new RetData(dataLayout); case DataLayout.branchDataTag: return new BranchData(dataLayout); case DataLayout.multiBranchDataTag: return new MultiBranchData(dataLayout); + case DataLayout.callTypeDataTag: + return new CallTypeData(this, dataLayout); + case DataLayout.virtualCallTypeDataTag: + return new VirtualCallTypeData(this, dataLayout); + case DataLayout.parametersTypeDataTag: + return new ParametersTypeData(this, dataLayout); } } @@ -272,7 +317,42 @@ public class MethodData extends Metadata { } boolean isValid(ProfileData current) { return current != null; } + DataLayout limitDataPosition() { + return new DataLayout(this, dataSize() + (int)data.getOffset()); + } + + DataLayout extraDataBase() { + return limitDataPosition(); + } + + DataLayout extraDataLimit() { + return new DataLayout(this, sizeInBytes()); + } + + static public int extraNbCells(DataLayout dataLayout) { + int nbCells = 0; + switch(dataLayout.tag()) { + case DataLayout.bitDataTag: + case DataLayout.noTag: + nbCells = BitData.staticCellCount(); + break; + case DataLayout.speculativeTrapDataTag: + nbCells = SpeculativeTrapData.staticCellCount(); + break; + default: + throw new InternalError("unexpected tag " + dataLayout.tag()); + } + return nbCells; + } + + DataLayout nextExtra(DataLayout dataLayout) { + return new DataLayout(this, dataLayout.dp() + DataLayout.computeSizeInBytes(extraNbCells(dataLayout))); + } + public void printDataOn(PrintStream st) { + if (parametersTypeData() != null) { + parametersTypeData().printDataOn(st); + } ProfileData data = firstData(); for ( ; isValid(data); data = nextData(data)) { st.print(dpToDi(data.dp())); @@ -280,6 +360,31 @@ public class MethodData extends Metadata { // st->fillTo(6); data.printDataOn(st); } + st.println("--- Extra data:"); + DataLayout dp = extraDataBase(); + DataLayout end = extraDataLimit(); + for (;; dp = nextExtra(dp)) { + switch(dp.tag()) { + case DataLayout.noTag: + continue; + case DataLayout.bitDataTag: + data = new BitData(dp); + break; + case DataLayout.speculativeTrapDataTag: + data = new SpeculativeTrapData(this, dp); + break; + case DataLayout.argInfoDataTag: + data = new ArgInfoData(dp); + dp = end; // ArgInfoData is at the end of extra data section. + break; + default: + throw new InternalError("unexpected tag " + dp.tag()); + } + st.print(dpToDi(data.dp())); + st.print(" "); + data.printDataOn(st); + if (dp == end) return; + } } private byte[] fetchDataAt(Address base, long offset, long size) { @@ -332,14 +437,71 @@ public class MethodData extends Metadata { return 20000; } + int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, Klass k) { + if (k != null) { + if (round == 0) count++; + else out.print(" " + + (dpToDi(pdata.dp() + + pdata.cellOffset(index)) / cellSize) + " " + + k.getName().asString()); + } + return count; + } + + int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData vdata) { + for (int i = 0; i < vdata.rowLimit(); i++) { + Klass k = vdata.receiver(i); + count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k); + } + return count; + } + + int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface callTypeData) { + if (callTypeData.hasArguments()) { + for (int i = 0; i < callTypeData.numberOfArguments(); i++) { + count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i)); + } + } + if (callTypeData.hasReturn()) { + count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType()); + } + return count; + } + + int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) { + DataLayout dp = extraDataBase(); + DataLayout end = extraDataLimit(); + + for (;dp != end; dp = nextExtra(dp)) { + switch(dp.tag()) { + case DataLayout.noTag: + case DataLayout.argInfoDataTag: + return count; + case DataLayout.bitDataTag: + break; + case DataLayout.speculativeTrapDataTag: { + SpeculativeTrapData data = new SpeculativeTrapData(this, dp); + Method m = data.method(); + if (m != null) { + if (round == 0) { + count++; + } else { + out.print(" " + (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / cellSize) + " " + m.nameAsAscii()); + } + } + break; + } + default: + throw new InternalError("bad tag " + dp.tag()); + } + } + return count; + } + public void dumpReplayData(PrintStream out) { Method method = getMethod(); - Klass holder = method.getMethodHolder(); - out.print("ciMethodData " + - holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + - "2" + " " + + out.print("ciMethodData " + method.nameAsAscii() + + " " + "2" + " " + currentMileage()); byte[] orig = orig(); out.print(" orig " + orig.length); @@ -353,36 +515,28 @@ public class MethodData extends Metadata { out.print(" 0x" + Long.toHexString(data[i])); } int count = 0; + ParametersTypeData parameters = parametersTypeData(); for (int round = 0; round < 2; round++) { if (round == 1) out.print(" oops " + count); ProfileData pdata = firstData(); for ( ; isValid(pdata); pdata = nextData(pdata)) { if (pdata instanceof ReceiverTypeData) { - ReceiverTypeData vdata = (ReceiverTypeData)pdata; - for (int i = 0; i < vdata.rowLimit(); i++) { - Klass k = vdata.receiver(i); - if (k != null) { - if (round == 0) count++; - else out.print(" " + - (dpToDi(vdata.dp() + - vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " + - k.getName().asString()); - } - } - } else if (pdata instanceof VirtualCallData) { - VirtualCallData vdata = (VirtualCallData)pdata; - for (int i = 0; i < vdata.rowLimit(); i++) { - Klass k = vdata.receiver(i); - if (k != null) { - if (round == 0) count++; - else out.print(" " + - (dpToDi(vdata.dp() + - vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " + - k.getName().asString()); - } - } + count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData)pdata); + } + if (pdata instanceof CallTypeDataInterface) { + count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface)pdata); } } + if (parameters != null) { + for (int i = 0; i < parameters.numberOfParameters(); i++) { + count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i)); + } + } + } + count = 0; + for (int round = 0; round < 2; round++) { + if (round == 1) out.print(" methods " + count); + count = dumpReplayDataExtraDataHelper(out, round, count); } out.println(); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java new file mode 100644 index 00000000000..8e6b131ee9d --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +public interface MethodDataInterface { + K getKlassAtAddress(Address addr); + M getMethodAtAddress(Address addr); + void printKlassValueOn(K klass, PrintStream st); + void printMethodValueOn(M klass, PrintStream st); +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java new file mode 100644 index 00000000000..d1a1fea6914 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// ParametersTypeData +// +// A ParametersTypeData is used to access profiling information about +// types of parameters to a method +public class ParametersTypeData extends ArrayData { + final TypeStackSlotEntries parameters; + + static int stackSlotLocalOffset(int i) { + return arrayStartOffSet + TypeStackSlotEntries.stackSlotLocalOffset(i); + } + + static int typeLocalOffset(int i) { + return arrayStartOffSet + TypeStackSlotEntries.typeLocalOffset(i); + } + + public ParametersTypeData(MethodDataInterface methodData, DataLayout layout) { + super(layout); + parameters = new TypeStackSlotEntries(methodData, this, 1, numberOfParameters()); + } + + public int numberOfParameters() { + return arrayLen() / TypeStackSlotEntries.perArgCount(); + } + + int stackSlot(int i) { + return parameters.stackSlot(i); + } + + public K type(int i) { + return parameters.type(i); + } + + static public int typeIndex(int i) { + return typeLocalOffset(i); + } + + public void printDataOn(PrintStream st) { + st.print("parameter types"); + parameters.printDataOn(st); + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java index 155035eea18..7ac053fe0c5 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java @@ -37,13 +37,15 @@ import sun.jvm.hotspot.utilities.*; // dynamic type check. It consists of a counter which counts the total times // that the check is reached, and a series of (Klass, count) pairs // which are used to store a type profile for the receiver of the check. -public class ReceiverTypeData extends CounterData { +public class ReceiverTypeData extends CounterData { static final int receiver0Offset = counterCellCount; static final int count0Offset = receiver0Offset + 1; static final int receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset; + final MethodDataInterface methodData; - public ReceiverTypeData(DataLayout layout) { + public ReceiverTypeData(MethodDataInterface methodData, DataLayout layout) { super(layout); + this.methodData = methodData; //assert(layout.tag() == DataLayout.receiverTypeDataTag || // layout.tag() == DataLayout.virtualCallDataTag, "wrong type"); } @@ -73,14 +75,14 @@ public class ReceiverTypeData extends CounterData { // gc; it does not assert the receiver is a klass. During compaction of the // perm gen, the klass may already have moved, so the isKlass() predicate // would fail. The 'normal' version should be used whenever possible. - Klass receiverUnchecked(int row) { + K receiverUnchecked(int row) { //assert(row < rowLimit(), "oob"); Address recv = addressAt(receiverCellIndex(row)); - return (Klass)Metadata.instantiateWrapperFor(recv); + return methodData.getKlassAtAddress(recv); } - public Klass receiver(int row) { - Klass recv = receiverUnchecked(row); + public K receiver(int row) { + K recv = receiverUnchecked(row); //assert(recv == NULL || ((oop)recv).isKlass(), "wrong type"); return recv; } @@ -111,7 +113,7 @@ public class ReceiverTypeData extends CounterData { for (row = 0; row < rowLimit(); row++) { if (receiver(row) != null) { tab(st); - receiver(row).printValueOn(st); + methodData.printKlassValueOn(receiver(row), st); st.println("(" + receiverCount(row) + ")"); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReturnTypeEntry.java similarity index 62% rename from hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java rename to hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReturnTypeEntry.java index e568b3f7cec..667e4cd4a94 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReturnTypeEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -22,32 +22,39 @@ * */ -package sun.jvm.hotspot.ci; +package sun.jvm.hotspot.oops; import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; -public class ciReceiverTypeData extends ReceiverTypeData { - public ciReceiverTypeData(DataLayout data) { - super(data); +// Type entry used for return from a call. A single cell to record the +// type. +public class ReturnTypeEntry extends TypeEntries { + static final int cellCount = 1; + + ReturnTypeEntry(MethodDataInterface methodData, ProfileData pd, int baseOff) { + super(methodData, pd, baseOff); } - public Klass receiver(int row) { - throw new InternalError("should not call"); + K type() { + return validKlass(baseOff); } - public ciKlass receiverAt(int row) { - //assert((uint)row < rowLimit(), "oob"); - ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row))); - if (recv != null && !(recv instanceof ciKlass)) { - System.err.println(recv); - } - //assert(recv == NULL || recv->isKlass(), "wrong type"); - return (ciKlass)recv; + static int staticCellCount() { + return cellCount; } + int typeIndex() { + return baseOff; + } + + void printDataOn(PrintStream st) { + pd.tab(st); + printKlass(st, baseOff); + st.println(); + } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java new file mode 100644 index 00000000000..16a33f932b9 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// SpeculativeTrapData +// +// A SpeculativeTrapData is used to record traps due to type +// speculation. It records the root of the compilation. +public class SpeculativeTrapData extends ProfileData { + static final int speculativeTrapMethod = 0; + static final int speculativeTrapCellCount = 1; + final MethodDataInterface methodData; + + public SpeculativeTrapData(MethodDataInterface methodData, DataLayout layout) { + super(layout); + this.methodData = methodData; + } + + static int staticCellCount() { + return speculativeTrapCellCount; + } + + public int cellCount() { + return staticCellCount(); + } + + public M method() { + return methodData.getMethodAtAddress(addressAt(speculativeTrapMethod)); + } + + static public int methodIndex() { + return speculativeTrapMethod; + } + + public void printDataOn(PrintStream st) { + printShared(st, "SpeculativeTrapData"); + tab(st); + methodData.printMethodValueOn(method(), st); + st.println(); + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java new file mode 100644 index 00000000000..8b791b5f938 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// Entries in a ProfileData object to record types: it can either be +// none (no profile), unknown (conflicting profile data) or a klass if +// a single one is seen. Whether a null reference was seen is also +// recorded. No counter is associated with the type and a single type +// is tracked (unlike VirtualCallData). +public abstract class TypeEntries { + static final int nullSeen = 1; + static final int typeMask = ~nullSeen; + static final int typeUnknown = 2; + static final int statusBits = nullSeen | typeUnknown; + static final int typeKlassMask = ~statusBits; + + final ProfileData pd; + final int baseOff; + final MethodDataInterface methodData; + + boolean wasNullSeen(int index) { + int v = pd.intptrAt(index); + return (v & nullSeen) != 0; + } + + boolean isTypeUnknown(int index) { + int v = pd.intptrAt(index); + return (v & typeUnknown) != 0; + } + + boolean isTypeNone(int index) { + int v = pd.intptrAt(index); + return (v & typeMask) == 0; + } + + K validKlass(int index) { + if (!isTypeNone(index) && + !isTypeUnknown(index)) { + return methodData.getKlassAtAddress(pd.addressAt(index).andWithMask(typeKlassMask)); + } else { + return null; + } + } + + void printKlass(PrintStream st, int index) { + if (isTypeNone(index)) { + st.print("none"); + } else if (isTypeUnknown(index)) { + st.print("unknown"); + } else { + methodData.printKlassValueOn(validKlass(index), st); + } + if (wasNullSeen(index)) { + st.print(" (null seen)"); + } + } + + TypeEntries(MethodDataInterface methodData, ProfileData pd, int baseOff) { + this.pd = pd; + this.baseOff = baseOff; + this.methodData = methodData; + } + + long intptrAt(int index) { + return pd.intptrAt(index); + } + +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java new file mode 100644 index 00000000000..2891f91c69e --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// Entries to collect type information at a call: contains arguments +// (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a +// number of cells. +public abstract class TypeEntriesAtCall { + + static int stackSlotLocalOffset(int i) { + return headerCellCount() + TypeStackSlotEntries.stackSlotLocalOffset(i); + } + + static int argumentTypeLocalOffset(int i) { + return headerCellCount() + TypeStackSlotEntries.typeLocalOffset(i); + } + + static int headerCellCount() { + return 1; + } + + static int cellCountLocalOffset() { + return 0; + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java new file mode 100644 index 00000000000..9efff34a4c3 --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// Type entries used for arguments passed at a call and parameters on +// method entry. 2 cells per entry: one for the type encoded as in +// TypeEntries and one initialized with the stack slot where the +// profiled object is to be found so that the interpreter can locate +// it quickly. +public class TypeStackSlotEntries extends TypeEntries { + static final int stackSlotEntry = 0; + static final int typeEntry = 1; + static final int perArgCellCount = 2; + + int stackSlotOffset(int i) { + return baseOff + stackSlotLocalOffset(i); + } + + final int numberOfEntries; + + int typeOffsetInCells(int i) { + return baseOff + typeLocalOffset(i); + } + + TypeStackSlotEntries(MethodDataInterface methodData, ProfileData pd, int baseOff, int nbEntries) { + super(methodData, pd, baseOff); + numberOfEntries = nbEntries; + } + + static int stackSlotLocalOffset(int i) { + return i * perArgCellCount + stackSlotEntry; + } + + static int typeLocalOffset(int i) { + return i * perArgCellCount + typeEntry; + } + + int stackSlot(int i) { + return pd.uintAt(stackSlotOffset(i)); + } + + K type(int i) { + return validKlass(typeOffsetInCells(i)); + } + + static int perArgCount() { + return perArgCellCount; + } + + int typeIndex(int i) { + return typeOffsetInCells(i); + } + + void printDataOn(PrintStream st) { + for (int i = 0; i < numberOfEntries; i++) { + pd.tab(st); + st.print(i + ": stack(" + stackSlot(i)+ ") "); + printKlass(st, typeOffsetInCells(i)); + st.println(); + } + } +} diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java index 21b715f343c..eec5000a6a4 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java @@ -35,9 +35,9 @@ import sun.jvm.hotspot.utilities.*; // // A VirtualCallData is used to access profiling information about a // call. For now, it has nothing more than a ReceiverTypeData. -public class VirtualCallData extends ReceiverTypeData { - public VirtualCallData(DataLayout layout) { - super(layout); +public class VirtualCallData extends ReceiverTypeData { + public VirtualCallData(MethodDataInterface methodData, DataLayout layout) { + super(methodData, layout); //assert(layout.tag() == DataLayout.virtualCallDataTag, "wrong type"); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java new file mode 100644 index 00000000000..d7ad5d993ec --- /dev/null +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +package sun.jvm.hotspot.oops; + +import java.io.*; +import java.util.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +// VirtualCallTypeData +// +// A VirtualCallTypeData is used to access profiling information about +// a virtual call for which we collect type information about +// arguments and return value. +public class VirtualCallTypeData extends VirtualCallData implements CallTypeDataInterface { + final TypeStackSlotEntries args; + final ReturnTypeEntry ret; + + int cellCountGlobalOffset() { + return VirtualCallData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset(); + } + + int cellCountNoHeader() { + return uintAt(cellCountGlobalOffset()); + } + + public VirtualCallTypeData(MethodDataInterface methodData, DataLayout layout) { + super(methodData, layout); + args = new TypeStackSlotEntries(methodData, this, VirtualCallData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments()); + ret = new ReturnTypeEntry(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount()); + } + + static int staticCellCount() { + return -1; + } + + public int cellCount() { + return VirtualCallData.staticCellCount() + + TypeEntriesAtCall.headerCellCount() + + intAt(cellCountGlobalOffset()); + } + + public int numberOfArguments() { + return cellCountNoHeader() / TypeStackSlotEntries.perArgCount(); + } + + public boolean hasArguments() { + return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount(); + } + + public K argumentType(int i) { + return args.type(i); + } + + public boolean hasReturn() { + return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0; + } + + public K returnType() { + return ret.type(); + } + + public int argumentTypeIndex(int i) { + return args.typeIndex(i); + } + + public int returnTypeIndex() { + return ret.typeIndex(); + } + + public void printDataOn(PrintStream st) { + super.printDataOn(st); + if (hasArguments()) { + tab(st); + st.print("argument types"); + args.printDataOn(st); + } + if (hasReturn()) { + tab(st); + st.print("return type"); + ret.printDataOn(st); + } + } +}; diff --git a/hotspot/src/share/vm/ci/ciMethodData.cpp b/hotspot/src/share/vm/ci/ciMethodData.cpp index 1b604ba4e4d..9a7c405a2d8 100644 --- a/hotspot/src/share/vm/ci/ciMethodData.cpp +++ b/hotspot/src/share/vm/ci/ciMethodData.cpp @@ -177,7 +177,7 @@ void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) { void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) { - for (int i = 0; i < _number_of_entries; i++) { + for (int i = 0; i < number_of_entries(); i++) { intptr_t k = entries->type(i); TypeStackSlotEntries::set_type(i, translate_klass(k)); } @@ -242,7 +242,6 @@ ciProfileData* ciMethodData::next_data(ciProfileData* current) { } ciProfileData* ciMethodData::bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots) { - // bci_to_extra_data(bci) ... DataLayout* dp = data_layout_at(data_size()); DataLayout* end = data_layout_at(data_size() + extra_data_size()); two_free_slots = false; @@ -506,6 +505,63 @@ void ciMethodData::print_impl(outputStream* st) { ciMetadata::print_impl(st); } +void ciMethodData::dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k) { + if (k != NULL) { + if (round == 0) { + count++; + } else { + out->print(" %d %s", (int)(dp_to_di(pdata->dp() + in_bytes(offset)) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); + } + } +} + +template void ciMethodData::dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* vdata) { + for (uint i = 0; i < vdata->row_limit(); i++) { + dump_replay_data_type_helper(out, round, count, vdata, vdata->receiver_offset(i), vdata->receiver(i)); + } +} + +template void ciMethodData::dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data) { + if (call_type_data->has_arguments()) { + for (int i = 0; i < call_type_data->number_of_arguments(); i++) { + dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->argument_type_offset(i), call_type_data->valid_argument_type(i)); + } + } + if (call_type_data->has_return()) { + dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->return_type_offset(), call_type_data->valid_return_type()); + } +} + +void ciMethodData::dump_replay_data_extra_data_helper(outputStream* out, int round, int& count) { + DataLayout* dp = data_layout_at(data_size()); + DataLayout* end = data_layout_at(data_size() + extra_data_size()); + + for (;dp < end; dp = MethodData::next_extra(dp)) { + switch(dp->tag()) { + case DataLayout::no_tag: + case DataLayout::arg_info_data_tag: + return; + case DataLayout::bit_data_tag: + break; + case DataLayout::speculative_trap_data_tag: { + ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp); + ciMethod* m = data->method(); + if (m != NULL) { + if (round == 0) { + count++; + } else { + out->print(" %d ", (int)(dp_to_di(((address)dp) + in_bytes(ciSpeculativeTrapData::method_offset())) / sizeof(intptr_t))); + m->dump_name_as_ascii(out); + } + } + break; + } + default: + fatal(err_msg("bad tag = %d", dp->tag())); + } + } +} + void ciMethodData::dump_replay_data(outputStream* out) { ResourceMark rm; MethodData* mdo = get_MethodData(); @@ -527,7 +583,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { } // dump the MDO data as raw data - int elements = data_size() / sizeof(intptr_t); + int elements = (data_size() + extra_data_size()) / sizeof(intptr_t); out->print(" data %d", elements); for (int i = 0; i < elements; i++) { // We could use INTPTR_FORMAT here but that's a zero justified @@ -544,37 +600,35 @@ void ciMethodData::dump_replay_data(outputStream* out) { // and emit pairs of offset and klass name so that they can be // reconstructed at runtime. The first round counts the number of // oop references and the second actually emits them. - int count = 0; - for (int round = 0; round < 2; round++) { + ciParametersTypeData* parameters = parameters_type_data(); + for (int count = 0, round = 0; round < 2; round++) { if (round == 1) out->print(" oops %d", count); ProfileData* pdata = first_data(); for ( ; is_valid(pdata); pdata = next_data(pdata)) { - if (pdata->is_ReceiverTypeData()) { - ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata; - for (uint i = 0; i < vdata->row_limit(); i++) { - ciKlass* k = vdata->receiver(i); - if (k != NULL) { - if (round == 0) { - count++; - } else { - out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); - } - } - } - } else if (pdata->is_VirtualCallData()) { + if (pdata->is_VirtualCallData()) { ciVirtualCallData* vdata = (ciVirtualCallData*)pdata; - for (uint i = 0; i < vdata->row_limit(); i++) { - ciKlass* k = vdata->receiver(i); - if (k != NULL) { - if (round == 0) { - count++; - } else { - out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); - } - } + dump_replay_data_receiver_type_helper(out, round, count, vdata); + if (pdata->is_VirtualCallTypeData()) { + ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata; + dump_replay_data_call_type_helper(out, round, count, call_type_data); } + } else if (pdata->is_ReceiverTypeData()) { + ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata; + dump_replay_data_receiver_type_helper(out, round, count, vdata); + } else if (pdata->is_CallTypeData()) { + ciCallTypeData* call_type_data = (ciCallTypeData*)pdata; + dump_replay_data_call_type_helper(out, round, count, call_type_data); } } + if (parameters != NULL) { + for (int i = 0; i < parameters->number_of_parameters(); i++) { + dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i)); + } + } + } + for (int count = 0, round = 0; round < 2; round++) { + if (round == 1) out->print(" methods %d", count); + dump_replay_data_extra_data_helper(out, round, count); } out->cr(); } @@ -586,6 +640,10 @@ void ciMethodData::print() { void ciMethodData::print_data_on(outputStream* st) { ResourceMark rm; + ciParametersTypeData* parameters = parameters_type_data(); + if (parameters != NULL) { + parameters->print_data_on(st); + } ciProfileData* data; for (data = first_data(); is_valid(data); data = next_data(data)) { st->print("%d", dp_to_di(data->dp())); @@ -607,6 +665,9 @@ void ciMethodData::print_data_on(outputStream* st) { data = new ciArgInfoData(dp); dp = end; // ArgInfoData is at the end of extra data section. break; + case DataLayout::speculative_trap_data_tag: + data = new ciSpeculativeTrapData(dp); + break; default: fatal(err_msg("unexpected tag %d", dp->tag())); } @@ -631,7 +692,7 @@ void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) { } void ciTypeStackSlotEntries::print_data_on(outputStream* st) const { - for (int i = 0; i < _number_of_entries; i++) { + for (int i = 0; i < number_of_entries(); i++) { _pd->tab(st); st->print("%d: stack (%u) ", i, stack_slot(i)); print_ciklass(st, type(i)); @@ -650,12 +711,12 @@ void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const { print_shared(st, "ciCallTypeData", extra); if (has_arguments()) { tab(st, true); - st->print("argument types"); + st->print_cr("argument types"); args()->print_data_on(st); } if (has_return()) { tab(st, true); - st->print("return type"); + st->print_cr("return type"); ret()->print_data_on(st); } } diff --git a/hotspot/src/share/vm/ci/ciMethodData.hpp b/hotspot/src/share/vm/ci/ciMethodData.hpp index b1809a19d10..9b9f67c446a 100644 --- a/hotspot/src/share/vm/ci/ciMethodData.hpp +++ b/hotspot/src/share/vm/ci/ciMethodData.hpp @@ -45,7 +45,7 @@ class ciArgInfoData; class ciCallTypeData; class ciVirtualCallTypeData; class ciParametersTypeData; -class ciSpeculativeTrapData;; +class ciSpeculativeTrapData; typedef ProfileData ciProfileData; @@ -175,7 +175,7 @@ public: } #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; #endif }; @@ -202,7 +202,7 @@ public: } void translate_receiver_data_from(const ProfileData* data); #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; void print_receiver_data_on(outputStream* st) const; #endif }; @@ -227,7 +227,7 @@ public: rtd_super()->translate_receiver_data_from(data); } #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; #endif }; @@ -289,7 +289,7 @@ public: } #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; #endif }; @@ -338,7 +338,7 @@ public: } #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; #endif }; @@ -349,15 +349,15 @@ public: virtual void translate_from(const ProfileData* data); ciMethod* method() const { - return (ciMethod*)intptr_at(method_offset); + return (ciMethod*)intptr_at(speculative_trap_method); } void set_method(ciMethod* m) { - set_intptr_at(method_offset, (intptr_t)m); + set_intptr_at(speculative_trap_method, (intptr_t)m); } #ifndef PRODUCT - void print_data_on(outputStream* st, const char* extra) const; + void print_data_on(outputStream* st, const char* extra = NULL) const; #endif }; @@ -406,8 +406,8 @@ private: // Coherent snapshot of original header. MethodData _orig; - // Dedicated area dedicated to parameters. Null if no parameter - // profiling for this method. + // Area dedicated to parameters. NULL if no parameter profiling for + // this method. DataLayout* _parameters; ciMethodData(MethodData* md); @@ -467,6 +467,11 @@ private: void load_extra_data(); ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots); + void dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k); + template void dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data); + template void dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* call_type_data); + void dump_replay_data_extra_data_helper(outputStream* out, int round, int& count); + public: bool is_method_data() const { return true; } diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 6acde213d57..51897b26300 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -48,11 +48,14 @@ typedef struct _ciMethodDataRecord { intptr_t* _data; char* _orig_data; - jobject* _oops_handles; - int* _oops_offsets; + Klass** _classes; + Method** _methods; + int* _classes_offsets; + int* _methods_offsets; int _data_length; int _orig_data_length; - int _oops_length; + int _classes_length; + int _methods_length; } ciMethodDataRecord; typedef struct _ciMethodRecord { @@ -565,7 +568,7 @@ class CompileReplay : public StackObj { rec->_instructions_size = parse_int("instructions_size"); } - // ciMethodData orig # # ... data # # ... oops + // ciMethodData orig # # ... data # # ... oops # ... methods void process_ciMethodData(TRAPS) { Method* method = parse_method(CHECK); if (had_error()) return; @@ -602,21 +605,34 @@ class CompileReplay : public StackObj { if (rec->_data == NULL) { return; } - if (!parse_tag_and_count("oops", rec->_oops_length)) { + if (!parse_tag_and_count("oops", rec->_classes_length)) { return; } - rec->_oops_handles = NEW_RESOURCE_ARRAY(jobject, rec->_oops_length); - rec->_oops_offsets = NEW_RESOURCE_ARRAY(int, rec->_oops_length); - for (int i = 0; i < rec->_oops_length; i++) { + rec->_classes = NEW_RESOURCE_ARRAY(Klass*, rec->_classes_length); + rec->_classes_offsets = NEW_RESOURCE_ARRAY(int, rec->_classes_length); + for (int i = 0; i < rec->_classes_length; i++) { int offset = parse_int("offset"); if (had_error()) { return; } Klass* k = parse_klass(CHECK); - rec->_oops_offsets[i] = offset; - KlassHandle *kh = NEW_C_HEAP_OBJ(KlassHandle, mtCompiler); - ::new ((void*)kh) KlassHandle(THREAD, k); - rec->_oops_handles[i] = (jobject)kh; + rec->_classes_offsets[i] = offset; + rec->_classes[i] = k; + } + + if (!parse_tag_and_count("methods", rec->_methods_length)) { + return; + } + rec->_methods = NEW_RESOURCE_ARRAY(Method*, rec->_methods_length); + rec->_methods_offsets = NEW_RESOURCE_ARRAY(int, rec->_methods_length); + for (int i = 0; i < rec->_methods_length; i++) { + int offset = parse_int("offset"); + if (had_error()) { + return; + } + Method* m = parse_method(CHECK); + rec->_methods_offsets[i] = offset; + rec->_methods[i] = m; } } @@ -1105,14 +1121,22 @@ void ciReplay::initialize(ciMethodData* m) { m->_state = rec->_state; m->_current_mileage = rec->_current_mileage; if (rec->_data_length != 0) { - assert(m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree"); + assert(m->_data_size + m->_extra_data_size == rec->_data_length * (int)sizeof(rec->_data[0]) || + m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree"); // Write the correct ciObjects back into the profile data ciEnv* env = ciEnv::current(); - for (int i = 0; i < rec->_oops_length; i++) { - KlassHandle *h = (KlassHandle *)rec->_oops_handles[i]; - *(ciMetadata**)(rec->_data + rec->_oops_offsets[i]) = - env->get_metadata((*h)()); + for (int i = 0; i < rec->_classes_length; i++) { + Klass *k = rec->_classes[i]; + // In case this class pointer is is tagged, preserve the tag + // bits + rec->_data[rec->_classes_offsets[i]] = + ciTypeEntries::with_status(env->get_metadata(k)->as_klass(), rec->_data[rec->_classes_offsets[i]]); + } + for (int i = 0; i < rec->_methods_length; i++) { + Method *m = rec->_methods[i]; + *(ciMetadata**)(rec->_data + rec->_methods_offsets[i]) = + env->get_metadata(m); } // Copy the updated profile data into place as intptr_ts #ifdef _LP64 diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp index 32a48a97a5a..be40bad175d 100644 --- a/hotspot/src/share/vm/oops/methodData.hpp +++ b/hotspot/src/share/vm/oops/methodData.hpp @@ -851,11 +851,10 @@ private: return _base_off + stack_slot_local_offset(i); } -protected: const int _number_of_entries; // offset of cell for type for entry i within ProfileData object - int type_offset(int i) const { + int type_offset_in_cells(int i) const { return _base_off + type_local_offset(i); } @@ -868,6 +867,8 @@ public: void post_initialize(Symbol* signature, bool has_receiver, bool include_receiver); + int number_of_entries() const { return _number_of_entries; } + // offset of cell for stack slot for entry i within this block of cells for a TypeStackSlotEntries static int stack_slot_local_offset(int i) { return i * per_arg_cell_count + stack_slot_entry; @@ -893,13 +894,13 @@ public: // type for entry i intptr_t type(int i) const { assert(i >= 0 && i < _number_of_entries, "oob"); - return _pd->intptr_at(type_offset(i)); + return _pd->intptr_at(type_offset_in_cells(i)); } // set type for entry i void set_type(int i, intptr_t k) { assert(i >= 0 && i < _number_of_entries, "oob"); - _pd->set_intptr_at(type_offset(i), k); + _pd->set_intptr_at(type_offset_in_cells(i), k); } static ByteSize per_arg_size() { @@ -907,7 +908,11 @@ public: } static int per_arg_count() { - return per_arg_cell_count ; + return per_arg_cell_count; + } + + ByteSize type_offset(int i) const { + return DataLayout::cell_offset(type_offset_in_cells(i)); } // GC support @@ -973,7 +978,7 @@ private: } static int argument_type_local_offset(int i) { - return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);; + return header_cell_count() + TypeStackSlotEntries::type_local_offset(i); } public: @@ -1129,6 +1134,14 @@ public: return cell_offset(CounterData::static_cell_count()) + TypeEntriesAtCall::args_data_offset(); } + ByteSize argument_type_offset(int i) { + return _args.type_offset(i); + } + + ByteSize return_type_offset() { + return _ret.type_offset(); + } + // GC support virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) { if (has_arguments()) { @@ -1436,6 +1449,14 @@ public: return cell_offset(VirtualCallData::static_cell_count()) + TypeEntriesAtCall::args_data_offset(); } + ByteSize argument_type_offset(int i) { + return _args.type_offset(i); + } + + ByteSize return_type_offset() { + return _ret.type_offset(); + } + // GC support virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) { ReceiverTypeData::clean_weak_klass_links(is_alive_closure); @@ -1926,7 +1947,7 @@ public: class SpeculativeTrapData : public ProfileData { protected: enum { - method_offset, + speculative_trap_method, speculative_trap_cell_count }; public: @@ -1946,11 +1967,15 @@ public: // Direct accessor Method* method() const { - return (Method*)intptr_at(method_offset); + return (Method*)intptr_at(speculative_trap_method); } void set_method(Method* m) { - set_intptr_at(method_offset, (intptr_t)m); + set_intptr_at(speculative_trap_method, (intptr_t)m); + } + + static ByteSize method_offset() { + return cell_offset(speculative_trap_method); } virtual void print_data_on(outputStream* st, const char* extra = NULL) const; diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index f169c3b2ef0..66bc5a8fab6 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -353,6 +353,7 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; nonstatic_field(MethodData, _method, Method*) \ nonstatic_field(MethodData, _data_size, int) \ nonstatic_field(MethodData, _data[0], intptr_t) \ + nonstatic_field(MethodData, _parameters_type_data_di, int) \ nonstatic_field(MethodData, _nof_decompiles, uint) \ nonstatic_field(MethodData, _nof_overflow_recompiles, uint) \ nonstatic_field(MethodData, _nof_overflow_traps, uint) \ @@ -2499,6 +2500,10 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; declare_constant(Deoptimization::Reason_age) \ declare_constant(Deoptimization::Reason_predicate) \ declare_constant(Deoptimization::Reason_loop_limit_check) \ + declare_constant(Deoptimization::Reason_speculate_class_check) \ + declare_constant(Deoptimization::Reason_speculate_null_check) \ + declare_constant(Deoptimization::Reason_rtm_state_change) \ + declare_constant(Deoptimization::Reason_tenured) \ declare_constant(Deoptimization::Reason_LIMIT) \ declare_constant(Deoptimization::Reason_RECORDED_LIMIT) \ \ From a2eea4770afb5e6b384402ccaac8dcced8c4dfdb Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Thu, 15 May 2014 10:37:52 -0700 Subject: [PATCH 049/185] 8043180: SIGSEGV in Events::log_deopt_message Added missing deopt reason name Reason_tenured Reviewed-by: kvn, twisti --- hotspot/src/share/vm/runtime/deoptimization.cpp | 15 +++++++++++---- hotspot/src/share/vm/runtime/deoptimization.hpp | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index eec441873c3..e4b1292c6b6 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -1340,7 +1340,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra if (xtty != NULL) xtty->name(class_name); } - if (xtty != NULL && trap_mdo != NULL) { + if (xtty != NULL && trap_mdo != NULL && (int)reason < (int)MethodData::_trap_hist_limit) { // Dump the relevant MDO state. // This is the deopt count for the current reason, any previous // reasons or recompiles seen at this point. @@ -1818,7 +1818,7 @@ const char* Deoptimization::format_trap_state(char* buf, size_t buflen, //--------------------------------statics-------------------------------------- -const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = { +const char* Deoptimization::_trap_reason_name[] = { // Note: Keep this in sync. with enum DeoptReason. "none", "null_check", @@ -1839,9 +1839,10 @@ const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = { "loop_limit_check", "speculate_class_check", "speculate_null_check", - "rtm_state_change" + "rtm_state_change", + "tenured" }; -const char* Deoptimization::_trap_action_name[Action_LIMIT] = { +const char* Deoptimization::_trap_action_name[] = { // Note: Keep this in sync. with enum DeoptAction. "none", "maybe_recompile", @@ -1851,6 +1852,9 @@ const char* Deoptimization::_trap_action_name[Action_LIMIT] = { }; const char* Deoptimization::trap_reason_name(int reason) { + // Check that every reason has a name + STATIC_ASSERT(sizeof(_trap_reason_name)/sizeof(const char*) == Reason_LIMIT); + if (reason == Reason_many) return "many"; if ((uint)reason < Reason_LIMIT) return _trap_reason_name[reason]; @@ -1859,6 +1863,9 @@ const char* Deoptimization::trap_reason_name(int reason) { return buf; } const char* Deoptimization::trap_action_name(int action) { + // Check that every action has a name + STATIC_ASSERT(sizeof(_trap_action_name)/sizeof(const char*) == Action_LIMIT); + if ((uint)action < Action_LIMIT) return _trap_action_name[action]; static char buf[20]; diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp index d0af1823248..02daabccb98 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.hpp +++ b/hotspot/src/share/vm/runtime/deoptimization.hpp @@ -376,8 +376,8 @@ class Deoptimization : AllStatic { static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread); static DeoptAction _unloaded_action; // == Action_reinterpret; - static const char* _trap_reason_name[Reason_LIMIT]; - static const char* _trap_action_name[Action_LIMIT]; + static const char* _trap_reason_name[]; + static const char* _trap_action_name[]; static juint _deoptimization_hist[Reason_LIMIT][1+Action_LIMIT][BC_CASE_LIMIT]; // Note: Histogram array size is 1-2 Kb. From 6bfc0288f34379a294f10bcf2bdefbee02378823 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 16 May 2014 12:05:14 -0700 Subject: [PATCH 050/185] 8042786: Proper fix for 8032566 Check for overflow cases in range checks and collapse it if we can. Reviewed-by: jrose, iveresov --- hotspot/src/share/vm/opto/c2_globals.hpp | 2 +- hotspot/src/share/vm/opto/callGenerator.cpp | 2 +- hotspot/src/share/vm/opto/doCall.cpp | 2 +- hotspot/src/share/vm/opto/ifnode.cpp | 2 +- hotspot/src/share/vm/opto/phaseX.cpp | 9 +++ hotspot/src/share/vm/opto/subnode.cpp | 87 ++++++++++++++++++++- hotspot/src/share/vm/opto/subnode.hpp | 2 + 7 files changed, 101 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 093344bb32d..4f45d28666b 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -452,7 +452,7 @@ notproduct(bool, PrintEliminateLocks, false, \ "Print out when locks are eliminated") \ \ - product(bool, EliminateAutoBox, false, \ + product(bool, EliminateAutoBox, true, \ "Control optimizations for autobox elimination") \ \ diagnostic(bool, UseImplicitStableValues, true, \ diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp index ef1921a0077..249e0215c60 100644 --- a/hotspot/src/share/vm/opto/callGenerator.cpp +++ b/hotspot/src/share/vm/opto/callGenerator.cpp @@ -391,7 +391,7 @@ void LateInlineCallGenerator::do_late_inline() { } // Setup default node notes to be picked up by the inlining - Node_Notes* old_nn = C->default_node_notes(); + Node_Notes* old_nn = C->node_notes_at(call->_idx); if (old_nn != NULL) { Node_Notes* entry_nn = old_nn->clone(C); entry_nn->set_jvms(jvms); diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index e3a95c079f3..2c48e604497 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -364,7 +364,7 @@ bool Compile::should_delay_string_inlining(ciMethod* call_method, JVMState* jvms bool Compile::should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms) { if (eliminate_boxing() && call_method->is_boxing_method()) { set_has_boxed_value(true); - return true; + return aggressive_unboxing(); } return false; } diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp index 1c9dbb70839..587c3b8c864 100644 --- a/hotspot/src/share/vm/opto/ifnode.cpp +++ b/hotspot/src/share/vm/opto/ifnode.cpp @@ -673,7 +673,7 @@ const TypeInt* IfNode::filtered_int_type(PhaseGVN* gvn, Node *val, Node* if_proj // / Region // Node* IfNode::fold_compares(PhaseGVN* phase) { - if (!phase->C->eliminate_boxing() || Opcode() != Op_If) return NULL; + if (Opcode() != Op_If) return NULL; Node* this_cmp = in(1)->in(1); if (this_cmp != NULL && this_cmp->Opcode() == Op_CmpI && diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp index 8cc008f8f56..4635342e678 100644 --- a/hotspot/src/share/vm/opto/phaseX.cpp +++ b/hotspot/src/share/vm/opto/phaseX.cpp @@ -1393,6 +1393,15 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) { _worklist.push(u); } } + // If changed AddI/SubI inputs, check CmpU for range check optimization. + if (use_op == Op_AddI || use_op == Op_SubI) { + for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { + Node* u = use->fast_out(i2); + if (u->is_Cmp() && (u->Opcode() == Op_CmpU)) { + _worklist.push(u); + } + } + } // If changed AddP inputs, check Stores for loop invariant if( use_op == Op_AddP ) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 31bb9f6d133..102e8ece6e4 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -80,7 +80,7 @@ Node *SubNode::Identity( PhaseTransform *phase ) { //------------------------------Value------------------------------------------ // A subtract node differences it's two inputs. -const Type *SubNode::Value( PhaseTransform *phase ) const { +const Type* SubNode::Value_common(PhaseTransform *phase) const { const Node* in1 = in(1); const Node* in2 = in(2); // Either input is TOP ==> the result is TOP @@ -97,6 +97,16 @@ const Type *SubNode::Value( PhaseTransform *phase ) const { if( t1 == Type::BOTTOM || t2 == Type::BOTTOM ) return bottom_type(); + return NULL; +} + +const Type* SubNode::Value(PhaseTransform *phase) const { + const Type* t = Value_common(phase); + if (t != NULL) { + return t; + } + const Type* t1 = phase->type(in(1)); + const Type* t2 = phase->type(in(2)); return sub(t1,t2); // Local flavor of type subtraction } @@ -570,6 +580,81 @@ const Type *CmpUNode::sub( const Type *t1, const Type *t2 ) const { return TypeInt::CC; // else use worst case results } +const Type* CmpUNode::Value(PhaseTransform *phase) const { + const Type* t = SubNode::Value_common(phase); + if (t != NULL) { + return t; + } + const Node* in1 = in(1); + const Node* in2 = in(2); + const Type* t1 = phase->type(in1); + const Type* t2 = phase->type(in2); + assert(t1->isa_int(), "CmpU has only Int type inputs"); + if (t2 == TypeInt::INT) { // Compare to bottom? + return bottom_type(); + } + uint in1_op = in1->Opcode(); + if (in1_op == Op_AddI || in1_op == Op_SubI) { + // The problem rise when result of AddI(SubI) may overflow + // signed integer value. Let say the input type is + // [256, maxint] then +128 will create 2 ranges due to + // overflow: [minint, minint+127] and [384, maxint]. + // But C2 type system keep only 1 type range and as result + // it use general [minint, maxint] for this case which we + // can't optimize. + // + // Make 2 separate type ranges based on types of AddI(SubI) inputs + // and compare results of their compare. If results are the same + // CmpU node can be optimized. + const Node* in11 = in1->in(1); + const Node* in12 = in1->in(2); + const Type* t11 = (in11 == in1) ? Type::TOP : phase->type(in11); + const Type* t12 = (in12 == in1) ? Type::TOP : phase->type(in12); + // Skip cases when input types are top or bottom. + if ((t11 != Type::TOP) && (t11 != TypeInt::INT) && + (t12 != Type::TOP) && (t12 != TypeInt::INT)) { + const TypeInt *r0 = t11->is_int(); + const TypeInt *r1 = t12->is_int(); + jlong lo_r0 = r0->_lo; + jlong hi_r0 = r0->_hi; + jlong lo_r1 = r1->_lo; + jlong hi_r1 = r1->_hi; + if (in1_op == Op_SubI) { + jlong tmp = hi_r1; + hi_r1 = -lo_r1; + lo_r1 = -tmp; + // Note, for substructing [minint,x] type range + // long arithmetic provides correct overflow answer. + // The confusion come from the fact that in 32-bit + // -minint == minint but in 64-bit -minint == maxint+1. + } + jlong lo_long = lo_r0 + lo_r1; + jlong hi_long = hi_r0 + hi_r1; + int lo_tr1 = min_jint; + int hi_tr1 = (int)hi_long; + int lo_tr2 = (int)lo_long; + int hi_tr2 = max_jint; + bool underflow = lo_long != (jlong)lo_tr2; + bool overflow = hi_long != (jlong)hi_tr1; + // Use sub(t1, t2) when there is no overflow (one type range) + // or when both overflow and underflow (too complex). + if ((underflow != overflow) && (hi_tr1 < lo_tr2)) { + // Overflow only on one boundary, compare 2 separate type ranges. + int w = MAX2(r0->_widen, r1->_widen); // _widen does not matter here + const TypeInt* tr1 = TypeInt::make(lo_tr1, hi_tr1, w); + const TypeInt* tr2 = TypeInt::make(lo_tr2, hi_tr2, w); + const Type* cmp1 = sub(tr1, t2); + const Type* cmp2 = sub(tr2, t2); + if (cmp1 == cmp2) { + return cmp1; // Hit! + } + } + } + } + + return sub(t1, t2); // Local flavor of type subtraction +} + bool CmpUNode::is_index_range_check() const { // Check for the "(X ModI Y) CmpU Y" shape return (in(1)->Opcode() == Op_ModI && diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp index 56ee308d982..da5d7e378cd 100644 --- a/hotspot/src/share/vm/opto/subnode.hpp +++ b/hotspot/src/share/vm/opto/subnode.hpp @@ -50,6 +50,7 @@ public: // Compute a new Type for this node. Basically we just do the pre-check, // then call the virtual add() to set the type. virtual const Type *Value( PhaseTransform *phase ) const; + const Type* Value_common( PhaseTransform *phase ) const; // Supplied function returns the subtractend of the inputs. // This also type-checks the inputs for sanity. Guaranteed never to @@ -158,6 +159,7 @@ public: CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {} virtual int Opcode() const; virtual const Type *sub( const Type *, const Type * ) const; + const Type *Value( PhaseTransform *phase ) const; bool is_index_range_check() const; }; From 1af450a3cbd06fb55bd4f9e802d43dce2721eb72 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Mon, 19 May 2014 23:52:23 +0400 Subject: [PATCH 051/185] 8032498: compiler/ciReplay tests fail with StatusError: failed to clean up files after test.. Reviewed-by: kvn --- hotspot/test/compiler/ciReplay/TestVM.sh | 1 - hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh | 1 - hotspot/test/compiler/ciReplay/common.sh | 6 ++++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hotspot/test/compiler/ciReplay/TestVM.sh b/hotspot/test/compiler/ciReplay/TestVM.sh index bdb38748504..e58d63e16fa 100644 --- a/hotspot/test/compiler/ciReplay/TestVM.sh +++ b/hotspot/test/compiler/ciReplay/TestVM.sh @@ -26,7 +26,6 @@ ## ## @test ## @bug 8011675 -## @ignore 8032498 ## @summary testing of ciReplay with using generated by VM replay.txt ## @author igor.ignatyev@oracle.com ## @run shell TestVM.sh diff --git a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh index 19f23583e6d..d961d42541d 100644 --- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh +++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh @@ -26,7 +26,6 @@ ## ## @test ## @bug 8011675 -## @ignore 8032498 ## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level ## @author igor.ignatyev@oracle.com ## @run shell TestVM_no_comp_level.sh diff --git a/hotspot/test/compiler/ciReplay/common.sh b/hotspot/test/compiler/ciReplay/common.sh index f992ff39fc2..cf17febc4f7 100644 --- a/hotspot/test/compiler/ciReplay/common.sh +++ b/hotspot/test/compiler/ciReplay/common.sh @@ -234,6 +234,12 @@ generate_replay() { sed -e 's/.*location: //'` echo CRASH OUTPUT: cat crash.out + + if [ "${core_locations}" = "" ] + then + test_fail 2 "CHECK :: CORE_LOCATION" "output doesn't contain the location of core file, see crash.out" + fi + rm crash.out # processing core locations for *nix From c66bd8445cb4cad36e6e59ec83f5b7a3cfe86b94 Mon Sep 17 00:00:00 2001 From: Bharadwaj Yadavalli Date: Mon, 19 May 2014 20:28:35 +0000 Subject: [PATCH 052/185] 6563994: assert(wf.check_method_context(ctxk, m), "proper context") failed Check for redefined method before finding unique concrete method Reviewed-by: twisti, kvn --- hotspot/src/share/vm/code/dependencies.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp index 21e0f816d83..0f50425bcdd 100644 --- a/hotspot/src/share/vm/code/dependencies.cpp +++ b/hotspot/src/share/vm/code/dependencies.cpp @@ -1429,6 +1429,10 @@ Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, Method* uniqm, // Include m itself in the set, unless it is abstract. // If this set has exactly one element, return that element. Method* Dependencies::find_unique_concrete_method(Klass* ctxk, Method* m) { + // Return NULL if m is marked old; must have been a redefined method. + if (m->is_old()) { + return NULL; + } ClassHierarchyWalker wf(m); assert(wf.check_method_context(ctxk, m), "proper context"); wf.record_witnesses(1); From 5ec44ad8e9a20ce41cf16ce3000331e550f11e41 Mon Sep 17 00:00:00 2001 From: Yuri Gaevsky Date: Tue, 20 May 2014 09:35:05 +0200 Subject: [PATCH 053/185] 6883953: java -client -XX:ValueMapInitialSize=0 crashes Added lower bound check for ValueMapInitialSize Reviewed-by: kvn --- hotspot/src/share/vm/runtime/arguments.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 0239d8817d3..7e67292092b 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2363,6 +2363,9 @@ bool Arguments::check_vm_args_consistency() { status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio"); status = status && verify_min_value(MarkSweepAlwaysCompactCount, 1, "MarkSweepAlwaysCompactCount"); +#ifdef COMPILER1 + status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize"); +#endif if (PrintNMTStatistics) { #if INCLUDE_NMT From fb62773268082fd73fb93bd3c58821c05db06a56 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 8 May 2014 15:37:17 +0200 Subject: [PATCH 054/185] 8042737: Introduce umbrella header prefetch.inline.hpp Reviewed-by: twisti, stefank --- hotspot/src/os/aix/vm/thread_aix.inline.hpp | 3 - hotspot/src/os/bsd/vm/thread_bsd.inline.hpp | 6 - .../src/os/linux/vm/thread_linux.inline.hpp | 16 - .../os/solaris/vm/thread_solaris.inline.hpp | 7 - .../os/windows/vm/thread_windows.inline.hpp | 4 - .../compactibleFreeListSpace.cpp | 1 + .../gc_implementation/g1/concurrentMark.cpp | 1 + .../gc_implementation/g1/g1CollectedHeap.cpp | 1 + .../g1/g1OopClosures.inline.hpp | 1 + .../vm/gc_implementation/g1/heapRegion.cpp | 1 + .../parallelScavenge/cardTableExtension.cpp | 1 + .../parallelScavenge/psMarkSweepDecorator.cpp | 1 + .../src/share/vm/memory/defNewGeneration.cpp | 1 + hotspot/src/share/vm/memory/space.cpp | 1 + hotspot/src/share/vm/memory/space.hpp | 282 ------------------ hotspot/src/share/vm/memory/space.inline.hpp | 267 +++++++++++++++++ hotspot/src/share/vm/oops/klass.hpp | 30 -- .../src/share/vm/precompiled/precompiled.hpp | 1 + hotspot/src/share/vm/prims/unsafe.cpp | 1 + .../src/share/vm/runtime/prefetch.inline.hpp | 73 +++++ 20 files changed, 351 insertions(+), 348 deletions(-) create mode 100644 hotspot/src/share/vm/runtime/prefetch.inline.hpp diff --git a/hotspot/src/os/aix/vm/thread_aix.inline.hpp b/hotspot/src/os/aix/vm/thread_aix.inline.hpp index 034f6b4e2e0..04623516049 100644 --- a/hotspot/src/os/aix/vm/thread_aix.inline.hpp +++ b/hotspot/src/os/aix/vm/thread_aix.inline.hpp @@ -26,12 +26,9 @@ #ifndef OS_AIX_VM_THREAD_AIX_INLINE_HPP #define OS_AIX_VM_THREAD_AIX_INLINE_HPP -#include "runtime/prefetch.hpp" #include "runtime/thread.hpp" #include "runtime/threadLocalStorage.hpp" -#include "prefetch_aix_ppc.inline.hpp" - // Contains inlined functions for class Thread and ThreadLocalStorage inline void ThreadLocalStorage::pd_invalidate_all() {} // nothing to do diff --git a/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp b/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp index 622707d4f5d..86f125dc5b4 100644 --- a/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp +++ b/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp @@ -31,12 +31,6 @@ #include "runtime/thread.hpp" #include "runtime/threadLocalStorage.hpp" -#ifdef TARGET_OS_ARCH_bsd_x86 -# include "prefetch_bsd_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_bsd_zero -# include "prefetch_bsd_zero.inline.hpp" -#endif // Contains inlined functions for class Thread and ThreadLocalStorage diff --git a/hotspot/src/os/linux/vm/thread_linux.inline.hpp b/hotspot/src/os/linux/vm/thread_linux.inline.hpp index 76bdd223449..b58dc078948 100644 --- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp +++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp @@ -29,24 +29,8 @@ #error "This file should only be included from thread.inline.hpp" #endif -#include "runtime/prefetch.hpp" #include "runtime/thread.hpp" #include "runtime/threadLocalStorage.hpp" -#ifdef TARGET_OS_ARCH_linux_x86 -# include "prefetch_linux_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_sparc -# include "prefetch_linux_sparc.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_zero -# include "prefetch_linux_zero.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_arm -# include "prefetch_linux_arm.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_linux_ppc -# include "prefetch_linux_ppc.inline.hpp" -#endif // Contains inlined functions for class Thread and ThreadLocalStorage diff --git a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp index affc2c824c6..d7d6d378f1a 100644 --- a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp +++ b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp @@ -30,15 +30,8 @@ #endif #include "runtime/atomic.inline.hpp" -#include "runtime/prefetch.hpp" #include "runtime/thread.hpp" #include "runtime/threadLocalStorage.hpp" -#ifdef TARGET_OS_ARCH_solaris_x86 -# include "prefetch_solaris_x86.inline.hpp" -#endif -#ifdef TARGET_OS_ARCH_solaris_sparc -# include "prefetch_solaris_sparc.inline.hpp" -#endif // Thread::current is "hot" it's called > 128K times in the 1st 500 msecs of // startup. diff --git a/hotspot/src/os/windows/vm/thread_windows.inline.hpp b/hotspot/src/os/windows/vm/thread_windows.inline.hpp index a7af8776325..95dd17cecc7 100644 --- a/hotspot/src/os/windows/vm/thread_windows.inline.hpp +++ b/hotspot/src/os/windows/vm/thread_windows.inline.hpp @@ -29,12 +29,8 @@ #error "This file should only be included from thread.inline.hpp" #endif -#include "runtime/prefetch.hpp" #include "runtime/thread.hpp" #include "runtime/threadLocalStorage.hpp" -#ifdef TARGET_OS_ARCH_windows_x86 -# include "prefetch_windows_x86.inline.hpp" -#endif // Contains inlined functions for class Thread and ThreadLocalStorage diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index da4bf278299..640265fbf56 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -33,6 +33,7 @@ #include "memory/allocation.inline.hpp" #include "memory/blockOffsetTable.inline.hpp" #include "memory/resourceArea.hpp" +#include "memory/space.inline.hpp" #include "memory/universe.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/globals.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index ad21b8ed7b6..ed28c85f22c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -45,6 +45,7 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" +#include "runtime/prefetch.inline.hpp" #include "services/memTracker.hpp" // Concurrent marking bit map wrapper diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 575d3db9239..001673a1cdb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -62,6 +62,7 @@ #include "memory/referenceProcessor.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.pcgc.inline.hpp" +#include "runtime/prefetch.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/vmThread.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp index 0c9f0cf2d49..48c024d7470 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp @@ -31,6 +31,7 @@ #include "gc_implementation/g1/g1RemSet.hpp" #include "gc_implementation/g1/g1RemSet.inline.hpp" #include "gc_implementation/g1/heapRegionRemSet.hpp" +#include "runtime/prefetch.inline.hpp" /* * This really ought to be an inline function, but apparently the C++ diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 24afeba238f..c12e3fe840c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -32,6 +32,7 @@ #include "gc_implementation/g1/heapRegionSeq.inline.hpp" #include "memory/genOopClosures.inline.hpp" #include "memory/iterator.hpp" +#include "memory/space.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/orderAccess.inline.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp index 502371f0169..a2a6b55a27c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp @@ -30,6 +30,7 @@ #include "gc_implementation/parallelScavenge/psYoungGen.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.psgc.inline.hpp" +#include "runtime/prefetch.inline.hpp" // Checks an individual oop for missing precise marks. Mark // may be either dirty or newgen. diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index ee43825614b..dc79821cb37 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -32,6 +32,7 @@ #include "gc_implementation/shared/markSweep.inline.hpp" #include "gc_implementation/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" +#include "runtime/prefetch.inline.hpp" PSMarkSweepDecorator* PSMarkSweepDecorator::_destination_decorator = NULL; diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 32c2e28bee6..bf51090df12 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -42,6 +42,7 @@ #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +#include "runtime/prefetch.inline.hpp" #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 68e2631d115..ae29692a62b 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -37,6 +37,7 @@ #include "oops/oop.inline.hpp" #include "oops/oop.inline2.hpp" #include "runtime/java.hpp" +#include "runtime/prefetch.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/safepoint.hpp" #include "utilities/copy.hpp" diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index 2e0ebcb09b4..4c2974dcdab 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -33,24 +33,8 @@ #include "memory/watermark.hpp" #include "oops/markOop.hpp" #include "runtime/mutexLocker.hpp" -#include "runtime/prefetch.hpp" #include "utilities/macros.hpp" #include "utilities/workgroup.hpp" -#ifdef TARGET_OS_FAMILY_linux -# include "os_linux.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_solaris -# include "os_solaris.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_windows -# include "os_windows.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_aix -# include "os_aix.inline.hpp" -#endif -#ifdef TARGET_OS_FAMILY_bsd -# include "os_bsd.inline.hpp" -#endif // A space is an abstraction for the "storage units" backing // up the generation abstraction. It includes specific @@ -468,272 +452,6 @@ protected: size_t word_len); }; -#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) { \ - /* Compute the new addresses for the live objects and store it in the mark \ - * Used by universe::mark_sweep_phase2() \ - */ \ - HeapWord* compact_top; /* This is where we are currently compacting to. */ \ - \ - /* We're sure to be here before any objects are compacted into this \ - * space, so this is a good time to initialize this: \ - */ \ - set_compaction_top(bottom()); \ - \ - if (cp->space == NULL) { \ - assert(cp->gen != NULL, "need a generation"); \ - assert(cp->threshold == NULL, "just checking"); \ - assert(cp->gen->first_compaction_space() == this, "just checking"); \ - cp->space = cp->gen->first_compaction_space(); \ - compact_top = cp->space->bottom(); \ - cp->space->set_compaction_top(compact_top); \ - cp->threshold = cp->space->initialize_threshold(); \ - } else { \ - compact_top = cp->space->compaction_top(); \ - } \ - \ - /* We allow some amount of garbage towards the bottom of the space, so \ - * we don't start compacting before there is a significant gain to be made.\ - * Occasionally, we want to ensure a full compaction, which is determined \ - * by the MarkSweepAlwaysCompactCount parameter. \ - */ \ - uint invocations = MarkSweep::total_invocations(); \ - bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \ - \ - size_t allowed_deadspace = 0; \ - if (skip_dead) { \ - const size_t ratio = allowed_dead_ratio(); \ - allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ - } \ - \ - HeapWord* q = bottom(); \ - HeapWord* t = scan_limit(); \ - \ - HeapWord* end_of_live= q; /* One byte beyond the last byte of the last \ - live object. */ \ - HeapWord* first_dead = end();/* The first dead object. */ \ - LiveRange* liveRange = NULL; /* The current live range, recorded in the \ - first header of preceding free area. */ \ - _first_dead = first_dead; \ - \ - const intx interval = PrefetchScanIntervalInBytes; \ - \ - while (q < t) { \ - assert(!block_is_obj(q) || \ - oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || \ - oop(q)->mark()->has_bias_pattern(), \ - "these are the only valid states during a mark sweep"); \ - if (block_is_obj(q) && oop(q)->is_gc_marked()) { \ - /* prefetch beyond q */ \ - Prefetch::write(q, interval); \ - size_t size = block_size(q); \ - compact_top = cp->space->forward(oop(q), size, cp, compact_top); \ - q += size; \ - end_of_live = q; \ - } else { \ - /* run over all the contiguous dead objects */ \ - HeapWord* end = q; \ - do { \ - /* prefetch beyond end */ \ - Prefetch::write(end, interval); \ - end += block_size(end); \ - } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\ - \ - /* see if we might want to pretend this object is alive so that \ - * we don't have to compact quite as often. \ - */ \ - if (allowed_deadspace > 0 && q == compact_top) { \ - size_t sz = pointer_delta(end, q); \ - if (insert_deadspace(allowed_deadspace, q, sz)) { \ - compact_top = cp->space->forward(oop(q), sz, cp, compact_top); \ - q = end; \ - end_of_live = end; \ - continue; \ - } \ - } \ - \ - /* otherwise, it really is a free region. */ \ - \ - /* for the previous LiveRange, record the end of the live objects. */ \ - if (liveRange) { \ - liveRange->set_end(q); \ - } \ - \ - /* record the current LiveRange object. \ - * liveRange->start() is overlaid on the mark word. \ - */ \ - liveRange = (LiveRange*)q; \ - liveRange->set_start(end); \ - liveRange->set_end(end); \ - \ - /* see if this is the first dead region. */ \ - if (q < first_dead) { \ - first_dead = q; \ - } \ - \ - /* move on to the next object */ \ - q = end; \ - } \ - } \ - \ - assert(q == t, "just checking"); \ - if (liveRange != NULL) { \ - liveRange->set_end(q); \ - } \ - _end_of_live = end_of_live; \ - if (end_of_live < first_dead) { \ - first_dead = end_of_live; \ - } \ - _first_dead = first_dead; \ - \ - /* save the compaction_top of the compaction space. */ \ - cp->space->set_compaction_top(compact_top); \ -} - -#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ - /* adjust all the interior pointers to point at the new locations of objects \ - * Used by MarkSweep::mark_sweep_phase3() */ \ - \ - HeapWord* q = bottom(); \ - HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ - \ - assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ - \ - if (q < t && _first_dead > q && \ - !oop(q)->is_gc_marked()) { \ - /* we have a chunk of the space which hasn't moved and we've \ - * reinitialized the mark word during the previous pass, so we can't \ - * use is_gc_marked for the traversal. */ \ - HeapWord* end = _first_dead; \ - \ - while (q < end) { \ - /* I originally tried to conjoin "block_start(q) == q" to the \ - * assertion below, but that doesn't work, because you can't \ - * accurately traverse previous objects to get to the current one \ - * after their pointers have been \ - * updated, until the actual compaction is done. dld, 4/00 */ \ - assert(block_is_obj(q), \ - "should be at block boundaries, and should be looking at objs"); \ - \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ - \ - q += size; \ - } \ - \ - if (_first_dead == t) { \ - q = t; \ - } else { \ - /* $$$ This is funky. Using this to read the previously written \ - * LiveRange. See also use below. */ \ - q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \ - } \ - } \ - \ - const intx interval = PrefetchScanIntervalInBytes; \ - \ - debug_only(HeapWord* prev_q = NULL); \ - while (q < t) { \ - /* prefetch beyond q */ \ - Prefetch::write(q, interval); \ - if (oop(q)->is_gc_marked()) { \ - /* q is alive */ \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ - debug_only(prev_q = q); \ - q += size; \ - } else { \ - /* q is not a live object, so its mark should point at the next \ - * live object */ \ - debug_only(prev_q = q); \ - q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ - assert(q > prev_q, "we should be moving forward through memory"); \ - } \ - } \ - \ - assert(q == t, "just checking"); \ -} - -#define SCAN_AND_COMPACT(obj_size) { \ - /* Copy all live objects to their new location \ - * Used by MarkSweep::mark_sweep_phase4() */ \ - \ - HeapWord* q = bottom(); \ - HeapWord* const t = _end_of_live; \ - debug_only(HeapWord* prev_q = NULL); \ - \ - if (q < t && _first_dead > q && \ - !oop(q)->is_gc_marked()) { \ - debug_only( \ - /* we have a chunk of the space which hasn't moved and we've reinitialized \ - * the mark word during the previous pass, so we can't use is_gc_marked for \ - * the traversal. */ \ - HeapWord* const end = _first_dead; \ - \ - while (q < end) { \ - size_t size = obj_size(q); \ - assert(!oop(q)->is_gc_marked(), \ - "should be unmarked (special dense prefix handling)"); \ - debug_only(prev_q = q); \ - q += size; \ - } \ - ) /* debug_only */ \ - \ - if (_first_dead == t) { \ - q = t; \ - } else { \ - /* $$$ Funky */ \ - q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); \ - } \ - } \ - \ - const intx scan_interval = PrefetchScanIntervalInBytes; \ - const intx copy_interval = PrefetchCopyIntervalInBytes; \ - while (q < t) { \ - if (!oop(q)->is_gc_marked()) { \ - /* mark is pointer to next marked oop */ \ - debug_only(prev_q = q); \ - q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ - assert(q > prev_q, "we should be moving forward through memory"); \ - } else { \ - /* prefetch beyond q */ \ - Prefetch::read(q, scan_interval); \ - \ - /* size and destination */ \ - size_t size = obj_size(q); \ - HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); \ - \ - /* prefetch beyond compaction_top */ \ - Prefetch::write(compaction_top, copy_interval); \ - \ - /* copy object and reinit its mark */ \ - assert(q != compaction_top, "everything in this pass should be moving"); \ - Copy::aligned_conjoint_words(q, compaction_top, size); \ - oop(compaction_top)->init_mark(); \ - assert(oop(compaction_top)->klass() != NULL, "should have a class"); \ - \ - debug_only(prev_q = q); \ - q += size; \ - } \ - } \ - \ - /* Let's remember if we were empty before we did the compaction. */ \ - bool was_empty = used_region().is_empty(); \ - /* Reset space after compaction is complete */ \ - reset_after_compaction(); \ - /* We do this clear, below, since it has overloaded meanings for some */ \ - /* space subtypes. For example, OffsetTableContigSpace's that were */ \ - /* compacted into will have had their offset table thresholds updated */ \ - /* continuously, but those that weren't need to have their thresholds */ \ - /* re-initialized. Also mangles unused area for debugging. */ \ - if (used_region().is_empty()) { \ - if (!was_empty) clear(SpaceDecorator::Mangle); \ - } else { \ - if (ZapUnusedHeapArea) mangle_unused_area(); \ - } \ -} - class GenSpaceMangler; // A space in which the free area is contiguous. It therefore supports diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp index 1d600e2a1aa..007cebd16e6 100644 --- a/hotspot/src/share/vm/memory/space.inline.hpp +++ b/hotspot/src/share/vm/memory/space.inline.hpp @@ -28,12 +28,279 @@ #include "gc_interface/collectedHeap.hpp" #include "memory/space.hpp" #include "memory/universe.hpp" +#include "runtime/prefetch.inline.hpp" #include "runtime/safepoint.hpp" inline HeapWord* Space::block_start(const void* p) { return block_start_const(p); } +#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) { \ + /* Compute the new addresses for the live objects and store it in the mark \ + * Used by universe::mark_sweep_phase2() \ + */ \ + HeapWord* compact_top; /* This is where we are currently compacting to. */ \ + \ + /* We're sure to be here before any objects are compacted into this \ + * space, so this is a good time to initialize this: \ + */ \ + set_compaction_top(bottom()); \ + \ + if (cp->space == NULL) { \ + assert(cp->gen != NULL, "need a generation"); \ + assert(cp->threshold == NULL, "just checking"); \ + assert(cp->gen->first_compaction_space() == this, "just checking"); \ + cp->space = cp->gen->first_compaction_space(); \ + compact_top = cp->space->bottom(); \ + cp->space->set_compaction_top(compact_top); \ + cp->threshold = cp->space->initialize_threshold(); \ + } else { \ + compact_top = cp->space->compaction_top(); \ + } \ + \ + /* We allow some amount of garbage towards the bottom of the space, so \ + * we don't start compacting before there is a significant gain to be made.\ + * Occasionally, we want to ensure a full compaction, which is determined \ + * by the MarkSweepAlwaysCompactCount parameter. \ + */ \ + uint invocations = MarkSweep::total_invocations(); \ + bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0); \ + \ + size_t allowed_deadspace = 0; \ + if (skip_dead) { \ + const size_t ratio = allowed_dead_ratio(); \ + allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ + } \ + \ + HeapWord* q = bottom(); \ + HeapWord* t = scan_limit(); \ + \ + HeapWord* end_of_live= q; /* One byte beyond the last byte of the last \ + live object. */ \ + HeapWord* first_dead = end();/* The first dead object. */ \ + LiveRange* liveRange = NULL; /* The current live range, recorded in the \ + first header of preceding free area. */ \ + _first_dead = first_dead; \ + \ + const intx interval = PrefetchScanIntervalInBytes; \ + \ + while (q < t) { \ + assert(!block_is_obj(q) || \ + oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() || \ + oop(q)->mark()->has_bias_pattern(), \ + "these are the only valid states during a mark sweep"); \ + if (block_is_obj(q) && oop(q)->is_gc_marked()) { \ + /* prefetch beyond q */ \ + Prefetch::write(q, interval); \ + size_t size = block_size(q); \ + compact_top = cp->space->forward(oop(q), size, cp, compact_top); \ + q += size; \ + end_of_live = q; \ + } else { \ + /* run over all the contiguous dead objects */ \ + HeapWord* end = q; \ + do { \ + /* prefetch beyond end */ \ + Prefetch::write(end, interval); \ + end += block_size(end); \ + } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\ + \ + /* see if we might want to pretend this object is alive so that \ + * we don't have to compact quite as often. \ + */ \ + if (allowed_deadspace > 0 && q == compact_top) { \ + size_t sz = pointer_delta(end, q); \ + if (insert_deadspace(allowed_deadspace, q, sz)) { \ + compact_top = cp->space->forward(oop(q), sz, cp, compact_top); \ + q = end; \ + end_of_live = end; \ + continue; \ + } \ + } \ + \ + /* otherwise, it really is a free region. */ \ + \ + /* for the previous LiveRange, record the end of the live objects. */ \ + if (liveRange) { \ + liveRange->set_end(q); \ + } \ + \ + /* record the current LiveRange object. \ + * liveRange->start() is overlaid on the mark word. \ + */ \ + liveRange = (LiveRange*)q; \ + liveRange->set_start(end); \ + liveRange->set_end(end); \ + \ + /* see if this is the first dead region. */ \ + if (q < first_dead) { \ + first_dead = q; \ + } \ + \ + /* move on to the next object */ \ + q = end; \ + } \ + } \ + \ + assert(q == t, "just checking"); \ + if (liveRange != NULL) { \ + liveRange->set_end(q); \ + } \ + _end_of_live = end_of_live; \ + if (end_of_live < first_dead) { \ + first_dead = end_of_live; \ + } \ + _first_dead = first_dead; \ + \ + /* save the compaction_top of the compaction space. */ \ + cp->space->set_compaction_top(compact_top); \ +} + +#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ + /* adjust all the interior pointers to point at the new locations of objects \ + * Used by MarkSweep::mark_sweep_phase3() */ \ + \ + HeapWord* q = bottom(); \ + HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ + \ + assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ + \ + if (q < t && _first_dead > q && \ + !oop(q)->is_gc_marked()) { \ + /* we have a chunk of the space which hasn't moved and we've \ + * reinitialized the mark word during the previous pass, so we can't \ + * use is_gc_marked for the traversal. */ \ + HeapWord* end = _first_dead; \ + \ + while (q < end) { \ + /* I originally tried to conjoin "block_start(q) == q" to the \ + * assertion below, but that doesn't work, because you can't \ + * accurately traverse previous objects to get to the current one \ + * after their pointers have been \ + * updated, until the actual compaction is done. dld, 4/00 */ \ + assert(block_is_obj(q), \ + "should be at block boundaries, and should be looking at objs"); \ + \ + /* point all the oops to the new location */ \ + size_t size = oop(q)->adjust_pointers(); \ + size = adjust_obj_size(size); \ + \ + q += size; \ + } \ + \ + if (_first_dead == t) { \ + q = t; \ + } else { \ + /* $$$ This is funky. Using this to read the previously written \ + * LiveRange. See also use below. */ \ + q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \ + } \ + } \ + \ + const intx interval = PrefetchScanIntervalInBytes; \ + \ + debug_only(HeapWord* prev_q = NULL); \ + while (q < t) { \ + /* prefetch beyond q */ \ + Prefetch::write(q, interval); \ + if (oop(q)->is_gc_marked()) { \ + /* q is alive */ \ + /* point all the oops to the new location */ \ + size_t size = oop(q)->adjust_pointers(); \ + size = adjust_obj_size(size); \ + debug_only(prev_q = q); \ + q += size; \ + } else { \ + /* q is not a live object, so its mark should point at the next \ + * live object */ \ + debug_only(prev_q = q); \ + q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ + assert(q > prev_q, "we should be moving forward through memory"); \ + } \ + } \ + \ + assert(q == t, "just checking"); \ +} + +#define SCAN_AND_COMPACT(obj_size) { \ + /* Copy all live objects to their new location \ + * Used by MarkSweep::mark_sweep_phase4() */ \ + \ + HeapWord* q = bottom(); \ + HeapWord* const t = _end_of_live; \ + debug_only(HeapWord* prev_q = NULL); \ + \ + if (q < t && _first_dead > q && \ + !oop(q)->is_gc_marked()) { \ + debug_only( \ + /* we have a chunk of the space which hasn't moved and we've reinitialized \ + * the mark word during the previous pass, so we can't use is_gc_marked for \ + * the traversal. */ \ + HeapWord* const end = _first_dead; \ + \ + while (q < end) { \ + size_t size = obj_size(q); \ + assert(!oop(q)->is_gc_marked(), \ + "should be unmarked (special dense prefix handling)"); \ + debug_only(prev_q = q); \ + q += size; \ + } \ + ) /* debug_only */ \ + \ + if (_first_dead == t) { \ + q = t; \ + } else { \ + /* $$$ Funky */ \ + q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer(); \ + } \ + } \ + \ + const intx scan_interval = PrefetchScanIntervalInBytes; \ + const intx copy_interval = PrefetchCopyIntervalInBytes; \ + while (q < t) { \ + if (!oop(q)->is_gc_marked()) { \ + /* mark is pointer to next marked oop */ \ + debug_only(prev_q = q); \ + q = (HeapWord*) oop(q)->mark()->decode_pointer(); \ + assert(q > prev_q, "we should be moving forward through memory"); \ + } else { \ + /* prefetch beyond q */ \ + Prefetch::read(q, scan_interval); \ + \ + /* size and destination */ \ + size_t size = obj_size(q); \ + HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee(); \ + \ + /* prefetch beyond compaction_top */ \ + Prefetch::write(compaction_top, copy_interval); \ + \ + /* copy object and reinit its mark */ \ + assert(q != compaction_top, "everything in this pass should be moving"); \ + Copy::aligned_conjoint_words(q, compaction_top, size); \ + oop(compaction_top)->init_mark(); \ + assert(oop(compaction_top)->klass() != NULL, "should have a class"); \ + \ + debug_only(prev_q = q); \ + q += size; \ + } \ + } \ + \ + /* Let's remember if we were empty before we did the compaction. */ \ + bool was_empty = used_region().is_empty(); \ + /* Reset space after compaction is complete */ \ + reset_after_compaction(); \ + /* We do this clear, below, since it has overloaded meanings for some */ \ + /* space subtypes. For example, OffsetTableContigSpace's that were */ \ + /* compacted into will have had their offset table thresholds updated */ \ + /* continuously, but those that weren't need to have their thresholds */ \ + /* re-initialized. Also mangles unused area for debugging. */ \ + if (used_region().is_empty()) { \ + if (!was_empty) clear(SpaceDecorator::Mangle); \ + } else { \ + if (ZapUnusedHeapArea) mangle_unused_area(); \ + } \ +} + inline HeapWord* OffsetTableContigSpace::allocate(size_t size) { HeapWord* res = ContiguousSpace::allocate(size); if (res != NULL) { diff --git a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp index 6aac575cf11..06198fbb11c 100644 --- a/hotspot/src/share/vm/oops/klass.hpp +++ b/hotspot/src/share/vm/oops/klass.hpp @@ -555,36 +555,6 @@ class Klass : public Metadata { static void clean_weak_klass_links(BoolObjectClosure* is_alive); - // Prefetch within oop iterators. This is a macro because we - // can't guarantee that the compiler will inline it. In 64-bit - // it generally doesn't. Signature is - // - // static void prefetch_beyond(oop* const start, - // oop* const end, - // const intx foffset, - // const Prefetch::style pstyle); -#define prefetch_beyond(start, end, foffset, pstyle) { \ - const intx foffset_ = (foffset); \ - const Prefetch::style pstyle_ = (pstyle); \ - assert(foffset_ > 0, "prefetch beyond, not behind"); \ - if (pstyle_ != Prefetch::do_none) { \ - oop* ref = (start); \ - if (ref < (end)) { \ - switch (pstyle_) { \ - case Prefetch::do_read: \ - Prefetch::read(*ref, foffset_); \ - break; \ - case Prefetch::do_write: \ - Prefetch::write(*ref, foffset_); \ - break; \ - default: \ - ShouldNotReachHere(); \ - break; \ - } \ - } \ - } \ - } - // iterators virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index 6d532de6aad..e8d014430df 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -199,6 +199,7 @@ # include "runtime/perfData.hpp" # include "runtime/perfMemory.hpp" # include "runtime/prefetch.hpp" +# include "runtime/prefetch.inline.hpp" # include "runtime/reflection.hpp" # include "runtime/reflectionUtils.hpp" # include "runtime/registerMap.hpp" diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index b3160771aed..4dd10cfca57 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -33,6 +33,7 @@ #include "prims/jvm.h" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.hpp" +#include "runtime/prefetch.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/reflection.hpp" #include "runtime/synchronizer.hpp" diff --git a/hotspot/src/share/vm/runtime/prefetch.inline.hpp b/hotspot/src/share/vm/runtime/prefetch.inline.hpp new file mode 100644 index 00000000000..e147a211aea --- /dev/null +++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2014, 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. + * + */ + +#ifndef SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP +#define SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP + +#include "runtime/prefetch.hpp" + +// Linux +#ifdef TARGET_OS_ARCH_linux_x86 +# include "prefetch_linux_x86.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_linux_sparc +# include "prefetch_linux_sparc.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_linux_zero +# include "prefetch_linux_zero.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_linux_arm +# include "prefetch_linux_arm.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_linux_ppc +# include "prefetch_linux_ppc.inline.hpp" +#endif + +// Solaris +#ifdef TARGET_OS_ARCH_solaris_x86 +# include "prefetch_solaris_x86.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_solaris_sparc +# include "prefetch_solaris_sparc.inline.hpp" +#endif + +// Windows +#ifdef TARGET_OS_ARCH_windows_x86 +# include "prefetch_windows_x86.inline.hpp" +#endif + +// AIX +#ifdef TARGET_OS_ARCH_aix_ppc +# include "prefetch_aix_ppc.inline.hpp" +#endif + +// BSD +#ifdef TARGET_OS_ARCH_bsd_x86 +# include "prefetch_bsd_x86.inline.hpp" +#endif +#ifdef TARGET_OS_ARCH_bsd_zero +# include "prefetch_bsd_zero.inline.hpp" +#endif + +#endif // SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP From 358e8a04ee83ac9aec3c9a743e8bf6619df98173 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Thu, 8 May 2014 18:37:34 +0400 Subject: [PATCH 055/185] 8042752: [macosx] NSEvent instances leak throw JNI local references Reviewed-by: serb, azvegint --- jdk/src/macosx/native/sun/awt/AWTView.m | 13 +++++++------ jdk/src/macosx/native/sun/awt/CTrayIcon.m | 7 +++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/AWTView.m b/jdk/src/macosx/native/sun/awt/AWTView.m index bcc832190f4..830fb77e82b 100644 --- a/jdk/src/macosx/native/sun/awt/AWTView.m +++ b/jdk/src/macosx/native/sun/awt/AWTView.m @@ -27,6 +27,7 @@ #import #import +#import "jni_util.h" #import "ThreadUtilities.h" #import "AWTView.h" @@ -391,14 +392,12 @@ AWT_ASSERT_APPKIT_THREAD; (jint)absP.x, (jint)absP.y, [event deltaY], [event deltaX]); - if (jEvent == nil) { - // Unable to create event by some reason. - return; - } + CHECK_NULL(jEvent); static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView"); static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V"); JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent); + (*env)->DeleteLocalRef(env, jEvent); } - (void) resetTrackingArea { @@ -447,20 +446,22 @@ AWT_ASSERT_APPKIT_THREAD; static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent"); static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V"); - jobject jevent = JNFNewObject(env, jctor_NSEvent, + jobject jEvent = JNFNewObject(env, jctor_NSEvent, [event type], [event modifierFlags], [event keyCode], characters); + CHECK_NULL(jEvent); static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView"); static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView, "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V"); - JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent); + JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jEvent); if (characters != NULL) { (*env)->DeleteLocalRef(env, characters); } + (*env)->DeleteLocalRef(env, jEvent); } -(void) deliverResize: (NSRect) rect { diff --git a/jdk/src/macosx/native/sun/awt/CTrayIcon.m b/jdk/src/macosx/native/sun/awt/CTrayIcon.m index 79ae024f76f..35adf3b866d 100644 --- a/jdk/src/macosx/native/sun/awt/CTrayIcon.m +++ b/jdk/src/macosx/native/sun/awt/CTrayIcon.m @@ -25,6 +25,7 @@ #import #import +#import "jni_util.h" #import "CTrayIcon.h" #import "ThreadUtilities.h" @@ -146,14 +147,12 @@ static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) { (jint)absP.x, (jint)absP.y, [event deltaY], [event deltaX]); - if (jEvent == nil) { - // Unable to create event by some reason. - return; - } + CHECK_NULL(jEvent); static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon"); static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V"); JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent); + (*env)->DeleteLocalRef(env, jEvent); } @end //AWTTrayIcon From 4c217914c2965a26f38a85379b007f16061e7aad Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 8 May 2014 15:17:02 -0700 Subject: [PATCH 056/185] 8038875: Remove use of ServiceLoader in finding class implementing sun.java2d.pipe. RenderingEngine Reviewed-by: flar, mchung --- jdk/make/CopyIntoClasses.gmk | 2 - jdk/make/profile-rtjar-includes.txt | 3 +- .../services/sun.java2d.pipe.RenderingEngine | 2 - .../sun/java2d/pipe/RenderingEngine.java | 60 +++++++------------ .../services/sun.java2d.pipe.RenderingEngine | 2 - .../services/sun.java2d.pipe.RenderingEngine | 5 -- 6 files changed, 23 insertions(+), 51 deletions(-) delete mode 100644 jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine delete mode 100644 jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine delete mode 100644 jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine diff --git a/jdk/make/CopyIntoClasses.gmk b/jdk/make/CopyIntoClasses.gmk index 36b0919fa2f..322901603a3 100644 --- a/jdk/make/CopyIntoClasses.gmk +++ b/jdk/make/CopyIntoClasses.gmk @@ -118,10 +118,8 @@ endif SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS))) ifdef OPENJDK - SRC_SERVICES_FILES := $(filter-out %sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES)) SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) else - SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES)) SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) endif diff --git a/jdk/make/profile-rtjar-includes.txt b/jdk/make/profile-rtjar-includes.txt index 231b1583ae0..6cce159e400 100644 --- a/jdk/make/profile-rtjar-includes.txt +++ b/jdk/make/profile-rtjar-includes.txt @@ -242,5 +242,4 @@ FULL_JRE_INCLUDE_METAINF_SERVICES := \ META-INF/services/javax.sound.sampled.spi.AudioFileWriter \ META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \ META-INF/services/javax.sound.sampled.spi.MixerProvider \ - META-INF/services/sun.java2d.cmm.PCMM \ - META-INF/services/sun.java2d.pipe.RenderingEngine + META-INF/services/sun.java2d.cmm.PCMM diff --git a/jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine b/jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine deleted file mode 100644 index 45f0ddfa772..00000000000 --- a/jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine +++ /dev/null @@ -1,2 +0,0 @@ -# Ductus Rendering Engine module -sun.dc.DuctusRenderingEngine diff --git a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java index 3c2a77ca73b..034a6e8b218 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java +++ b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java @@ -32,7 +32,6 @@ import java.awt.geom.AffineTransform; import java.security.PrivilegedAction; import java.security.AccessController; -import java.util.ServiceLoader; import sun.security.action.GetPropertyAction; import sun.awt.geom.PathConsumer2D; @@ -97,12 +96,9 @@ public abstract class RenderingEngine { * * * If no specific {@code RenderingEngine} is specified on the command - * or Ductus renderer is specified, it will attempt loading the - * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath; - * if not found, use the ServiceLoader. - * If no specific {@code RenderingEngine} is specified on the command - * line then the last one returned by enumerating all subclasses of - * {@code RenderingEngine} known to the ServiceLoader is used. + * or Ductus renderer is specified, it will first attempt loading the + * sun.dc.DuctusRenderingEngine class using Class.forName, if that + * is not found, then it will look for Pisces. *

    * Runtime tracing of the actions of the {@code RenderingEngine} * can be enabled by specifying the runtime flag: @@ -117,42 +113,30 @@ public abstract class RenderingEngine { return reImpl; } - reImpl = - AccessController.doPrivileged(new PrivilegedAction() { - public RenderingEngine run() { - final String ductusREClass = "sun.dc.DuctusRenderingEngine"; - String reClass = - System.getProperty("sun.java2d.renderer", ductusREClass); - if (reClass.equals(ductusREClass)) { - try { - Class cls = Class.forName(ductusREClass); - return (RenderingEngine) cls.newInstance(); - } catch (ReflectiveOperationException ignored) { - // not found - } - } - - ServiceLoader reLoader = - ServiceLoader.loadInstalled(RenderingEngine.class); - - RenderingEngine service = null; - - for (RenderingEngine re : reLoader) { - service = re; - if (re.getClass().getName().equals(reClass)) { - break; - } - } - return service; - } - }); + /* Look first for ductus or an app-override renderer, + * if not specified or present, then look for pisces. + */ + final String ductusREClass = "sun.dc.DuctusRenderingEngine"; + final String piscesREClass = "sun.java2d.pisces.PiscesRenderingEngine"; + GetPropertyAction gpa = + new GetPropertyAction("sun.java2d.renderer", ductusREClass); + String reClass = AccessController.doPrivileged(gpa); + try { + Class cls = Class.forName(reClass); + reImpl = (RenderingEngine) cls.newInstance(); + } catch (ReflectiveOperationException ignored0) { + try { + Class cls = Class.forName(piscesREClass); + reImpl = (RenderingEngine) cls.newInstance(); + } catch (ReflectiveOperationException ignored1) { + } + } if (reImpl == null) { throw new InternalError("No RenderingEngine module found"); } - GetPropertyAction gpa = - new GetPropertyAction("sun.java2d.renderer.trace"); + gpa = new GetPropertyAction("sun.java2d.renderer.trace"); String reTrace = AccessController.doPrivileged(gpa); if (reTrace != null) { reImpl = new Tracer(reImpl); diff --git a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine b/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine deleted file mode 100644 index 607ff59051a..00000000000 --- a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine +++ /dev/null @@ -1,2 +0,0 @@ -# Pisces Rendering Engine module -sun.java2d.pisces.PiscesRenderingEngine diff --git a/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine b/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine deleted file mode 100644 index c79fdbde9c8..00000000000 --- a/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine +++ /dev/null @@ -1,5 +0,0 @@ -# Jules Rendering Engine module -sun.java2d.jules.JulesRenderingEngine - -# Pisces Rendering Engine module -sun.java2d.pisces.PiscesRenderingEngine From a9f93ddc32c6fc158b449c3bc4b4865a147762fd Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Thu, 8 May 2014 19:27:24 -0400 Subject: [PATCH 057/185] 8042806: Splashscreen uses libjpeg-internal macros Reviewed-by: anthony, prr --- .../share/native/sun/awt/splashscreen/splashscreen_jpeg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c index f9cb8995c86..8d41c9207d8 100644 --- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c +++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c @@ -25,7 +25,6 @@ #include "splashscreen_impl.h" -#include "jinclude.h" #include "jpeglib.h" #include "jerror.h" @@ -107,11 +106,11 @@ set_stream_src(j_decompress_ptr cinfo, SplashStream * stream) if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, - JPOOL_PERMANENT, SIZEOF(stream_source_mgr)); + JPOOL_PERMANENT, sizeof(stream_source_mgr)); src = (stream_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, - JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET)); + JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET)); } src = (stream_src_ptr) cinfo->src; From 8629eeb403467b26502a71d8656fd57f163a8885 Mon Sep 17 00:00:00 2001 From: Erik Helin Date: Fri, 9 May 2014 09:59:39 +0200 Subject: [PATCH 058/185] 8034852: Shrinking of Metaspace high-water-mark causes incorrect OutOfMemoryErrors or back-to-back GCs Reviewed-by: jmasa, pliden, stefank --- hotspot/src/share/vm/memory/metaspace.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 10b95973192..70207ca3ad1 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -1431,10 +1431,9 @@ size_t MetaspaceGC::allowed_expansion() { } size_t capacity_until_gc = capacity_until_GC(); - - if (capacity_until_gc <= committed_bytes) { - return 0; - } + assert(capacity_until_gc >= committed_bytes, + err_msg("capacity_until_gc: " SIZE_FORMAT " < committed_bytes: " SIZE_FORMAT, + capacity_until_gc, committed_bytes)); size_t left_until_GC = capacity_until_gc - committed_bytes; size_t left_to_commit = MIN2(left_until_GC, left_until_max); @@ -1447,7 +1446,15 @@ void MetaspaceGC::compute_new_size() { uint current_shrink_factor = _shrink_factor; _shrink_factor = 0; - const size_t used_after_gc = MetaspaceAux::capacity_bytes(); + // Using committed_bytes() for used_after_gc is an overestimation, since the + // chunk free lists are included in committed_bytes() and the memory in an + // un-fragmented chunk free list is available for future allocations. + // However, if the chunk free lists becomes fragmented, then the memory may + // not be available for future allocations and the memory is therefore "in use". + // Including the chunk free lists in the definition of "in use" is therefore + // necessary. Not including the chunk free lists can cause capacity_until_GC to + // shrink below committed_bytes() and this has caused serious bugs in the past. + const size_t used_after_gc = MetaspaceAux::committed_bytes(); const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC(); const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0; From 20e8dfef5327f5c32a9d3501cb18ae8a99bb7921 Mon Sep 17 00:00:00 2001 From: Christian Tornqvist Date: Fri, 9 May 2014 17:06:17 +0200 Subject: [PATCH 059/185] 8042471: Unable to build JDK 9 Hotspot within VS2010 Fixed quoting issue and passing on defines to project file Reviewed-by: mgronlun, sla --- hotspot/make/windows/projectfiles/common/Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile index 4a527ef68c3..51d4e6f1f11 100644 --- a/hotspot/make/windows/projectfiles/common/Makefile +++ b/hotspot/make/windows/projectfiles/common/Makefile @@ -93,7 +93,7 @@ JRE_RELEASE_VERSION="\\\"$(JDK_MAJOR_VER).$(JDK_MINOR_VER).$(JDK_MICRO_VER)\\\"" !if "$(HOTSPOT_RELEASE_VERSION)" != "" HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\"" !else -HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\"" +HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION) !endif # Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set, # and if it is not see if we have the src/closed directory @@ -105,9 +105,18 @@ HOTSPOT_VM_DISTRO="\\\"Java HotSpot(TM)\\\"" !else HOTSPOT_VM_DISTRO="\\\"OpenJDK\\\"" !endif +!if "$(JDK_BUILD_NUMBER)" != "" +JDK_BUILD_NUMBER="\\\"$(JDK_BUILD_NUMBER)\\\"" +!else +JDK_BUILD_NUMBER="\\\"00\\\"" +!endif !endif -ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) +JDK_MAJOR_VERSION="\\\"$(JDK_MAJOR_VER)\\\"" +JDK_MINOR_VERSION="\\\"$(JDK_MINOR_VER)\\\"" +JDK_MICRO_VERSION="\\\"$(JDK_MICRO_VER)\\\"" + +ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER) ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions) $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class From 3e6986fb58400193cf02ce4566afcf8bd24b92de Mon Sep 17 00:00:00 2001 From: Christian Tornqvist Date: Fri, 9 May 2014 17:06:52 +0200 Subject: [PATCH 060/185] 8042726: [TESTBUG] TEST.groups file was not updated after runtime/6925573/SortMethodsTest.java removal Removed runtime/6925573/SortMethodsTest.java from TEST.groups Reviewed-by: gtriantafill, lfoltan, coleenp, dholmes --- hotspot/test/TEST.groups | 1 - 1 file changed, 1 deletion(-) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index 1053faa7f16..e470171dc21 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -66,7 +66,6 @@ needs_jdk = \ gc/metaspace/TestMetaspacePerfCounters.java \ gc/metaspace/TestPerfCountersAndMemoryPools.java \ runtime/6819213/TestBootNativeLibraryPath.java \ - runtime/6925573/SortMethodsTest.java \ runtime/7158988/FieldMonitor.java \ runtime/7194254/Test7194254.java \ runtime/Metaspace/FragmentMetaspace.java \ From 305ec3bd3f3fd4abb55a992f418bcf88a2694925 Mon Sep 17 00:00:00 2001 From: David Chase Date: Fri, 9 May 2014 16:50:54 -0400 Subject: [PATCH 061/185] 8037816: Fix for 8036122 breaks build with Xcode5/clang Repaired or selectively disabled offending formats; future-proofed with additional checking Reviewed-by: kvn, jrose, stefank --- hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp | 4 +- hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp | 12 ++-- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 6 +- hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/compiledIC_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/frame_x86.cpp | 3 +- hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp | 3 +- hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 3 +- hotspot/src/cpu/x86/vm/methodHandles_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/nativeInst_x86.cpp | 4 +- hotspot/src/cpu/x86/vm/vm_version_x86.cpp | 20 +++--- hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp | 6 +- hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp | 4 +- hotspot/src/os/bsd/vm/decoder_machO.cpp | 4 +- hotspot/src/os/bsd/vm/os_bsd.cpp | 11 +-- hotspot/src/os/bsd/vm/perfMemory_bsd.cpp | 4 +- hotspot/src/os/linux/vm/os_linux.cpp | 14 ++-- hotspot/src/os/linux/vm/perfMemory_linux.cpp | 2 +- hotspot/src/os/posix/vm/os_posix.cpp | 14 ++-- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp | 4 +- .../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 4 +- hotspot/src/share/vm/adlc/formssel.cpp | 6 +- hotspot/src/share/vm/adlc/output_h.cpp | 34 ++++----- hotspot/src/share/vm/asm/codeBuffer.cpp | 10 +-- hotspot/src/share/vm/asm/codeBuffer.hpp | 4 +- hotspot/src/share/vm/asm/register.hpp | 46 +++++++----- hotspot/src/share/vm/c1/c1_CFGPrinter.cpp | 6 +- .../src/share/vm/c1/c1_InstructionPrinter.cpp | 16 ++--- hotspot/src/share/vm/c1/c1_LIR.cpp | 44 ++++++------ .../share/vm/c1/c1_RangeCheckElimination.cpp | 12 ++-- hotspot/src/share/vm/c1/c1_Runtime1.cpp | 14 ++-- hotspot/src/share/vm/c1/c1_ValueType.hpp | 4 +- hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp | 8 +-- hotspot/src/share/vm/ci/ciConstant.cpp | 4 +- hotspot/src/share/vm/ci/ciEnv.cpp | 7 +- hotspot/src/share/vm/ci/ciInstanceKlass.cpp | 10 +-- hotspot/src/share/vm/ci/ciMetadata.cpp | 4 +- hotspot/src/share/vm/ci/ciMethodData.cpp | 6 +- hotspot/src/share/vm/ci/ciObject.cpp | 6 +- hotspot/src/share/vm/ci/ciSignature.cpp | 4 +- hotspot/src/share/vm/ci/ciType.cpp | 4 +- .../src/share/vm/classfile/classFileError.cpp | 7 +- .../share/vm/classfile/classFileParser.hpp | 7 +- .../src/share/vm/classfile/classLoader.cpp | 6 +- .../share/vm/classfile/classLoaderData.cpp | 26 +++---- .../src/share/vm/classfile/defaultMethods.cpp | 12 ++-- hotspot/src/share/vm/classfile/dictionary.cpp | 1 + hotspot/src/share/vm/classfile/dictionary.hpp | 4 +- .../src/share/vm/classfile/javaClasses.cpp | 4 +- .../src/share/vm/classfile/symbolTable.cpp | 2 + .../share/vm/classfile/systemDictionary.cpp | 2 +- hotspot/src/share/vm/classfile/verifier.cpp | 17 +++-- hotspot/src/share/vm/classfile/verifier.hpp | 8 +-- hotspot/src/share/vm/classfile/vmSymbols.cpp | 4 +- hotspot/src/share/vm/code/codeBlob.cpp | 16 ++--- hotspot/src/share/vm/code/codeCache.cpp | 26 +++---- hotspot/src/share/vm/code/compiledIC.cpp | 24 +++---- .../src/share/vm/code/compressedStream.cpp | 5 +- hotspot/src/share/vm/code/debugInfo.cpp | 6 +- .../share/vm/code/exceptionHandlerTable.cpp | 4 +- hotspot/src/share/vm/code/icBuffer.cpp | 3 +- hotspot/src/share/vm/code/nmethod.cpp | 4 +- hotspot/src/share/vm/code/pcDesc.cpp | 4 +- hotspot/src/share/vm/code/relocInfo.cpp | 3 +- hotspot/src/share/vm/code/scopeDesc.cpp | 3 +- hotspot/src/share/vm/code/vtableStubs.cpp | 4 +- .../src/share/vm/compiler/compileBroker.cpp | 12 ++-- hotspot/src/share/vm/compiler/compileLog.cpp | 12 ++-- hotspot/src/share/vm/compiler/compileLog.hpp | 6 +- .../src/share/vm/compiler/compilerOracle.cpp | 6 +- .../src/share/vm/compiler/disassembler.cpp | 5 +- .../src/share/vm/compiler/methodLiveness.cpp | 4 +- hotspot/src/share/vm/compiler/oopMap.cpp | 10 +-- .../concurrentMarkSweep/adaptiveFreeList.cpp | 4 +- .../compactibleFreeListSpace.cpp | 18 ++--- .../compactibleFreeListSpace.hpp | 4 +- .../concurrentMarkSweepGeneration.cpp | 14 ++-- .../concurrentMarkSweepThread.cpp | 4 +- .../concurrentMarkSweepThread.hpp | 6 +- .../concurrentMarkSweep/freeChunk.cpp | 4 +- .../concurrentMarkSweep/promotionInfo.cpp | 4 +- .../concurrentMarkSweep/vmCMSOperations.cpp | 3 +- .../gc_implementation/g1/concurrentMark.cpp | 72 +++++++++---------- .../g1/concurrentMark.inline.hpp | 14 ++-- .../vm/gc_implementation/g1/g1AllocRegion.cpp | 4 +- .../vm/gc_implementation/g1/g1AllocRegion.hpp | 4 +- .../vm/gc_implementation/g1/g1BiasedArray.cpp | 4 +- .../vm/gc_implementation/g1/g1BiasedArray.hpp | 8 +-- .../g1/g1BlockOffsetTable.cpp | 4 +- .../g1/g1BlockOffsetTable.hpp | 4 +- .../g1/g1BlockOffsetTable.inline.hpp | 6 +- .../vm/gc_implementation/g1/g1CardCounts.cpp | 4 +- .../vm/gc_implementation/g1/g1CardCounts.hpp | 6 +- .../g1/g1CodeCacheRemSet.cpp | 2 + .../gc_implementation/g1/g1CollectedHeap.cpp | 11 ++- .../g1/g1CollectedHeap.inline.hpp | 4 +- .../g1/g1CollectorPolicy.cpp | 17 +++-- .../gc_implementation/g1/g1GCPhaseTimes.cpp | 11 +-- .../vm/gc_implementation/g1/g1HRPrinter.cpp | 4 +- .../g1/g1OopClosures.inline.hpp | 4 +- .../vm/gc_implementation/g1/g1RemSet.cpp | 4 +- .../vm/gc_implementation/g1/heapRegion.cpp | 6 +- .../vm/gc_implementation/g1/heapRegion.hpp | 6 +- .../gc_implementation/g1/heapRegionRemSet.cpp | 4 +- .../vm/gc_implementation/g1/heapRegionSeq.cpp | 4 +- .../g1/heapRegionSeq.inline.hpp | 6 +- .../vm/gc_implementation/g1/heapRegionSet.cpp | 2 + .../vm/gc_implementation/g1/heapRegionSet.hpp | 2 +- .../vm/gc_implementation/g1/satbQueue.cpp | 4 +- .../vm/gc_implementation/g1/survRateGroup.cpp | 6 +- .../parNew/asParNewGeneration.cpp | 38 +++++----- .../parNew/parCardTableModRefBS.cpp | 4 +- .../parNew/parNewGeneration.cpp | 4 +- .../parNew/parOopClosures.inline.hpp | 8 +-- .../parallelScavenge/asPSYoungGen.cpp | 38 +++++----- .../parallelScavenge/cardTableExtension.cpp | 18 ++--- .../parallelScavenge/gcTaskManager.cpp | 4 +- .../parallelScavenge/gcTaskThread.cpp | 4 +- .../parallelScavenge/parMarkBitMap.hpp | 8 +-- .../parallelScavenge/parallelScavengeHeap.cpp | 4 +- .../parallelScavengeHeap.inline.hpp | 4 +- .../parallelScavenge/pcTasks.cpp | 4 +- .../parallelScavenge/psAdaptiveSizePolicy.cpp | 6 +- .../parallelScavenge/psMarkSweep.cpp | 4 +- .../parallelScavenge/psOldGen.cpp | 4 +- .../parallelScavenge/psParallelCompact.cpp | 4 +- .../parallelScavenge/psPromotionManager.cpp | 6 +- .../psPromotionManager.inline.hpp | 4 +- .../parallelScavenge/psScavenge.cpp | 3 +- .../parallelScavenge/psScavenge.inline.hpp | 6 +- .../parallelScavenge/psVirtualspace.cpp | 4 +- .../parallelScavenge/psYoungGen.cpp | 4 +- .../vm/gc_implementation/shared/ageTable.cpp | 8 +-- .../shared/allocationStats.hpp | 4 +- .../shared/immutableSpace.cpp | 4 +- .../vm/gc_implementation/shared/markSweep.cpp | 4 +- .../shared/mutableNUMASpace.cpp | 4 +- .../gc_implementation/shared/mutableSpace.cpp | 4 +- .../shared/parGCAllocBuffer.cpp | 4 +- .../shared/spaceDecorator.cpp | 4 +- .../share/vm/gc_interface/collectedHeap.cpp | 4 +- .../share/vm/interpreter/bytecodeTracer.cpp | 19 +++-- .../src/share/vm/interpreter/interpreter.cpp | 4 +- .../vm/interpreter/interpreterRuntime.cpp | 4 +- .../src/share/vm/interpreter/linkResolver.cpp | 2 +- .../src/share/vm/interpreter/oopMapCache.cpp | 4 +- .../vm/interpreter/templateInterpreter.cpp | 4 +- hotspot/src/share/vm/libadt/dict.cpp | 4 +- hotspot/src/share/vm/libadt/set.cpp | 4 +- hotspot/src/share/vm/memory/allocation.cpp | 20 +++--- .../share/vm/memory/binaryTreeDictionary.cpp | 2 +- .../src/share/vm/memory/blockOffsetTable.cpp | 22 +++--- .../src/share/vm/memory/cardTableModRefBS.cpp | 32 ++++----- .../src/share/vm/memory/cardTableModRefBS.hpp | 8 +-- hotspot/src/share/vm/memory/cardTableRS.cpp | 14 ++-- .../src/share/vm/memory/collectorPolicy.cpp | 6 +- .../src/share/vm/memory/defNewGeneration.cpp | 4 +- hotspot/src/share/vm/memory/filemap.cpp | 3 +- hotspot/src/share/vm/memory/gcLocker.cpp | 4 +- .../src/share/vm/memory/genCollectedHeap.cpp | 8 +-- .../src/share/vm/memory/genOopClosures.hpp | 4 +- hotspot/src/share/vm/memory/generation.cpp | 4 +- hotspot/src/share/vm/memory/generation.hpp | 4 +- .../src/share/vm/memory/heapInspection.cpp | 14 +++- .../src/share/vm/memory/heapInspection.hpp | 6 +- hotspot/src/share/vm/memory/metachunk.cpp | 4 +- hotspot/src/share/vm/memory/metaspace.cpp | 8 ++- .../src/share/vm/memory/metaspaceShared.cpp | 29 ++++---- .../share/vm/memory/referenceProcessor.cpp | 4 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 4 +- hotspot/src/share/vm/memory/space.cpp | 4 +- .../vm/memory/threadLocalAllocBuffer.cpp | 4 +- .../memory/threadLocalAllocBuffer.inline.hpp | 4 +- hotspot/src/share/vm/memory/universe.cpp | 6 +- hotspot/src/share/vm/oops/annotations.cpp | 4 +- hotspot/src/share/vm/oops/constMethod.cpp | 6 +- hotspot/src/share/vm/oops/constantPool.cpp | 4 +- hotspot/src/share/vm/oops/cpCache.cpp | 5 +- hotspot/src/share/vm/oops/generateOopMap.hpp | 8 +-- hotspot/src/share/vm/oops/instanceKlass.cpp | 4 +- .../src/share/vm/oops/instanceRefKlass.cpp | 4 +- hotspot/src/share/vm/oops/klass.inline.hpp | 4 +- hotspot/src/share/vm/oops/klassVtable.cpp | 2 + hotspot/src/share/vm/oops/markOop.cpp | 6 +- hotspot/src/share/vm/oops/method.cpp | 7 +- hotspot/src/share/vm/oops/methodData.cpp | 8 ++- hotspot/src/share/vm/oops/oop.cpp | 2 + hotspot/src/share/vm/oops/oop.inline.hpp | 4 +- hotspot/src/share/vm/opto/block.cpp | 4 +- hotspot/src/share/vm/opto/callnode.cpp | 24 +++---- hotspot/src/share/vm/opto/chaitin.cpp | 22 +++--- hotspot/src/share/vm/opto/compile.cpp | 15 ++-- hotspot/src/share/vm/opto/compile.hpp | 4 +- hotspot/src/share/vm/opto/doCall.cpp | 4 +- hotspot/src/share/vm/opto/gcm.cpp | 4 +- .../src/share/vm/opto/idealGraphPrinter.cpp | 14 ++-- hotspot/src/share/vm/opto/ifg.cpp | 4 +- hotspot/src/share/vm/opto/loopPredicate.cpp | 4 +- hotspot/src/share/vm/opto/loopnode.cpp | 4 +- hotspot/src/share/vm/opto/matcher.cpp | 4 +- hotspot/src/share/vm/opto/memnode.cpp | 4 +- hotspot/src/share/vm/opto/node.cpp | 4 +- hotspot/src/share/vm/opto/parse1.cpp | 6 +- hotspot/src/share/vm/opto/parse2.cpp | 6 +- hotspot/src/share/vm/opto/phaseX.cpp | 6 +- hotspot/src/share/vm/opto/regmask.cpp | 4 +- hotspot/src/share/vm/opto/runtime.cpp | 2 +- hotspot/src/share/vm/opto/subnode.cpp | 4 +- hotspot/src/share/vm/opto/type.cpp | 6 +- hotspot/src/share/vm/prims/jni.cpp | 2 +- hotspot/src/share/vm/prims/jniCheck.cpp | 8 +-- hotspot/src/share/vm/prims/jvm.cpp | 17 ++--- hotspot/src/share/vm/prims/jvmtiEnter.xsl | 5 +- .../share/vm/prims/jvmtiEnvThreadState.cpp | 2 +- .../share/vm/prims/jvmtiEventController.cpp | 2 + hotspot/src/share/vm/prims/jvmtiExport.cpp | 2 + hotspot/src/share/vm/prims/jvmtiImpl.cpp | 4 +- .../share/vm/prims/jvmtiRedefineClasses.cpp | 6 +- hotspot/src/share/vm/prims/methodHandles.cpp | 4 +- .../src/share/vm/prims/privilegedStack.cpp | 3 +- hotspot/src/share/vm/prims/unsafe.cpp | 4 +- hotspot/src/share/vm/prims/whitebox.cpp | 2 + hotspot/src/share/vm/runtime/arguments.cpp | 18 ++--- hotspot/src/share/vm/runtime/arguments.hpp | 4 +- .../src/share/vm/runtime/biasedLocking.cpp | 14 ++-- .../share/vm/runtime/compilationPolicy.cpp | 14 ++-- .../src/share/vm/runtime/deoptimization.cpp | 4 +- hotspot/src/share/vm/runtime/fprofiler.cpp | 6 +- hotspot/src/share/vm/runtime/frame.cpp | 4 +- hotspot/src/share/vm/runtime/globals.cpp | 10 ++- hotspot/src/share/vm/runtime/handles.cpp | 4 +- .../src/share/vm/runtime/interfaceSupport.cpp | 3 +- hotspot/src/share/vm/runtime/java.cpp | 7 +- hotspot/src/share/vm/runtime/jniHandles.cpp | 1 + hotspot/src/share/vm/runtime/mutex.cpp | 4 +- hotspot/src/share/vm/runtime/os.cpp | 8 ++- hotspot/src/share/vm/runtime/osThread.cpp | 3 +- hotspot/src/share/vm/runtime/perfData.cpp | 4 +- hotspot/src/share/vm/runtime/perfMemory.cpp | 2 + hotspot/src/share/vm/runtime/safepoint.cpp | 10 +-- hotspot/src/share/vm/runtime/safepoint.hpp | 6 +- .../src/share/vm/runtime/sharedRuntime.cpp | 2 + hotspot/src/share/vm/runtime/signature.cpp | 3 +- hotspot/src/share/vm/runtime/stackValue.cpp | 4 +- .../share/vm/runtime/stackValueCollection.cpp | 4 +- .../share/vm/runtime/stubCodeGenerator.cpp | 8 +-- hotspot/src/share/vm/runtime/sweeper.cpp | 8 ++- hotspot/src/share/vm/runtime/sweeper.hpp | 4 +- hotspot/src/share/vm/runtime/synchronizer.cpp | 2 + hotspot/src/share/vm/runtime/thread.cpp | 4 +- hotspot/src/share/vm/runtime/thread.hpp | 2 +- hotspot/src/share/vm/runtime/timer.cpp | 4 +- .../src/share/vm/runtime/unhandledOops.cpp | 4 +- hotspot/src/share/vm/runtime/vframe.cpp | 4 +- hotspot/src/share/vm/runtime/vframe.hpp | 4 +- hotspot/src/share/vm/runtime/vframeArray.cpp | 3 +- hotspot/src/share/vm/runtime/virtualspace.cpp | 3 +- hotspot/src/share/vm/runtime/vmThread.cpp | 4 +- .../src/share/vm/runtime/vm_operations.cpp | 4 +- hotspot/src/share/vm/runtime/vm_version.cpp | 4 +- .../src/share/vm/services/attachListener.cpp | 12 ++-- .../share/vm/services/classLoadingService.cpp | 4 +- .../share/vm/services/diagnosticCommand.cpp | 6 +- .../share/vm/services/diagnosticFramework.cpp | 8 +-- hotspot/src/share/vm/services/heapDumper.cpp | 6 +- .../share/vm/services/lowMemoryDetector.cpp | 4 +- hotspot/src/share/vm/services/management.cpp | 8 ++- hotspot/src/share/vm/services/memReporter.cpp | 4 +- hotspot/src/share/vm/services/memSnapshot.cpp | 6 +- .../src/share/vm/services/memTrackWorker.cpp | 4 +- hotspot/src/share/vm/services/nmtDCmd.cpp | 4 +- .../src/share/vm/services/threadService.cpp | 4 +- hotspot/src/share/vm/trace/traceStream.hpp | 4 +- hotspot/src/share/vm/utilities/array.hpp | 2 +- hotspot/src/share/vm/utilities/bitMap.cpp | 6 +- .../src/share/vm/utilities/constantTag.cpp | 2 +- hotspot/src/share/vm/utilities/debug.cpp | 5 +- hotspot/src/share/vm/utilities/debug.hpp | 12 ++-- hotspot/src/share/vm/utilities/events.cpp | 6 +- hotspot/src/share/vm/utilities/events.hpp | 17 +++-- hotspot/src/share/vm/utilities/exceptions.cpp | 4 +- hotspot/src/share/vm/utilities/exceptions.hpp | 2 +- .../share/vm/utilities/globalDefinitions.hpp | 37 +++++++++- .../vm/utilities/globalDefinitions_gcc.hpp | 31 +++++++- hotspot/src/share/vm/utilities/numberSeq.cpp | 4 +- hotspot/src/share/vm/utilities/ostream.cpp | 16 ++--- hotspot/src/share/vm/utilities/ostream.hpp | 20 +++--- hotspot/src/share/vm/utilities/quickSort.cpp | 4 +- hotspot/src/share/vm/utilities/taskqueue.cpp | 4 +- hotspot/src/share/vm/utilities/vmError.cpp | 12 ++-- hotspot/src/share/vm/utilities/workgroup.cpp | 4 +- hotspot/src/share/vm/utilities/xmlstream.cpp | 7 +- hotspot/src/share/vm/utilities/xmlstream.hpp | 32 ++++----- 293 files changed, 1285 insertions(+), 913 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp index 0a6261a21e8..32fb22ce229 100644 --- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -149,7 +149,7 @@ void VM_Version::initialize() { } void VM_Version::print_features() { - tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), get_cache_line_size()); + tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), (int) get_cache_line_size()); } #ifdef COMPILER2 diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp index 129bcd8b6c3..1943705a558 100644 --- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp @@ -318,22 +318,22 @@ void VM_Version::initialize() { tty->print("BIS"); } if (AllocatePrefetchLines > 1) { - tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize); } else { - tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize); } } if (PrefetchCopyIntervalInBytes > 0) { - tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes); + tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes); } if (PrefetchScanIntervalInBytes > 0) { - tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes); + tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes); } if (PrefetchFieldsAhead > 0) { - tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead); + tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead); } if (ContendedPaddingWidth > 0) { - tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth); + tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth); } } #endif // PRODUCT diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index a89e50b650e..64b8ce731a5 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -522,11 +522,11 @@ address Assembler::locate_operand(address inst, WhichOperand which) { // these asserts are somewhat nonsensical #ifndef _LP64 assert(which == imm_operand || which == disp32_operand, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); #else assert((which == call32_operand || which == imm_operand) && is_64bit || which == narrow_oop_operand && !is_64bit, - err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip)); + err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip))); #endif // _LP64 return ip; diff --git a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp index 12b01bfab42..ba5dc48623d 100644 --- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -95,7 +95,7 @@ void LinearScan::allocate_fpu_stack() { #ifndef PRODUCT if (TraceFPURegisterUsage) { - tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->print_cr(""); + tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->cr(); } #endif } diff --git a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp index 957695fdc32..26d56b86ab3 100644 --- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp +++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -122,7 +122,7 @@ void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) if (TraceICs) { ResourceMark rm; tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", - instruction_address(), + p2i(instruction_address()), callee->name_and_sig_as_C_string()); } diff --git a/hotspot/src/cpu/x86/vm/frame_x86.cpp b/hotspot/src/cpu/x86/vm/frame_x86.cpp index deeb48a44bb..7a31e0800c4 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -48,6 +48,7 @@ void RegisterMap::check_location_valid() { } #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Profiling/safepoint support diff --git a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp index 02ee74506bb..e9c1ef782d8 100644 --- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -51,6 +51,7 @@ #define __ _masm-> +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #ifdef _WIN64 address AbstractInterpreterGenerator::generate_slow_signature_handler() { diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index 3a14d975927..5b324124138 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -55,6 +55,7 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC #ifdef ASSERT bool AbstractAssembler::pd_check_instruction_mark() { return true; } diff --git a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp index 3c12385fdbb..42c690f5e07 100644 --- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp +++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -29,6 +29,8 @@ #include "memory/allocation.inline.hpp" #include "prims/methodHandles.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define __ _masm-> #ifdef PRODUCT diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp index dccd7e0b7cd..cc1573e720a 100644 --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -35,6 +35,8 @@ #include "c1/c1_Runtime1.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void NativeInstruction::wrote(int offset) { ICache::invalidate_word(addr_at(offset)); } diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index 1fc0e614b6d..e09dba38b0d 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -925,16 +925,16 @@ void VM_Version::get_processor_features() { if (PrintMiscellaneous && Verbose) { tty->print_cr("Logical CPUs per core: %u", logical_processors_per_package()); - tty->print("UseSSE=%d",UseSSE); + tty->print("UseSSE=%d", (int) UseSSE); if (UseAVX > 0) { - tty->print(" UseAVX=%d",UseAVX); + tty->print(" UseAVX=%d", (int) UseAVX); } if (UseAES) { tty->print(" UseAES=1"); } #ifdef COMPILER2 if (MaxVectorSize > 0) { - tty->print(" MaxVectorSize=%d", MaxVectorSize); + tty->print(" MaxVectorSize=%d", (int) MaxVectorSize); } #endif tty->cr(); @@ -957,23 +957,23 @@ void VM_Version::get_processor_features() { } } if (AllocatePrefetchLines > 1) { - tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize); } else { - tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize); + tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize); } } if (PrefetchCopyIntervalInBytes > 0) { - tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes); + tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes); } if (PrefetchScanIntervalInBytes > 0) { - tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes); + tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes); } if (PrefetchFieldsAhead > 0) { - tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead); + tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead); } if (ContendedPaddingWidth > 0) { - tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth); + tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth); } } #endif // !PRODUCT diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp index 73c2f3ca20d..8d0353eff64 100644 --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -118,7 +118,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", - vtable_index, s->entry_point(), + vtable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } @@ -199,7 +199,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", - itable_index, s->entry_point(), + itable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp index 089b368d015..b6dd1b33645 100644 --- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -35,6 +35,8 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // machine-dependent part of VtableStubs: create VtableStub of correct size and // initialize its code diff --git a/hotspot/src/os/bsd/vm/decoder_machO.cpp b/hotspot/src/os/bsd/vm/decoder_machO.cpp index b475f23ff94..6ef6314a1d1 100644 --- a/hotspot/src/os/bsd/vm/decoder_machO.cpp +++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -53,7 +53,7 @@ bool MachODecoder::decode(address addr, char *buf, struct symtab_command * symt = (struct symtab_command *) mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB); if (symt == NULL) { - DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base)); + DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", p2i(mach_base))); return false; } uint32_t off = symt->symoff; /* symbol table offset (within this mach file) */ diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 9d3ec5ffd2d..c8313235d0c 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -124,6 +124,9 @@ #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) #define LARGEPAGES_BIT (1 << 6) + +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + //////////////////////////////////////////////////////////////////////////////// // global variables julong os::Bsd::_physical_memory = 0; @@ -2394,7 +2397,6 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes) ); - char msg[128]; // Create a large shared memory region to attach to based on size. // Currently, size is the total size of the heap @@ -2415,8 +2417,7 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, // coalesce into large pages. Try to reserve large pages when // the system is still "fresh". if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning(msg); + warning("Failed to reserve shared memory (errno = %d).", errno); } return NULL; } @@ -2433,8 +2434,7 @@ char* os::reserve_memory_special(size_t bytes, size_t alignment, char* req_addr, if ((intptr_t)addr == -1) { if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning(msg); + warning("Failed to attach shared memory (errno = %d).", err); } return NULL; } @@ -3810,6 +3810,7 @@ bool os::check_heap(bool force) { return true; } +ATTRIBUTE_PRINTF(3, 0) int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { return ::vsnprintf(buf, count, format, args); } diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp index f59b763b325..e812a76f51b 100644 --- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp +++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -925,7 +925,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor if (PerfTraceMemOps) { tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at " - INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress); + INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress)); } } diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index ce771028a3b..7941edf59ce 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -102,6 +102,8 @@ # include # include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling // getrusage() is prepared to handle the associated failure. #ifndef RUSAGE_THREAD @@ -2138,7 +2140,7 @@ void os::print_os_info(outputStream* st) { // Print warning if unsafe chroot environment detected if (unsafe_chroot_detected) { st->print("WARNING!! "); - st->print_cr(unstable_chroot_error); + st->print_cr("%s", unstable_chroot_error); } os::Linux::print_libversion_info(st); @@ -2199,8 +2201,8 @@ void os::Linux::print_distro_info(outputStream* st) { void os::Linux::print_libversion_info(outputStream* st) { // libc, pthread st->print("libc:"); - st->print(os::Linux::glibc_version()); st->print(" "); - st->print(os::Linux::libpthread_version()); st->print(" "); + st->print("%s ", os::Linux::glibc_version()); + st->print("%s ", os::Linux::libpthread_version()); if (os::Linux::is_LinuxThreads()) { st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed"); } @@ -3417,7 +3419,7 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char // the system is still "fresh". if (warn_on_failure) { jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning(msg); + warning("%s", msg); } return NULL; } @@ -3435,7 +3437,7 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char if ((intptr_t)addr == -1) { if (warn_on_failure) { jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning(msg); + warning("%s", msg); } return NULL; } @@ -3455,7 +3457,7 @@ static void warn_on_large_pages_failure(char* req_addr, size_t bytes, int error) char msg[128]; jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error); - warning(msg); + warning("%s", msg); } } diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp index d95d33107e6..9708734295f 100644 --- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp +++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp @@ -931,7 +931,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor if (PerfTraceMemOps) { tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at " - INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress); + INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress)); } } diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index 41e9b6ccfe9..d17bc15cbae 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -36,6 +36,8 @@ #include #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Todo: provide a os::get_max_process_id() or similar. Number of processes // may have been configured, can be read more accurately from proc fs etc. #ifndef MAX_PID @@ -192,10 +194,10 @@ void os::Posix::print_uname_info(outputStream* st) { st->print("uname:"); struct utsname name; uname(&name); - st->print(name.sysname); st->print(" "); - st->print(name.release); st->print(" "); - st->print(name.version); st->print(" "); - st->print(name.machine); + st->print("%s ", name.sysname); + st->print("%s ", name.release); + st->print("%s ", name.version); + st->print("%s", name.machine); st->cr(); } @@ -682,7 +684,7 @@ const char* os::Posix::describe_signal_set_short(const sigset_t* set, char* buff void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) { char buf[NUM_IMPORTANT_SIGS + 1]; os::Posix::describe_signal_set_short(set, buf, sizeof(buf)); - st->print(buf); + st->print("%s", buf); } // Writes one-line description of a combination of sigaction.sa_flags into a user @@ -742,7 +744,7 @@ const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size) { void os::Posix::print_sa_flags(outputStream* st, int flags) { char buffer[0x100]; os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer)); - st->print(buffer); + st->print("%s", buffer); } // Helper function for os::Posix::print_siginfo_...(): diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index 5718a791959..50051d7c699 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -276,6 +276,8 @@ # endif #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + address os::current_stack_pointer() { #if defined(__clang__) || defined(__llvm__) register void *esp; diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index d269d38ac59..3c8e18eef48 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -89,6 +89,8 @@ #define SPELL_REG_FP "ebp" #endif // AMD64 +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + address os::current_stack_pointer() { #ifdef SPARC_WORKS register void *esp; diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index df58c5746de..ffb13e759a4 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -1322,7 +1322,7 @@ void InstructForm::rep_var_format(FILE *fp, const char *rep_var) { OperandForm* oper = form->is_operand(); if (oper != NULL && oper->is_bound_register()) { const RegDef* first = oper->get_RegClass()->find_first_elem(); - fprintf(fp, " st->print(\"%s\");\n", first->_regname); + fprintf(fp, " st->print_raw(\"%s\");\n", first->_regname); } else { globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var); } @@ -2530,7 +2530,7 @@ void OperandForm::format_constant(FILE *fp, uint const_index, uint const_type) { case Form::idealP: fprintf(fp," if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break; case Form::idealNKlass: case Form::idealN: fprintf(fp," if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break; - case Form::idealL: fprintf(fp," st->print(\"#%%lld\", _c%d);\n", const_index); break; + case Form::idealL: fprintf(fp," st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break; case Form::idealF: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break; case Form::idealD: fprintf(fp," st->print(\"#%%f\", _c%d);\n", const_index); break; default: diff --git a/hotspot/src/share/vm/adlc/output_h.cpp b/hotspot/src/share/vm/adlc/output_h.cpp index 2279e75ecc5..4a5b5467687 100644 --- a/hotspot/src/share/vm/adlc/output_h.cpp +++ b/hotspot/src/share/vm/adlc/output_h.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -386,14 +386,14 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts, static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) { assert(oper != NULL, "what"); CondInterface* cond = oper->_interface->is_CondInterface(); - fprintf(fp, " if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format); - fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format); - fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format); - fprintf(fp, " else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format); - fprintf(fp, " else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format); + fprintf(fp, " if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format); + fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format); + fprintf(fp, " else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format); + fprintf(fp, " else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format); } // Output code that dumps constant values, increment "i" if type is constant @@ -416,8 +416,8 @@ static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, Operand ++i; } else if (!strcmp(ideal_type, "ConL")) { - fprintf(fp," st->print(\"#\" INT64_FORMAT, _c%d);\n", i); - fprintf(fp," st->print(\"/\" PTR64_FORMAT, _c%d);\n", i); + fprintf(fp," st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i); + fprintf(fp," st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i); ++i; } else if (!strcmp(ideal_type, "ConF")) { @@ -429,7 +429,7 @@ static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, Operand else if (!strcmp(ideal_type, "ConD")) { fprintf(fp," st->print(\"#%%f\", _c%d);\n", i); fprintf(fp," jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i); - fprintf(fp," st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i); + fprintf(fp," st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i); ++i; } else if (!strcmp(ideal_type, "Bool")) { @@ -471,7 +471,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_ if ( string != NameList::_signal ) { // Normal string // Pass through to st->print - fprintf(fp," st->print(\"%s\");\n", string); + fprintf(fp," st->print_raw(\"%s\");\n", string); } else { // Replacement variable const char *rep_var = oper._format->_rep_vars.iter(); @@ -542,7 +542,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_ if ( string != NameList::_signal ) { // Normal string // Pass through to st->print - fprintf(fp," st->print(\"%s\");\n", string); + fprintf(fp," st->print_raw(\"%s\");\n", string); } else { // Replacement variable const char *rep_var = oper._format->_rep_vars.iter(); @@ -669,7 +669,7 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c } else if( string == NameList::_signal2 ) // Raw program text fputs(inst._format->_strings.iter(), fp); else - fprintf(fp,"st->print(\"%s\");\n", string); + fprintf(fp,"st->print_raw(\"%s\");\n", string); } // Done with all format strings } // Done generating the user-defined portion of the format @@ -696,13 +696,13 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c default: assert(0,"ShouldNotReachHere"); } - fprintf(fp, " st->print_cr(\"\");\n" ); + fprintf(fp, " st->cr();\n" ); fprintf(fp, " if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\" No JVM State Info\");\n" ); fprintf(fp, " st->print(\" # \");\n" ); fprintf(fp, " if( _jvms && _oop_map ) _oop_map->print_on(st);\n"); } else if(inst.is_ideal_safepoint()) { - fprintf(fp, " st->print(\"\");\n" ); + fprintf(fp, " st->print_raw(\"\");\n" ); fprintf(fp, " if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\" No JVM State Info\");\n" ); fprintf(fp, " st->print(\" # \");\n" ); fprintf(fp, " if( _jvms && _oop_map ) _oop_map->print_on(st);\n"); diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp index 0c10e1fdb9e..60d405b35f4 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.cpp +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -988,7 +988,7 @@ void CodeSection::dump() { for (csize_t step; ptr < end(); ptr += step) { step = end() - ptr; if (step > jintSize * 4) step = jintSize * 4; - tty->print(PTR_FORMAT ": ", ptr); + tty->print(INTPTR_FORMAT ": ", p2i(ptr)); while (step > 0) { tty->print(" " PTR32_FORMAT, *(jint*)ptr); ptr += jintSize; @@ -1098,7 +1098,7 @@ void CodeStrings::print_block_comment(outputStream* stream, intptr_t offset) con while (c && c->offset() == offset) { stream->bol(); stream->print(" ;; "); - stream->print_cr(c->string()); + stream->print_cr("%s", c->string()); c = c->next_comment(); } } @@ -1154,10 +1154,10 @@ void CodeBuffer::decode_all() { void CodeSection::print(const char* name) { csize_t locs_size = locs_end() - locs_start(); tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)%s", - name, start(), end(), limit(), size(), capacity(), + name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity(), is_frozen()? " [frozen]": ""); tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d", - name, locs_start(), locs_end(), locs_limit(), locs_size, locs_capacity(), locs_point_off()); + name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off()); if (PrintRelocations) { RelocIterator iter(this); iter.print(); diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp index bcc5d51e7ad..5572a39af7d 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.hpp +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -173,7 +173,7 @@ class CodeSection VALUE_OBJ_CLASS_SPEC { bool allocates(address pc) const { return pc >= _start && pc < _limit; } bool allocates2(address pc) const { return pc >= _start && pc <= _limit; } - void set_end(address pc) { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, _start, pc, _limit)); _end = pc; } + void set_end(address pc) { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; } void set_mark(address pc) { assert(contains2(pc), "not in codeBuffer"); _mark = pc; } void set_mark_off(int offset) { assert(contains2(offset+_start),"not in codeBuffer"); diff --git a/hotspot/src/share/vm/asm/register.hpp b/hotspot/src/share/vm/asm/register.hpp index 5afecdeb116..d9918517dd9 100644 --- a/hotspot/src/share/vm/asm/register.hpp +++ b/hotspot/src/share/vm/asm/register.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -118,8 +118,8 @@ inline void assert_different_registers( ) { assert( a != b, - err_msg_res("registers must be different: a=%d, b=%d", - a, b) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "", + p2i(a), p2i(b)) ); } @@ -132,8 +132,9 @@ inline void assert_different_registers( assert( a != b && a != c && b != c, - err_msg_res("registers must be different: a=%d, b=%d, c=%d", - a, b, c) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c)) ); } @@ -148,8 +149,9 @@ inline void assert_different_registers( a != b && a != c && a != d && b != c && b != d && c != d, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d", - a, b, c, d) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d)) ); } @@ -166,8 +168,9 @@ inline void assert_different_registers( && b != c && b != d && b != e && c != d && c != e && d != e, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d", - a, b, c, d, e) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e)) ); } @@ -186,8 +189,10 @@ inline void assert_different_registers( && c != d && c != e && c != f && d != e && d != f && e != f, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d", - a, b, c, d, e, f) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f)) ); } @@ -208,8 +213,10 @@ inline void assert_different_registers( && d != e && d != f && d != g && e != f && e != g && f != g, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d", - a, b, c, d, e, f, g) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g)) ); } @@ -232,8 +239,10 @@ inline void assert_different_registers( && e != f && e != g && e != h && f != g && f != h && g != h, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d", - a, b, c, d, e, f, g, h) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h)) ); } @@ -258,8 +267,11 @@ inline void assert_different_registers( && f != g && f != h && f != i && g != h && g != i && h != i, - err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d", - a, b, c, d, e, f, g, h, i) + err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT + ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT + ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT + ", i=" INTPTR_FORMAT "", + p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i)) ); } diff --git a/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp index 4eaa7d27f68..b0cb94629f4 100644 --- a/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp +++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -50,7 +50,7 @@ class CFGPrinterOutput : public CHeapObj { void inc_indent(); void dec_indent(); - void print(const char* format, ...); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void print_begin(const char* tag); void print_end(const char* tag); @@ -161,7 +161,7 @@ void CFGPrinterOutput::print_compilation() { print("name \"%s\"", method_name(_compilation->method(), true)); print("method \"%s\"", method_name(_compilation->method())); - print("date "INT64_FORMAT, os::javaTimeMillis()); + print("date "INT64_FORMAT, (int64_t) os::javaTimeMillis()); print_end("compilation"); } diff --git a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp index 7f87e1183b0..842acec5be9 100644 --- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp +++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -134,23 +134,23 @@ void InstructionPrinter::print_object(Value obj) { if (value->is_null_object()) { output()->print("null"); } else if (!value->is_loaded()) { - output()->print("", value); + output()->print("", p2i(value)); } else { - output()->print(""); } } else if (type->as_InstanceConstant() != NULL) { ciInstance* value = type->as_InstanceConstant()->value(); if (value->is_loaded()) { - output()->print(""); } else { - output()->print("", value); + output()->print("", p2i(value)); } } else if (type->as_ArrayConstant() != NULL) { - output()->print("", type->as_ArrayConstant()->value()->constant_encoding()); + output()->print("", p2i(type->as_ArrayConstant()->value()->constant_encoding())); } else if (type->as_ClassConstant() != NULL) { ciInstanceKlass* klass = type->as_ClassConstant()->value(); if (!klass->is_loaded()) { @@ -268,7 +268,7 @@ void InstructionPrinter::print_inline_level(BlockBegin* block) { void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) { - output()->print(name); + output()->print("%s", name); output()->print(".("); } @@ -479,7 +479,7 @@ void InstructionPrinter::do_TypeCast(TypeCast* x) { if (x->declared_type()->is_klass()) print_klass(x->declared_type()->as_klass()); else - output()->print(type2name(x->declared_type()->basic_type())); + output()->print("%s", type2name(x->declared_type()->basic_type())); } diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp index 2634f5f4105..fc176943ee8 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.cpp +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -1563,15 +1563,15 @@ void LIR_OprDesc::print(outputStream* out) const { } else if (is_virtual()) { out->print("R%d", vreg_number()); } else if (is_single_cpu()) { - out->print(as_register()->name()); + out->print("%s", as_register()->name()); } else if (is_double_cpu()) { - out->print(as_register_hi()->name()); - out->print(as_register_lo()->name()); + out->print("%s", as_register_hi()->name()); + out->print("%s", as_register_lo()->name()); #if defined(X86) } else if (is_single_xmm()) { - out->print(as_xmm_float_reg()->name()); + out->print("%s", as_xmm_float_reg()->name()); } else if (is_double_xmm()) { - out->print(as_xmm_double_reg()->name()); + out->print("%s", as_xmm_double_reg()->name()); } else if (is_single_fpu()) { out->print("fpu%d", fpu_regnr()); } else if (is_double_fpu()) { @@ -1583,9 +1583,9 @@ void LIR_OprDesc::print(outputStream* out) const { out->print("d%d", fpu_regnrLo() >> 1); #else } else if (is_single_fpu()) { - out->print(as_float_reg()->name()); + out->print("%s", as_float_reg()->name()); } else if (is_double_fpu()) { - out->print(as_double_reg()->name()); + out->print("%s", as_double_reg()->name()); #endif } else if (is_illegal()) { @@ -1611,9 +1611,9 @@ void LIR_Const::print_value_on(outputStream* out) const { case T_LONG: out->print("lng:" JLONG_FORMAT, as_jlong()); break; case T_FLOAT: out->print("flt:%f", as_jfloat()); break; case T_DOUBLE: out->print("dbl:%f", as_jdouble()); break; - case T_OBJECT: out->print("obj:0x%x", as_jobject()); break; - case T_METADATA: out->print("metadata:0x%x", as_metadata());break; - default: out->print("%3d:0x%x",type(), as_jdouble()); break; + case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject())); break; + case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break; + default: out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break; } } @@ -1629,7 +1629,7 @@ void LIR_Address::print_value_on(outputStream* out) const { case times_8: out->print(" * 8"); break; } } - out->print(" Disp: %d", _disp); + out->print(" Disp: " INTX_FORMAT, _disp); } // debug output of block header without InstructionPrinter @@ -1703,7 +1703,7 @@ void LIR_Op::print_on(outputStream* out) const { } else { out->print(" "); } - out->print(name()); out->print(" "); + out->print("%s ", name()); print_instr(out); if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci()); #ifdef ASSERT @@ -1833,7 +1833,7 @@ const char * LIR_Op::name() const { // LIR_OpJavaCall void LIR_OpJavaCall::print_instr(outputStream* out) const { out->print("call: "); - out->print("[addr: 0x%x]", address()); + out->print("[addr: " INTPTR_FORMAT "]", p2i(address())); if (receiver()->is_valid()) { out->print(" [recv: "); receiver()->print(out); out->print("]"); } @@ -1844,7 +1844,7 @@ void LIR_OpJavaCall::print_instr(outputStream* out) const { // LIR_OpLabel void LIR_OpLabel::print_instr(outputStream* out) const { - out->print("[label:0x%x]", _label); + out->print("[label:" INTPTR_FORMAT "]", p2i(_label)); } // LIR_OpArrayCopy @@ -1911,7 +1911,7 @@ void LIR_Op1::print_instr(outputStream* out) const { // LIR_Op1 void LIR_OpRTCall::print_instr(outputStream* out) const { intx a = (intx)addr(); - out->print(Runtime1::name_for_address(addr())); + out->print("%s", Runtime1::name_for_address(addr())); out->print(" "); tmp()->print(out); } @@ -1934,10 +1934,10 @@ void LIR_OpBranch::print_instr(outputStream* out) const { } else if (stub() != NULL) { out->print("["); stub()->print_name(out); - out->print(": 0x%x]", stub()); + out->print(": " INTPTR_FORMAT "]", p2i(stub())); if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci()); } else { - out->print("[label:0x%x] ", label()); + out->print("[label:" INTPTR_FORMAT "] ", p2i(label())); } if (ublock() != NULL) { out->print("unordered: [B%d] ", ublock()->block_id()); @@ -2004,7 +2004,7 @@ void LIR_OpAllocObj::print_instr(outputStream* out) const { tmp4()->print(out); out->print(" "); out->print("[hdr:%d]", header_size()); out->print(" "); out->print("[obj:%d]", object_size()); out->print(" "); - out->print("[lbl:0x%x]", stub()->entry()); + out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry())); } void LIR_OpRoundFP::print_instr(outputStream* out) const { @@ -2037,7 +2037,7 @@ void LIR_OpAllocArray::print_instr(outputStream* out) const { tmp3()->print(out); out->print(" "); tmp4()->print(out); out->print(" "); out->print("[type:0x%x]", type()); out->print(" "); - out->print("[label:0x%x]", stub()->entry()); + out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry())); } @@ -2074,7 +2074,7 @@ void LIR_OpLock::print_instr(outputStream* out) const { if (_scratch->is_valid()) { _scratch->print(out); out->print(" "); } - out->print("[lbl:0x%x]", stub()->entry()); + out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry())); } #ifdef ASSERT @@ -2082,7 +2082,7 @@ void LIR_OpAssert::print_instr(outputStream* out) const { print_condition(out, condition()); out->print(" "); in_opr1()->print(out); out->print(" "); in_opr2()->print(out); out->print(", \""); - out->print(msg()); out->print("\""); + out->print("%s", msg()); out->print("\""); } #endif diff --git a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp index 599cedb99d0..71e9de00b30 100644 --- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -62,10 +62,10 @@ RangeCheckEliminator::RangeCheckEliminator(IR *ir) : _optimistic = ir->compilation()->is_optimistic(); TRACE_RANGE_CHECK_ELIMINATION( - tty->print_cr(""); + tty->cr(); tty->print_cr("Range check elimination"); ir->method()->print_name(tty); - tty->print_cr(""); + tty->cr(); ); TRACE_RANGE_CHECK_ELIMINATION( @@ -1024,7 +1024,7 @@ void RangeCheckEliminator::dump_condition_stack(BlockBegin *block) { tty->print("i%d", phi->id()); tty->print(": "); bound->print(); - tty->print_cr(""); + tty->cr(); ); } }); @@ -1039,7 +1039,7 @@ void RangeCheckEliminator::dump_condition_stack(BlockBegin *block) { tty->print("i%d", instr->id()); tty->print(": "); bound->print(); - tty->print_cr(""); + tty->cr(); ); } } @@ -1400,7 +1400,7 @@ Value RangeCheckEliminator::Bound::lower_instr() { // print void RangeCheckEliminator::Bound::print() { - tty->print(""); + tty->print("%s", ""); if (this->_lower_instr || this->_lower != min_jint) { if (this->_lower_instr) { tty->print("i%d", this->_lower_instr->id()); diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 11542c4a50b..9942e44b842 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -532,8 +532,8 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t if (TraceExceptions) { ttyLocker ttyl; ResourceMark rm; - tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x", - exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread); + tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", + exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); } // for AbortVMOnException flag NOT_PRODUCT(Exceptions::debug_check_abort(exception)); @@ -563,7 +563,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t ttyLocker ttyl; ResourceMark rm; tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, - thread, continuation, pc); + p2i(thread), p2i(continuation), p2i(pc)); } return continuation; @@ -988,8 +988,8 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i address copy_buff = stub_location - *byte_skip - *byte_count; address being_initialized_entry = stub_location - *being_initialized_entry_offset; if (TracePatching) { - tty->print_cr(" Patching %s at bci %d at address 0x%x (%s)", Bytecodes::name(code), bci, - instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); + tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, + p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); assert(caller_code != NULL, "nmethod not found"); @@ -1448,7 +1448,7 @@ JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread)) methodHandle inlinee = methodHandle(vfst.method()); inlinee->print_short_name(&ss1); m->print_short_name(&ss2); - tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc()); + tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc())); } diff --git a/hotspot/src/share/vm/c1/c1_ValueType.hpp b/hotspot/src/share/vm/c1/c1_ValueType.hpp index a0bb5647d76..291dd2386d3 100644 --- a/hotspot/src/share/vm/c1/c1_ValueType.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueType.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -175,7 +175,7 @@ class ValueType: public CompilationResourceObj { ValueType* join(ValueType* y) const; // debugging - void print(outputStream* s = tty) { s->print(name()); } + void print(outputStream* s = tty) { s->print("%s", name()); } }; diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp index 24b2830ed83..c2943e98edb 100644 --- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp +++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -1287,10 +1287,10 @@ void BCEscapeAnalyzer::compute_escape_info() { tty->print_cr("class of method is not initialized."); else if (_level > MaxBCEAEstimateLevel) tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).", - _level, MaxBCEAEstimateLevel); + _level, (int) MaxBCEAEstimateLevel); else if (method()->code_size() > MaxBCEAEstimateSize) - tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.", - method()->code_size(), MaxBCEAEstimateSize); + tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize (%d).", + method()->code_size(), (int) MaxBCEAEstimateSize); else ShouldNotReachHere(); } diff --git a/hotspot/src/share/vm/ci/ciConstant.cpp b/hotspot/src/share/vm/ci/ciConstant.cpp index 4955a088ffa..a059f2c8a3e 100644 --- a/hotspot/src/share/vm/ci/ciConstant.cpp +++ b/hotspot/src/share/vm/ci/ciConstant.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -48,7 +48,7 @@ void ciConstant::print() { tty->print("%d", _value._int); break; case T_LONG: - tty->print(INT64_FORMAT, _value._long); + tty->print(INT64_FORMAT, (int64_t)(_value._long)); break; case T_FLOAT: tty->print("%f", _value._float); diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index df6017e0a4a..fbe7bbbd83c 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -1250,8 +1250,7 @@ void ciEnv::dump_replay_data(int compile_id) { if (replay_data_file != NULL) { fileStream replay_data_stream(replay_data_file, /*need_close=*/true); dump_replay_data(&replay_data_stream); - tty->print("# Compiler replay data is saved as: "); - tty->print_cr(buffer); + tty->print_cr("# Compiler replay data is saved as: %s", buffer); } else { tty->print_cr("# Can't open file to dump replay data."); } @@ -1274,7 +1273,7 @@ void ciEnv::dump_inline_data(int compile_id) { ) replay_data_stream.flush(); tty->print("# Compiler inline data is saved as: "); - tty->print_cr(buffer); + tty->print_cr("%s", buffer); } else { tty->print_cr("# Can't open file to dump inline data."); } diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp index f4389da46a6..f8b39ed79c9 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -292,7 +292,7 @@ bool ciInstanceKlass::is_in_package_impl(const char* packagename, int len) { // Implementation of the print method. void ciInstanceKlass::print_impl(outputStream* st) { ciKlass::print_impl(st); - GUARDED_VM_ENTRY(st->print(" loader=0x%x", (address)loader());) + GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));) if (is_loaded()) { st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=", bool_to_str(is_initialized()), @@ -618,7 +618,7 @@ class StaticFinalFieldPrinter : public FieldClosure { case T_SHORT: _out->print_cr("%d", mirror->short_field(fd->offset())); break; case T_CHAR: _out->print_cr("%d", mirror->char_field(fd->offset())); break; case T_INT: _out->print_cr("%d", mirror->int_field(fd->offset())); break; - case T_LONG: _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset())); break; + case T_LONG: _out->print_cr(INT64_FORMAT, (int64_t)(mirror->long_field(fd->offset()))); break; case T_FLOAT: { float f = mirror->float_field(fd->offset()); _out->print_cr("%d", *(int*)&f); @@ -626,7 +626,7 @@ class StaticFinalFieldPrinter : public FieldClosure { } case T_DOUBLE: { double d = mirror->double_field(fd->offset()); - _out->print_cr(INT64_FORMAT, *(jlong*)&d); + _out->print_cr(INT64_FORMAT, *(int64_t*)&d); break; } case T_ARRAY: { @@ -656,7 +656,7 @@ class StaticFinalFieldPrinter : public FieldClosure { _out->print_cr("\""); } else { const char* klass_name = value->klass()->name()->as_quoted_ascii(); - _out->print_cr(klass_name); + _out->print_cr("%s", klass_name); } } else { ShouldNotReachHere(); diff --git a/hotspot/src/share/vm/ci/ciMetadata.cpp b/hotspot/src/share/vm/ci/ciMetadata.cpp index fb738798549..efb4f58aef2 100644 --- a/hotspot/src/share/vm/ci/ciMetadata.cpp +++ b/hotspot/src/share/vm/ci/ciMetadata.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -38,7 +38,7 @@ void ciMetadata::print(outputStream* st) { st->print("<%s", type_string()); GUARDED_VM_ENTRY(print_impl(st);) - st->print(" ident=%d address=0x%x>", ident(), (address)this); + st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i((address)this)); } diff --git a/hotspot/src/share/vm/ci/ciMethodData.cpp b/hotspot/src/share/vm/ci/ciMethodData.cpp index bc8794063ad..1b604ba4e4d 100644 --- a/hotspot/src/share/vm/ci/ciMethodData.cpp +++ b/hotspot/src/share/vm/ci/ciMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -557,7 +557,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { if (round == 0) { count++; } else { - out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii()); + out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); } } } @@ -569,7 +569,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { if (round == 0) { count++; } else { - out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii()); + out->print(" %d %s", (int)(dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t)), k->name()->as_quoted_ascii()); } } } diff --git a/hotspot/src/share/vm/ci/ciObject.cpp b/hotspot/src/share/vm/ci/ciObject.cpp index 9685356754c..0fe31d54b13 100644 --- a/hotspot/src/share/vm/ci/ciObject.cpp +++ b/hotspot/src/share/vm/ci/ciObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -213,9 +213,9 @@ void ciObject::init_flags_from(oop x) { void ciObject::print(outputStream* st) { st->print("<%s", type_string()); GUARDED_VM_ENTRY(print_impl(st);) - st->print(" ident=%d %s address=0x%x>", ident(), + st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(), is_scavengable() ? "SCAVENGABLE" : "", - (address)this); + p2i((address)this)); } // ------------------------------------------------------------------ diff --git a/hotspot/src/share/vm/ci/ciSignature.cpp b/hotspot/src/share/vm/ci/ciSignature.cpp index d09cc2fd2fe..634ca47981c 100644 --- a/hotspot/src/share/vm/ci/ciSignature.cpp +++ b/hotspot/src/share/vm/ci/ciSignature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -148,5 +148,5 @@ void ciSignature::print() { print_signature(); tty->print(" accessing_klass="); _accessing_klass->print(); - tty->print(" address=0x%x>", (address)this); + tty->print(" address=" INTPTR_FORMAT ">", p2i((address)this)); } diff --git a/hotspot/src/share/vm/ci/ciType.cpp b/hotspot/src/share/vm/ci/ciType.cpp index 15c884213bb..43df753cb49 100644 --- a/hotspot/src/share/vm/ci/ciType.cpp +++ b/hotspot/src/share/vm/ci/ciType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -87,7 +87,7 @@ void ciType::print_impl(outputStream* st) { // Print the name of this type void ciType::print_name_on(outputStream* st) { ResourceMark rm; - st->print(name()); + st->print("%s", name()); } diff --git a/hotspot/src/share/vm/classfile/classFileError.cpp b/hotspot/src/share/vm/classfile/classFileError.cpp index a9c55fb73a5..3c3302fb29f 100644 --- a/hotspot/src/share/vm/classfile/classFileError.cpp +++ b/hotspot/src/share/vm/classfile/classFileError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -29,6 +29,9 @@ // Keep these in a separate file to prevent inlining +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED + void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) { ResourceMark rm(THREAD); Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(), @@ -53,6 +56,8 @@ void ClassFileParser::classfile_parse_error(const char* msg, int index, const ch msg, index, name, _class_name->as_C_string()); } +PRAGMA_DIAG_POP + void StackMapStream::stackmap_format_error(const char* msg, TRAPS) { ResourceMark rm(THREAD); Exceptions::fthrow( diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index ba12f26fde0..10170eb49eb 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -312,7 +312,9 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { if (!b) { classfile_parse_error(msg, CHECK); } } - inline void assert_property(bool b, const char* msg, TRAPS) { +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED +inline void assert_property(bool b, const char* msg, TRAPS) { #ifdef ASSERT if (!b) { ResourceMark rm(THREAD); @@ -329,6 +331,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { } #endif } +PRAGMA_DIAG_POP inline void check_property(bool property, const char* msg, int index, TRAPS) { if (_need_verify) { diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index c1dcb36dba4..8366c8fc4ce 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -343,7 +343,7 @@ static void print_meta_index(LazyClassPathEntry* entry, tty->print("[Meta index for %s=", entry->name()); for (int i = 0; i < meta_packages.length(); i++) { if (i > 0) tty->print(" "); - tty->print(meta_packages.at(i)); + tty->print("%s", meta_packages.at(i)); } tty->print_cr("]"); } @@ -1299,7 +1299,7 @@ void ClassLoader::compile_the_world() { e = e->next(); } jlong end = os::javaTimeMillis(); - tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)", + tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)", _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start)); { // Print statistics as if before normal exit: diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index efd141332dc..4d716b9f38a 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -281,10 +281,10 @@ void ClassLoaderData::add_class(Klass* k) { ResourceMark rm; tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: " PTR_FORMAT " loader: " PTR_FORMAT " %s", - k, + p2i(k), k->external_name(), - k->class_loader_data(), - (void *)k->class_loader(), + p2i(k->class_loader_data()), + p2i((void *)k->class_loader()), loader_name()); } } @@ -319,11 +319,11 @@ void ClassLoaderData::unload() { if (TraceClassLoaderData) { ResourceMark rm; - tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this); - tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(), + tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this)); + tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()), loader_name()); if (is_anonymous()) { - tty->print(" for anonymous class "PTR_FORMAT " ", _klasses); + tty->print(" for anonymous class " INTPTR_FORMAT " ", p2i(_klasses)); } tty->print_cr("]"); } @@ -485,14 +485,14 @@ const char* ClassLoaderData::loader_name() { void ClassLoaderData::dump(outputStream * const out) { ResourceMark rm; out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {", - this, (void *)class_loader(), - class_loader() != NULL ? class_loader()->klass() : NULL, loader_name()); + p2i(this), p2i((void *)class_loader()), + p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name()); if (claimed()) out->print(" claimed "); if (is_unloading()) out->print(" unloading "); - out->print(" handles " INTPTR_FORMAT, handles()); + out->print(" handles " INTPTR_FORMAT, p2i(handles())); out->cr(); if (metaspace_or_null() != NULL) { - out->print_cr("metaspace: " PTR_FORMAT, metaspace_or_null()); + out->print_cr("metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null())); metaspace_or_null()->dump(out); } else { out->print_cr("metaspace: NULL"); @@ -586,8 +586,8 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRA if (TraceClassLoaderData) { ResourceMark rm; tty->print("[ClassLoaderData: "); - tty->print("create class loader data "PTR_FORMAT, cld); - tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(), + tty->print("create class loader data " INTPTR_FORMAT, p2i(cld)); + tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()), cld->loader_name()); tty->print_cr("]"); } @@ -847,7 +847,7 @@ void ClassLoaderData::print_value_on(outputStream* out) const { if (class_loader() == NULL) { out->print("NULL class_loader"); } else { - out->print("class loader "PTR_FORMAT, this); + out->print("class loader " INTPTR_FORMAT, p2i(this)); class_loader()->print_value_on(out); } } diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp index b5e4da63f0f..1b56ff2fba4 100644 --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp @@ -436,7 +436,7 @@ class MethodFamily : public ResourceObj { _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); if (TraceDefaultMethods) { _exception_message->print_value_on(tty); - tty->print_cr(""); + tty->cr(); } } } @@ -463,7 +463,7 @@ class MethodFamily : public ResourceObj { if (_members.at(i).second == DISQUALIFIED) { str->print(" (disqualified)"); } - str->print_cr(""); + str->cr(); } if (_selected_target != NULL) { @@ -480,7 +480,7 @@ class MethodFamily : public ResourceObj { if (!method_holder->is_interface()) { tty->print(" : in superclass"); } - str->print_cr(""); + str->cr(); } void print_exception(outputStream* str, int indent) { @@ -688,7 +688,7 @@ static GrowableArray* find_empty_vtable_slots( for (int i = 0; i < slots->length(); ++i) { tty->indent(); slots->at(i)->print_on(tty); - tty->print_cr(""); + tty->cr(); } } #endif // ndef PRODUCT @@ -828,7 +828,7 @@ void DefaultMethods::generate_default_methods( streamIndentor si(tty, 2); tty->indent().print("Looking for default methods for slot "); slot->print_on(tty); - tty->print_cr(""); + tty->cr(); } #endif // ndef PRODUCT @@ -946,7 +946,7 @@ static void create_defaults_and_exceptions( if (TraceDefaultMethods) { tty->print("for slot: "); slot->print_on(tty); - tty->print_cr(""); + tty->cr(); if (method->has_target()) { method->print_selected(tty, 1); } else if (method->throws_exception()) { diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp index ec64adc2476..b84475a8dbb 100644 --- a/hotspot/src/share/vm/classfile/dictionary.cpp +++ b/hotspot/src/share/vm/classfile/dictionary.cpp @@ -31,6 +31,7 @@ #include "runtime/orderAccess.inline.hpp" #include "utilities/hashtable.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC DictionaryEntry* Dictionary::_current_class_entry = NULL; int Dictionary::_current_class_index = 0; diff --git a/hotspot/src/share/vm/classfile/dictionary.hpp b/hotspot/src/share/vm/classfile/dictionary.hpp index 17d916f0629..bc25c811c52 100644 --- a/hotspot/src/share/vm/classfile/dictionary.hpp +++ b/hotspot/src/share/vm/classfile/dictionary.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -379,7 +379,7 @@ class SymbolPropertyEntry : public HashtableEntry { } if (method_type() != NULL) { if (printed) st->print(" and "); - st->print(INTPTR_FORMAT, (void *)method_type()); + st->print(INTPTR_FORMAT, p2i((void *)method_type())); printed = true; } st->print_cr(printed ? "" : "(empty)"); diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index a9d213948eb..d68c4e806cb 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -51,6 +51,8 @@ #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java) \ klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum); @@ -1490,7 +1492,7 @@ void java_lang_Throwable::print_stack_trace(oop throwable, outputStream* st) { while (h_throwable.not_null()) { objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable()))); if (result.is_null()) { - st->print_cr(no_stack_trace_message()); + st->print_cr("%s", no_stack_trace_message()); return; } diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 40a06da9b34..3028e12dae9 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -39,6 +39,8 @@ #include "gc_implementation/g1/g1StringDedup.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // -------------------------------------------------------------------------- // the number of buckets a thread claims diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 8d52bef7194..f4a933045d0 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -2269,7 +2269,7 @@ static methodHandle unpack_method_and_appendix(Handle mname, oop appendix = appendix_box->obj_at(0); if (TraceMethodHandles) { #ifndef PRODUCT - tty->print("Linked method="INTPTR_FORMAT": ", m); + tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m)); m->print(); if (appendix != NULL) { tty->print("appendix = "); appendix->print(); } tty->cr(); diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index d1238f609fa..2c1edcb6278 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -364,7 +364,7 @@ void TypeOrigin::print_on(outputStream* str) const { void ErrorContext::details(outputStream* ss, const Method* method) const { if (is_valid()) { - ss->print_cr(""); + ss->cr(); ss->print_cr("Exception Details:"); location_details(ss, method); reason_details(ss); @@ -379,7 +379,7 @@ void ErrorContext::reason_details(outputStream* ss) const { streamIndentor si(ss); ss->indent().print_cr("Reason:"); streamIndentor si2(ss); - ss->indent().print(""); + ss->indent().print("%s", ""); switch (_fault) { case INVALID_BYTECODE: ss->print("Error exists in the bytecode"); @@ -432,7 +432,7 @@ void ErrorContext::reason_details(outputStream* ss) const { ShouldNotReachHere(); ss->print_cr("Unknown"); } - ss->print_cr(""); + ss->cr(); } void ErrorContext::location_details(outputStream* ss, const Method* method) const { @@ -507,7 +507,7 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons for (u2 i = 0; i < sm_table->number_of_entries(); ++i) { ss->indent(); sm_frame->print_on(ss, current_offset); - ss->print_cr(""); + ss->cr(); current_offset += sm_frame->offset_delta(); sm_frame = sm_frame->next(); } @@ -579,7 +579,8 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string()); } - const char* bad_type_msg = "Bad type on operand stack in %s"; +// For clang, the only good constant format string is a literal constant format string. +#define bad_type_msg "Bad type on operand stack in %s" int32_t max_stack = m->verifier_max_stack(); int32_t max_locals = m->max_locals(); @@ -1676,6 +1677,8 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) { } } +#undef bad_type_message + char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) { char* code_data = NEW_RESOURCE_ARRAY(char, code_length); memset(code_data, 0, sizeof(char) * code_length); @@ -2363,8 +2366,8 @@ void ClassVerifier::verify_invoke_instructions( if (opcode == Bytecodes::_invokedynamic) { if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) { class_format_error( - "invokedynamic instructions not supported by this class file version", - _klass->external_name()); + "invokedynamic instructions not supported by this class file version (%d), class %s", + _klass->major_version(), _klass->external_name()); return; } } else { diff --git a/hotspot/src/share/vm/classfile/verifier.hpp b/hotspot/src/share/vm/classfile/verifier.hpp index 74143a6e787..557f567bf78 100644 --- a/hotspot/src/share/vm/classfile/verifier.hpp +++ b/hotspot/src/share/vm/classfile/verifier.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -375,15 +375,15 @@ class ClassVerifier : public StackObj { bool has_error() const { return result() != NULL; } char* exception_message() { stringStream ss; - ss.print(_message); + ss.print("%s", _message); _error_context.details(&ss, _method()); return ss.as_string(); } // Called when verify or class format errors are encountered. // May throw an exception based upon the mode. - void verify_error(ErrorContext ctx, const char* fmt, ...); - void class_format_error(const char* fmt, ...); + void verify_error(ErrorContext ctx, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4); + void class_format_error(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3); Klass* load_class(Symbol* name, TRAPS); diff --git a/hotspot/src/share/vm/classfile/vmSymbols.cpp b/hotspot/src/share/vm/classfile/vmSymbols.cpp index 855c6bdd773..6d13995c588 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.cpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -533,7 +533,7 @@ void vmIntrinsics::verify_method(ID actual_id, Method* m) { xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'", actual_name, declared_name); xtty->method(mh); - xtty->end_elem(""); + xtty->end_elem("%s", ""); } if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):", diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp index 141bbae007b..f9e78bfb9e2 100644 --- a/hotspot/src/share/vm/code/codeBlob.cpp +++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -530,7 +530,7 @@ void CodeBlob::verify() { } void CodeBlob::print_on(outputStream* st) const { - st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this); + st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this)); st->print_cr("Framesize: %d", _frame_size); } @@ -548,7 +548,7 @@ void BufferBlob::print_on(outputStream* st) const { } void BufferBlob::print_value_on(outputStream* st) const { - st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", this, name()); + st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", p2i(this), name()); } void RuntimeStub::verify() { @@ -558,13 +558,13 @@ void RuntimeStub::verify() { void RuntimeStub::print_on(outputStream* st) const { ttyLocker ttyl; CodeBlob::print_on(st); - st->print("Runtime Stub (" INTPTR_FORMAT "): ", this); - st->print_cr(name()); + st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this)); + st->print_cr("%s", name()); Disassembler::decode((CodeBlob*)this, st); } void RuntimeStub::print_value_on(outputStream* st) const { - st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name()); + st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name()); } void SingletonBlob::verify() { @@ -574,12 +574,12 @@ void SingletonBlob::verify() { void SingletonBlob::print_on(outputStream* st) const { ttyLocker ttyl; CodeBlob::print_on(st); - st->print_cr(name()); + st->print_cr("%s", name()); Disassembler::decode((CodeBlob*)this, st); } void SingletonBlob::print_value_on(outputStream* st) const { - st->print_cr(name()); + st->print_cr("%s", name()); } void DeoptimizationBlob::print_value_on(outputStream* st) const { diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp index b3a857c2062..07bcc202b76 100644 --- a/hotspot/src/share/vm/code/codeCache.cpp +++ b/hotspot/src/share/vm/code/codeCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -81,10 +81,10 @@ class CodeBlob_sizes { bool is_empty() { return count == 0; } void print(const char* title) { - tty->print_cr(" #%d %s = %dK (hdr %d%%, loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])", + tty->print_cr(" #%d %s = %dK (hdr %d%%, loc %d%%, code %d%%, stub %d%%, [oops %d%%, metadata %d%%, data %d%%, pcs %d%%])", count, title, - total() / K, + (int)(total() / K), header_size * 100 / total_size, relocation_size * 100 / total_size, code_size * 100 / total_size, @@ -191,7 +191,7 @@ CodeBlob* CodeCache::allocate(int size, bool is_critical) { } if (PrintCodeCacheExtension) { ResourceMark rm; - tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%d bytes)", + tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)", (intptr_t)_heap->low_boundary(), (intptr_t)_heap->high(), (address)_heap->high() - (address)_heap->low_boundary()); } @@ -487,7 +487,7 @@ void CodeCache::gc_epilogue() { if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) { CompiledIC *ic = CompiledIC_at(iter.reloc()); if (TraceCompiledIC) { - tty->print("noticed icholder " INTPTR_FORMAT " ", ic->cached_icholder()); + tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder())); ic->print(); } assert(ic->cached_icholder() != NULL, "must be non-NULL"); @@ -741,10 +741,10 @@ void CodeCache::print_memory_overhead() { } // Print bytes that are allocated in the freelist ttyLocker ttl; - tty->print_cr("Number of elements in freelist: %d", freelist_length()); - tty->print_cr("Allocated in freelist: %dkB", bytes_allocated_in_freelist()/K); - tty->print_cr("Unused bytes in CodeBlobs: %dkB", (int)(wasted_bytes/K)); - tty->print_cr("Segment map size: %dkB", allocated_segments()/K); // 1 byte per segment + tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelist_length()); + tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelist()/K); + tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K)); + tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment } //------------------------------------------------------------------------------------------------ @@ -756,7 +756,7 @@ void CodeCache::print_trace(const char* event, CodeBlob* cb, int size) { if (PrintCodeCache2) { // Need to add a new flag ResourceMark rm; if (size == 0) size = cb->size(); - tty->print_cr("CodeCache %s: addr: " INTPTR_FORMAT ", size: 0x%x", event, cb, size); + tty->print_cr("CodeCache %s: addr: " INTPTR_FORMAT ", size: 0x%x", event, p2i(cb), size); } } @@ -926,9 +926,9 @@ void CodeCache::print_summary(outputStream* st, bool detailed) { if (detailed) { st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]", - _heap->low_boundary(), - _heap->high(), - _heap->high_boundary()); + p2i(_heap->low_boundary()), + p2i(_heap->high()), + p2i(_heap->high_boundary())); st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT " adapters=" UINT32_FORMAT, nof_blobs(), nof_nmethods(), nof_adapters()); diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp index 251a4c79c43..9a038164689 100644 --- a/hotspot/src/share/vm/code/compiledIC.cpp +++ b/hotspot/src/share/vm/code/compiledIC.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -88,9 +88,9 @@ void CompiledIC::internal_set_ic_destination(address entry_point, bool is_icstub if (TraceCompiledIC) { tty->print(" "); print_compiled_ic(); - tty->print(" changing destination to " INTPTR_FORMAT, entry_point); + tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point)); if (!is_optimized()) { - tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", (address)cache); + tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache)); } if (is_icstub) { tty->print(" (icstub)"); @@ -195,7 +195,7 @@ bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod if (TraceICs) { ResourceMark rm; tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, - instruction_address(), call_info->selected_method()->print_value_string(), entry); + p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry)); } // We can't check this anymore. With lazy deopt we could have already @@ -272,7 +272,7 @@ bool CompiledIC::is_call_to_interpreted() const { void CompiledIC::set_to_clean() { assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call"); if (TraceInlineCacheClearing || TraceICs) { - tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", instruction_address()); + tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address())); print(); } @@ -354,7 +354,7 @@ void CompiledIC::set_to_monomorphic(CompiledICInfo& info) { if (TraceICs) { ResourceMark rm(thread); tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s", - instruction_address(), + p2i(instruction_address()), method->print_value_string()); } } else { @@ -362,7 +362,7 @@ void CompiledIC::set_to_monomorphic(CompiledICInfo& info) { InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry()); if (TraceICs) { ResourceMark rm(thread); - tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", instruction_address()); + tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address())); } } } else { @@ -392,7 +392,7 @@ void CompiledIC::set_to_monomorphic(CompiledICInfo& info) { ResourceMark rm(thread); assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be"); tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s", - instruction_address(), + p2i(instruction_address()), ((Klass*)info.cached_metadata())->print_value_string(), (safe) ? "" : "via stub"); } @@ -530,8 +530,8 @@ void CompiledStaticCall::set(const StaticCallInfo& info) { if (TraceICs) { ResourceMark rm; tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT, - instruction_address(), - info.entry()); + p2i(instruction_address()), + p2i(info.entry())); } // Call to compiled code assert (CodeCache::contains(info.entry()), "wrong entry point"); @@ -600,11 +600,11 @@ void CompiledIC::print() { void CompiledIC::print_compiled_ic() { tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT, - instruction_address(), is_call_to_interpreted() ? "interpreted " : "", ic_destination(), is_optimized() ? NULL : cached_value()); + p2i(instruction_address()), is_call_to_interpreted() ? "interpreted " : "", p2i(ic_destination()), p2i(is_optimized() ? NULL : cached_value())); } void CompiledStaticCall::print() { - tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address()); + tty->print("static call at " INTPTR_FORMAT " -> ", p2i(instruction_address())); if (is_clean()) { tty->print("clean"); } else if (is_call_to_compiled()) { diff --git a/hotspot/src/share/vm/code/compressedStream.cpp b/hotspot/src/share/vm/code/compressedStream.cpp index 1716ffac651..4687372f833 100644 --- a/hotspot/src/share/vm/code/compressedStream.cpp +++ b/hotspot/src/share/vm/code/compressedStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -212,6 +212,8 @@ static jlong stretch(jint x, int bits) { return h ^ l; } +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_IGNORED // Someone needs to deal with this. void test_compressed_stream(int trace) { CompressedWriteStream bytes(stretch_limit * 100); jint n; @@ -275,6 +277,7 @@ void test_compressed_stream(int trace) { guarantee(length == length2, "bad length"); guarantee(fails == 0, "test failures"); } +PRAGMA_DIAG_POP #if defined(_MSC_VER) &&_MSC_VER >=1400 && !defined(_WIN64) #pragma warning(default: 4748) diff --git a/hotspot/src/share/vm/code/debugInfo.cpp b/hotspot/src/share/vm/code/debugInfo.cpp index ecdae461039..3b01884c6e4 100644 --- a/hotspot/src/share/vm/code/debugInfo.cpp +++ b/hotspot/src/share/vm/code/debugInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -28,7 +28,9 @@ #include "code/nmethod.hpp" #include "runtime/handles.inline.hpp" -// Comstructors +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + +// Constructors DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size) : CompressedWriteStream(initial_size) { diff --git a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp index 9e259008287..511b84d220d 100644 --- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp +++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -27,6 +27,8 @@ #include "code/nmethod.hpp" #include "memory/allocation.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) { _nesting.check(); if (_length >= _size) { diff --git a/hotspot/src/share/vm/code/icBuffer.cpp b/hotspot/src/share/vm/code/icBuffer.cpp index 81ef87ce200..0fe6e0d1145 100644 --- a/hotspot/src/share/vm/code/icBuffer.cpp +++ b/hotspot/src/share/vm/code/icBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -39,6 +39,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/stubRoutines.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC DEF_STUB_INTERFACE(ICStub); diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 89604e0caa8..86264436755 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -48,6 +48,8 @@ #include "shark/sharkCompiler.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED // Only bother with this argument setup if dtrace is available diff --git a/hotspot/src/share/vm/code/pcDesc.cpp b/hotspot/src/share/vm/code/pcDesc.cpp index 7ba25464f7d..7f27cc0c08c 100644 --- a/hotspot/src/share/vm/code/pcDesc.cpp +++ b/hotspot/src/share/vm/code/pcDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -29,6 +29,8 @@ #include "code/scopeDesc.hpp" #include "memory/resourceArea.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) { _pc_offset = pc_offset; _scope_decode_offset = scope_decode_offset; diff --git a/hotspot/src/share/vm/code/relocInfo.cpp b/hotspot/src/share/vm/code/relocInfo.cpp index 7cff27f085e..aa0ef6b106e 100644 --- a/hotspot/src/share/vm/code/relocInfo.cpp +++ b/hotspot/src/share/vm/code/relocInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -31,6 +31,7 @@ #include "runtime/stubCodeGenerator.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC const RelocationHolder RelocationHolder::none; // its type is relocInfo::none diff --git a/hotspot/src/share/vm/code/scopeDesc.cpp b/hotspot/src/share/vm/code/scopeDesc.cpp index b1c3ccef764..7e557afcd35 100644 --- a/hotspot/src/share/vm/code/scopeDesc.cpp +++ b/hotspot/src/share/vm/code/scopeDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -30,6 +30,7 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) { _code = code; diff --git a/hotspot/src/share/vm/code/vtableStubs.cpp b/hotspot/src/share/vm/code/vtableStubs.cpp index b3bfc258f56..ac99da40e1c 100644 --- a/hotspot/src/share/vm/code/vtableStubs.cpp +++ b/hotspot/src/share/vm/code/vtableStubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -39,6 +39,8 @@ #include "opto/matcher.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // ----------------------------------------------------------------------------------------- // Implementation of VtableStub diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index 8521806cd1f..b2320eac8bd 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -172,7 +172,7 @@ class CompilationLog : public StringEventLog { void log_nmethod(JavaThread* thread, nmethod* nm) { log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]", nm->compile_id(), nm->is_osr_method() ? "%" : "", - nm, nm->code_begin(), nm->code_end()); + p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end())); } void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) { @@ -1786,7 +1786,7 @@ void CompileBroker::init_compiler_thread_log() { if (xtty != NULL) { ttyLocker ttyl; // Record any per thread log files - xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name); + xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name); } return; } @@ -1817,7 +1817,7 @@ void CompileBroker::maybe_block() { if (_should_block) { #ifndef PRODUCT if (PrintCompilation && (Verbose || WizardMode)) - tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", Thread::current()); + tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", p2i(Thread::current())); #endif ThreadInVMfromNative tivfn(JavaThread::current()); } @@ -1834,7 +1834,7 @@ static void codecache_print(bool detailed) CodeCache::print_summary(&s, detailed); } ttyLocker ttyl; - tty->print(s.as_string()); + tty->print("%s", s.as_string()); } // ------------------------------------------------------------------ @@ -2039,7 +2039,7 @@ void CompileBroker::handle_full_code_cache() { // Lock to prevent tearing ttyLocker ttyl; xtty->begin_elem("code_cache_full"); - xtty->print(s.as_string()); + xtty->print("%s", s.as_string()); xtty->stamp(); xtty->end_elem(); } diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp index 8753e7b2859..f2c04b6e4ff 100644 --- a/hotspot/src/share/vm/compiler/compileLog.cpp +++ b/hotspot/src/share/vm/compiler/compileLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -174,9 +174,9 @@ void CompileLog::name(ciSymbol* name) { void CompileLog::name(ciKlass* k) { print(" name='"); if (!k->is_loaded()) { - text()->print(k->name()->as_klass_external_name()); + text()->print("%s", k->name()->as_klass_external_name()); } else { - text()->print(k->external_name()); + text()->print("%s", k->external_name()); } print("'"); } @@ -303,7 +303,7 @@ void CompileLog::finish_log(outputStream* file) { // Print about successful method inlining. void CompileLog::inline_success(const char* reason) { begin_elem("inline_success reason='"); - text(reason); + text("%s", reason); end_elem("'"); } @@ -313,7 +313,7 @@ void CompileLog::inline_success(const char* reason) { // Print about failed method inlining. void CompileLog::inline_fail(const char* reason) { begin_elem("inline_fail reason='"); - text(reason); + text("%s", reason); end_elem("'"); } @@ -339,5 +339,5 @@ void CompileLog::set_context(const char* format, ...) { void CompileLog::code_cache_state() { begin_elem("code_cache"); CodeCache::log_state(this); - end_elem(""); + end_elem("%s", ""); } diff --git a/hotspot/src/share/vm/compiler/compileLog.hpp b/hotspot/src/share/vm/compiler/compileLog.hpp index 094dc767f7e..49e2b6a6180 100644 --- a/hotspot/src/share/vm/compiler/compileLog.hpp +++ b/hotspot/src/share/vm/compiler/compileLog.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -55,7 +55,7 @@ class CompileLog : public xmlStream { static CompileLog* _first; // head of static chain - void va_tag(bool push, const char* format, va_list ap); + void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); public: CompileLog(const char* file_name, FILE* fp, intx thread_id); @@ -69,7 +69,7 @@ class CompileLog : public xmlStream { // or reset, context string will be silently ignored stringStream* context() { return &_context; } void clear_context() { context()->reset(); } - void set_context(const char* format, ...); + void set_context(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void name(ciSymbol* s); // name='s' void name(Symbol* s) { xmlStream::name(s); } diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp index 582ec675d4d..c58fb169309 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -520,7 +520,7 @@ void CompilerOracle::parse_from_line(char* line) { tty->print_cr("CompilerOracle: unrecognized line"); tty->print_cr(" \"%s\"", original_line); if (error_msg != NULL) { - tty->print_cr(error_msg); + tty->print_cr("%s", error_msg); } } } @@ -642,7 +642,7 @@ void CompilerOracle::parse_compile_only(char * line) { char method_sep = have_colon ? ':' : '.'; if (Verbose) { - tty->print_cr(line); + tty->print_cr("%s", line); } ResourceMark rm; diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp index 8495210c384..0e9c14c1549 100644 --- a/hotspot/src/share/vm/compiler/disassembler.cpp +++ b/hotspot/src/share/vm/compiler/disassembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, 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 @@ -51,6 +51,8 @@ #include "shark/sharkEntry.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void* Disassembler::_library = NULL; bool Disassembler::_tried_to_load_library = false; @@ -411,6 +413,7 @@ static void* event_to_env(void* env_pv, const char* event, void* arg) { return env->handle_event(event, (address) arg); } +ATTRIBUTE_PRINTF(2, 3) static int printf_to_env(void* env_pv, const char* format, ...) { decode_env* env = (decode_env*) env_pv; outputStream* st = env->output(); diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp index 4fcc5613336..0c1d9b09232 100644 --- a/hotspot/src/share/vm/compiler/methodLiveness.cpp +++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -32,6 +32,8 @@ #include "memory/allocation.inline.hpp" #include "utilities/bitMap.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The MethodLiveness class performs a simple liveness analysis on a method // in order to decide which locals are live (that is, will be used again) at // a particular bytecode index (bci). diff --git a/hotspot/src/share/vm/compiler/oopMap.cpp b/hotspot/src/share/vm/compiler/oopMap.cpp index c4c83fc164d..5e1801584c2 100644 --- a/hotspot/src/share/vm/compiler/oopMap.cpp +++ b/hotspot/src/share/vm/compiler/oopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -633,8 +633,8 @@ void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) { tty->print_cr( "Add derived pointer@" INTPTR_FORMAT " - Derived: " INTPTR_FORMAT - " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)", - derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset + " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")", + p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset ); } // Set derived oop location to point to base. @@ -661,8 +661,8 @@ void DerivedPointerTable::update_pointers() { if (TraceDerivedPointers) { tty->print_cr("Updating derived pointer@" INTPTR_FORMAT - " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %d)", - derived_loc, (address)*derived_loc, (address)base, offset); + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")", + p2i(derived_loc), p2i((address)*derived_loc), p2i((address)base), offset); } // Delete entry diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp index 309fe014aa1..b7f7ed1f0a3 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -157,7 +157,7 @@ void AdaptiveFreeList::verify_stats() const { " split_deaths(" SIZE_FORMAT ")" " coal_deaths(" SIZE_FORMAT ")" " + count(" SSIZE_FORMAT ")", - this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), + p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(), _allocation_stats.coal_births(), _allocation_stats.split_deaths(), _allocation_stats.coal_deaths(), count())); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index bbaffb9bf2e..da4bf278299 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -428,7 +428,7 @@ size_t CompactibleFreeListSpace::max_alloc_in_words() const { void LinearAllocBlock::print_on(outputStream* st) const { st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT, - _ptr, _word_size, _refillSize, _allocation_size_limit); + p2i(_ptr), _word_size, _refillSize, _allocation_size_limit); } void CompactibleFreeListSpace::print_on(outputStream* st) const { @@ -459,7 +459,7 @@ const { for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; fc = fc->next()) { gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", - fc, (HeapWord*)fc + i, + p2i(fc), p2i((HeapWord*)fc + i), fc->cantCoalesce() ? "\t CC" : ""); } } @@ -503,7 +503,7 @@ size_t BlkPrintingClosure::do_blk(HeapWord* addr) { if (_sp->block_is_obj(addr)) { const bool dead = _post_remark && !_live_bit_map->isMarked(addr); _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s", - addr, + p2i(addr), dead ? "dead" : "live", sz, (!dead && CMSPrintObjectsInDump) ? ":" : "."); @@ -513,7 +513,7 @@ size_t BlkPrintingClosure::do_blk(HeapWord* addr) { } } else { // free block _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s", - addr, sz, CMSPrintChunksInDump ? ":" : "."); + p2i(addr), sz, CMSPrintChunksInDump ? ":" : "."); if (CMSPrintChunksInDump) { ((FreeChunk*)addr)->print_on(_st); _st->print_cr("--------------------------------------"); @@ -1983,7 +1983,7 @@ void CompactibleFreeListSpace::save_marks() { assert(ur.contains(urasm), err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")" " should contain [" PTR_FORMAT "," PTR_FORMAT ")", - ur.start(), ur.end(), urasm.start(), urasm.end())); + p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end()))); #endif // inform allocator that promotions should be tracked. assert(_promoInfo.noPromotions(), "_promoInfo inconsistency"); @@ -2206,7 +2206,7 @@ void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) { if (PrintFLSStatistics > 0) { HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict(); gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT, - largestAddr); + p2i(largestAddr)); } setFLSurplus(); setFLHints(); @@ -2355,8 +2355,8 @@ class VerifyAllBlksClosure: public BlkClosure { gclog_or_tty->print_cr( " Current: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n" " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n", - addr, res, was_obj ?"true":"false", was_live ?"true":"false", - _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); + p2i(addr), res, was_obj ?"true":"false", was_live ?"true":"false", + p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false"); _sp->print_on(gclog_or_tty); guarantee(false, "Seppuku!"); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index 9f01fcd54a4..e1d5e29a84b 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -403,7 +403,7 @@ class CompactibleFreeListSpace: public CompactibleSpace { if (CMSTraceSweeper) { gclog_or_tty->print_cr(">>>>> Saving sweep limit " PTR_FORMAT " for space [" PTR_FORMAT "," PTR_FORMAT ") <<<<<<", - _sweep_limit, bottom(), end()); + p2i(_sweep_limit), p2i(bottom()), p2i(end())); } } NOT_PRODUCT( diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 3d108c28181..b3e47f03d80 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -64,6 +64,8 @@ #include "services/memoryService.hpp" #include "services/runtimeService.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // statics CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; bool CMSCollector::_full_gc_requested = false; @@ -1182,7 +1184,7 @@ void CMSCollector::icms_update_allocation_limits() gclog_or_tty->print(" icms alloc limits: " PTR_FORMAT "," PTR_FORMAT " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ", - _icms_start_limit, _icms_stop_limit, + p2i(_icms_start_limit), p2i(_icms_stop_limit), percent_of_space(eden, _icms_start_limit), percent_of_space(eden, _icms_stop_limit)); if (Verbose) { @@ -1210,7 +1212,7 @@ CMSCollector::allocation_limit_reached(Space* space, HeapWord* top, gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT ", new limit=" PTR_FORMAT " (" SIZE_FORMAT "%%)", - top, _icms_stop_limit, + p2i(top), p2i(_icms_stop_limit), percent_of_space(space, _icms_stop_limit)); } ConcurrentMarkSweepThread::start_icms(); @@ -1227,7 +1229,7 @@ CMSCollector::allocation_limit_reached(Space* space, HeapWord* top, gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT ", new limit=" PTR_FORMAT " (" SIZE_FORMAT "%%)", - top, space->end(), + p2i(top), p2i(space->end()), percent_of_space(space, space->end())); } ConcurrentMarkSweepThread::stop_icms(); @@ -1502,7 +1504,7 @@ bool CMSCollector::shouldConcurrentCollect() { if (PrintCMSInitiationStatistics && stats().valid()) { gclog_or_tty->print("CMSCollector shouldConcurrentCollect: "); gclog_or_tty->stamp(); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); stats().print_on(gclog_or_tty); gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", stats().time_until_cms_gen_full()); @@ -3588,7 +3590,7 @@ CMSPhaseAccounting::~CMSPhaseAccounting() { _collector->cmsGen()->short_name(), _phase, _collector->timerValue(), _wallclock.seconds()); if (_print_cr) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } if (PrintCMSStatistics != 0) { gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase, diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp index 75c1ddcc0dd..0479143d4f9 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -111,7 +111,7 @@ void ConcurrentMarkSweepThread::run() { // From this time Thread::current() should be working. assert(this == Thread::current(), "just checking"); if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) { - warning("Couldn't bind CMS thread to processor %u", CPUForCMSThread); + warning("Couldn't bind CMS thread to processor " UINTX_FORMAT, CPUForCMSThread); } // Wait until Universe::is_fully_initialized() { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp index 7da7511905f..5f508cc09a4 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -239,7 +239,7 @@ inline void ConcurrentMarkSweepThread::trace_state(const char* desc) { jio_snprintf(buf, sizeof(buf), " [%.3f: CMSThread %s] ", ts.seconds(), desc); buf[sizeof(buf) - 1] = '\0'; - gclog_or_tty->print(buf); + gclog_or_tty->print("%s", buf); } } @@ -271,7 +271,7 @@ class CMSLoopCountWarn: public StackObj { inline void tick() { _ticks++; if (CMSLoopWarn && _ticks % _threshold == 0) { - warning("%s has looped %d times %s", _src, _ticks, _msg); + warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg); } } }; diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp index 34ee7d67b9a..133ed3c5969 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -27,6 +27,8 @@ #include "memory/freeBlockDictionary.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifndef PRODUCT #define baadbabeHeapWord badHeapWordVal diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp index cc870308548..44f5a287c6e 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2014, 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 @@ -28,6 +28,8 @@ #include "oops/markOop.inline.hpp" #include "oops/oop.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ///////////////////////////////////////////////////////////////////////// //// PromotionInfo ///////////////////////////////////////////////////////////////////////// diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index 46c0650a772..ca1a1124643 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -34,6 +34,7 @@ #include "runtime/os.hpp" #include "utilities/dtrace.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC ////////////////////////////////////////////////////////// // Methods in abstract class VM_CMS_Operation diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index de13a943c10..ad21b8ed7b6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -537,7 +537,7 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) : if (verbose_low()) { gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " - "heap end = "PTR_FORMAT, _heap_start, _heap_end); + "heap end = " PTR_FORMAT, p2i(_heap_start), p2i(_heap_end)); } if (!_markBitMap1.allocate(heap_rs)) { @@ -651,7 +651,7 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) : if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - mark_stack_size, 1, MarkStackSizeMax); + mark_stack_size, (uintx) 1, MarkStackSizeMax); return; } FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); @@ -662,7 +662,7 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) : if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - MarkStackSize, 1, MarkStackSizeMax); + MarkStackSize, (uintx) 1, MarkStackSizeMax); return; } } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { @@ -821,7 +821,7 @@ void ConcurrentMark::set_concurrency_and_phase(uint active_tasks, bool concurren assert(!concurrent_marking_in_progress(), "invariant"); assert(_finger == _heap_end, err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT, - _finger, _heap_end)); + p2i(_finger), p2i(_heap_end))); update_g1_committed(true); } } @@ -1424,7 +1424,7 @@ public: assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), err_msg("Preconditions not met - " "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, - start, ntams, hr->end())); + p2i(start), p2i(ntams), p2i(hr->end()))); // Find the first marked object at or after "start". start = _bm->getNextMarkedWordAddress(start, ntams); @@ -1609,7 +1609,7 @@ public: if (failures > 0 && _verbose) { gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, - HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(), + HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()), _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); } @@ -2241,7 +2241,7 @@ class G1CMKeepAliveAndDrainClosure: public OopClosure { if (_cm->verbose_high()) { gclog_or_tty->print_cr("\t[%u] we're looking at location " "*"PTR_FORMAT" = "PTR_FORMAT, - _task->worker_id(), p, (void*) obj); + _task->worker_id(), p2i(p), p2i((void*) obj)); } _task->deal_with_reference(obj); @@ -2675,7 +2675,7 @@ public: } _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", - p, (void*) obj, str, str2); + p2i(p), p2i((void*) obj), str, str2); } }; @@ -2702,7 +2702,7 @@ public: if (print_it) { _out->print_cr(" "PTR_FORMAT"%s", - (void *)o, (over_tams) ? " >" : (marked) ? " M" : ""); + p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : ""); PrintReachableOopClosure oopCl(_out, _vo, _all); o->oop_iterate_no_header(&oopCl); } @@ -2723,14 +2723,14 @@ public: HeapWord* t = hr->top(); HeapWord* p = _g1h->top_at_mark_start(hr, _vo); _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " - "TAMS: "PTR_FORMAT, b, e, t, p); + "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p)); _out->cr(); HeapWord* from = b; HeapWord* to = t; if (to > from) { - _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to); + _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to)); _out->cr(); PrintReachableObjectClosure ocl(_out, _vo, _all, hr); hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); @@ -2846,7 +2846,7 @@ ConcurrentMark::claim_region(uint worker_id) { gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " "["PTR_FORMAT", "PTR_FORMAT"), " "limit = "PTR_FORMAT, - worker_id, curr_region, bottom, end, limit); + worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit)); } // Is the gap between reading the finger and doing the CAS too long? @@ -2860,13 +2860,13 @@ ConcurrentMark::claim_region(uint worker_id) { if (verbose_low()) { gclog_or_tty->print_cr("[%u] we were successful with region = " - PTR_FORMAT, worker_id, curr_region); + PTR_FORMAT, worker_id, p2i(curr_region)); } if (limit > bottom) { if (verbose_low()) { gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " - "returning it ", worker_id, curr_region); + "returning it ", worker_id, p2i(curr_region)); } return curr_region; } else { @@ -2874,7 +2874,7 @@ ConcurrentMark::claim_region(uint worker_id) { "the region limit should be at bottom"); if (verbose_low()) { gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " - "returning NULL", worker_id, curr_region); + "returning NULL", worker_id, p2i(curr_region)); } // we return NULL and the caller should try calling // claim_region() again. @@ -2886,7 +2886,7 @@ ConcurrentMark::claim_region(uint worker_id) { gclog_or_tty->print_cr("[%u] somebody else moved the finger, " "global finger = "PTR_FORMAT", " "our finger = "PTR_FORMAT, - worker_id, _finger, finger); + worker_id, p2i(_finger), p2i(finger)); } // read it again @@ -2925,7 +2925,7 @@ private: void do_object_work(oop obj) { guarantee(!_g1h->obj_in_cs(obj), err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", - (void*) obj, phase_str(), _info)); + p2i((void*) obj), phase_str(), _info)); } public: @@ -3004,7 +3004,7 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks, HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); guarantee(global_finger == global_hr->bottom(), err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, - global_finger, HR_FORMAT_PARAMS(global_hr))); + p2i(global_finger), HR_FORMAT_PARAMS(global_hr))); } // Verify the task fingers @@ -3018,7 +3018,7 @@ void ConcurrentMark::verify_no_cset_oops(bool verify_stacks, guarantee(task_finger == task_hr->bottom() || !task_hr->in_collection_set(), err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, - task_finger, HR_FORMAT_PARAMS(task_hr))); + p2i(task_finger), HR_FORMAT_PARAMS(task_hr))); } } } @@ -3062,7 +3062,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure { err_msg("Preconditions not met - " "start: "PTR_FORMAT", limit: "PTR_FORMAT", " "top: "PTR_FORMAT", end: "PTR_FORMAT, - start, limit, hr->top(), hr->end())); + p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end()))); assert(hr->next_marked_bytes() == 0, "Precondition"); @@ -3303,7 +3303,7 @@ void ConcurrentMark::print_worker_threads_on(outputStream* st) const { void ConcurrentMark::print_on_error(outputStream* st) const { st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, - _prevMarkBitMap, _nextMarkBitMap); + p2i(_prevMarkBitMap), p2i(_nextMarkBitMap)); _prevMarkBitMap->print_on_error(st, " Prev Bits: "); _nextMarkBitMap->print_on_error(st, " Next Bits: "); } @@ -3336,11 +3336,11 @@ bool ConcurrentMark::containing_cards_are_marked(void* start, // for debugging purposes void ConcurrentMark::print_finger() { gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, - _heap_start, _heap_end, _finger); + p2i(_heap_start), p2i(_heap_end), p2i(_finger)); for (uint i = 0; i < _max_worker_id; ++i) { - gclog_or_tty->print(" %u: "PTR_FORMAT, i, _tasks[i]->finger()); + gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger())); } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } #endif @@ -3349,7 +3349,7 @@ void CMTask::scan_object(oop obj) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } size_t obj_size = obj->size(); @@ -3428,7 +3428,7 @@ void CMTask::setup_for_region(HeapRegion* hr) { if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, - _worker_id, hr); + _worker_id, p2i(hr)); } _curr_region = hr; @@ -3445,7 +3445,7 @@ void CMTask::update_region_limit() { if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] found an empty region " "["PTR_FORMAT", "PTR_FORMAT")", - _worker_id, bottom, limit); + _worker_id, p2i(bottom), p2i(limit)); } // The region was collected underneath our feet. // We set the finger to bottom to ensure that the bitmap @@ -3477,7 +3477,7 @@ void CMTask::giveup_current_region() { assert(_curr_region != NULL, "invariant"); if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, - _worker_id, _curr_region); + _worker_id, p2i(_curr_region)); } clear_region_fields(); } @@ -3768,7 +3768,7 @@ void CMTask::drain_local_queue(bool partially) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, - (void*) obj); + p2i((void*) obj)); } assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); @@ -4153,7 +4153,7 @@ void CMTask::do_marking_step(double time_target_ms, gclog_or_tty->print_cr("[%u] we're scanning part " "["PTR_FORMAT", "PTR_FORMAT") " "of region "HR_FORMAT, - _worker_id, _finger, _region_limit, + _worker_id, p2i(_finger), p2i(_region_limit), HR_FORMAT_PARAMS(_curr_region)); } @@ -4240,7 +4240,7 @@ void CMTask::do_marking_step(double time_target_ms, if (_cm->verbose_low()) { gclog_or_tty->print_cr("[%u] we successfully claimed " "region "PTR_FORMAT, - _worker_id, claimed_region); + _worker_id, p2i(claimed_region)); } setup_for_region(claimed_region); @@ -4301,7 +4301,7 @@ void CMTask::do_marking_step(double time_target_ms, if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { if (_cm->verbose_medium()) { gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } statsOnly( ++_steals ); @@ -4549,8 +4549,8 @@ G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name) G1PPRL_SUM_ADDR_FORMAT("committed") G1PPRL_SUM_ADDR_FORMAT("reserved") G1PPRL_SUM_BYTE_FORMAT("region-size"), - g1_committed.start(), g1_committed.end(), - g1_reserved.start(), g1_reserved.end(), + p2i(g1_committed.start()), p2i(g1_committed.end()), + p2i(g1_reserved.start()), p2i(g1_reserved.end()), HeapRegion::GrainBytes); _out->print_cr(G1PPRL_LINE_PREFIX); _out->print_cr(G1PPRL_LINE_PREFIX @@ -4667,7 +4667,7 @@ bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) { G1PPRL_DOUBLE_FORMAT G1PPRL_BYTE_FORMAT G1PPRL_BYTE_FORMAT, - type, bottom, end, + type, p2i(bottom), p2i(end), used_bytes, prev_live_bytes, next_live_bytes, gc_eff, remset_bytes, strong_code_roots_bytes); diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp index e4ca5ecee5e..12ba5683ed8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -277,7 +277,7 @@ inline void CMTask::push(oop obj) { assert(_nextMarkBitMap->isMarked(objAddr), "invariant"); if (_cm->verbose_high()) { - gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj); + gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj)); } if (!_task_queue->push(obj)) { @@ -317,7 +317,7 @@ inline void CMTask::push(oop obj) { inline void CMTask::deal_with_reference(oop obj) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT, - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } ++_refs_reached; @@ -334,7 +334,7 @@ inline void CMTask::deal_with_reference(oop obj) { if (!hr->obj_allocated_since_next_marking(obj)) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked", - _worker_id, (void*) obj); + _worker_id, p2i((void*) obj)); } // we need to mark it first @@ -349,7 +349,7 @@ inline void CMTask::deal_with_reference(oop obj) { if (_finger != NULL && objAddr < _finger) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), " - "pushing it", _worker_id, _finger); + "pushing it", _worker_id, p2i(_finger)); } push(obj); } else if (_curr_region != NULL && objAddr < _region_limit) { @@ -367,7 +367,7 @@ inline void CMTask::deal_with_reference(oop obj) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the global finger " "("PTR_FORMAT"), pushing it", - _worker_id, global_finger); + _worker_id, p2i(global_finger)); } push(obj); } else { @@ -382,7 +382,7 @@ inline void CMTask::deal_with_reference(oop obj) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] below the global finger " "("PTR_FORMAT"), pushing it", - _worker_id, global_finger); + _worker_id, p2i(global_finger)); } push(obj); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp index 58a76c1dd26..a0d994738fd 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -143,7 +143,7 @@ HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) { msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT, _name, message, _count, BOOL_TO_STR(_bot_updates), - _alloc_region, _used_bytes_before); + p2i(_alloc_region), _used_bytes_before); } void G1AllocRegion::init() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp index 3f6e040bf54..050490dbbef 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -184,7 +184,7 @@ public: class ar_ext_msg : public err_msg { public: - ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") { + ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") { alloc_region->fill_in_ext_msg(this, message); } }; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp index d5851a6d467..8c5bef77122 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -65,7 +65,7 @@ public: REGION_SIZE_IN_WORDS * HeapWordSize); // Check address calculation (bounds) assert(array.bottom_address_mapped() == fake_heap, - err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped())); + err_msg("bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped()))); assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be"); int* bottom = array.address_mapped_to(fake_heap); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp index b0b7a76e1fe..f7ec3e39f2d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -55,7 +55,7 @@ protected: void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { assert(base != NULL, "just checking"); assert(length > 0, "just checking"); - assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by)); + assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %u, larger than word size?", shift_by)); _base = base; _length = length; _biased_base = base - (bias * elem_size); @@ -71,10 +71,10 @@ protected: err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, - mapping_granularity_in_bytes, bottom)); + mapping_granularity_in_bytes, p2i(bottom))); assert((uintptr_t)end % mapping_granularity_in_bytes == 0, err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, - mapping_granularity_in_bytes, end)); + mapping_granularity_in_bytes, p2i(end))); size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes); idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp index 9777c17b5a8..14d0126e224 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -29,6 +29,8 @@ #include "runtime/java.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ////////////////////////////////////////////////////////////////////// // G1BlockOffsetSharedArray ////////////////////////////////////////////////////////////////////// diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp index ba664ee5275..56dca4d26f8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -80,7 +80,7 @@ public: virtual void set_bottom(HeapWord* new_bottom) { assert(new_bottom <= _end, err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")", - new_bottom, _end)); + p2i(new_bottom), p2i(_end))); _bottom = new_bottom; resize(pointer_delta(_end, _bottom)); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp index d300f56255f..5ae3bc1cdeb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -50,7 +50,7 @@ inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { assert(pc >= (char*)_reserved.start() && pc < (char*)_reserved.end(), err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")", - p, (char*)_reserved.start(), (char*)_reserved.end())); + p2i(p), p2i(_reserved.start()), p2i(_reserved.end()))); size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); size_t result = delta >> LogN; check_index(result, "bad index from address"); @@ -65,7 +65,7 @@ G1BlockOffsetSharedArray::address_for_index(size_t index) const { err_msg("bad address from index result " PTR_FORMAT " _reserved.start() " PTR_FORMAT " _reserved.end() " PTR_FORMAT, - result, _reserved.start(), _reserved.end())); + p2i(result), p2i(_reserved.start()), p2i(_reserved.end()))); return result; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp index ccb7c3f10b3..9fff9604ff2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -31,6 +31,8 @@ #include "services/memTracker.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) { if (has_count_table()) { assert(from_card_num >= 0 && from_card_num < _committed_max_card_num, diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp index 129b3b0d232..ef08479f60a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -77,10 +77,10 @@ class G1CardCounts: public CHeapObj { err_msg("Invalid card pointer: " "card_ptr: " PTR_FORMAT ", " "_ct_bot: " PTR_FORMAT, - card_ptr, _ct_bot)); + p2i(card_ptr), p2i(_ct_bot))); size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); assert(card_num >= 0 && card_num < _committed_max_card_num, - err_msg("card pointer out of range: " PTR_FORMAT, card_ptr)); + err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr))); return card_num; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp index 1130278fa91..fbe7095f75c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp @@ -28,6 +28,8 @@ #include "gc_implementation/g1/g1CodeCacheRemSet.hpp" #include "memory/iterator.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + G1CodeRootChunk::G1CodeRootChunk() : _top(NULL), _next(NULL), _prev(NULL) { _top = bottom(); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 46feeea2841..70a7568f62f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -22,6 +22,11 @@ * */ +#if !defined(__clang_major__) && defined(__GNUC__) +// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information. +#define ATTRIBUTE_PRINTF(x,y) +#endif + #include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/icBuffer.hpp" @@ -370,7 +375,7 @@ void YoungList::print() { } } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); } void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr) @@ -3470,7 +3475,7 @@ void G1CollectedHeap::verify(bool silent, VerifyOption vo) { // help us track down what went wrong. This is why we call // print_extended_on() instead of print_on(). print_extended_on(gclog_or_tty); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); #ifndef PRODUCT if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) { concurrent_mark()->print_reachable("at-verification-failure", @@ -3664,7 +3669,7 @@ public: PrintRSetsClosure(const char* msg) : _msg(msg), _occupied_sum(0) { gclog_or_tty->cr(); gclog_or_tty->print_cr("========================================"); - gclog_or_tty->print_cr(msg); + gclog_or_tty->print_cr("%s", msg); gclog_or_tty->cr(); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp index b308d4a00dd..42a5931815b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -47,7 +47,7 @@ G1CollectedHeap::heap_region_containing_raw(const T addr) const { assert(addr != NULL, "invariant"); assert(_g1_reserved.contains((const void*) addr), err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")", - (void*)addr, _g1_reserved.start(), _g1_reserved.end())); + p2i((void*)addr), p2i(_g1_reserved.start()), p2i(_g1_reserved.end()))); return _hrs.addr_to_region((HeapWord*) addr); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index a0b40d4dbf1..89b6f3fa616 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -22,6 +22,11 @@ * */ +#ifndef __clang_major__ +// FIXME, formats have issues. Disable this macro definition, compile, and study warnings for more information. +#define ATTRIBUTE_PRINTF(x,y) +#endif + #include "precompiled.hpp" #include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentMark.hpp" @@ -965,7 +970,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua #ifndef PRODUCT if (G1YoungSurvRateVerbose) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); _short_lived_surv_rate_group->print(); // do that for any other surv rate groups too } @@ -2222,11 +2227,11 @@ void TraceGen0TimeData::print() const { gclog_or_tty->print_cr("ALL PAUSES"); print_summary_sd(" Total", &_total); - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); + gclog_or_tty->cr(); gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num); gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("EVACUATION PAUSES"); @@ -2246,7 +2251,7 @@ void TraceGen0TimeData::print() const { print_summary(" Clear CT", &_clear_ct); print_summary(" Other", &_other); } - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("MISC"); print_summary_sd(" Stop World", &_all_stop_world_times_ms); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index c4c3432ad43..8e361b63638 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -39,7 +39,7 @@ private: int _indent_level; int _cur; - void vappend(const char* format, va_list ap) { + void vappend(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) { int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap); if (res != -1) { _cur += res; @@ -63,14 +63,14 @@ public: } #endif - void append(const char* format, ...) { + void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); va_end(ap); } - void append_and_print_cr(const char* format, ...) { + void append_and_print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); @@ -80,6 +80,8 @@ public: } }; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED template void WorkerDataArray::print(int level, const char* title) { if (_length == 1) { @@ -109,7 +111,7 @@ void WorkerDataArray::print(int level, const char* title) { } if (G1Log::finest()) { - buf.append_and_print_cr(""); + buf.append_and_print_cr("%s", ""); } double avg = (double)sum / (double)_length; @@ -129,6 +131,7 @@ void WorkerDataArray::print(int level, const char* title) { } buf.append_and_print_cr("]"); } +PRAGMA_DIAG_POP #ifndef PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp index 56a1a3be8a3..8139048ef23 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -27,6 +27,8 @@ #include "gc_implementation/g1/heapRegion.hpp" #include "utilities/ostream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + const char* G1HRPrinter::action_name(ActionType action) { switch(action) { case Alloc: return "ALLOC"; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp index 1fa7639729c..0c9f0cf2d49 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -114,7 +114,7 @@ inline void G1CMOopClosure::do_oop_nv(T* p) { if (_cm->verbose_high()) { gclog_or_tty->print_cr("[%u] we're looking at location " "*"PTR_FORMAT" = "PTR_FORMAT, - _task->worker_id(), p, (void*) obj); + _task->worker_id(), p2i(p), p2i((void*) obj)); } _task->deal_with_reference(obj); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index 58212625c82..69b17c56702 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -39,6 +39,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/intHisto.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define CARD_REPEAT_HISTO 0 #if CARD_REPEAT_HISTO diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 57feb98db2e..24afeba238f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -35,6 +35,8 @@ #include "oops/oop.inline.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + int HeapRegion::LogOfHRGrainBytes = 0; int HeapRegion::LogOfHRGrainWords = 0; size_t HeapRegion::GrainBytes = 0; @@ -827,7 +829,7 @@ public: Mutex::_no_safepoint_check_flag); if (!_failures) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("----------"); } if (!_g1h->is_in_closed_subset(obj)) { @@ -882,7 +884,7 @@ public: Mutex::_no_safepoint_check_flag); if (!_failures) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("----------"); } gclog_or_tty->print_cr("Missing rem set entry:"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index b10f32674cc..25ffe1c8264 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -61,7 +61,7 @@ class nmethod; (_hr_)->startsHumongous() ? "HS" : \ (_hr_)->continuesHumongous() ? "HC" : \ !(_hr_)->is_empty() ? "O" : "F", \ - (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end() + p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end()) // sentinel value for hrs_index #define G1_NULL_HRS_INDEX ((uint) -1) @@ -550,7 +550,7 @@ class HeapRegion: public G1OffsetTableContigSpace { (containing_set != NULL && _containing_set == NULL), err_msg("containing_set: "PTR_FORMAT" " "_containing_set: "PTR_FORMAT, - containing_set, _containing_set)); + p2i(containing_set), p2i(_containing_set))); _containing_set = containing_set; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp index 016e7b0109d..382a3fb32ec 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -36,6 +36,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class PerRegionTable: public CHeapObj { friend class OtherRegionsTable; friend class HeapRegionRemSetIterator; @@ -1218,7 +1220,7 @@ void HeapRegionRemSet::print_recorded() { while (cur_evnt < _n_recorded_events && i == cur_evnt_ind) { gclog_or_tty->print("Event: "); print_event(gclog_or_tty, cur_evnt_kind); - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); cur_evnt++; if (cur_evnt < MaxRecordedEvents) { cur_evnt_kind = _recorded_events[cur_evnt]; diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index 62638a8f9b3..04f48e60550 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -233,7 +233,7 @@ void HeapRegionSeq::verify_optional() { guarantee(hr != NULL, err_msg("invariant: i: %u", i)); guarantee(hr->bottom() == prev_end, err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT, - i, HR_FORMAT_PARAMS(hr), prev_end)); + i, HR_FORMAT_PARAMS(hr), p2i(prev_end))); guarantee(hr->hrs_index() == i, err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index())); if (i < length()) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp index 429457a488f..4028b7a4a5d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -30,9 +30,9 @@ inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const { assert(addr < heap_end(), - err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, addr, heap_end())); + err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, p2i(addr), p2i(heap_end()))); assert(addr >= heap_bottom(), - err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom())); + err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, p2i(addr), p2i(heap_bottom()))); HeapRegion* hr = _regions.get_by_address(addr); assert(hr != NULL, "invariant"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp index 6ec03d5ceae..fa5ab14287e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -26,6 +26,8 @@ #include "gc_implementation/g1/heapRegionRemSet.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + uint FreeRegionList::_unrealistically_long_length = 0; void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp index c54fc784719..222fc694f4c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp @@ -162,7 +162,7 @@ public: // diagnosing failures. class hrs_ext_msg : public hrs_err_msg { public: - hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("") { + hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("%s","") { set->fill_in_ext_msg(this, message); } }; diff --git a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp index 7930e581b98..8a0e42ea4e5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -32,6 +32,8 @@ #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void ObjPtrQueue::flush() { // The buffer might contain refs into the CSet. We have to filter it // first before we flush it, otherwise we might end up with an diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp index 49e4e01fa9e..3121c9c664e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -29,6 +29,8 @@ #include "gc_implementation/g1/survRateGroup.hpp" #include "memory/allocation.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p, const char* name, size_t summary_surv_rates_len) : @@ -202,7 +204,7 @@ SurvRateGroup::print_surv_rate_summary() { if (length == 0) return; - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1); gclog_or_tty->print_cr(" age range survival rate (avg) samples (avg)"); gclog_or_tty->print_cr(" ---------------------------------------------------------"); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp index 6d0e1a2243c..9b39c289900 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -259,22 +259,22 @@ void ASParNewGeneration::resize_spaces(size_t requested_eden_size, requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - eden()->bottom(), - eden()->end(), + p2i(eden()->bottom()), + p2i(eden()->end()), pointer_delta(eden()->end(), eden()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - from()->bottom(), - from()->end(), + p2i(from()->bottom()), + p2i(from()->end()), pointer_delta(from()->end(), from()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - to()->bottom(), - to()->end(), + p2i(to()->bottom()), + p2i(to()->end()), pointer_delta( to()->end(), to()->bottom(), sizeof(char))); @@ -382,18 +382,18 @@ void ASParNewGeneration::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); } } else { @@ -473,18 +473,18 @@ void ASParNewGeneration::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); } } diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp index 3a03b93a56f..c1033579cf5 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, 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 @@ -36,6 +36,8 @@ #include "runtime/virtualspace.hpp" #include "runtime/vmThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, OopsInGenClosure* cl, CardTableRS* ct, diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 41c7bb827d8..2661e1280b6 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -55,6 +55,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable:4355 ) // 'this' : used in base member initializer list diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp index 383a579bec9..2a3e3207195 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, 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 @@ -79,12 +79,12 @@ inline void ParScanClosure::do_oop_work(T* p, if ((HeapWord*)obj < _boundary) { #ifndef PRODUCT if (_g->to()->is_in_reserved(obj)) { - tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p); + tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p2i(p)); GenCollectedHeap* gch = (GenCollectedHeap*)Universe::heap(); Space* sp = gch->space_containing(p); oop obj = oop(sp->block_start(p)); assert((HeapWord*)obj < (HeapWord*)p, "Error"); - tty->print_cr("Object: " PTR_FORMAT, (void *)obj); + tty->print_cr("Object: " PTR_FORMAT, p2i((void *)obj)); tty->print_cr("-------"); obj->print(); tty->print_cr("-----"); @@ -110,7 +110,7 @@ inline void ParScanClosure::do_oop_work(T* p, if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", "forwarded ", - new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i(p), p2i((void *)obj), p2i((void *)new_obj), new_obj->size()); } #endif diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp index f403a3a3a62..d711104e459 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -252,22 +252,22 @@ void ASPSYoungGen::resize_spaces(size_t requested_eden_size, requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - eden_space()->bottom(), - eden_space()->end(), + p2i(eden_space()->bottom()), + p2i(eden_space()->end()), pointer_delta(eden_space()->end(), eden_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - from_space()->bottom(), - from_space()->end(), + p2i(from_space()->bottom()), + p2i(from_space()->end()), pointer_delta(from_space()->end(), from_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - to_space()->bottom(), - to_space()->end(), + p2i(to_space()->bottom()), + p2i(to_space()->end()), pointer_delta( to_space()->end(), to_space()->bottom(), sizeof(char))); @@ -373,18 +373,18 @@ void ASPSYoungGen::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); } } else { @@ -427,18 +427,18 @@ void ASPSYoungGen::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp index b49ccb05c1e..502371f0169 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -478,23 +478,23 @@ void CardTableExtension::resize_covered_region_by_end(int changed_region, gclog_or_tty->print_cr(" " " _covered[%d].start(): " INTPTR_FORMAT " _covered[%d].last(): " INTPTR_FORMAT, - ind, _covered[ind].start(), - ind, _covered[ind].last()); + ind, p2i(_covered[ind].start()), + ind, p2i(_covered[ind].last())); gclog_or_tty->print_cr(" " " _committed[%d].start(): " INTPTR_FORMAT " _committed[%d].last(): " INTPTR_FORMAT, - ind, _committed[ind].start(), - ind, _committed[ind].last()); + ind, p2i(_committed[ind].start()), + ind, p2i(_committed[ind].last())); gclog_or_tty->print_cr(" " " byte_for(start): " INTPTR_FORMAT " byte_for(last): " INTPTR_FORMAT, - byte_for(_covered[ind].start()), - byte_for(_covered[ind].last())); + p2i(byte_for(_covered[ind].start())), + p2i(byte_for(_covered[ind].last()))); gclog_or_tty->print_cr(" " " addr_for(start): " INTPTR_FORMAT " addr_for(last): " INTPTR_FORMAT, - addr_for((jbyte*) _committed[ind].start()), - addr_for((jbyte*) _committed[ind].last())); + p2i(addr_for((jbyte*) _committed[ind].start())), + p2i(addr_for((jbyte*) _committed[ind].last()))); } debug_only(verify_guard();) } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp index ac7a1a31e45..5aecfb2a984 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -32,6 +32,8 @@ #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // GCTask // diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp index ec2e28f5674..ec5ac692ebd 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -34,6 +34,8 @@ #include "runtime/os.hpp" #include "runtime/thread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + GCTaskThread::GCTaskThread(GCTaskManager* manager, uint which, uint processor_id) : diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp index 32f7eed82cb..8d0153d485d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -155,7 +155,7 @@ public: static inline idx_t bits_required(MemRegion covered_region); void print_on_error(outputStream* st) const { - st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this); + st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, p2i(this)); _beg_bits.print_on_error(st, " Begin Bits: "); _end_bits.print_on_error(st, " End Bits: "); } @@ -390,9 +390,9 @@ inline void ParMarkBitMap::verify_bit(idx_t bit) const { inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { // Allow one past the last valid address; useful for loop bounds. assert(addr >= region_start(), - err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start())); + err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start()))); assert(addr <= region_end(), - err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end())); + err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end()))); } #endif // #ifdef ASSERT diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 9ebdb841dfd..5a2f4e79d95 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -373,7 +373,7 @@ HeapWord* ParallelScavengeHeap::mem_allocate( if ((result == NULL) && (QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t" - " size=%d", loop_count, size); + " size=" SIZE_FORMAT, loop_count, size); } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp index 47a7b90d984..1c646fe3e1d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, 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 @@ -52,7 +52,7 @@ inline bool ParallelScavengeHeap::is_in_young(oop p) { const void* loc = (void*) p; bool result = ((HeapWord*)p) >= young_gen()->reserved().start(); assert(result == young_gen()->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p)); + err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p))); return result; } #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_INLINE_HPP diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index 10932e6b9e6..5037c207c62 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -41,6 +41,8 @@ #include "runtime/vmThread.hpp" #include "services/management.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // ThreadRootsMarkingTask // diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp index f28b7458c6d..229b9dd3cfa 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -35,6 +35,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size, size_t init_promo_size, size_t init_survivor_size, @@ -1033,7 +1035,7 @@ size_t PSAdaptiveSizePolicy::adjust_promo_for_footprint( "AdaptiveSizePolicy::adjust_promo_for_footprint " "adjusting tenured gen for footprint. " "starting promo size " SIZE_FORMAT - " reduced promo size " SIZE_FORMAT, + " reduced promo size " SIZE_FORMAT " promo delta " SIZE_FORMAT, desired_promo_size, reduced_size, change ); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index cdfc31911ee..c3866f347bd 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -54,6 +54,8 @@ #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + elapsedTimer PSMarkSweep::_accumulated_time; jlong PSMarkSweep::_time_of_last_gc = 0; CollectorCounters* PSMarkSweep::_counters = NULL; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp index 8ffdb0fbb37..8ef5abefdef 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -33,6 +33,8 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + inline const char* PSOldGen::select_name() { return UseParallelOldGC ? "ParOldGen" : "PSOldGen"; } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index e93f612e4bd..745a6de2fb0 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -62,6 +62,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // All sizes are in HeapWords. const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index 01b404eac55..93446fdbfa0 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -35,6 +35,8 @@ #include "oops/oop.inline.hpp" #include "oops/oop.psgc.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PaddedEnd* PSPromotionManager::_manager_array = NULL; OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; PSOldGen* PSPromotionManager::_old_gen = NULL; @@ -136,7 +138,7 @@ PSPromotionManager::print_stats() { } const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); - for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]); + for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]); for (uint i = 0; i < ParallelGCThreads + 1; ++i) { manager_array(i)->print_local_stats(i); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp index 2a45c240c9f..356c2585168 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -226,7 +226,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring", - new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } #endif diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index de18bd00d05..c039b229b9f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -56,6 +56,7 @@ #include "services/memoryService.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC HeapWord* PSScavenge::_to_space_top_before_gc = NULL; int PSScavenge::_consecutive_skipped_scavenges = 0; @@ -833,7 +834,7 @@ void PSScavenge::initialize() { if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold)); + err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold)); _tenuring_threshold = MaxTenuringThreshold; } else { // We want to smooth out our startup times for the AdaptiveSizePolicy diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp index 3b8447988cb..8030aad21b9 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -82,7 +82,7 @@ inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm, if (TraceScavenge && o->is_forwarded()) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", "forwarding", - new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size()); } #endif @@ -180,7 +180,7 @@ class PSScavengeKlassClosure: public KlassClosure { if (TraceScavenge) { ResourceMark rm; gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s", - klass, + p2i(klass), klass->external_name(), klass->has_modified_oops() ? "true" : "false"); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp index 90672fba061..910a29c5259 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -42,6 +42,8 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // PSVirtualSpace PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) : diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp index 1ea30b4027f..b5902a23381 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -33,6 +33,8 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) : diff --git a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp index 2fe4de9c30e..634d0a5ddc5 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp @@ -84,7 +84,7 @@ uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) { if (AlwaysTenure || NeverTenure) { assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1, - err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold)); + err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold)); result = MaxTenuringThreshold; } else { size_t total = 0; @@ -106,7 +106,7 @@ uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) { gclog_or_tty->cr(); gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold " UINTX_FORMAT " (max threshold " UINTX_FORMAT ")", - desired_survivor_size*oopSize, result, MaxTenuringThreshold); + desired_survivor_size*oopSize, (uintx) result, MaxTenuringThreshold); } size_t total = 0; @@ -115,8 +115,8 @@ uint ageTable::compute_tenuring_threshold(size_t survivor_capacity) { total += sizes[age]; if (sizes[age] > 0) { if (PrintTenuringDistribution) { - gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total", - age, sizes[age]*oopSize, total*oopSize); + gclog_or_tty->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total", + age, sizes[age]*oopSize, total*oopSize); } } if (UsePerfData) { diff --git a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp index d2282df167e..9459efbdefd 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -107,7 +107,7 @@ class AllocationStats VALUE_OBJ_CLASS_SPEC { assert(demand >= 0, err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for " PTR_FORMAT " (size=" SIZE_FORMAT ")", - demand, this, count)); + demand, p2i(this), count)); // Defensive: adjust for imprecision in event counting if (demand < 0) { demand = 0; diff --git a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp index b1563ac8686..477680727ba 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -66,7 +66,7 @@ void ImmutableSpace::print_short() const { void ImmutableSpace::print() const { print_short(); - tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end()); + tty->print_cr(" [" INTPTR_FORMAT_W(#-6) "," INTPTR_FORMAT_W(#-6) ")", p2i(bottom()), p2i(end())); } #endif diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp index b4bc3f9aea5..07cbb23de4a 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -32,6 +32,8 @@ #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + uint MarkSweep::_total_invocations = 0; Stack MarkSweep::_marking_stack; diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index 20a7a6aa789..8590e850b60 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, 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 @@ -30,6 +30,8 @@ #include "oops/oop.inline.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray(0, true); _page_size = os::vm_page_size(); diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp index 7e5b5a81125..17a3ecbc14a 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -32,6 +32,8 @@ #include "runtime/thread.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) { assert(MutableSpace::alignment() >= 0 && MutableSpace::alignment() % os::vm_page_size() == 0, diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp index 2198a86aff6..01781705f93 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -29,6 +29,8 @@ #include "oops/oop.inline.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) : _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL), _end(NULL), _hard_end(NULL), diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp index c2b42873a7c..15e38aa1ba1 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -27,6 +27,8 @@ #include "memory/space.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Catch-all file for utility classes #ifndef PRODUCT diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp index 4b33afd66b7..1304092002e 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp @@ -599,12 +599,12 @@ void CollectedHeap::test_is_in() { assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity"); void* before_heap = (void*)(heap_start - epsilon); assert(!heap->is_in(before_heap), - err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap)); + err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap))); // Test that a pointer to after the heap end is reported as outside the heap. assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity"); void* after_heap = (void*)(heap_end + epsilon); assert(!heap->is_in(after_heap), - err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap)); + err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap))); } #endif diff --git a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp index 36867113eff..4600413dc5b 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -213,7 +213,7 @@ void print_oop(oop value, outputStream* st) { st->print_cr(" %s", buf); } } else { - st->print_cr(" " PTR_FORMAT, (void *)value); + st->print_cr(" " INTPTR_FORMAT, p2i((void *)value)); } } @@ -282,7 +282,7 @@ bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* s if (i >= 0 && i < climit) { cp_index = cache->entry_at(i)->constant_pool_index(); } else { - st->print_cr(" not in CP[*]?", i); + st->print_cr("%d not in CP[*]?", i); return false; } return true; @@ -297,7 +297,7 @@ bool BytecodePrinter::check_obj_index(int i, int& cp_index, outputStream* st) { cp_index = constants->object_to_cp_index(i); return true; } else { - st->print_cr(" not in OBJ[*]?", i); + st->print_cr("%d not in OBJ[*]?", i); return false; } } @@ -321,7 +321,7 @@ void BytecodePrinter::print_constant(int i, outputStream* st) { if (tag.is_int()) { st->print_cr(" " INT32_FORMAT, constants->int_at(i)); } else if (tag.is_long()) { - st->print_cr(" " INT64_FORMAT, constants->long_at(i)); + st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i))); } else if (tag.is_float()) { st->print_cr(" %f", constants->float_at(i)); } else if (tag.is_double()) { @@ -340,7 +340,7 @@ void BytecodePrinter::print_constant(int i, outputStream* st) { } else if (tag.is_method_handle()) { int kind = constants->method_handle_ref_kind_at(i); int i2 = constants->method_handle_index_at(i); - st->print(" ", kind, i2); + st->print(" ", kind, i2); print_field_or_method(-i, i2, st); } else { st->print_cr(" bad tag=%d at %d", tag.value(), i); @@ -389,6 +389,7 @@ void BytecodePrinter::print_field_or_method(int orig_i, int i, outputStream* st) } +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void BytecodePrinter::print_attributes(int bci, outputStream* st) { // Show attributes of pre-rewritten codes Bytecodes::Code code = Bytecodes::java_code(raw_code()); @@ -515,7 +516,10 @@ void BytecodePrinter::print_attributes(int bci, outputStream* st) { int idx = ll - lo; const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" : ", %d:" INT32_FORMAT " (delta: %d)"; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format, ll, dest[idx], dest[idx]-bci); +PRAGMA_DIAG_POP } st->cr(); } @@ -535,7 +539,10 @@ void BytecodePrinter::print_attributes(int bci, outputStream* st) { for (int ll = 0; ll < len; ll++, first = false) { const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT : ", " INT32_FORMAT ":" INT32_FORMAT ; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format, key[ll], dest[ll]); +PRAGMA_DIAG_POP } st->cr(); } diff --git a/hotspot/src/share/vm/interpreter/interpreter.cpp b/hotspot/src/share/vm/interpreter/interpreter.cpp index 60246e9013d..7ce4bdbb3ec 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.cpp +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -72,7 +72,7 @@ void InterpreterCodelet::print_on(outputStream* st) const { if (description() != NULL) st->print("%s ", description()); if (bytecode() >= 0 ) st->print("%d %s ", bytecode(), Bytecodes::name(bytecode())); st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", - code_begin(), code_end(), code_size()); + p2i(code_begin()), p2i(code_end()), code_size()); if (PrintInterpreter) { st->cr(); diff --git a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp index 0e1c129038d..ca4f3e3e1b4 100644 --- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -75,6 +75,8 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class UnlockFlagSaver { private: JavaThread* _thread; diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp index a0f204c6eb2..8ebb1ecabae 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp @@ -1626,7 +1626,7 @@ void LinkResolver::resolve_dynamic_call(CallInfo& result, THREAD); if (HAS_PENDING_EXCEPTION) { if (TraceMethodHandles) { - tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION); + tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); PENDING_EXCEPTION->print(); } if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) { diff --git a/hotspot/src/share/vm/interpreter/oopMapCache.cpp b/hotspot/src/share/vm/interpreter/oopMapCache.cpp index 34f3edc17f0..79e2bba8bad 100644 --- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -31,6 +31,8 @@ #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class OopMapCacheEntry: private InterpreterOopMap { friend class InterpreterOopMap; friend class OopMapForCacheEntry; diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp index e3e89e8eed9..66eb63eafb6 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -104,7 +104,7 @@ void EntryPoint::print() { tty->print("["); for (int i = 0; i < number_of_states; i++) { if (i > 0) tty->print(", "); - tty->print(INTPTR_FORMAT, _entry[i]); + tty->print(INTPTR_FORMAT, p2i(_entry[i])); } tty->print("]"); } diff --git a/hotspot/src/share/vm/libadt/dict.cpp b/hotspot/src/share/vm/libadt/dict.cpp index 29c16bb41e0..37559a097df 100644 --- a/hotspot/src/share/vm/libadt/dict.cpp +++ b/hotspot/src/share/vm/libadt/dict.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -38,6 +38,8 @@ #include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The iostream is not needed and it gets confused for gcc by the // define of bool. // diff --git a/hotspot/src/share/vm/libadt/set.cpp b/hotspot/src/share/vm/libadt/set.cpp index 7364795ed70..f91acd80cff 100644 --- a/hotspot/src/share/vm/libadt/set.cpp +++ b/hotspot/src/share/vm/libadt/set.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -116,7 +116,7 @@ char *Set::setstr() const void Set::print() const { char *printable_set = setstr(); - tty->print_cr(printable_set); + tty->print_cr("%s", printable_set); FreeHeap(printable_set); } diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index 9fece9b4ef4..a05e74b77a0 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -79,7 +79,7 @@ bool MetaspaceObj::is_metaspace_object() const { } void MetaspaceObj::print_address_on(outputStream* st) const { - st->print(" {"INTPTR_FORMAT"}", this); + st->print(" {" INTPTR_FORMAT "}", p2i(this)); } void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() { @@ -142,7 +142,7 @@ void ResourceObj::operator delete [](void* p) { void ResourceObj::set_allocation_type(address res, allocation_type type) { // Set allocation type in the resource object uintptr_t allocation = (uintptr_t)res; - assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " PTR_FORMAT, res)); + assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res))); assert(type <= allocation_mask, "incorrect allocation type"); ResourceObj* resobj = (ResourceObj *)res; resobj->_allocation_t[0] = ~(allocation + type); @@ -179,7 +179,7 @@ ResourceObj::ResourceObj() { // default constructor // Operator new() was called and type was set. assert(!allocated_on_stack(), err_msg("not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); } else { // Operator new() was not called. // Assume that it is embedded or stack object. @@ -193,7 +193,7 @@ ResourceObj::ResourceObj(const ResourceObj& r) { // default copy constructor // Note: garbage may resembles valid value. assert(~(_allocation_t[0] | allocation_mask) != (uintptr_t)this || !is_type_set(), err_msg("embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); set_allocation_type((address)this, STACK_OR_EMBEDDED); _allocation_t[1] = 0; // Zap verification value } @@ -202,7 +202,7 @@ ResourceObj& ResourceObj::operator=(const ResourceObj& r) { // default copy assi // Used in InlineTree::ok_to_inline() for WarmCallInfo. assert(allocated_on_stack(), err_msg("copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")", - this, get_allocation_type(), _allocation_t[0], _allocation_t[1])); + p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1])); // Keep current _allocation_t value; return *this; } @@ -218,13 +218,13 @@ ResourceObj::~ResourceObj() { void trace_heap_malloc(size_t size, const char* name, void* p) { // A lock is not needed here - tty uses a lock internally - tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p, size, name == NULL ? "" : name); + tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p2i(p), size, name == NULL ? "" : name); } void trace_heap_free(void* p) { // A lock is not needed here - tty uses a lock internally - tty->print_cr("Heap free " INTPTR_FORMAT, p); + tty->print_cr("Heap free " INTPTR_FORMAT, p2i(p)); } //-------------------------------------------------------------------------------------- @@ -725,11 +725,11 @@ void AllocatedObj::print() const { print_on(tty); } void AllocatedObj::print_value() const { print_value_on(tty); } void AllocatedObj::print_on(outputStream* st) const { - st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", this); + st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", p2i(this)); } void AllocatedObj::print_value_on(outputStream* st) const { - st->print("AllocatedObj(" INTPTR_FORMAT ")", this); + st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this)); } julong Arena::_bytes_allocated = 0; diff --git a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp index ac716bb01e2..60435e63c1d 100644 --- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp +++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp @@ -1318,7 +1318,7 @@ class PrintFreeListsClosure : public AscendTreeCensusClosurehead(); fc != NULL; fc = fc->next()) { _st->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ") %s", - fc, (HeapWord*)fc + sz, + p2i(fc), p2i((HeapWord*)fc + sz), fc->cantCoalesce() ? "\t CC" : ""); } } diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.cpp b/hotspot/src/share/vm/memory/blockOffsetTable.cpp index 7a54e147790..d64aff67dd7 100644 --- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp +++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -59,12 +59,12 @@ BlockOffsetSharedArray::BlockOffsetSharedArray(MemRegion reserved, " rs.base(): " INTPTR_FORMAT " rs.size(): " INTPTR_FORMAT " rs end(): " INTPTR_FORMAT, - rs.base(), rs.size(), rs.base() + rs.size()); + p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size())); gclog_or_tty->print_cr(" " " _vs.low_boundary(): " INTPTR_FORMAT " _vs.high_boundary(): " INTPTR_FORMAT, - _vs.low_boundary(), - _vs.high_boundary()); + p2i(_vs.low_boundary()), + p2i(_vs.high_boundary())); } } @@ -537,10 +537,10 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe( q -= (N_words * n_cards_back); assert(q >= _sp->bottom(), err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - q, _sp->bottom())); + p2i(q), p2i(_sp->bottom()))); assert(q < _sp->end(), err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - q, _sp->end())); + p2i(q), p2i(_sp->end()))); index -= n_cards_back; offset = _array->offset_array(index); } @@ -549,10 +549,10 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe( q -= offset; assert(q >= _sp->bottom(), err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT, - q, _sp->bottom())); + p2i(q), p2i(_sp->bottom()))); assert(q < _sp->end(), err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT, - q, _sp->end())); + p2i(q), p2i(_sp->end()))); HeapWord* n = q; while (n <= addr) { @@ -563,14 +563,14 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe( err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT"," " while querying blk_start(" PTR_FORMAT ")" " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")", - n, last, addr, _sp->bottom(), _sp->end())); + p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end()))); } assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")", - q, addr)); + p2i(q), p2i(addr))); assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", - addr, n)); + p2i(addr), p2i(n))); return q; } diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index 4b54a404457..f5ff6aad2c1 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -138,11 +138,11 @@ CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, gclog_or_tty->print_cr(" " " &_byte_map[0]: " INTPTR_FORMAT " &_byte_map[_last_valid_index]: " INTPTR_FORMAT, - &_byte_map[0], - &_byte_map[_last_valid_index]); + p2i(&_byte_map[0]), + p2i(&_byte_map[_last_valid_index])); gclog_or_tty->print_cr(" " " byte_map_base: " INTPTR_FORMAT, - byte_map_base); + p2i(byte_map_base)); } } @@ -392,23 +392,23 @@ void CardTableModRefBS::resize_covered_region(MemRegion new_region) { gclog_or_tty->print_cr(" " " _covered[%d].start(): " INTPTR_FORMAT " _covered[%d].last(): " INTPTR_FORMAT, - ind, _covered[ind].start(), - ind, _covered[ind].last()); + ind, p2i(_covered[ind].start()), + ind, p2i(_covered[ind].last())); gclog_or_tty->print_cr(" " " _committed[%d].start(): " INTPTR_FORMAT " _committed[%d].last(): " INTPTR_FORMAT, - ind, _committed[ind].start(), - ind, _committed[ind].last()); + ind, p2i(_committed[ind].start()), + ind, p2i(_committed[ind].last())); gclog_or_tty->print_cr(" " " byte_for(start): " INTPTR_FORMAT " byte_for(last): " INTPTR_FORMAT, - byte_for(_covered[ind].start()), - byte_for(_covered[ind].last())); + p2i(byte_for(_covered[ind].start())), + p2i(byte_for(_covered[ind].last()))); gclog_or_tty->print_cr(" " " addr_for(start): " INTPTR_FORMAT " addr_for(last): " INTPTR_FORMAT, - addr_for((jbyte*) _committed[ind].start()), - addr_for((jbyte*) _committed[ind].last())); + p2i(addr_for((jbyte*) _committed[ind].start())), + p2i(addr_for((jbyte*) _committed[ind].last()))); } // Touch the last card of the covered region to show that it // is committed (or SEGV). @@ -657,14 +657,14 @@ void CardTableModRefBS::verify_region(MemRegion mr, if (failed) { if (!failures) { tty->cr(); - tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end); + tty->print_cr("== CT verification failed: [" INTPTR_FORMAT "," INTPTR_FORMAT "]", p2i(start), p2i(end)); tty->print_cr("== %sexpecting value: %d", (val_equals) ? "" : "not ", val); failures = true; } tty->print_cr("== card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], " - "val: %d", curr, addr_for(curr), - (HeapWord*) (((size_t) addr_for(curr)) + card_size), + "val: %d", p2i(curr), p2i(addr_for(curr)), + p2i((HeapWord*) (((size_t) addr_for(curr)) + card_size)), (int) curr_val); } } @@ -682,7 +682,7 @@ void CardTableModRefBS::verify_dirty_region(MemRegion mr) { void CardTableModRefBS::print_on(outputStream* st) const { st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT, - _byte_map, _byte_map + _byte_map_size, byte_map_base); + p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base)); } bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) { diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index 1aa5b41ab14..5e72b4640f9 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -155,7 +155,7 @@ class CardTableModRefBS: public ModRefBarrierSet { assert(_whole_heap.contains(p), err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - p, _whole_heap.start(), _whole_heap.end())); + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift]; assert(result >= _byte_map && result < _byte_map + _byte_map_size, "out of bounds accessor for card marking array"); @@ -431,7 +431,7 @@ public: assert(_whole_heap.contains(result), err_msg("Returning result = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - result, _whole_heap.start(), _whole_heap.end())); + p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); return result; } @@ -440,7 +440,7 @@ public: assert(_whole_heap.contains(p), err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of " " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")", - p, _whole_heap.start(), _whole_heap.end())); + p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()))); return byte_for(p) - _byte_map; } diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index d79b4b92ec8..56af890a421 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -288,14 +288,14 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp, err_msg("Did you forget to call save_marks()? " "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " "[" PTR_FORMAT ", " PTR_FORMAT ")", - urasm.start(), urasm.end(), ur.start(), ur.end())); + p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()))); // In the case of CMS+ParNew, issue a warning if (!ur.contains(urasm)) { assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above"); warning("CMS+ParNew: Did you forget to call save_marks()? " "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in " "[" PTR_FORMAT ", " PTR_FORMAT ")", - urasm.start(), urasm.end(), ur.start(), ur.end()); + p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())); MemRegion ur2 = sp->used_region(); MemRegion urasm2 = sp->used_region_at_save_marks(); if (!ur.equals(ur2)) { @@ -349,12 +349,12 @@ protected: assert(jp >= _begin && jp < _end, err_msg("Error: jp " PTR_FORMAT " should be within " "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", - jp, _begin, _end)); + p2i(jp), p2i(_begin), p2i(_end))); oop obj = oopDesc::load_decode_heap_oop(p); guarantee(obj == NULL || (HeapWord*)obj >= _boundary, err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on " "clean card crosses boundary" PTR_FORMAT, - (HeapWord*)obj, jp, _boundary)); + p2i((HeapWord*)obj), p2i(jp), p2i(_boundary))); } public: @@ -362,10 +362,10 @@ public: _boundary(b), _begin(begin), _end(end) { assert(b <= begin, err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT, - b, begin)); + p2i(b), p2i(begin))); assert(begin <= end, err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT, - begin, end)); + p2i(begin), p2i(end))); } virtual void do_oop(oop* p) { VerifyCleanCardClosure::do_oop_work(p); } diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index 69d39e4d431..6d822a4b9e9 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -736,7 +736,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, if ((QueuedAllocationWarningCount > 0) && (try_count % QueuedAllocationWarningCount == 0)) { warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t" - " size=%d %s", try_count, size, is_tlab ? "(TLAB)" : ""); + " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : ""); } } } @@ -903,7 +903,7 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation( if ((QueuedAllocationWarningCount > 0) && (loop_count % QueuedAllocationWarningCount == 0)) { warning("satisfy_failed_metadata_allocation() retries %d times \n\t" - " size=%d", loop_count, word_size); + " size=" SIZE_FORMAT, loop_count, word_size); } } while (true); // Until a GC is done } diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 000be1f8bf3..32c2e28bee6 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -47,6 +47,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // // DefNewGeneration functions. diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp index 1420c279036..47527f21e9f 100644 --- a/hotspot/src/share/vm/memory/filemap.cpp +++ b/hotspot/src/share/vm/memory/filemap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -40,6 +40,7 @@ #define O_BINARY 0 // otherwise do nothing. #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC extern address JVM_FunctionAtStart(); extern address JVM_FunctionAtEnd(); diff --git a/hotspot/src/share/vm/memory/gcLocker.cpp b/hotspot/src/share/vm/memory/gcLocker.cpp index fc267ad84f1..96742637939 100644 --- a/hotspot/src/share/vm/memory/gcLocker.cpp +++ b/hotspot/src/share/vm/memory/gcLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -52,7 +52,7 @@ void GC_locker::verify_critical_count() { tty->print_cr("critical counts don't match: %d != %d", _jni_lock_count, count); for (JavaThread* thr = Threads::first(); thr; thr = thr->next()) { if (thr->in_critical()) { - tty->print_cr(INTPTR_FORMAT " in_critical %d", thr, thr->in_critical()); + tty->print_cr(INTPTR_FORMAT " in_critical %d", p2i(thr), thr->in_critical()); } } } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index f3b2a8ec885..0f75d779d2a 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -794,7 +794,7 @@ void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs, bool GenCollectedHeap::is_in_young(oop p) { bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start(); assert(result == _gens[0]->is_in_reserved(p), - err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p)); + err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p))); return result; } @@ -1067,7 +1067,7 @@ void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) { for (int i = _n_gens-1; i >= 0; i--) { Generation* g = _gens[i]; if (!silent) { - gclog_or_tty->print(g->name()); + gclog_or_tty->print("%s", g->name()); gclog_or_tty->print(" "); } g->verify(); @@ -1270,7 +1270,7 @@ jlong GenCollectedHeap::millis_since_last_gc() { // back a time later than 'now'. jlong retVal = now - tolgc_cl.time(); if (retVal < 0) { - NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);) + NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);) return 0; } return retVal; diff --git a/hotspot/src/share/vm/memory/genOopClosures.hpp b/hotspot/src/share/vm/memory/genOopClosures.hpp index 1f24b2b3cab..977fcb34cf4 100644 --- a/hotspot/src/share/vm/memory/genOopClosures.hpp +++ b/hotspot/src/share/vm/memory/genOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -193,7 +193,7 @@ class VerifyOopClosure: public OopClosure { protected: template inline void do_oop_work(T* p) { oop obj = oopDesc::load_decode_heap_oop(p); - guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj)); + guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj))); } public: virtual void do_oop(oop* p); diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp index 5d3ad791473..0c121503a17 100644 --- a/hotspot/src/share/vm/memory/generation.cpp +++ b/hotspot/src/share/vm/memory/generation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,6 +43,8 @@ #include "utilities/copy.hpp" #include "utilities/events.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : _level(level), _ref_processor(NULL) { diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp index f44f0245c36..de60d23f197 100644 --- a/hotspot/src/share/vm/memory/generation.hpp +++ b/hotspot/src/share/vm/memory/generation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -422,7 +422,7 @@ class Generation: public CHeapObj { // have to guard against non-monotonicity. NOT_PRODUCT( if (now < _time_of_last_gc) { - warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now); + warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now); } ) return _time_of_last_gc; diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index bf65c882cd6..7a4c6fc8752 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -35,6 +35,8 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // HeapInspection int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) { @@ -270,6 +272,7 @@ bool KlassInfoHisto::is_selected(const char *col_name) { return true; } +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void KlassInfoHisto::print_title(outputStream* st, bool csv_format, bool selected[], int width_table[], const char *name_table[]) { @@ -282,7 +285,10 @@ void KlassInfoHisto::print_title(outputStream* st, bool csv_format, } else { st->print("Index Super"); for (int c=0; cprint(str_fmt(width_table[c]), name_table[c]);} +PRAGMA_DIAG_POP } st->print(" ClassName"); } @@ -395,12 +401,18 @@ void KlassInfoHisto::print_class_stats(outputStream* st, case KlassSizeStats::_index_inst_size: case KlassSizeStats::_index_inst_count: case KlassSizeStats::_index_method_count: +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(str_fmt(width_table[c]), "-"); +PRAGMA_DIAG_POP break; default: { double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes; +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(perc_fmt(width_table[c]), perc); +PRAGMA_DIAG_POP } } } diff --git a/hotspot/src/share/vm/memory/heapInspection.hpp b/hotspot/src/share/vm/memory/heapInspection.hpp index 8cdd4ccdf65..b305f08fdb3 100644 --- a/hotspot/src/share/vm/memory/heapInspection.hpp +++ b/hotspot/src/share/vm/memory/heapInspection.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -295,6 +295,9 @@ class KlassInfoHisto : public StackObj { // returns a format string to print a julong with the given width. E.g, // printf(num_fmt(6), julong(10)) would print out the number 10 with 4 // leading spaces. +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED + static void print_julong(outputStream* st, int width, julong n) { int num_spaces = width - julong_width(n); if (num_spaces > 0) { @@ -302,6 +305,7 @@ class KlassInfoHisto : public StackObj { } st->print(JULONG_FORMAT, n); } +PRAGMA_DIAG_POP static char* perc_fmt(int width) { static char buf[32]; diff --git a/hotspot/src/share/vm/memory/metachunk.cpp b/hotspot/src/share/vm/memory/metachunk.cpp index 81a1f8f8224..6cb6625b186 100644 --- a/hotspot/src/share/vm/memory/metachunk.cpp +++ b/hotspot/src/share/vm/memory/metachunk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -28,6 +28,8 @@ #include "utilities/copy.hpp" #include "utilities/debug.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + class VirtualSpaceNode; const size_t metadata_chunk_initialize = 0xf7f7f7f7; diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 0ace09a0735..e005263aa0b 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -48,6 +48,8 @@ #include "utilities/copy.hpp" #include "utilities/debug.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + typedef BinaryTreeDictionary > BlockTreeDictionary; typedef BinaryTreeDictionary > ChunkTreeDictionary; @@ -1961,7 +1963,7 @@ void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const { st->print_cr(" free " SIZE_FORMAT, chunk->free_word_size()); } else { - st->print_cr(""); + st->cr(); } } @@ -2245,7 +2247,7 @@ SpaceManager::~SpaceManager() { humongous_chunks = next_humongous_chunks; } if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr(""); + gclog_or_tty->cr(); gclog_or_tty->print_cr("updated dictionary count %d %s", chunk_manager()->humongous_dictionary()->total_count(), chunk_size_name(HumongousIndex)); diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index ef4572824f7..fc303f050a8 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -40,6 +40,7 @@ #include "runtime/vmThread.hpp" #include "utilities/hashtable.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC int MetaspaceShared::_max_alignment = 0; @@ -337,13 +338,14 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all int all_rw_count = 0; int all_rw_bytes = 0; - const char *fmt = "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"; +// To make fmt_stats be a syntactic constant (for format warnings), use #define. +#define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f" const char *sep = "--------------------+---------------------------+---------------------------+--------------------------"; const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %"; tty->print_cr("Detailed metadata info (rw includes md and mc):"); - tty->print_cr(hdr); - tty->print_cr(sep); + tty->print_cr("%s", hdr); + tty->print_cr("%s", sep); for (int type = 0; type < int(_number_of_types); type ++) { const char *name = type_name((Type)type); int ro_count = _counts[RO][type]; @@ -357,7 +359,7 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all double rw_perc = 100.0 * double(rw_bytes) / double(rw_all); double perc = 100.0 * double(bytes) / double(ro_all + rw_all); - tty->print_cr(fmt, name, + tty->print_cr(fmt_stats, name, ro_count, ro_bytes, ro_perc, rw_count, rw_bytes, rw_perc, count, bytes, perc); @@ -375,14 +377,15 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all); double all_perc = 100.0 * double(all_bytes) / double(ro_all + rw_all); - tty->print_cr(sep); - tty->print_cr(fmt, "Total", + tty->print_cr("%s", sep); + tty->print_cr(fmt_stats, "Total", all_ro_count, all_ro_bytes, all_ro_perc, all_rw_count, all_rw_bytes, all_rw_perc, all_count, all_bytes, all_perc); assert(all_ro_bytes == ro_all, "everything should have been counted"); assert(all_rw_bytes == rw_all, "everything should have been counted"); +#undef fmt_stats } // Populate the shared space. @@ -514,7 +517,8 @@ void VM_PopulateDumpSharedSpace::doit() { md_top = wc.get_top(); // Print shared spaces all the time - const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT; +// To make fmt_space be a syntactic constant (for format warnings), use #define. +#define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT Metaspace* ro_space = _loader_data->ro_metaspace(); Metaspace* rw_space = _loader_data->rw_metaspace(); @@ -545,10 +549,10 @@ void VM_PopulateDumpSharedSpace::doit() { const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0; const double total_u_perc = total_bytes / double(total_alloced) * 100.0; - tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom()); - tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom()); - tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low); - tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low); + tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom()); + tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom()); + tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low); + tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low); tty->print_cr("total : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]", total_bytes, total_alloced, total_u_perc); @@ -603,6 +607,7 @@ void VM_PopulateDumpSharedSpace::doit() { dac.dump_stats(int(ro_bytes), int(rw_bytes), int(md_bytes), int(mc_bytes)); } +#undef fmt_space } static void link_shared_classes(Klass* obj, TRAPS) { diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index 72a43d85df3..2a87b4b65b6 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -35,6 +35,8 @@ #include "runtime/java.hpp" #include "runtime/jniHandles.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; bool ReferenceProcessor::_pending_list_uses_discovered_field = false; diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index b59635c9f33..7b187ee01ad 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -35,6 +35,8 @@ #include "utilities/copy.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + SharedHeap* SharedHeap::_sh; // The set of potentially parallel tasks in strong root scanning. diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 8bff19441d9..68e2631d115 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,6 +43,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top, HeapWord* top_obj) { if (top_obj != NULL) { diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp index 715e6214c9b..b59cfd80d39 100644 --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -31,6 +31,8 @@ #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Thread-Local Edens support // static member initialization diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp index ea803157300..cf3fefbfe3a 100644 --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -98,7 +98,7 @@ void ThreadLocalAllocBuffer::record_slow_allocation(size_t obj_size) { " obj: "SIZE_FORMAT " free: "SIZE_FORMAT " waste: "SIZE_FORMAT"\n", - "slow", thrd, thrd->osthread()->thread_id(), + "slow", p2i(thrd), thrd->osthread()->thread_id(), obj_size, free(), refill_waste_limit()); } } diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 63c7c005d44..ffecfc19cc8 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -78,6 +78,8 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Known objects Klass* Universe::_boolArrayKlassObj = NULL; Klass* Universe::_byteArrayKlassObj = NULL; @@ -1348,7 +1350,7 @@ void Universe::verify(VerifyOption option, const char* prefix, bool silent) { HandleMark hm; // Handles created during verification can be zapped _verify_count++; - if (!silent) gclog_or_tty->print(prefix); + if (!silent) gclog_or_tty->print("%s", prefix); if (!silent) gclog_or_tty->print("[Verifying "); if (!silent) gclog_or_tty->print("threads "); Threads::verify(); diff --git a/hotspot/src/share/vm/oops/annotations.cpp b/hotspot/src/share/vm/oops/annotations.cpp index 1eb3afbb740..776b8606b66 100644 --- a/hotspot/src/share/vm/oops/annotations.cpp +++ b/hotspot/src/share/vm/oops/annotations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -76,7 +76,7 @@ typeArrayOop Annotations::make_java_array(AnnotationArray* annotations, TRAPS) { void Annotations::print_value_on(outputStream* st) const { - st->print("Anotations(" INTPTR_FORMAT ")", this); + st->print("Anotations(" INTPTR_FORMAT ")", p2i(this)); } #if INCLUDE_SERVICES diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp index 4c0720908f7..ea51a2c02c4 100644 --- a/hotspot/src/share/vm/oops/constMethod.cpp +++ b/hotspot/src/share/vm/oops/constMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -388,8 +388,8 @@ void ConstMethod::copy_annotations_from(ConstMethod* cm) { void ConstMethod::print_on(outputStream* st) const { ResourceMark rm; assert(is_constMethod(), "must be constMethod"); - st->print_cr(internal_name()); - st->print(" - method: " INTPTR_FORMAT " ", (address)method()); + st->print_cr("%s", internal_name()); + st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method())); method()->print_value_on(st); st->cr(); if (has_stackmap_table()) { st->print(" - stackmap data: "); diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index bd2ee585149..34dba443f83 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -42,6 +42,8 @@ #include "runtime/signature.hpp" #include "runtime/vframe.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) { // Tags are RW but comment below applies to tags also. Array* tags = MetadataFactory::new_writeable_array(loader_data, length, 0, CHECK_NULL); @@ -1892,7 +1894,7 @@ void ConstantPool::preload_and_initialize_all_classes(ConstantPool* obj, TRAPS) void ConstantPool::print_on(outputStream* st) const { assert(is_constantPool(), "must be constantPool"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); if (flags() != 0) { st->print(" - flags: 0x%x", flags()); if (has_preresolution()) st->print(" has_preresolution"); diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index cdd3cef4ad1..4b6459ee33f 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -39,8 +39,9 @@ # include "gc_implementation/parallelScavenge/psPromotionManager.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC -// Implememtation of ConstantPoolCacheEntry +// Implementation of ConstantPoolCacheEntry void ConstantPoolCacheEntry::initialize_entry(int index) { assert(0 < index && index < 0x10000, "sanity check"); @@ -668,7 +669,7 @@ void ConstantPoolCache::dump_cache() { void ConstantPoolCache::print_on(outputStream* st) const { assert(is_constantPoolCache(), "obj must be constant pool cache"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); // print constant pool cache entries for (int i = 0; i < length(); i++) entry_at(i)->print(st, i); } diff --git a/hotspot/src/share/vm/oops/generateOopMap.hpp b/hotspot/src/share/vm/oops/generateOopMap.hpp index ad0578c323a..48c49f443e9 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.hpp +++ b/hotspot/src/share/vm/oops/generateOopMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -412,9 +412,9 @@ class GenerateOopMap VALUE_OBJ_CLASS_SPEC { int copy_cts (CellTypeState *dst, CellTypeState *src); // Error handling - void error_work (const char *format, va_list ap); - void report_error (const char *format, ...); - void verify_error (const char *format, ...); + void error_work (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void report_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3); + void verify_error (const char *format, ...) ATTRIBUTE_PRINTF(2, 3); bool got_error() { return _got_error; } // Create result set diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 84775407262..9c4c9b8fbf5 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -77,6 +77,8 @@ #include "c1/c1_Compiler.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED @@ -2857,7 +2859,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"instance size: %d", size_helper()); st->cr(); st->print(BULLET"klass size: %d", size()); st->cr(); st->print(BULLET"access: "); access_flags().print_on(st); st->cr(); - st->print(BULLET"state: "); st->print_cr(state_names[_init_state]); + st->print(BULLET"state: "); st->print_cr("%s", state_names[_init_state]); st->print(BULLET"name: "); name()->print_value_on(st); st->cr(); st->print(BULLET"super: "); super()->print_value_on_maybe_null(st); st->cr(); st->print(BULLET"sub: "); diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index f388980adc3..7340e5adc91 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -45,6 +45,8 @@ #include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + template void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) { T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); diff --git a/hotspot/src/share/vm/oops/klass.inline.hpp b/hotspot/src/share/vm/oops/klass.inline.hpp index 841a4873a32..8b05c3c2945 100644 --- a/hotspot/src/share/vm/oops/klass.inline.hpp +++ b/hotspot/src/share/vm/oops/klass.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -63,7 +63,7 @@ inline Klass* Klass::decode_klass_not_null(narrowKlass v) { assert(!is_null(v), "narrow klass value can never be zero"); int shift = Universe::narrow_klass_shift(); Klass* result = (Klass*)(void*)((uintptr_t)Universe::narrow_klass_base() + ((uintptr_t)v << shift)); - assert(check_klass_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result)); + assert(check_klass_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); return result; } diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp index ad185c7f1a8..6d122de680a 100644 --- a/hotspot/src/share/vm/oops/klassVtable.cpp +++ b/hotspot/src/share/vm/oops/klassVtable.cpp @@ -39,6 +39,8 @@ #include "runtime/handles.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + inline InstanceKlass* klassVtable::ik() const { Klass* k = _klass(); assert(k->oop_is_instance(), "not an InstanceKlass"); diff --git a/hotspot/src/share/vm/oops/markOop.cpp b/hotspot/src/share/vm/oops/markOop.cpp index af722e7cf72..85dd5a06a65 100644 --- a/hotspot/src/share/vm/oops/markOop.cpp +++ b/hotspot/src/share/vm/oops/markOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,9 +26,11 @@ #include "oops/markOop.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void markOopDesc::print_on(outputStream* st) const { if (is_locked()) { - st->print("locked(0x%lx)->", value()); + st->print("locked(" INTPTR_FORMAT ")->", value()); markOop(*(markOop*)value())->print_on(st); } else { assert(is_unlocked() || has_bias_pattern(), "just checking"); diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index 883ff487b26..0ce786e572f 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -56,6 +56,7 @@ #include "utilities/quickSort.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of Method @@ -1425,7 +1426,7 @@ class SignatureTypePrinter : public SignatureTypeNames { void type_name(const char* name) { if (_use_separator) _st->print(", "); - _st->print(name); + _st->print("%s", name); _use_separator = true; } @@ -1898,7 +1899,7 @@ void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) void Method::print_on(outputStream* st) const { ResourceMark rm; assert(is_method(), "must be method"); - st->print_cr(internal_name()); + st->print_cr("%s", internal_name()); // get the effect of PrintOopAddress, always, for methods: st->print_cr(" - this oop: "INTPTR_FORMAT, (intptr_t)this); st->print (" - method holder: "); method_holder()->print_value_on(st); st->cr(); @@ -1981,7 +1982,7 @@ void Method::print_on(outputStream* st) const { void Method::print_value_on(outputStream* st) const { assert(is_method(), "must be method"); - st->print(internal_name()); + st->print("%s", internal_name()); print_address_on(st); st->print(" "); name()->print_value_on(st); diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp index 06d9dcb51bf..4bbdc992d86 100644 --- a/hotspot/src/share/vm/oops/methodData.cpp +++ b/hotspot/src/share/vm/oops/methodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -36,6 +36,8 @@ #include "runtime/handles.inline.hpp" #include "runtime/orderAccess.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // ================================================================== // DataLayout // @@ -127,7 +129,7 @@ void ProfileData::print_shared(outputStream* st, const char* name, const char* e st->print("trap(%s) ", Deoptimization::format_trap_state(buf, sizeof(buf), trap)); } if (extra != NULL) { - st->print(extra); + st->print("%s", extra); } int flags = data()->flags(); if (flags != 0) { @@ -635,7 +637,7 @@ bool ParametersTypeData::profiling_enabled() { } void ParametersTypeData::print_data_on(outputStream* st, const char* extra) const { - st->print("parameter types", extra); + st->print("parameter types"); // FIXME extra ignored? _parameters.print_data_on(st); } diff --git a/hotspot/src/share/vm/oops/oop.cpp b/hotspot/src/share/vm/oops/oop.cpp index 281188354a0..1be57811ede 100644 --- a/hotspot/src/share/vm/oops/oop.cpp +++ b/hotspot/src/share/vm/oops/oop.cpp @@ -30,6 +30,8 @@ #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + bool always_do_update_barrier = false; BarrierSet* oopDesc::_bs = NULL; diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 7dd78ef8eb2..0dc0db8e946 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -211,7 +211,7 @@ inline oop oopDesc::decode_heap_oop_not_null(narrowOop v) { address base = Universe::narrow_oop_base(); int shift = Universe::narrow_oop_shift(); oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift)); - assert(check_obj_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result)); + assert(check_obj_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result))); return result; } diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index 3eaa2abcb7c..f9fec29359f 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -339,7 +339,7 @@ void Block::dump_head(const PhaseCFG* cfg, outputStream* st) const { st->print(" FRegPressure: %d",_freg_pressure); st->print(" FHRP Index: %d",_fhrp_index); } - st->print_cr(""); + st->cr(); } void Block::dump() const { diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index 1637741176d..b2cd166b4dd 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -112,7 +112,7 @@ const char * const ParmNode::names[TypeFunc::Parms+1] = { #ifndef PRODUCT void ParmNode::dump_spec(outputStream *st) const { if( _con < TypeFunc::Parms ) { - st->print(names[_con]); + st->print("%s", names[_con]); } else { st->print("Parm%d: ",_con-TypeFunc::Parms); // Verbose and WizardMode dump bottom_type for all nodes @@ -348,19 +348,19 @@ static void format_helper( PhaseRegAlloc *regalloc, outputStream* st, Node *n, c break; case Type::AryPtr: case Type::InstPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->isa_oopptr()->const_oop()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop())); break; case Type::KlassPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_klassptr()->klass()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass())); break; case Type::MetadataPtr: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_metadataptr()->metadata()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata())); break; case Type::NarrowOop: - st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_oopptr()->const_oop()); + st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop())); break; case Type::RawPtr: - st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,t->is_rawptr()); + st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr())); break; case Type::DoubleCon: st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d); @@ -369,7 +369,7 @@ static void format_helper( PhaseRegAlloc *regalloc, outputStream* st, Node *n, c st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f); break; case Type::Long: - st->print(" %s%d]=#"INT64_FORMAT,msg,i,t->is_long()->get_con()); + st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con())); break; case Type::Half: case Type::Top: @@ -428,7 +428,7 @@ void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) for (i = 0; i < (uint)scobjs.length(); i++) { // Scalar replaced objects. - st->print_cr(""); + st->cr(); st->print(" # ScObj" INT32_FORMAT " ", i); SafePointScalarObjectNode* spobj = scobjs.at(i); ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass(); @@ -485,7 +485,7 @@ void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) st->print(" }"); } } - st->print_cr(""); + st->cr(); if (caller() != NULL) caller()->format(regalloc, n, st); } @@ -981,7 +981,7 @@ uint CallRuntimeNode::cmp( const Node &n ) const { #ifndef PRODUCT void CallRuntimeNode::dump_spec(outputStream *st) const { st->print("# "); - st->print(_name); + st->print("%s", _name); CallNode::dump_spec(st); } #endif @@ -999,7 +999,7 @@ void CallRuntimeNode::calling_convention( BasicType* sig_bt, VMRegPair *parm_reg #ifndef PRODUCT void CallLeafNode::dump_spec(outputStream *st) const { st->print("# "); - st->print(_name); + st->print("%s", _name); CallNode::dump_spec(st); } #endif diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 24328546fec..f6e2065e26d 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -2020,25 +2020,25 @@ void PhaseChaitin::dump() const { tty->print_cr("new LRG"); } } - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Lo degree: "); for(uint i3 = _lo_degree; i3; i3 = lrgs(i3)._next ) tty->print("L%d ",i3); - tty->print_cr(""); + tty->cr(); // Dump lo-stk-degree list tty->print("Lo stk degree: "); for(uint i4 = _lo_stk_degree; i4; i4 = lrgs(i4)._next ) tty->print("L%d ",i4); - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Hi degree: "); for(uint i5 = _hi_degree; i5; i5 = lrgs(i5)._next ) tty->print("L%d ",i5); - tty->print_cr(""); + tty->cr(); } void PhaseChaitin::dump_degree_lists() const { @@ -2046,26 +2046,26 @@ void PhaseChaitin::dump_degree_lists() const { tty->print("Lo degree: "); for( uint i = _lo_degree; i; i = lrgs(i)._next ) tty->print("L%d ",i); - tty->print_cr(""); + tty->cr(); // Dump lo-stk-degree list tty->print("Lo stk degree: "); for(uint i2 = _lo_stk_degree; i2; i2 = lrgs(i2)._next ) tty->print("L%d ",i2); - tty->print_cr(""); + tty->cr(); // Dump lo-degree list tty->print("Hi degree: "); for(uint i3 = _hi_degree; i3; i3 = lrgs(i3)._next ) tty->print("L%d ",i3); - tty->print_cr(""); + tty->cr(); } void PhaseChaitin::dump_simplified() const { tty->print("Simplified: "); for( uint i = _simplified; i; i = lrgs(i)._next ) tty->print("L%d ",i); - tty->print_cr(""); + tty->cr(); } static char *print_reg( OptoReg::Name reg, const PhaseChaitin *pc, char *buf ) { @@ -2144,7 +2144,7 @@ void PhaseChaitin::dump_frame() const { } tty->print(" : parm %d: ", k); domain->field_at(k + TypeFunc::Parms)->dump(); - tty->print_cr(""); + tty->cr(); } } @@ -2166,7 +2166,7 @@ void PhaseChaitin::dump_frame() const { _matcher._parm_regs[j].second() == reg ) { tty->print("parm %d: ",j); domain->field_at(j + TypeFunc::Parms)->dump(); - tty->print_cr(""); + tty->cr(); break; } } diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 7226a725a7c..738644001b1 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -2424,7 +2424,7 @@ void Compile::dump_asm(int *pcs, uint pc_limit) { starts_bundle = ' '; tty->print("\t"); delay->format(_regalloc, tty); - tty->print_cr(""); + tty->cr(); delay = NULL; } @@ -2438,12 +2438,12 @@ void Compile::dump_asm(int *pcs, uint pc_limit) { if (pcs && n->_idx < pc_limit) tty->print_cr("%3.3x", pcs[n->_idx]); else - tty->print_cr(""); + tty->cr(); assert(cut_short || delay == NULL, "no unconditional delay branch"); } // End of per-block dump - tty->print_cr(""); + tty->cr(); if (cut_short) tty->print_cr("*** disassembly is cut short ***"); } @@ -3688,7 +3688,8 @@ void Compile::ConstantTable::emit(CodeBuffer& cb) { default: ShouldNotReachHere(); } assert(constant_addr, "consts section too small"); - assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset())); + assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), + err_msg_res("must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset()))); } } @@ -3768,7 +3769,7 @@ void Compile::ConstantTable::fill_jump_table(CodeBuffer& cb, MachConstantNode* n for (uint i = 0; i < n->outcnt(); i++) { address* constant_addr = &jump_table_base[i]; - assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i))); + assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i))); *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr); cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type); } @@ -3884,7 +3885,7 @@ void Compile::dump_inlining() { } if (do_print_inlining) { for (int i = 0; i < _print_inlining_list->length(); i++) { - tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); + tty->print("%s", _print_inlining_list->adr_at(i)->ss()->as_string()); } } } diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 3d561556881..aa4a5720502 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -459,7 +459,7 @@ class Compile : public Phase { void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) { stringStream ss; CompileTask::print_inlining(&ss, method, inline_level, bci, msg); - print_inlining_stream()->print(ss.as_string()); + print_inlining_stream()->print("%s", ss.as_string()); } void log_late_inline(CallGenerator* cg); diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index d806d0acf22..e3a95c079f3 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -57,7 +57,7 @@ void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMeth out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); stringStream ss; prof_klass->name()->print_symbol_on(&ss); - out->print(ss.as_string()); + out->print("%s", ss.as_string()); out->cr(); } } diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index fcfb3880e19..4aa770d5af5 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -2014,7 +2014,7 @@ void CFGLoop::dump() const { tty->print("%s: %d trip_count: %6.0f freq: %6.0f\n", _depth == 0 ? "Method" : "Loop", _id, trip_count(), _freq); for (int i = 0; i < _depth; i++) tty->print(" "); - tty->print(" members:", _id); + tty->print(" members:"); int k = 0; for (int i = 0; i < _members.length(); i++) { if (k++ >= 6) { diff --git a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp index 851b70d3f8f..b222526c620 100644 --- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp +++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, 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 @@ -155,7 +155,7 @@ IdealGraphPrinter::IdealGraphPrinter() { } else { // It would be nice if we could shut down cleanly but it should // be an error if we can't connect to the visualizer. - fatal(err_msg_res("Couldn't connect to visualizer at %s:%d", + fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT, PrintIdealGraphAddress, PrintIdealGraphPort)); } } @@ -195,7 +195,7 @@ IdealGraphPrinter::~IdealGraphPrinter() { void IdealGraphPrinter::begin_elem(const char *s) { - _xml->begin_elem(s); + _xml->begin_elem("%s", s); } void IdealGraphPrinter::end_elem() { @@ -203,7 +203,7 @@ void IdealGraphPrinter::end_elem() { } void IdealGraphPrinter::begin_head(const char *s) { - _xml->begin_head(s); + _xml->begin_head("%s", s); } void IdealGraphPrinter::end_head() { @@ -223,7 +223,7 @@ void IdealGraphPrinter::print_attr(const char *name, const char *val) { } void IdealGraphPrinter::head(const char *name) { - _xml->head(name); + _xml->head("%s", name); } void IdealGraphPrinter::tail(const char *name) { @@ -231,7 +231,7 @@ void IdealGraphPrinter::tail(const char *name) { } void IdealGraphPrinter::text(const char *s) { - _xml->text(s); + _xml->text("%s", s); } void IdealGraphPrinter::print_prop(const char *name, int val) { @@ -359,7 +359,7 @@ void IdealGraphPrinter::end_method() { void IdealGraphPrinter::print_indent() { tty->print_cr("printing ident %d", _depth); for (int i = 0; i < _depth; i++) { - _xml->print(INDENT); + _xml->print("%s", INDENT); } } diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp index 825a7a25533..59c407aaeeb 100644 --- a/hotspot/src/share/vm/opto/ifg.cpp +++ b/hotspot/src/share/vm/opto/ifg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -256,7 +256,7 @@ void PhaseIFG::stats() const { for( i = 0; i < _maxlrg*2; i++ ) if( h_cnt[i] ) tty->print("%d/%d ",i,h_cnt[i]); - tty->print_cr(""); + tty->cr(); } void PhaseIFG::verify( const PhaseChaitin *pc ) const { diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp index 0e86e403473..aeb3ffad0d5 100644 --- a/hotspot/src/share/vm/opto/loopPredicate.cpp +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -639,7 +639,7 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl, if (TraceLoopPredicate) { predString->print_cr("print(predString->as_string()); + tty->print("%s", predString->as_string()); } return bol; } diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index 5436fd5f640..f11583a25b2 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -3569,7 +3569,7 @@ void PhaseIdealLoop::build_loop_late_post( Node *n ) { #ifdef ASSERT void PhaseIdealLoop::dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA) { - tty->print_cr(msg); + tty->print_cr("%s", msg); tty->print("n: "); n->dump(); tty->print("early(n): "); early->dump(); if (n->in(0) != NULL && !n->in(0)->is_top() && diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 0e650639d0c..7cdf630e1dc 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -2622,7 +2622,7 @@ void State::dump(int depth) { tty->print_cr("%s %d %s", ruleName[i], _cost[i], ruleName[_rule[i]] ); } - tty->print_cr(""); + tty->cr(); for( i=0; i<2; i++ ) if( _kids[i] ) diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 24b7c909923..1d908c5b577 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -3981,7 +3981,7 @@ bool InitializeNode::stores_are_sane(PhaseTransform* phase) { intptr_t st_off = get_store_offset(st, phase); if (st_off < 0) continue; // ignore dead garbage if (last_off > st_off) { - tty->print_cr("*** bad store offset at %d: %d > %d", i, last_off, st_off); + tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off); this->dump(2); assert(false, "ascending store offsets"); return false; diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 2064b07f451..cec7f0d517b 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -1688,7 +1688,7 @@ void Node::dump(const char* suffix, outputStream *st) const { } } } - if (suffix) st->print(suffix); + if (suffix) st->print("%s", suffix); C->_in_dump_cnt--; } diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index 9d7bef8edbd..d7c7a40bc50 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -611,7 +611,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses, Pars set_map(entry_map); do_exits(); - if (log) log->done("parse nodes='%d' live='%d' memory='%d'", + if (log) log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'", C->unique(), C->live_nodes(), C->node_arena()->used()); } @@ -1395,7 +1395,7 @@ void Parse::do_one_block() { tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo()); } if (b->is_loop_head()) tty->print(" lphd"); - tty->print_cr(""); + tty->cr(); } assert(block()->is_merged(), "must be merged before being parsed"); diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index cce96328b9b..9d9a21f8812 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -628,7 +628,7 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, _method->print_short_name(); tty->print_cr(" switch decision tree"); tty->print_cr(" %d ranges (%d singletons), max_depth=%d, est_depth=%d", - hi-lo+1, nsing, _max_switch_depth, _est_switch_depth); + (int) (hi-lo+1), nsing, _max_switch_depth, _est_switch_depth); if (_max_switch_depth > _est_switch_depth) { tty->print_cr("******** BAD SWITCH DEPTH ********"); } @@ -636,7 +636,7 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, for( r = lo; r <= hi; r++ ) { r->print(); } - tty->print_cr(""); + tty->cr(); } #endif } diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp index 276fafcdbb5..8cc008f8f56 100644 --- a/hotspot/src/share/vm/opto/phaseX.cpp +++ b/hotspot/src/share/vm/opto/phaseX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -958,10 +958,10 @@ void PhaseIterGVN::verify_PhaseIterGVN() { if (VerifyIterativeGVN && PrintOpto) { if (_verify_counter == _verify_full_passes) { tty->print_cr("VerifyIterativeGVN: %d transforms and verify passes", - _verify_full_passes); + (int) _verify_full_passes); } else { tty->print_cr("VerifyIterativeGVN: %d transforms, %d full verify passes", - _verify_counter, _verify_full_passes); + (int) _verify_counter, (int) _verify_full_passes); } } } diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp index 07fddd151c3..4b367117ebf 100644 --- a/hotspot/src/share/vm/opto/regmask.cpp +++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -116,7 +116,7 @@ void OptoReg::dump(int r, outputStream *st) { case Special: st->print("r---"); break; case Bad: st->print("rBAD"); break; default: - if (r < _last_Mach_Reg) st->print(Matcher::regName[r]); + if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]); else st->print("rS%d",r); break; } diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index cabf1675735..6081d449506 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -1393,7 +1393,7 @@ static void trace_exception(oop exception_oop, address exception_pc, const char* } else { tty->print(""); } - tty->print(" at " INTPTR_FORMAT, exception_pc); + tty->print(" at " INTPTR_FORMAT, p2i(exception_pc)); tty->print_cr("]"); } diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 469d4141e32..31bb9f6d133 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -1065,7 +1065,7 @@ const Type *BoolTest::cc2logical( const Type *CC ) const { #ifndef PRODUCT void BoolTest::dump_on(outputStream *st) const { const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"}; - st->print(msg[_test]); + st->print("%s", msg[_test]); } #endif diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 0f011e04864..39662643ac9 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -41,6 +41,8 @@ #include "opto/opcodes.hpp" #include "opto/type.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Portions of code courtesy of Clifford Click // Optimization - Graph Style @@ -842,7 +844,7 @@ bool Type::has_memory() const { #ifndef PRODUCT //------------------------------dump2------------------------------------------ void Type::dump2( Dict &d, uint depth, outputStream *st ) const { - st->print(_type_info[_base].msg); + st->print("%s", _type_info[_base].msg); } //------------------------------dump------------------------------------------- diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index 53215062573..baf1cc6be21 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -275,7 +275,7 @@ const int MAX_REASONABLE_LOCAL_CAPACITY = 4*K; class JNITraceWrapper : public StackObj { public: - JNITraceWrapper(const char* format, ...) { + JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (TraceJNICalls) { va_list ap; va_start(ap, format); diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index 7937090cc27..0d5ffab1cdc 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -100,7 +100,7 @@ extern "C" { \ result_type JNICALL header { \ JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\ if (thr == NULL || !thr->is_Java_thread()) { \ - tty->print_cr(fatal_using_jnienv_in_nonjava); \ + tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \ os::abort(true); \ } \ JNIEnv* xenv = thr->jni_environment(); \ @@ -184,7 +184,7 @@ static inline void functionEnter(JavaThread* thr) { if (thr->in_critical()) { - tty->print_cr(warn_other_function_in_critical); + tty->print_cr("%s", warn_other_function_in_critical); } if (thr->has_pending_exception()) { NativeReportJNIWarning(thr, "JNI call made with exception pending"); @@ -195,7 +195,7 @@ static inline void functionEnterExceptionAllowed(JavaThread* thr) { if (thr->in_critical()) { - tty->print_cr(warn_other_function_in_critical); + tty->print_cr("%s", warn_other_function_in_critical); } } diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index cc6ec977fdf..c6e6cf09296 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -215,7 +215,7 @@ void trace_class_resolution(Klass* to_class) { #ifdef ASSERT class JVMTraceWrapper : public StackObj { public: - JVMTraceWrapper(const char* format, ...) { + JVMTraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (TraceJVMCalls) { va_list ap; va_start(ap, format); @@ -2736,14 +2736,14 @@ JVM_END JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence)) - JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence); + JVMWrapper4("JVM_Lseek (0x%x, " INT64_FORMAT ", %d)", fd, (int64_t) offset, whence); //%note jvm_r6 return os::lseek(fd, offset, whence); JVM_END JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length)) - JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length); + JVMWrapper3("JVM_SetLength (0x%x, " INT64_FORMAT ")", fd, (int64_t) length); return os::ftruncate(fd, length); JVM_END @@ -2758,13 +2758,14 @@ JVM_END // Printing support ////////////////////////////////////////////////// extern "C" { +ATTRIBUTE_PRINTF(3, 0) int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) { // see bug 4399518, 4417214 if ((intptr_t)count <= 0) return -1; return vsnprintf(str, count, fmt, args); } - +ATTRIBUTE_PRINTF(3, 0) int jio_snprintf(char *str, size_t count, const char *fmt, ...) { va_list args; int len; @@ -2774,7 +2775,7 @@ int jio_snprintf(char *str, size_t count, const char *fmt, ...) { return len; } - +ATTRIBUTE_PRINTF(2,3) int jio_fprintf(FILE* f, const char *fmt, ...) { int len; va_list args; @@ -2784,7 +2785,7 @@ int jio_fprintf(FILE* f, const char *fmt, ...) { return len; } - +ATTRIBUTE_PRINTF(2, 0) int jio_vfprintf(FILE* f, const char *fmt, va_list args) { if (Arguments::vfprintf_hook() != NULL) { return Arguments::vfprintf_hook()(f, fmt, args); @@ -2793,7 +2794,7 @@ int jio_vfprintf(FILE* f, const char *fmt, va_list args) { } } - +ATTRIBUTE_PRINTF(1, 2) JNIEXPORT int jio_printf(const char *fmt, ...) { int len; va_list args; @@ -2930,7 +2931,7 @@ JVM_ENTRY(void, JVM_StopThread(JNIEnv* env, jobject jthread, jobject throwable)) JavaThread* receiver = java_lang_Thread::thread(java_thread); Events::log_exception(JavaThread::current(), "JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]", - receiver, (address)java_thread, throwable); + p2i(receiver), p2i((address)java_thread), p2i(throwable)); // First check if thread is alive if (receiver != NULL) { // Check if exception is getting thrown at self (use oop equality, since the diff --git a/hotspot/src/share/vm/prims/jvmtiEnter.xsl b/hotspot/src/share/vm/prims/jvmtiEnter.xsl index ff609eee2f9..e855d21dd81 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl +++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl @@ -1,6 +1,6 @@ " INTPTR_FORMAT, first->top_method()->code()); + if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code())); } else { if (TimeCompilationPolicy) accumulated_time()->start(); GrowableArray* stack = new GrowableArray(50); @@ -640,7 +644,7 @@ RFrame* StackWalkCompPolicy::findTopInlinableFrame(GrowableArray* stack if (TraceCompilationPolicy && Verbose) { tty->print("\n\t check caller: "); next_m->print_short_name(tty); - tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size()); + tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size()); } current = next; diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index 75e68590b2e..1ec4e3b12f8 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -89,6 +89,8 @@ #endif #endif // COMPILER2 +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + bool DeoptimizationMarker::_is_active = false; Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame, diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp index 7e497b73541..58cb6e89daa 100644 --- a/hotspot/src/share/vm/runtime/fprofiler.cpp +++ b/hotspot/src/share/vm/runtime/fprofiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -42,6 +42,8 @@ #include "runtime/vframe.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Static fields of FlatProfiler int FlatProfiler::received_gc_ticks = 0; int FlatProfiler::vm_operation_ticks = 0; @@ -309,7 +311,7 @@ class ProfilerNode { st->fill_to(col2); t->print_native(st); st->fill_to(col3); - st->print(msg); + st->print("%s", msg); st->cr(); } diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp index 1409bd79651..2f7cb8f186a 100644 --- a/hotspot/src/share/vm/runtime/frame.cpp +++ b/hotspot/src/share/vm/runtime/frame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -62,6 +62,8 @@ # include "nativeInst_ppc.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + RegisterMap::RegisterMap(JavaThread *thread, bool update_map) { _thread = thread; _update_map = update_map; diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 526d47c9ad6..05daec54cf8 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -45,6 +45,8 @@ #include "shark/shark_globals.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ @@ -283,6 +285,7 @@ bool Flag::is_external() const { // Length of format string (e.g. "%.1234s") for printing ccstr below #define FORMAT_BUFFER_LEN 16 +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void Flag::print_on(outputStream* st, bool withComments) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { @@ -315,7 +318,10 @@ void Flag::print_on(outputStream* st, bool withComments) { size_t llen = pointer_delta(eol, cp, sizeof(char)); jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, "%%." SIZE_FORMAT "s", llen); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format_buffer, cp); +PRAGMA_DIAG_POP st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", _name); @@ -372,7 +378,7 @@ void Flag::print_kind(outputStream* st) { } else { st->print(" "); } - st->print(d.name); + st->print("%s", d.name); } } diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp index ca73f86ba7f..e80b6d79828 100644 --- a/hotspot/src/share/vm/runtime/handles.cpp +++ b/hotspot/src/share/vm/runtime/handles.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -41,6 +41,8 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT oop* HandleArea::allocate_handle(oop obj) { assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp index 61bdfcebf85..09757155d9d 100644 --- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp +++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -35,6 +35,7 @@ #include "runtime/vframe.hpp" #include "utilities/preserveException.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of InterfaceSupport diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp index cddfd3d1ffc..8b352765b13 100644 --- a/hotspot/src/share/vm/runtime/java.cpp +++ b/hotspot/src/share/vm/runtime/java.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -97,6 +97,7 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC GrowableArray* collected_profiled_methods; @@ -366,7 +367,7 @@ void print_statistics() { BaselineTTYOutputer outputer(tty); MemTracker::print_memory_usage(outputer, K, false); } else { - tty->print_cr(MemTracker::reason()); + tty->print_cr("%s", MemTracker::reason()); } } } @@ -407,7 +408,7 @@ void print_statistics() { BaselineTTYOutputer outputer(tty); MemTracker::print_memory_usage(outputer, K, false); } else { - tty->print_cr(MemTracker::reason()); + tty->print_cr("%s", MemTracker::reason()); } } } diff --git a/hotspot/src/share/vm/runtime/jniHandles.cpp b/hotspot/src/share/vm/runtime/jniHandles.cpp index 373c3359d02..7ff38335029 100644 --- a/hotspot/src/share/vm/runtime/jniHandles.cpp +++ b/hotspot/src/share/vm/runtime/jniHandles.cpp @@ -30,6 +30,7 @@ #include "runtime/mutexLocker.hpp" #include "runtime/thread.inline.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC JNIHandleBlock* JNIHandles::_global_handles = NULL; JNIHandleBlock* JNIHandles::_weak_global_handles = NULL; diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index 8789e5d0df4..34c9366f0d1 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -42,6 +42,8 @@ # include "mutex_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o // // Native Monitor-Mutex locking - theory of operations diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 82361d3fd43..70c6c064fbf 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -65,6 +65,8 @@ # include +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + OSThread* os::_starting_thread = NULL; address os::_polling_page = NULL; volatile int32_t* os::_mem_serialize_page = NULL; @@ -909,9 +911,9 @@ void os::print_environment_variables(outputStream* st, const char** env_list, for (int i = 0; env_list[i] != NULL; i++) { if (getenv(env_list[i], buffer, len)) { - st->print(env_list[i]); + st->print("%s", env_list[i]); st->print("="); - st->print_cr(buffer); + st->print_cr("%s", buffer); } } } diff --git a/hotspot/src/share/vm/runtime/osThread.cpp b/hotspot/src/share/vm/runtime/osThread.cpp index 8c7b5e61c96..57bf1f524fd 100644 --- a/hotspot/src/share/vm/runtime/osThread.cpp +++ b/hotspot/src/share/vm/runtime/osThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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,6 +26,7 @@ #include "oops/oop.inline.hpp" #include "runtime/osThread.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC OSThread::OSThread(OSThreadStartFunc start_proc, void* start_parm) { pd_initialize(); diff --git a/hotspot/src/share/vm/runtime/perfData.cpp b/hotspot/src/share/vm/runtime/perfData.cpp index f2152ab1c64..caf4c99295e 100644 --- a/hotspot/src/share/vm/runtime/perfData.cpp +++ b/hotspot/src/share/vm/runtime/perfData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -34,6 +34,8 @@ #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PerfDataList* PerfDataManager::_all = NULL; PerfDataList* PerfDataManager::_sampled = NULL; PerfDataList* PerfDataManager::_constants = NULL; diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp index 209288cb680..4eddf2a9722 100644 --- a/hotspot/src/share/vm/runtime/perfMemory.cpp +++ b/hotspot/src/share/vm/runtime/perfMemory.cpp @@ -35,6 +35,8 @@ #include "runtime/statSampler.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Prefix of performance data file. const char PERFDATA_NAME[] = "hsperfdata"; diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index cbf11d17311..1cb4190cc2d 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -82,6 +82,8 @@ #include "c1/c1_globals.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // -------------------------------------------------------------------------------------------------- // Implementation of Safepoint begin/end @@ -787,7 +789,7 @@ static void print_me(intptr_t *new_sp, intptr_t *old_sp, bool *was_oops) { old_sp += incr*32; new_sp += incr*32; was_oops += incr*32; for( int i2=0; i2<16; i2++ ) { tty->print("call %c%d |"PTR_FORMAT" ","LI"[i2>>3],i2&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); } - tty->print_cr(""); + tty->cr(); } #endif // SPARC #endif // PRODUCT @@ -829,7 +831,7 @@ void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason timeout_error_printed = true; // Print out the thread info which didn't reach the safepoint for debugging // purposes (useful when there are lots of threads in the debugger). - tty->print_cr(""); + tty->cr(); tty->print_cr("# SafepointSynchronize::begin: Timeout detected:"); if (reason == _spinning_timeout) { tty->print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint."); @@ -849,7 +851,7 @@ void SafepointSynchronize::print_safepoint_timeout(SafepointTimeoutReason reason (reason == _blocking_timeout && !cur_state->has_called_back()))) { tty->print("# "); cur_thread->print(); - tty->print_cr(""); + tty->cr(); } } tty->print_cr("# SafepointSynchronize::begin: (End of list)"); @@ -1322,7 +1324,7 @@ void SafepointSynchronize::print_stat_on_exit() { spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) { print_statistics(); } - tty->print_cr(""); + tty->cr(); // Print out polling page sampling status. if (!need_to_track_page_armed_status) { diff --git a/hotspot/src/share/vm/runtime/safepoint.hpp b/hotspot/src/share/vm/runtime/safepoint.hpp index e43eef4df96..ab5d2e9445d 100644 --- a/hotspot/src/share/vm/runtime/safepoint.hpp +++ b/hotspot/src/share/vm/runtime/safepoint.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -174,7 +174,7 @@ public: // Debugging static void print_state() PRODUCT_RETURN; - static void safepoint_msg(const char* format, ...) PRODUCT_RETURN; + static void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(1, 2) PRODUCT_RETURN; static void deferred_initialize_stat(); static void print_stat_on_exit(); @@ -240,7 +240,7 @@ class ThreadSafepointState: public CHeapObj { static void create(JavaThread *thread); static void destroy(JavaThread *thread); - void safepoint_msg(const char* format, ...) { + void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { if (ShowSafepointMsgs) { va_list ap; va_start(ap, format); diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index ad69dcec364..fad31fd02f1 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -82,6 +82,8 @@ #include "c1/c1_Runtime1.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Shared stub locations RuntimeStub* SharedRuntime::_wrong_method_blob; RuntimeStub* SharedRuntime::_wrong_method_abstract_blob; diff --git a/hotspot/src/share/vm/runtime/signature.cpp b/hotspot/src/share/vm/runtime/signature.cpp index 3bad97a71d9..a92f5e73b28 100644 --- a/hotspot/src/share/vm/runtime/signature.cpp +++ b/hotspot/src/share/vm/runtime/signature.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -32,6 +32,7 @@ #include "oops/typeArrayKlass.hpp" #include "runtime/signature.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of SignatureIterator diff --git a/hotspot/src/share/vm/runtime/stackValue.cpp b/hotspot/src/share/vm/runtime/stackValue.cpp index ce274103d3f..a0e6f5104f8 100644 --- a/hotspot/src/share/vm/runtime/stackValue.cpp +++ b/hotspot/src/share/vm/runtime/stackValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -196,7 +196,7 @@ void StackValue::print_on(outputStream* st) const { case T_OBJECT: _o()->print_value_on(st); - st->print(" <" INTPTR_FORMAT ">", (address)_o()); + st->print(" <" INTPTR_FORMAT ">", p2i((address)_o())); break; case T_CONFLICT: diff --git a/hotspot/src/share/vm/runtime/stackValueCollection.cpp b/hotspot/src/share/vm/runtime/stackValueCollection.cpp index 110f7120d4f..3794f64d78c 100644 --- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp +++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -40,6 +40,8 @@ # include "jniTypes_ppc.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + jint StackValueCollection::int_at(int slot) const { intptr_t val = at(slot)->get_int(); jint ival = *((jint*) (&val)); diff --git a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp index 92f3d0be1dd..5ecbe028724 100644 --- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp +++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -60,10 +60,10 @@ const char* StubCodeDesc::name_for(address pc) { void StubCodeDesc::print_on(outputStream* st) const { - st->print(group()); + st->print("%s", group()); st->print("::"); - st->print(name()); - st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes()); + st->print("%s", name()); + st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", p2i(begin()), p2i(end()), size_in_bytes()); } // Implementation of StubCodeGenerator diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp index 6d30bd34032..4eba81debe6 100644 --- a/hotspot/src/share/vm/runtime/sweeper.cpp +++ b/hotspot/src/share/vm/runtime/sweeper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,6 +43,8 @@ #include "utilities/ticks.inline.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT #define SWEEP(nm) record_sweep(nm, __LINE__) @@ -627,7 +629,7 @@ void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { tty->vprint(format, ap); va_end(ap); } - tty->print_cr(s.as_string()); + tty->print_cr("%s", s.as_string()); } if (LogCompilation && (xtty != NULL)) { @@ -644,7 +646,7 @@ void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { xtty->vprint(format, ap); va_end(ap); } - xtty->print(s.as_string()); + xtty->print("%s", s.as_string()); xtty->stamp(); xtty->end_elem(); } diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp index abee1ec77d2..f7482d8194d 100644 --- a/hotspot/src/share/vm/runtime/sweeper.hpp +++ b/hotspot/src/share/vm/runtime/sweeper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -94,7 +94,7 @@ class NMethodSweeper : public AllStatic { static const Tickspan total_time_sweeping() { return _total_time_sweeping; } static const Tickspan peak_sweep_time() { return _peak_sweep_time; } static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; } - static void log_sweep(const char* msg, const char* format = NULL, ...); + static void log_sweep(const char* msg, const char* format = NULL, ...) ATTRIBUTE_PRINTF(2, 3); #ifdef ASSERT diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index e6d4913d71a..62bd1ab9139 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -60,6 +60,8 @@ #define ATTR #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // The "core" versions of monitor enter and exit reside in this file. // The interpreter and compilers contain specialized transliterated // variants of the enter-exit fast-path operations. See i486.ad fast_lock(), diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 0d8b90e11a4..e6d9eee7927 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -112,6 +112,8 @@ #include "runtime/rtmLocking.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef DTRACE_ENABLED // Only bother with this argument setup if dtrace is available @@ -4273,7 +4275,7 @@ JavaThread *Threads::owning_thread_from_monitor_owner(address owner, bool doLock // Threads::print_on() is called at safepoint by VM_PrintThreads operation. void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks) { char buf[32]; - st->print_cr(os::local_time_string(buf, sizeof(buf))); + st->print_cr("%s", os::local_time_string(buf, sizeof(buf))); st->print_cr("Full thread dump %s (%s %s):", Abstract_VM_Version::vm_name(), diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 422ba755e48..a5f0a92246d 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -684,7 +684,7 @@ class NamedThread: public Thread { NamedThread(); ~NamedThread(); // May only be called once per thread. - void set_name(const char* format, ...); + void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); virtual bool is_Named_thread() const { return true; } virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; } JavaThread *processed_thread() { return _processed_thread; } diff --git a/hotspot/src/share/vm/runtime/timer.cpp b/hotspot/src/share/vm/runtime/timer.cpp index e33a51cfb97..9067f20b3d3 100644 --- a/hotspot/src/share/vm/runtime/timer.cpp +++ b/hotspot/src/share/vm/runtime/timer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -204,7 +204,7 @@ TraceCPUTime::~TraceCPUTime() { _logfile->print("[Error in TraceCPUTime]"); } if (_print_cr) { - _logfile->print_cr(""); + _logfile->cr(); } _logfile->flush(); } diff --git a/hotspot/src/share/vm/runtime/unhandledOops.cpp b/hotspot/src/share/vm/runtime/unhandledOops.cpp index cc0002d42c9..d27b1fb2f71 100644 --- a/hotspot/src/share/vm/runtime/unhandledOops.cpp +++ b/hotspot/src/share/vm/runtime/unhandledOops.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -31,6 +31,8 @@ #include "runtime/unhandledOops.hpp" #include "utilities/globalDefinitions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef CHECK_UNHANDLED_OOPS const int free_list_size = 256; diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp index 2487ad3c6cd..d5b5fa1f480 100644 --- a/hotspot/src/share/vm/runtime/vframe.cpp +++ b/hotspot/src/share/vm/runtime/vframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -46,6 +46,8 @@ #include "runtime/vframeArray.hpp" #include "runtime/vframe_hp.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) : _reg_map(reg_map), _thread(thread) { assert(fr != NULL, "must have frame"); diff --git a/hotspot/src/share/vm/runtime/vframe.hpp b/hotspot/src/share/vm/runtime/vframe.hpp index 27966b1a73e..a284b13de0c 100644 --- a/hotspot/src/share/vm/runtime/vframe.hpp +++ b/hotspot/src/share/vm/runtime/vframe.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -399,7 +399,7 @@ inline void vframeStreamCommon::fill_from_compiled_frame(int decode_offset) { if (WizardMode) { tty->print_cr("Error in fill_from_frame: pc_desc for " INTPTR_FORMAT " not found or invalid at %d", - _frame.pc(), decode_offset); + p2i(_frame.pc()), decode_offset); nm()->print(); nm()->method()->print_codes(); nm()->print_code(); diff --git a/hotspot/src/share/vm/runtime/vframeArray.cpp b/hotspot/src/share/vm/runtime/vframeArray.cpp index 5dff2d7b62a..72e2e8717cb 100644 --- a/hotspot/src/share/vm/runtime/vframeArray.cpp +++ b/hotspot/src/share/vm/runtime/vframeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,6 +43,7 @@ #include "opto/runtime.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); } diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp index 5ef3a976c49..19f699464b2 100644 --- a/hotspot/src/share/vm/runtime/virtualspace.cpp +++ b/hotspot/src/share/vm/runtime/virtualspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -43,6 +43,7 @@ # include "os_bsd.inline.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // ReservedSpace diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp index a3ff582fab9..ab755589403 100644 --- a/hotspot/src/share/vm/runtime/vmThread.cpp +++ b/hotspot/src/share/vm/runtime/vmThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -40,6 +40,8 @@ #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Dummy VM operation to act as first element in our circular double-linked list class VM_Dummy: public VM_Operation { VMOp_Type type() const { return VMOp_Dummy; } diff --git a/hotspot/src/share/vm/runtime/vm_operations.cpp b/hotspot/src/share/vm/runtime/vm_operations.cpp index e26c3938b20..d46e1f775ac 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.cpp +++ b/hotspot/src/share/vm/runtime/vm_operations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -39,6 +39,8 @@ #include "services/threadService.hpp" #include "trace/tracing.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #define VM_OP_NAME_INITIALIZE(name) #name, const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \ diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index d2d7efcafa2..5df7d221a2b 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -117,7 +117,7 @@ void Abstract_VM_Version::initialize() { set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version"); set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version"); int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0; - set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset, + set_version_field(&_vm_build_number, &JDK_BUILD_NUMBER[offset], "bad build number"); _initialized = true; diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp index 8551563f59f..9d68175518a 100644 --- a/hotspot/src/share/vm/services/attachListener.cpp +++ b/hotspot/src/share/vm/services/attachListener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -284,15 +284,15 @@ static jint set_uintx_flag(const char* name, AttachOperation* op, outputStream* } if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) { - out->print_cr(err_msg.buffer()); + out->print_cr("%s", err_msg.buffer()); return JNI_ERR; } } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) { - out->print_cr(err_msg.buffer()); + out->print_cr("%s", err_msg.buffer()); return JNI_ERR; } } @@ -381,7 +381,7 @@ static jint print_flag(AttachOperation* op, outputStream* out) { Flag* f = Flag::find_flag((char*)name, strlen(name)); if (f) { f->print_as_flag(out); - out->print_cr(""); + out->cr(); } else { out->print_cr("no such flag '%s'", name); } diff --git a/hotspot/src/share/vm/services/classLoadingService.cpp b/hotspot/src/share/vm/services/classLoadingService.cpp index bdc33fdd2bb..8ce6eb8e532 100644 --- a/hotspot/src/share/vm/services/classLoadingService.cpp +++ b/hotspot/src/share/vm/services/classLoadingService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -136,7 +136,7 @@ void ClassLoadingService::notify_class_unloaded(InstanceKlass* k) { if (TraceClassUnloading) { ResourceMark rm; - tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), k); + tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), p2i(k)); } } diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp index 74444d6168d..ca031f87963 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -33,6 +33,8 @@ #include "services/management.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + void DCmdRegistrant::register_dcmds(){ // Registration of the diagnostic commands // First argument specifies which interfaces will export the command @@ -101,7 +103,7 @@ void HelpDCmd::execute(DCmdSource source, TRAPS) { if (factory != NULL) { output()->print_cr("%s%s", factory->name(), factory->is_enabled() ? "" : " [disabled]"); - output()->print_cr(factory->description()); + output()->print_cr("%s", factory->description()); output()->print_cr("\nImpact: %s", factory->impact()); JavaPermission p = factory->permission(); if(p._class != NULL) { diff --git a/hotspot/src/share/vm/services/diagnosticFramework.cpp b/hotspot/src/share/vm/services/diagnosticFramework.cpp index dcc2a21e48a..dcb67d36c3b 100644 --- a/hotspot/src/share/vm/services/diagnosticFramework.cpp +++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -259,7 +259,7 @@ void DCmdParser::print_help(outputStream* out, const char* cmd_name) { } arg = arg->next(); } - out->print_cr(""); + out->cr(); if (_arguments_list != NULL) { out->print_cr("\nArguments:"); arg = _arguments_list; @@ -268,7 +268,7 @@ void DCmdParser::print_help(outputStream* out, const char* cmd_name) { arg->is_mandatory() ? "" : "[optional]", arg->description(), arg->type()); if (arg->has_default()) { - out->print(arg->default_string()); + out->print("%s", arg->default_string()); } else { out->print("no default value"); } @@ -284,7 +284,7 @@ void DCmdParser::print_help(outputStream* out, const char* cmd_name) { arg->is_mandatory() ? "" : "[optional]", arg->description(), arg->type()); if (arg->has_default()) { - out->print(arg->default_string()); + out->print("%s", arg->default_string()); } else { out->print("no default value"); } diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp index 39c9a395d73..79c6c8ca7e0 100644 --- a/hotspot/src/share/vm/services/heapDumper.cpp +++ b/hotspot/src/share/vm/services/heapDumper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, 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 @@ -1842,6 +1842,7 @@ void VM_HeapDumper::dump_stack_traces() { } // dump the heap to given path. +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL int HeapDumper::dump(const char* path) { assert(path != NULL && strlen(path) > 0, "path missing"); @@ -1882,7 +1883,10 @@ int HeapDumper::dump(const char* path) { char msg[256]; sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", JLONG_FORMAT, timer()->seconds()); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL tty->print_cr(msg, writer.bytes_written()); +PRAGMA_DIAG_POP } else { tty->print_cr("Dump file is incomplete: %s", writer.error()); } diff --git a/hotspot/src/share/vm/services/lowMemoryDetector.cpp b/hotspot/src/share/vm/services/lowMemoryDetector.cpp index 199a342dd77..b68be23dfa4 100644 --- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp +++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -353,7 +353,7 @@ void SensorInfo::clear(int count, TRAPS) { #ifndef PRODUCT void SensorInfo::print() { - tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld", + tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %d pending_clears = %d", (_sensor_on ? "on" : "off"), _sensor_count, _pending_trigger_count, _pending_clear_count); } diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 7c99aa47730..dc901876104 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -56,6 +56,8 @@ #include "services/threadService.hpp" #include "utilities/macros.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + PerfVariable* Management::_begin_vm_creation_time = NULL; PerfVariable* Management::_end_vm_creation_time = NULL; PerfVariable* Management::_vm_init_done_time = NULL; @@ -1839,12 +1841,12 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value uintx uvalue = (uintx)new_value.j; if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MaxHeapFreeRatio(err_msg, uvalue)) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer()); } } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) { - FormatBuffer<80> err_msg(""); + FormatBuffer<80> err_msg("%s", ""); if (!Arguments::verify_MinHeapFreeRatio(err_msg, uvalue)) { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer()); } diff --git a/hotspot/src/share/vm/services/memReporter.cpp b/hotspot/src/share/vm/services/memReporter.cpp index c9cbc08046c..305693dad08 100644 --- a/hotspot/src/share/vm/services/memReporter.cpp +++ b/hotspot/src/share/vm/services/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -28,6 +28,8 @@ #include "services/memPtrArray.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + const char* BaselineOutputer::memory_unit(size_t scale) { switch(scale) { case K: return "KB"; diff --git a/hotspot/src/share/vm/services/memSnapshot.cpp b/hotspot/src/share/vm/services/memSnapshot.cpp index 3bfd19324bb..8f5ca4f4195 100644 --- a/hotspot/src/share/vm/services/memSnapshot.cpp +++ b/hotspot/src/share/vm/services/memSnapshot.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -31,6 +31,8 @@ #include "services/memSnapshot.hpp" #include "services/memTracker.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef ASSERT void decode_pointer_record(MemPointerRecord* rec) { @@ -733,7 +735,7 @@ void MemSnapshot::dump_all_vm_pointers() { if (os::dll_address_to_function_name(ex->pc(), buf, sizeof(buf), NULL)) { tty->print_cr("\t%s", buf); } else { - tty->print_cr(""); + tty->cr(); } } } diff --git a/hotspot/src/share/vm/services/memTrackWorker.cpp b/hotspot/src/share/vm/services/memTrackWorker.cpp index e1382dd1a3a..7bf18eb273c 100644 --- a/hotspot/src/share/vm/services/memTrackWorker.cpp +++ b/hotspot/src/share/vm/services/memTrackWorker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -43,7 +43,7 @@ MemTrackWorker::MemTrackWorker(MemSnapshot* snapshot): _snapshot(snapshot) { // create thread uses cgc thread type for now. We should revisit // the option, or create new thread type. _has_error = !os::create_thread(this, os::cgc_thread); - set_name("MemTrackWorker", 0); + set_name("MemTrackWorker"); // initial generation circuit buffer if (!has_error()) { diff --git a/hotspot/src/share/vm/services/nmtDCmd.cpp b/hotspot/src/share/vm/services/nmtDCmd.cpp index 823e3c443f2..8ced28772f3 100644 --- a/hotspot/src/share/vm/services/nmtDCmd.cpp +++ b/hotspot/src/share/vm/services/nmtDCmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -128,7 +128,7 @@ void NMTDCmd::execute(DCmdSource source, TRAPS) { // native memory tracking has to be on if (!MemTracker::is_on() || MemTracker::shutdown_in_progress()) { // if it is not on, what's the reason? - output()->print_cr(MemTracker::reason()); + output()->print_cr("%s", MemTracker::reason()); return; } diff --git a/hotspot/src/share/vm/services/threadService.cpp b/hotspot/src/share/vm/services/threadService.cpp index a46067981a0..02156a2f3e2 100644 --- a/hotspot/src/share/vm/services/threadService.cpp +++ b/hotspot/src/share/vm/services/threadService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -38,6 +38,8 @@ #include "runtime/vm_operations.hpp" #include "services/threadService.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // TODO: we need to define a naming convention for perf counters // to distinguish counters for: // - standard JSR174 use diff --git a/hotspot/src/share/vm/trace/traceStream.hpp b/hotspot/src/share/vm/trace/traceStream.hpp index 4acbbb88498..2166a75126c 100644 --- a/hotspot/src/share/vm/trace/traceStream.hpp +++ b/hotspot/src/share/vm/trace/traceStream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, 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 @@ -113,7 +113,7 @@ class TraceStream : public StackObj { } void print(const char* val) { - _st.print(val); + _st.print("%s", val); } }; diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp index 99c84a6ddfe..632b7c656b2 100644 --- a/hotspot/src/share/vm/utilities/array.hpp +++ b/hotspot/src/share/vm/utilities/array.hpp @@ -376,7 +376,7 @@ protected: // FIXME: How to handle this? void print_value_on(outputStream* st) const { - st->print("Array(" INTPTR_FORMAT ")", this); + st->print("Array(" INTPTR_FORMAT ")", p2i(this)); } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/utilities/bitMap.cpp b/hotspot/src/share/vm/utilities/bitMap.cpp index 024e35e374d..bfcda11fdea 100644 --- a/hotspot/src/share/vm/utilities/bitMap.cpp +++ b/hotspot/src/share/vm/utilities/bitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -522,13 +522,13 @@ BitMap::idx_t BitMap::count_one_bits() const { void BitMap::print_on_error(outputStream* st, const char* prefix) const { st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")", - prefix, map(), (char*)map() + (size() >> LogBitsPerByte)); + prefix, p2i(map()), p2i((char*)map() + (size() >> LogBitsPerByte))); } #ifndef PRODUCT void BitMap::print_on(outputStream* st) const { - tty->print("Bitmap(%d):", size()); + tty->print("Bitmap(" SIZE_FORMAT "):", size()); for (idx_t index = 0; index < size(); index++) { tty->print("%c", at(index) ? '1' : '0'); } diff --git a/hotspot/src/share/vm/utilities/constantTag.cpp b/hotspot/src/share/vm/utilities/constantTag.cpp index 8f3b68a9b5d..1495a42e624 100644 --- a/hotspot/src/share/vm/utilities/constantTag.cpp +++ b/hotspot/src/share/vm/utilities/constantTag.cpp @@ -28,7 +28,7 @@ #ifndef PRODUCT void constantTag::print_on(outputStream* st) const { - st->print(internal_name()); + st->print("%s", internal_name()); } #endif // PRODUCT diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 31d13f794b8..604018f8dd9 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -88,6 +88,8 @@ # endif #endif // PRODUCT +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + FormatBufferResource::FormatBufferResource(const char * format, ...) : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) { va_list argp; @@ -96,6 +98,7 @@ FormatBufferResource::FormatBufferResource(const char * format, ...) va_end(argp); } +ATTRIBUTE_PRINTF(1, 2) void warning(const char* format, ...) { if (PrintWarnings) { FILE* const err = defaultStream::error_stream(); diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp index 310080dbb0e..9070fd80ee4 100644 --- a/hotspot/src/share/vm/utilities/debug.hpp +++ b/hotspot/src/share/vm/utilities/debug.hpp @@ -43,17 +43,17 @@ class FormatBufferBase { #define RES_BUFSZ 256 class FormatBufferResource : public FormatBufferBase { public: - FormatBufferResource(const char * format, ...); + FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); }; // Use stack for buffer template class FormatBuffer : public FormatBufferBase { public: - inline FormatBuffer(const char * format, ...); - inline void append(const char* format, ...); - inline void print(const char* format, ...); - inline void printv(const char* format, va_list ap); + inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); char* buffer() { return _buf; } int size() { return bufsz; } @@ -223,7 +223,7 @@ void report_should_not_reach_here(const char* file, int line); void report_unimplemented(const char* file, int line); void report_untested(const char* file, int line, const char* message); -void warning(const char* format, ...); +void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); #ifdef ASSERT // Compile-time asserts. diff --git a/hotspot/src/share/vm/utilities/events.cpp b/hotspot/src/share/vm/utilities/events.cpp index 8ccd65095e4..4d17c9bba42 100644 --- a/hotspot/src/share/vm/utilities/events.cpp +++ b/hotspot/src/share/vm/utilities/events.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -82,7 +82,7 @@ EventMark::EventMark(const char* format, ...) { va_start(ap, format); // Save a copy of begin message and log it. _buffer.printv(format, ap); - Events::log(NULL, _buffer); + Events::log(NULL, "%s", _buffer.buffer()); va_end(ap); } } @@ -91,6 +91,6 @@ EventMark::~EventMark() { if (LogEvents) { // Append " done" to the begin message and log it _buffer.append(" done"); - Events::log(NULL, _buffer); + Events::log(NULL, "%s", _buffer.buffer()); } } diff --git a/hotspot/src/share/vm/utilities/events.hpp b/hotspot/src/share/vm/utilities/events.hpp index 804fe77df2d..71a4a436694 100644 --- a/hotspot/src/share/vm/utilities/events.hpp +++ b/hotspot/src/share/vm/utilities/events.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -128,7 +128,7 @@ template class EventLogBase : public EventLog { void print(outputStream* out, EventRecord& e) { out->print("Event: %.3f ", e.timestamp); if (e.thread != NULL) { - out->print("Thread " INTPTR_FORMAT " ", e.thread); + out->print("Thread " INTPTR_FORMAT " ", p2i(e.thread)); } print(out, e.data); } @@ -148,7 +148,7 @@ class StringEventLog : public EventLogBase { public: StringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase(name, count) {} - void logv(Thread* thread, const char* format, va_list ap) { + void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) { if (!should_log()) return; double timestamp = fetch_timestamp(); @@ -159,7 +159,7 @@ class StringEventLog : public EventLogBase { _records[index].data.printv(format, ap); } - void log(Thread* thread, const char* format, ...) { + void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) { va_list ap; va_start(ap, format); logv(thread, format, ap); @@ -193,18 +193,17 @@ class Events : AllStatic { static void print(); // Logs a generic message with timestamp and format as printf. - static void log(Thread* thread, const char* format, ...); + static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // Log exception related message - static void log_exception(Thread* thread, const char* format, ...); + static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); - static void log_deopt_message(Thread* thread, const char* format, ...); + static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // Register default loggers static void init(); }; - inline void Events::log(Thread* thread, const char* format, ...) { if (LogEvents) { va_list ap; @@ -283,7 +282,7 @@ class EventMark : public StackObj { public: // log a begin event, format as printf - EventMark(const char* format, ...); + EventMark(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // log an end event ~EventMark(); }; diff --git a/hotspot/src/share/vm/utilities/exceptions.cpp b/hotspot/src/share/vm/utilities/exceptions.cpp index e3d08d5946f..0759eda3789 100644 --- a/hotspot/src/share/vm/utilities/exceptions.cpp +++ b/hotspot/src/share/vm/utilities/exceptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -35,6 +35,7 @@ #include "utilities/events.hpp" #include "utilities/exceptions.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC // Implementation of ThreadShadow void check_ThreadShadow() { @@ -237,6 +238,7 @@ void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_na _throw_msg(thread, file, line, h_name, msg); } + // Creates an exception oop, calls the method with the given signature. // and returns a Handle Handle Exceptions::new_exception(Thread *thread, Symbol* name, diff --git a/hotspot/src/share/vm/utilities/exceptions.hpp b/hotspot/src/share/vm/utilities/exceptions.hpp index 504d4caf5e3..52805805d59 100644 --- a/hotspot/src/share/vm/utilities/exceptions.hpp +++ b/hotspot/src/share/vm/utilities/exceptions.hpp @@ -132,7 +132,7 @@ class Exceptions { // There is no THROW... macro for this method. Caller should remember // to do a return after calling it. static void fthrow(Thread* thread, const char* file, int line, Symbol* name, - const char* format, ...); + const char* format, ...) ATTRIBUTE_PRINTF(5, 6); // Create and initialize a new exception static Handle new_exception(Thread* thread, Symbol* name, diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index ca9bc2f16a6..50074f387b5 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -42,6 +42,32 @@ # include "utilities/globalDefinitions_xlc.hpp" #endif +#ifndef PRAGMA_DIAG_PUSH +#define PRAGMA_DIAG_PUSH +#endif +#ifndef PRAGMA_DIAG_POP +#define PRAGMA_DIAG_POP +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED +#define PRAGMA_FORMAT_NONLITERAL_IGNORED +#endif +#ifndef PRAGMA_FORMAT_IGNORED +#define PRAGMA_FORMAT_IGNORED +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#endif +#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#endif +#ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC +#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC +#endif +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(fmt, vargs) +#endif + + #include "utilities/macros.hpp" // This file holds all globally used constants & types, class (forward) @@ -1284,6 +1310,11 @@ inline int build_int_from_shorts( jushort low, jushort high ) { return ((int)((unsigned int)high << 16) | (unsigned int)low); } +// Convert pointer to intptr_t, for use in printing pointers. +inline intptr_t p2i(const void * p) { + return (intptr_t) p; +} + // Printf-style formatters for fixed- and variable-width types as pointers and // integers. These are derived from the definitions in inttypes.h. If the platform // doesn't provide appropriate definitions, they should be provided in @@ -1302,6 +1333,7 @@ inline int build_int_from_shorts( jushort low, jushort high ) { // Format 64-bit quantities. #define INT64_FORMAT "%" PRId64 #define UINT64_FORMAT "%" PRIu64 +#define UINT64_FORMAT_X "%" PRIx64 #define INT64_FORMAT_W(width) "%" #width PRId64 #define UINT64_FORMAT_W(width) "%" #width PRIu64 @@ -1324,6 +1356,8 @@ inline int build_int_from_shorts( jushort low, jushort high ) { #define PTR_FORMAT "0x%08" PRIxPTR #endif // _LP64 +#define INTPTR_FORMAT_W(width) "%" #width PRIxPTR + #define SSIZE_FORMAT "%" PRIdPTR #define SIZE_FORMAT "%" PRIuPTR #define SIZE_FORMAT_HEX "0x%" PRIxPTR @@ -1355,7 +1389,6 @@ static inline void* dereference_vptr(void* addr) { return *(void**)addr; } - #ifndef PRODUCT // For unit testing only diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp index f66fb721e3a..3125859be31 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -282,6 +282,35 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); } #define PRAGMA_IMPLEMENTATION #pragma implementation #define VALUE_OBJ_CLASS_SPEC +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs))) +#endif + +#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic ignored \"-Wformat-security\"") +#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"") + +#if defined(__clang_major__) && (__clang_major__ >= 4 || (__clang_major__ >= 3 && __clang_minor__ >= 1)) || (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6) +// Tested to work with clang version 3.1 and better. +#define PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push") +#define PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop") +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED + +// Hack to deal with gcc yammering about non-security format stuff +#else +// Old versions of gcc don't do push/pop, also do not cope with this pragma within a function +// One method does so much varied printing that it is decorated with both internal and external +// versions of the macro-pragma to obtain better checking with newer compilers. +#define PRAGMA_DIAG_PUSH +#define PRAGMA_DIAG_POP +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED +#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL +#endif + +#ifndef __clang_major__ +#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC _Pragma("GCC diagnostic ignored \"-Wformat\"") _Pragma("GCC diagnostic error \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic error \"-Wformat-security\"") +#endif + #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) #define TEMPLATE_TABLE_BUG #endif diff --git a/hotspot/src/share/vm/utilities/numberSeq.cpp b/hotspot/src/share/vm/utilities/numberSeq.cpp index 06fcf40b7a8..230447b2167 100644 --- a/hotspot/src/share/vm/utilities/numberSeq.cpp +++ b/hotspot/src/share/vm/utilities/numberSeq.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -258,5 +258,5 @@ void TruncatedSeq::dump_on(outputStream* s) { } s->print("\t[%d]=%7.3f", i, _sequence[i]); } - s->print_cr(""); + s->cr(); } diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index e09dfccf123..54536c50742 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -268,7 +268,7 @@ void outputStream::print_data(void* data, size_t len, bool with_ascii) { size_t limit = (len + 16) / 16 * 16; for (size_t i = 0; i < limit; ++i) { if (i % 16 == 0) { - indent().print("%07x:", i); + indent().print(INTPTR_FORMAT_W(07)":", i); } if (i % 2 == 0) { print(" "); @@ -289,7 +289,7 @@ void outputStream::print_data(void* data, size_t len, bool with_ascii) { } } } - print_cr(""); + cr(); } } } @@ -606,7 +606,7 @@ void fdStream::write(const char* s, size_t len) { // memory usage and command line flags into header void gcLogFileStream::dump_loggc_header() { if (is_open()) { - print_cr(Abstract_VM_Version::internal_vm_info_string()); + print_cr("%s", Abstract_VM_Version::internal_vm_info_string()); os::print_memory_info(this); print("CommandLine flags: "); CommandLineFlags::printSetFlags(this); @@ -687,7 +687,7 @@ void gcLogFileStream::rotate_log(bool force, outputStream* out) { write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } dump_loggc_header(); @@ -720,7 +720,7 @@ void gcLogFileStream::rotate_log(bool force, outputStream* out) { write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } fclose(_file); @@ -765,7 +765,7 @@ void gcLogFileStream::rotate_log(bool force, outputStream* out) { write(time_msg, strlen(time_msg)); if (out != NULL) { - out->print(time_msg); + out->print("%s", time_msg); } dump_loggc_header(); @@ -845,7 +845,7 @@ void defaultStream::init_log() { xs->head("hotspot_log version='%d %d'" " process='%d' time_ms='"INT64_FORMAT"'", LOG_MAJOR_VERSION, LOG_MINOR_VERSION, - os::current_process_id(), time_ms); + os::current_process_id(), (int64_t)time_ms); // Write VM version header immediately. xs->head("vm_version"); xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr(); diff --git a/hotspot/src/share/vm/utilities/ostream.hpp b/hotspot/src/share/vm/utilities/ostream.hpp index 92440ee0a64..563bbe432b5 100644 --- a/hotspot/src/share/vm/utilities/ostream.hpp +++ b/hotspot/src/share/vm/utilities/ostream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -53,7 +53,7 @@ class outputStream : public ResourceObj { static const char* do_vsnprintf(char* buffer, size_t buflen, const char* format, va_list ap, bool add_cr, - size_t& result_len); + size_t& result_len) ATTRIBUTE_PRINTF(3, 0); public: // creation @@ -80,10 +80,10 @@ class outputStream : public ResourceObj { void set_position(int pos) { _position = pos; } // printing - void print(const char* format, ...); - void print_cr(const char* format, ...); - void vprint(const char *format, va_list argptr); - void vprint_cr(const char* format, va_list argptr); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); + void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); void print_raw(const char* str) { write(str, strlen(str)); } void print_raw(const char* str, int len) { write(str, len); } void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); } @@ -274,10 +274,10 @@ class staticBufferStream : public outputStream { ~staticBufferStream() {}; virtual void write(const char* c, size_t len); void flush(); - void print(const char* format, ...); - void print_cr(const char* format, ...); - void vprint(const char *format, va_list argptr); - void vprint_cr(const char* format, va_list argptr); + void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); + void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0); }; // In the non-fixed buffer case an underlying buffer will be created and diff --git a/hotspot/src/share/vm/utilities/quickSort.cpp b/hotspot/src/share/vm/utilities/quickSort.cpp index 0cb7f6ef833..de008877989 100644 --- a/hotspot/src/share/vm/utilities/quickSort.cpp +++ b/hotspot/src/share/vm/utilities/quickSort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -77,7 +77,7 @@ void QuickSort::print_array(const char* prefix, int* array, int length) { for (int i = 0; i < length; i++) { tty->print(" %d", array[i]); } - tty->print_cr(""); + tty->cr(); } bool QuickSort::compare_arrays(int* actual, int* expected, int length) { diff --git a/hotspot/src/share/vm/utilities/taskqueue.cpp b/hotspot/src/share/vm/utilities/taskqueue.cpp index 2811c84d75d..a3daa8847b6 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.cpp +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -30,6 +30,8 @@ #include "utilities/stack.inline.hpp" #include "utilities/taskqueue.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + #ifdef TRACESPINNING uint ParallelTaskTerminator::_total_yields = 0; uint ParallelTaskTerminator::_total_spins = 0; diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index 097e28de9c5..62d8ba6b176 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -42,6 +42,8 @@ #include "utilities/top.hpp" #include "utilities/vmError.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // List of environment variables that should be reported in error log file. const char *env_list[] = { // All platforms @@ -358,17 +360,17 @@ void VMError::report(outputStream* st) { st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : "(mmap) failed to map "); jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); - st->print(buf); + st->print("%s", buf); st->print(" bytes"); if (_message != NULL) { st->print(" for "); - st->print(_message); + st->print("%s", _message); } st->cr(); } else { if (_message != NULL) st->print("# "); - st->print_cr(_message); + st->print_cr("%s", _message); } // In error file give some solutions if (_verbose) { @@ -485,7 +487,7 @@ void VMError::report(outputStream* st) { } else { st->print("Failed to write core dump. %s", coredump_message); } - st->print_cr(""); + st->cr(); st->print_cr("#"); STEP(65, "(printing bug submit message)") diff --git a/hotspot/src/share/vm/utilities/workgroup.cpp b/hotspot/src/share/vm/utilities/workgroup.cpp index 479cd04029a..beab5906f42 100644 --- a/hotspot/src/share/vm/utilities/workgroup.cpp +++ b/hotspot/src/share/vm/utilities/workgroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, 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 @@ -28,6 +28,8 @@ #include "runtime/os.hpp" #include "utilities/workgroup.hpp" +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + // Definitions of WorkGang methods. AbstractWorkGang::AbstractWorkGang(const char* name, diff --git a/hotspot/src/share/vm/utilities/xmlstream.cpp b/hotspot/src/share/vm/utilities/xmlstream.cpp index e6714e15a86..785f927b10e 100644 --- a/hotspot/src/share/vm/utilities/xmlstream.cpp +++ b/hotspot/src/share/vm/utilities/xmlstream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -336,6 +336,8 @@ void xmlStream::done_raw(const char* kind) { print_raw_cr(">"); } +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED // ------------------------------------------------------------------ void xmlStream::va_done(const char* format, va_list ap) { char buffer[200]; @@ -354,6 +356,7 @@ void xmlStream::va_done(const char* format, va_list ap) { buffer[kind_len] = 0; tail(buffer); } +PRAGMA_DIAG_POP // Output a timestamp attribute. void xmlStream::stamp() { @@ -399,7 +402,7 @@ void xmlStream::method_text(methodHandle method) { ResourceMark rm; assert_if_no_error(inside_attrs(), "printing attributes"); if (method.is_null()) return; - text()->print(method->method_holder()->external_name()); + text()->print("%s", method->method_holder()->external_name()); print_raw(" "); // " " is easier for tools to parse than "::" method->name()->print_symbol_on(text()); print_raw(" "); // separator diff --git a/hotspot/src/share/vm/utilities/xmlstream.hpp b/hotspot/src/share/vm/utilities/xmlstream.hpp index 7ab93744b27..22a12cacda3 100644 --- a/hotspot/src/share/vm/utilities/xmlstream.hpp +++ b/hotspot/src/share/vm/utilities/xmlstream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 @@ -80,7 +80,7 @@ class xmlStream : public outputStream { outputStream* out() { return _out; } // helpers for writing XML elements - void va_tag(bool push, const char* format, va_list ap); + void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); virtual void see_tag(const char* tag, bool push) NOT_DEBUG({}); virtual void pop_tag(const char* tag) NOT_DEBUG({}); @@ -109,29 +109,29 @@ class xmlStream : public outputStream { int unflushed_count() { return (int)(out()->count() - _last_flush); } // writing complete XML elements - void elem(const char* format, ...); - void begin_elem(const char* format, ...); - void end_elem(const char* format, ...); + void elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void begin_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void end_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void end_elem(); - void head(const char* format, ...); - void begin_head(const char* format, ...); - void end_head(const char* format, ...); + void head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void begin_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void end_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); void end_head(); - void done(const char* format, ...); // xxx_done event, plus tail + void done(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); // xxx_done event, plus tail void done_raw(const char * kind); void tail(const char* kind); // va_list versions - void va_elem(const char* format, va_list ap); - void va_begin_elem(const char* format, va_list ap); - void va_head(const char* format, va_list ap); - void va_begin_head(const char* format, va_list ap); - void va_done(const char* format, va_list ap); + void va_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_begin_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_begin_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); + void va_done(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); // write text (with quoting of special XML characters <>&'" etc.) outputStream* text() { return _text; } - void text(const char* format, ...); - void va_text(const char* format, va_list ap) { + void text(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + void va_text(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) { text()->vprint(format, ap); } From 6049e98a0e8b36f8e99dbceda12b19afcb0a7c6c Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Sun, 11 May 2014 16:35:43 -0700 Subject: [PATCH 062/185] 8038928: gc/g1/TestGCLogMessages.java fail with "[Evacuation Failure' Reviewed-by: ysr, brutisso, tschatzl --- hotspot/test/gc/g1/TestGCLogMessages.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java index 0d5ba41fac9..dbb617001ba 100644 --- a/hotspot/test/gc/g1/TestGCLogMessages.java +++ b/hotspot/test/gc/g1/TestGCLogMessages.java @@ -22,7 +22,7 @@ */ /* - * @test TestPrintGCDetails + * @test TestGCLogMessages * @bug 8035406 8027295 8035398 8019342 * @summary Ensure that the PrintGCDetails output for a minor GC with G1 * includes the expected necessary messages. @@ -90,12 +90,6 @@ public class TestGCLogMessages { output.shouldContain("[String Dedup Fixup"); output.shouldContain("[Young Free CSet"); output.shouldContain("[Non-Young Free CSet"); - - // also check evacuation failure messages once - output.shouldNotContain("[Evacuation Failure"); - output.shouldNotContain("[Recalculate Used"); - output.shouldNotContain("[Remove Self Forwards"); - output.shouldNotContain("[Restore RemSet"); output.shouldHaveExitValue(0); } From abd503efebbeac59b0d7dbb66e4bec1610463da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Borggr=C3=A9n-Franck?= Date: Mon, 12 May 2014 14:47:55 +0200 Subject: [PATCH 063/185] 8038994: AnnotatedType.getType() of a TypeVariable boundary without annotations return null Reviewed-by: psandoz --- .../annotation/TypeAnnotationParser.java | 13 +- .../lang/annotation/TypeVariableBounds.java | 129 ++++++++++++++++++ 2 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 jdk/test/java/lang/annotation/TypeVariableBounds.java diff --git a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java index 9bd4b6c64c6..8eab556fdee 100644 --- a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java +++ b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java @@ -75,7 +75,7 @@ public final class TypeAnnotationParser { if (ti.getTarget() == filter) l.add(t); } - TypeAnnotation[] typeAnnotations = l.toArray(new TypeAnnotation[0]); + TypeAnnotation[] typeAnnotations = l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY); return AnnotatedTypeFactory.buildAnnotatedType(type, LocationInfo.BASE_LOCATION, typeAnnotations, @@ -245,7 +245,6 @@ public final class TypeAnnotationParser { if (bounds != null) { int startIndex = 0; AnnotatedType[] res = new AnnotatedType[bounds.length]; - Arrays.fill(res, AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE); // Adjust bounds index // @@ -276,12 +275,12 @@ public final class TypeAnnotationParser { tInfo.getCount() == typeVarIndex) { l.add(t); } - res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i], - loc, - l.toArray(new TypeAnnotation[0]), - candidates.toArray(new TypeAnnotation[0]), - (AnnotatedElement)decl); } + res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i], + loc, + l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY), + candidates.toArray(EMPTY_TYPE_ANNOTATION_ARRAY), + (AnnotatedElement)decl); } return res; } diff --git a/jdk/test/java/lang/annotation/TypeVariableBounds.java b/jdk/test/java/lang/annotation/TypeVariableBounds.java new file mode 100644 index 00000000000..1a2e33ae396 --- /dev/null +++ b/jdk/test/java/lang/annotation/TypeVariableBounds.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2014, 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 8038994 + * @summary Test that getAnnotatedBounds().getType() match getBounds() + * @run testng TypeVariableBounds + */ + +import java.io.Serializable; +import java.lang.annotation.*; +import java.lang.reflect.*; +import java.util.concurrent.Callable; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +public class TypeVariableBounds { + @Test(dataProvider = "classData") + public void testClass(Class c) throws Exception { + assertNotEquals(c.getTypeParameters().length, 0); + + TypeVariable[] tv = c.getTypeParameters(); + + for(TypeVariable t : tv) + testTv(t); + + } + + @Test(dataProvider = "methodData") + public void testMethod(Classc) throws Exception { + Method m = c.getMethod("aMethod"); + TypeVariable[] tv = m.getTypeParameters(); + + for(TypeVariable t : tv) + testTv(t); + + } + + public void testTv(TypeVariable tv) { + Type[] t = tv.getBounds(); + AnnotatedType[] at = tv.getAnnotatedBounds(); + + assertEquals(t.length, at.length, Arrays.asList(t) + " and " + Arrays.asList(at) + " should be the same length"); + + for (int i = 0; i < t.length; i++) + assertSame(at[i].getType(), t[i], "T: " + t[i] + ", AT: " + at[i] + ", AT.getType(): " + at[i].getType() + "\n"); + } + + @DataProvider + public Object[][] classData() { return CLASS_TESTS; } + + @DataProvider + public Object[][] methodData() { return METHOD_TESTS; } + + public static final Object[][] CLASS_TESTS = { + { Case1.class, }, + { Case2.class, }, + { Case5.class, }, + { Case6.class, }, + }; + + public static final Object[][] METHOD_TESTS = { + { Case3.class, }, + { Case4.class, }, + { Case5.class, }, + { Case6.class, }, + }; + + // Class type var + public static class Case1 {} + public static class Case2 {} + + // Method type var + public static class Case3 { public void aMethod() {}} + public static class Case4 { public void aMethod() {}} + + // Both + public static class Case5 { + public + void aMethod() {}} + + public static class Case6 <@TA C6CT1, C6CT2 extends @TB Runnable> { + public <@TA C6MT1, + C6MT2 extends @TB AnnotatedElement, + C6MT3 extends @TB AnnotatedElement & @TB2 Type & Serializable, + C6MT4 extends @TB2 C6CT2> + void aMethod() {}} + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE_PARAMETER) + public @interface TA {} + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE_USE) + public @interface TB {} + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE_USE) + public @interface TB2 {} +} From 630cca22439b32a0b6721359af95e0322d70c0ef Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Mon, 12 May 2014 06:16:36 -0700 Subject: [PATCH 064/185] 8042804: Support invoking Hotspot tests from top level Reviewed-by: sla, erikj --- test/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Makefile b/test/Makefile index 08b91bf7f9c..7a66290318c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -33,6 +33,7 @@ TOPDIR=.. # This makefile depends on the availability of sibling directories. LANGTOOLS_DIR=$(TOPDIR)/langtools JDK_DIR=$(TOPDIR)/jdk +HOTSPOT_DIR=$(TOPDIR)/hotspot # Macro to run a test target in a subdir define SUBDIR_TEST # subdirectory target @@ -62,6 +63,9 @@ langtools_% : jdk_% core_%s svc_%: @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@) +hotspot_%: + @$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@) + ################################################################ # Phony targets (e.g. these are not filenames) From f8bbbb68e6ab3d40a712cc9cc568f593cce15c5d Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Mon, 12 May 2014 06:17:05 -0700 Subject: [PATCH 065/185] 8042804: Support invoking Hotspot tests from top level Reviewed-by: sla, erikj --- hotspot/test/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hotspot/test/Makefile b/hotspot/test/Makefile index f29ef326c1d..f81cc8d64df 100644 --- a/hotspot/test/Makefile +++ b/hotspot/test/Makefile @@ -147,6 +147,11 @@ BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} ) all: jtreg_tests @$(ECHO) "Testing completed successfully" +# Support "hotspot_" prefixed test make targets too +# The hotspot_% targets are for example invoked by the top level Makefile +hotspot_%: + $(MAKE) $* + # Prep for output prep: clean @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) From 693f28c0128dac5184f4e743c70467edb47869d8 Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Mon, 12 May 2014 09:59:56 -0400 Subject: [PATCH 066/185] 8039805: Fix the signature of the global new/delete operators in allocation.cpp Reviewed-by: dholmes, lfoltan --- hotspot/make/aix/makefiles/vm.make | 2 - hotspot/make/bsd/makefiles/vm.make | 3 -- hotspot/src/os/aix/vm/os_aix.cpp | 2 +- hotspot/src/os/aix/vm/porting_aix.cpp | 3 +- hotspot/src/share/vm/memory/allocation.cpp | 49 +++++++++++++++------- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/hotspot/make/aix/makefiles/vm.make b/hotspot/make/aix/makefiles/vm.make index 4cdb6d92e5a..b579babfffa 100644 --- a/hotspot/make/aix/makefiles/vm.make +++ b/hotspot/make/aix/makefiles/vm.make @@ -136,8 +136,6 @@ include $(MAKEFILES_DIR)/dtrace.make JVM = jvm LIBJVM = lib$(JVM).so -CFLAGS += -DALLOW_OPERATOR_NEW_USAGE - LIBJVM_DEBUGINFO = lib$(JVM).debuginfo LIBJVM_DIZ = lib$(JVM).diz diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make index 40a9d6594af..77dde8bc930 100644 --- a/hotspot/make/bsd/makefiles/vm.make +++ b/hotspot/make/bsd/makefiles/vm.make @@ -146,9 +146,6 @@ JVM = jvm ifeq ($(OS_VENDOR), Darwin) LIBJVM = lib$(JVM).dylib CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE - ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug)) - CFLAGS += -DALLOW_OPERATOR_NEW_USAGE - endif LIBJVM_DEBUGINFO = lib$(JVM).dylib.dSYM LIBJVM_DIZ = lib$(JVM).diz diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index 66a1fc0bbfd..f8b07db7bb5 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -1870,7 +1870,7 @@ public: // properties. // ShmBkBlock: base class for all blocks in the shared memory bookkeeping -class ShmBkBlock { +class ShmBkBlock : public CHeapObj { ShmBkBlock* _next; diff --git a/hotspot/src/os/aix/vm/porting_aix.cpp b/hotspot/src/os/aix/vm/porting_aix.cpp index b79d33d742c..5e6a78ddcc9 100644 --- a/hotspot/src/os/aix/vm/porting_aix.cpp +++ b/hotspot/src/os/aix/vm/porting_aix.cpp @@ -23,6 +23,7 @@ */ #include "asm/assembler.hpp" +#include "memory/allocation.hpp" #include "loadlib_aix.hpp" #include "porting_aix.hpp" #include "utilities/debug.hpp" @@ -67,7 +68,7 @@ inline char* align_ptr_up(char* ptr, intptr_t alignment) { // a primitive string map. Should this turn out to be a performance // problem, a better hashmap has to be used. class fixed_strings { - struct node { + struct node : public CHeapObj { char* v; node* next; }; diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index 9fece9b4ef4..a3ad5945775 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -686,40 +686,57 @@ void* Arena::internal_malloc_4(size_t x) { // a memory leak. Use CHeapObj as the base class of such objects to make it explicit // that they're allocated on the C heap. // Commented out in product version to avoid conflicts with third-party C++ native code. -// On certain platforms, such as Mac OS X (Darwin), in debug version, new is being called -// from jdk source and causing data corruption. Such as -// Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair -// define ALLOW_OPERATOR_NEW_USAGE for platform on which global operator new allowed. // -#ifndef ALLOW_OPERATOR_NEW_USAGE -void* operator new(size_t size) throw() { - assert(false, "Should not call global operator new"); +// In C++98/03 the throwing new operators are defined with the following signature: +// +// void* operator new(std::size_tsize) throw(std::bad_alloc); +// void* operator new[](std::size_tsize) throw(std::bad_alloc); +// +// while all the other (non-throwing) new and delete operators are defined with an empty +// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not +// throw any exceptions (see section 18.4 of the C++ standard). +// +// In the new C++11/14 standard, the signature of the throwing new operators was changed +// by completely omitting the throw clause (which effectively means they could throw any +// exception) while all the other new/delete operators where changed to have a 'nothrow' +// clause instead of an empty throw clause. +// +// Unfortunately, the support for exception specifications among C++ compilers is still +// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to +// override the default throwing new operator with a user operator with an empty throw() +// clause, the MS Visual C++ compiler warns for every non-empty throw clause like +// throw(std::bad_alloc) that it will ignore the exception specification. The following +// operator definitions have been checked to correctly work with all currently supported +// compilers and they should be upwards compatible with C++11/14. Therefore +// PLEASE BE CAREFUL if you change the signature of the following operators! + +void* operator new(size_t size) /* throw(std::bad_alloc) */ { + fatal("Should not call global operator new"); return 0; } -void* operator new [](size_t size) throw() { - assert(false, "Should not call global operator new[]"); +void* operator new [](size_t size) /* throw(std::bad_alloc) */ { + fatal("Should not call global operator new[]"); return 0; } void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() { - assert(false, "Should not call global operator new"); + fatal("Should not call global operator new"); return 0; } void* operator new [](size_t size, std::nothrow_t& nothrow_constant) throw() { - assert(false, "Should not call global operator new[]"); + fatal("Should not call global operator new[]"); return 0; } -void operator delete(void* p) { - assert(false, "Should not call global delete"); +void operator delete(void* p) throw() { + fatal("Should not call global delete"); } -void operator delete [](void* p) { - assert(false, "Should not call global delete []"); +void operator delete [](void* p) throw() { + fatal("Should not call global delete []"); } -#endif // ALLOW_OPERATOR_NEW_USAGE void AllocatedObj::print() const { print_on(tty); } void AllocatedObj::print_value() const { print_value_on(tty); } From 6e71a0cb82a7690c33660d0d2267b60889566c7c Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Mon, 12 May 2014 18:21:15 +0400 Subject: [PATCH 067/185] 8024932: [TEST_BUG] [macosx] javax/swing/text/StyledEditorKit/8016833/bug8016833.java failed Reviewed-by: serb, alexsch --- .../swing/text/StyledEditorKit/8016833/bug8016833.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java b/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java index 601a31de688..1dec0972346 100644 --- a/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java +++ b/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -190,9 +190,9 @@ public class bug8016833 { // not too wide assertTrue(out3.getWidth() * 0.8 < out2.getWidth()); // not too low - assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) < 3); + assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) < 4); // not too high - assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) > 0); + assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) > 0); } void testStrikthrough() { @@ -217,7 +217,7 @@ public class bug8016833 { // not too wide assertTrue(out3.getWidth() * 0.8 < out2.getWidth()); // not too low - assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) < 0); + assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) < 0); // not too high assertTrue(out3.getY() - out1.getY() > 1); } From 23759a15dd7dbfc19c41903a6011e0b42257b6d5 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 12 May 2014 17:09:26 +0100 Subject: [PATCH 068/185] 8042771: Missing bug id in test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java Reviewed-by: jjg --- .../attributes/SourceFile/NoSourceFileAttribute.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java index 835f801d209..90321ed2901 100644 --- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java +++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java @@ -24,10 +24,11 @@ /* * @test * @summary sourcefile attribute test for file compiled without debug information. + * @bug 8040129 * @library /tools/javac/lib ../lib * @build SourceFileTestBase TestBase InMemoryFileManager ToolBox * @compile -g:none NoSourceFileAttribute.java - * @run main NoSourceFileAttribute + * @run main NoSourceFileAttribute */ import com.sun.tools.classfile.Attribute; From a80118b3ae552c3306ffbe5399a79e4219bdf3f4 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 12 May 2014 09:32:23 -0700 Subject: [PATCH 069/185] 8038876: Remove use of ServiceLoader in finding class implementing sun.java2d.cmm.CMMServiceProvider Reviewed-by: bae, mchung --- jdk/make/CopyIntoClasses.gmk | 10 ------ jdk/make/profile-rtjar-includes.txt | 3 +- .../classes/sun/java2d/cmm/CMSManager.java | 36 ++++++++----------- .../sun.java2d.cmm.CMMServiceProvider | 2 -- 4 files changed, 15 insertions(+), 36 deletions(-) delete mode 100644 jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider diff --git a/jdk/make/CopyIntoClasses.gmk b/jdk/make/CopyIntoClasses.gmk index 322901603a3..b3a216fb90e 100644 --- a/jdk/make/CopyIntoClasses.gmk +++ b/jdk/make/CopyIntoClasses.gmk @@ -111,18 +111,8 @@ else ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share) endif -ifndef OPENJDK - ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF -endif - SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS))) -ifdef OPENJDK - SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) -else - SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) -endif - # The number of services files are relatively few. If the increase in numbers, then # we have to use ListPathsSafelyNow here. # Change $(JDK_TOPDIR)/src/.../META-INF/services/yyyy into $(JDK_OUTPUTDIR)/classes/META-INF/services/yyyy diff --git a/jdk/make/profile-rtjar-includes.txt b/jdk/make/profile-rtjar-includes.txt index 6cce159e400..061a927e616 100644 --- a/jdk/make/profile-rtjar-includes.txt +++ b/jdk/make/profile-rtjar-includes.txt @@ -241,5 +241,4 @@ FULL_JRE_INCLUDE_METAINF_SERVICES := \ META-INF/services/javax.sound.sampled.spi.AudioFileReader \ META-INF/services/javax.sound.sampled.spi.AudioFileWriter \ META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \ - META-INF/services/javax.sound.sampled.spi.MixerProvider \ - META-INF/services/sun.java2d.cmm.PCMM + META-INF/services/javax.sound.sampled.spi.MixerProvider diff --git a/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java b/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java index 6970c59a19c..6036a3c2636 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java +++ b/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java @@ -34,7 +34,6 @@ import java.awt.image.WritableRaster; import java.security.AccessController; import java.security.PrivilegedAction; import sun.security.action.GetPropertyAction; -import java.util.ServiceLoader; public class CMSManager { public static ColorSpace GRAYspace; // These two fields allow access @@ -52,35 +51,28 @@ public class CMSManager { return cmmImpl; } - CMMServiceProvider spi = AccessController.doPrivileged( - new PrivilegedAction() { - public CMMServiceProvider run() { - String cmmClass = System.getProperty( - "sun.java2d.cmm", "sun.java2d.cmm.lcms.LcmsServiceProvider"); - - ServiceLoader cmmLoader - = ServiceLoader.loadInstalled(CMMServiceProvider.class); - - CMMServiceProvider spi = null; - - for (CMMServiceProvider cmm : cmmLoader) { - spi = cmm; - if (cmm.getClass().getName().equals(cmmClass)) { - break; - } - } - return spi; + GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm"); + String cmmProviderClass = AccessController.doPrivileged(gpa); + CMMServiceProvider provider = null; + if (cmmProviderClass != null) { + try { + Class cls = Class.forName(cmmProviderClass); + provider = (CMMServiceProvider)cls.newInstance(); + } catch (ReflectiveOperationException e) { } - }); + } + if (provider == null) { + provider = new sun.java2d.cmm.lcms.LcmsServiceProvider(); + } - cmmImpl = spi.getColorManagementModule(); + cmmImpl = provider.getColorManagementModule(); if (cmmImpl == null) { throw new CMMException("Cannot initialize Color Management System."+ "No CM module found"); } - GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm.trace"); + gpa = new GetPropertyAction("sun.java2d.cmm.trace"); String cmmTrace = AccessController.doPrivileged(gpa); if (cmmTrace != null) { cmmImpl = new CMMTracer(cmmImpl); diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider b/jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider deleted file mode 100644 index ce7ea564ffb..00000000000 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider +++ /dev/null @@ -1,2 +0,0 @@ -# Little CMS color management module -sun.java2d.cmm.lcms.LcmsServiceProvider From 976e7c8aa70cde6bde4a9eaa6fdd7e9284739a67 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Mon, 12 May 2014 13:12:30 -0400 Subject: [PATCH 070/185] 8040292: Annotation attributes must not appear more than once Add checks for duplicate attributes. Reviewed-by: coleenp, lfoltan --- .../share/vm/classfile/classFileParser.cpp | 99 +- .../duplAttributes/DuplAttributes.jcod | 1310 +++++++++++++++++ .../duplAttributes/DuplAttributesTest.java | 63 + hotspot/test/runtime/duplAttributes/test.jar | Bin 0 -> 4478 bytes 4 files changed, 1452 insertions(+), 20 deletions(-) create mode 100644 hotspot/test/runtime/duplAttributes/DuplAttributes.jcod create mode 100644 hotspot/test/runtime/duplAttributes/DuplAttributesTest.java create mode 100644 hotspot/test/runtime/duplAttributes/test.jar diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 8d73c099a71..e78a6b2615f 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -875,6 +875,7 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count, int runtime_visible_type_annotations_length = 0; u1* runtime_invisible_type_annotations = NULL; int runtime_invisible_type_annotations_length = 0; + bool runtime_invisible_annotations_exists = false; bool runtime_invisible_type_annotations_exists = false; while (attributes_count--) { cfs->guarantee_more(6, CHECK); // attribute_name_index, attribute_length @@ -920,6 +921,10 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count, } generic_signature_index = cfs->get_u2(CHECK); } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { + if (runtime_visible_annotations != NULL) { + classfile_parse_error( + "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK); + } runtime_visible_annotations_length = attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); @@ -928,11 +933,18 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count, parsed_annotations, CHECK); cfs->skip_u1(runtime_visible_annotations_length, CHECK); - } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { - runtime_invisible_annotations_length = attribute_length; - runtime_invisible_annotations = cfs->get_u1_buffer(); - assert(runtime_invisible_annotations != NULL, "null invisible annotations"); - cfs->skip_u1(runtime_invisible_annotations_length, CHECK); + } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { + if (runtime_invisible_annotations_exists) { + classfile_parse_error( + "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK); + } + runtime_invisible_annotations_exists = true; + if (PreserveAllAnnotations) { + runtime_invisible_annotations_length = attribute_length; + runtime_invisible_annotations = cfs->get_u1_buffer(); + assert(runtime_invisible_annotations != NULL, "null invisible annotations"); + } + cfs->skip_u1(attribute_length, CHECK); } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { if (runtime_visible_type_annotations != NULL) { classfile_parse_error( @@ -2066,7 +2078,9 @@ methodHandle ClassFileParser::parse_method(bool is_interface, int runtime_visible_type_annotations_length = 0; u1* runtime_invisible_type_annotations = NULL; int runtime_invisible_type_annotations_length = 0; + bool runtime_invisible_annotations_exists = false; bool runtime_invisible_type_annotations_exists = false; + bool runtime_invisible_parameter_annotations_exists = false; u1* annotation_default = NULL; int annotation_default_length = 0; @@ -2295,6 +2309,10 @@ methodHandle ClassFileParser::parse_method(bool is_interface, cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index generic_signature_index = cfs->get_u2_fast(); } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { + if (runtime_visible_annotations != NULL) { + classfile_parse_error( + "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); + } runtime_visible_annotations_length = method_attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); @@ -2302,22 +2320,45 @@ methodHandle ClassFileParser::parse_method(bool is_interface, runtime_visible_annotations_length, &parsed_annotations, CHECK_(nullHandle)); cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle)); - } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { - runtime_invisible_annotations_length = method_attribute_length; - runtime_invisible_annotations = cfs->get_u1_buffer(); - assert(runtime_invisible_annotations != NULL, "null invisible annotations"); - cfs->skip_u1(runtime_invisible_annotations_length, CHECK_(nullHandle)); + } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { + if (runtime_invisible_annotations_exists) { + classfile_parse_error( + "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); + } + runtime_invisible_annotations_exists = true; + if (PreserveAllAnnotations) { + runtime_invisible_annotations_length = method_attribute_length; + runtime_invisible_annotations = cfs->get_u1_buffer(); + assert(runtime_invisible_annotations != NULL, "null invisible annotations"); + } + cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) { + if (runtime_visible_parameter_annotations != NULL) { + classfile_parse_error( + "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); + } runtime_visible_parameter_annotations_length = method_attribute_length; runtime_visible_parameter_annotations = cfs->get_u1_buffer(); assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations"); cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle)); - } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) { - runtime_invisible_parameter_annotations_length = method_attribute_length; - runtime_invisible_parameter_annotations = cfs->get_u1_buffer(); - assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations"); - cfs->skip_u1(runtime_invisible_parameter_annotations_length, CHECK_(nullHandle)); + } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) { + if (runtime_invisible_parameter_annotations_exists) { + classfile_parse_error( + "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); + } + runtime_invisible_parameter_annotations_exists = true; + if (PreserveAllAnnotations) { + runtime_invisible_parameter_annotations_length = method_attribute_length; + runtime_invisible_parameter_annotations = cfs->get_u1_buffer(); + assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations"); + } + cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); } else if (method_attribute_name == vmSymbols::tag_annotation_default()) { + if (annotation_default != NULL) { + classfile_parse_error( + "Multiple AnnotationDefault attributes for method in class file %s", + CHECK_(nullHandle)); + } annotation_default_length = method_attribute_length; annotation_default = cfs->get_u1_buffer(); assert(annotation_default != NULL, "null annotation default"); @@ -2846,6 +2887,8 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio u1* runtime_invisible_type_annotations = NULL; int runtime_invisible_type_annotations_length = 0; bool runtime_invisible_type_annotations_exists = false; + bool runtime_invisible_annotations_exists = false; + bool parsed_source_debug_ext_annotations_exist = false; u1* inner_classes_attribute_start = NULL; u4 inner_classes_attribute_length = 0; u2 enclosing_method_class_index = 0; @@ -2873,6 +2916,11 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio parse_classfile_sourcefile_attribute(CHECK); } else if (tag == vmSymbols::tag_source_debug_extension()) { // Check for SourceDebugExtension tag + if (parsed_source_debug_ext_annotations_exist) { + classfile_parse_error( + "Multiple SourceDebugExtension attributes in class file %s", CHECK); + } + parsed_source_debug_ext_annotations_exist = true; parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK); } else if (tag == vmSymbols::tag_inner_classes()) { // Check for InnerClasses tag @@ -2909,6 +2957,10 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio } parse_classfile_signature_attribute(CHECK); } else if (tag == vmSymbols::tag_runtime_visible_annotations()) { + if (runtime_visible_annotations != NULL) { + classfile_parse_error( + "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK); + } runtime_visible_annotations_length = attribute_length; runtime_visible_annotations = cfs->get_u1_buffer(); assert(runtime_visible_annotations != NULL, "null visible annotations"); @@ -2917,11 +2969,18 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio parsed_annotations, CHECK); cfs->skip_u1(runtime_visible_annotations_length, CHECK); - } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_annotations()) { - runtime_invisible_annotations_length = attribute_length; - runtime_invisible_annotations = cfs->get_u1_buffer(); - assert(runtime_invisible_annotations != NULL, "null invisible annotations"); - cfs->skip_u1(runtime_invisible_annotations_length, CHECK); + } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) { + if (runtime_invisible_annotations_exists) { + classfile_parse_error( + "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK); + } + runtime_invisible_annotations_exists = true; + if (PreserveAllAnnotations) { + runtime_invisible_annotations_length = attribute_length; + runtime_invisible_annotations = cfs->get_u1_buffer(); + assert(runtime_invisible_annotations != NULL, "null invisible annotations"); + } + cfs->skip_u1(attribute_length, CHECK); } else if (tag == vmSymbols::tag_enclosing_method()) { if (parsed_enclosingmethod_attribute) { classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK); diff --git a/hotspot/test/runtime/duplAttributes/DuplAttributes.jcod b/hotspot/test/runtime/duplAttributes/DuplAttributes.jcod new file mode 100644 index 00000000000..1a9a1ae8f4b --- /dev/null +++ b/hotspot/test/runtime/duplAttributes/DuplAttributes.jcod @@ -0,0 +1,1310 @@ +/* + * Copyright (c) 2014, 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. + */ + + +/* + * This file contains ten different sub-tests. Each sub-test consists of a + * class with a different case of an invalid duplicate attribute. The main + * test runs each of these tests individually. If any of them fail then the + * whole test fails. + */ + + + +/* + * This test contains a class with invalid duplicate AnnotationDefault attributes. + */ +class AnnotationDefaultDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "AnnotationDefault"; // #9 + Utf8 "LAnnotationDefaultI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "AnnotationDefaultDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "AnnotationDefaultDupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + ; + + Attr(#9) { // AnnotationDefault + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end AnnotationDefault + // wrong: + ; + Attr(#9) { // AnnotationDefault + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end AnnotationDefault + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // AnnotationDefault + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end AnnotationDefault + } // Attributes + +} // end class + + + +/* + * This test contains a class with invalid duplicate RuntimeInvisibleAnnotations + * attributes. + */ +class ClassInvisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "RuntimeInvisibleAnnotations"; // #9 + Utf8 "LClassInvisAnnotsI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "ClassInvisAnnotsDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "ClassInvisAnnotsDupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations +// wrong: + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations +// end wrong + } // Attributes + +} // end class + + + +/* + * This test contains a class with invalid duplicate RuntimeVisibleAnnotations + * attributes. + */ +class ClassVisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "RuntimeVisibleAnnotations"; // #9 + Utf8 "LClassVisAnnotsI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "ClassVisAnnotsDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "ClassVisAnnotsDupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations +// wrong: + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations +// end wrong + } // Attributes + +} // end class + + + +/* + * This test contains a field with invalid duplicate RuntimeInvisibleAnnotations + * attributes. + */ +class FieldInvisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #4 #16; // #1 + Method #17 #18; // #2 + class #19; // #3 + class #20; // #4 + Utf8 "fld"; // #5 + Utf8 "Ljava/util/ArrayList;"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/util/ArrayList;"; // #8 + Utf8 "RuntimeInvisibleAnnotations"; // #9 + Utf8 "LFieldInvisAnnotsI;"; // #10 + Utf8 ""; // #11 + Utf8 "()V"; // #12 + Utf8 "Code"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #11 #12; // #16 + class #21; // #17 + NameAndType #14 #15; // #18 + Utf8 "FieldInvisAnnotsDup"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "FieldInvisAnnotsDupChecker"; // #21 + } // Constant Pool + + 0x0021; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x0001; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations + // wrong: + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations + // end wrong + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0001; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80002AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + } // Attributes +} // end class + + + +/* + * This test contains a field with invalid duplicate RuntimeVisibleAnnotations + * attributes. + */ +class FieldVisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #4 #16; // #1 + Method #17 #18; // #2 + class #19; // #3 + class #20; // #4 + Utf8 "fld"; // #5 + Utf8 "Ljava/util/ArrayList;"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/util/ArrayList;"; // #8 + Utf8 "RuntimeVisibleAnnotations"; // #9 + Utf8 "LFieldVisAnnotsI;"; // #10 + Utf8 ""; // #11 + Utf8 "()V"; // #12 + Utf8 "Code"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #11 #12; // #16 + class #21; // #17 + NameAndType #14 #15; // #18 + Utf8 "FieldVisAnnotsDup"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "FieldVisAnnotsDupChecker"; // #21 + } // Constant Pool + + 0x0021; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + { // Member + 0x0001; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations + // wrong: + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations + // end wrong + } // Attributes + } // Member + } // fields + + [] { // methods + { // Member + 0x0001; // access + #11; // name_cpx + #12; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#13) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80002AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + } // Attributes +} // end class + + + +/* + * This test contains a method with invalid duplicate RuntimeInvisibleAnnotations + * attributes. + */ +class MethInvisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "RuntimeInvisibleAnnotations"; // #9 + Utf8 "LMethInvisAnnotsI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "MethInvisAnnotsDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "MethInvisAnnotsDupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + ; + + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations + // wrong: + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeInvisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeInvisibleAnnotations + } // Attributes + +} // end class + + + +/* + * This test contains a method with invalid duplicate + * RuntimeInvisibleParameterAnnotations attributes. + */ +class MethInvisParamAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #4 #16; // #1 + Method #17 #18; // #2 + class #19; // #3 + class #20; // #4 + Utf8 ""; // #5 + Utf8 "()V"; // #6 + Utf8 "Code"; // #7 + Utf8 "m"; // #8 + Utf8 "()I"; // #9 + Utf8 "Signature"; // #10 + Utf8 "()I"; // #11 + Utf8 "RuntimeInvisibleParameterAnnotations"; // #12 + Utf8 "LMethInvisParamAnnotsI;"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #5 #6; // #16 + class #21; // #17 + NameAndType #14 #15; // #18 + Utf8 "MethInvisParamAnnotsDup"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "MethInvisParamAnnotsDupChecker"; // #21 + } // Constant Pool + + 0x0021; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0001; // access + #8; // name_cpx + #9; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x03AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + ; + Attr(#10) { // Signature + #11; + } // end Signature + ; + Attr(#12) { // RuntimeInvisibleParameterAnnotations + 0x0001010000000D00; + 0x00; + } // end RuntimeInvisibleParameterAnnotations +// wrong: + ; + Attr(#12) { // RuntimeInvisibleParameterAnnotations + 0x0001010000000D00; + 0x00; + } // end RuntimeInvisibleParameterAnnotations +// end wrong + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80002AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + } // Attributes +} // end class + + + +/* + * This test contains a method with invalid duplicate RuntimeVisibleAnnotations + * attributes. + */ +class MethVisAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "RuntimeVisibleAnnotations"; // #9 + Utf8 "LMethodVisAnnotsDupI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "MethVisAnnotsDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "MethVisAnnotsDupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + ; + + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations + // wrong: + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // RuntimeVisibleAnnotations + [] { // type annotations + { // type annotation + 0x00; // target_type + 0x00; // type_parameter_index + []b { // type_path + } + + #10; // type_index + [] { // element_value_pairs + } // element_value_pairs + } // type annotation + } // type annotations + } // end RuntimeVisibleAnnotations + } // Attributes + +} // end class + + + +/* + * This test contains a method with invalid duplicate + * RuntimeVisibleParameterAnnotations attributes. + */ +class MethVisParamAnnotsDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #4 #16; // #1 + Method #17 #18; // #2 + class #19; // #3 + class #20; // #4 + Utf8 ""; // #5 + Utf8 "()V"; // #6 + Utf8 "Code"; // #7 + Utf8 "m"; // #8 + Utf8 "()I"; // #9 + Utf8 "Signature"; // #10 + Utf8 "()I"; // #11 + Utf8 "RuntimeVisibleParameterAnnotations"; // #12 + Utf8 "LMethVisParamAnnotsI;"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #5 #6; // #16 + class #21; // #17 + NameAndType #14 #15; // #18 + Utf8 "MethVisParamAnnotsDup"; // #19 + Utf8 "java/lang/Object"; // #20 + Utf8 "MethVisParamAnnotsDupChecker"; // #21 + } // Constant Pool + + 0x0021; // access + #3;// this_cpx + #4;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #5; // name_cpx + #6; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0001; // access + #8; // name_cpx + #9; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x03AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + ; + Attr(#10) { // Signature + #11; + } // end Signature + ; + Attr(#12) { // RuntimeVisibleParameterAnnotations + 0x0001010000000D00; + 0x00; + } // end RuntimeVisibleParameterAnnotations +// wrong: + ; + Attr(#12) { // RuntimeVisibleParameterAnnotations + 0x0001010000000D00; + 0x00; + } // end RuntimeVisibleParameterAnnotations +// end wrong + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#7) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80002AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + } // Attributes +} // end class + + + +/* + * This test contains a method with invalid duplicate SourceDebugExtension + * attributes. + */ +class SrcDbgExtDup { + 0xCAFEBABE; + 0; // minor version + 52; // version + [] { // Constant Pool + ; // first element is empty + Method #3 #11; // #1 + class #12; // #2 + class #13; // #3 + Utf8 ""; // #4 + Utf8 "()V"; // #5 + Utf8 "Code"; // #6 + Utf8 "Signature"; // #7 + Utf8 "Ljava/lang/Object;"; // #8 + Utf8 "SourceDebugExtension"; // #9 + Utf8 "LSrcDbgExtDupI;"; // #10 + NameAndType #4 #5; // #11 + Utf8 "SrcDbgExtDup"; // #12 + Utf8 "java/lang/Object"; // #13 + Utf8 "run"; // #14 + Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15 + NameAndType #14 #15; // #16 + class #19; // #17 + Method #17 #16; // #18 + Utf8 "SrcDbgExt_dupChecker"; // #19 + } // Constant Pool + + 0x0021; // access + #2;// this_cpx + #3;// super_cpx + + [] { // Interfaces + } // Interfaces + + [] { // fields + } // fields + + [] { // methods + { // Member + 0x0001; // access + #4; // name_cpx + #5; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 1; // max_stack + 1; // max_locals + Bytes[]{ + 0x2AB70001B1; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + ; + { // Member + 0x0009; // access + #14; // name_cpx + #15; // sig_cpx + [] { // Attributes + Attr(#6) { // Code + 2; // max_stack + 2; // max_locals + Bytes[]{ + 0x2A2BB80012AC; + }; + [] { // Traps + } // end Traps + [] { // Attributes + } // Attributes + } // end Code + } // Attributes + } // Member + } // methods + + [] { // Attributes + Attr(#7) { // Signature + #8; + } // end Signature + ; + Attr(#9) { // SourceDebugExtension + [] { // debug_extensions + { // type debug_extension + []b { // type_path + } + } // type debug_extension + } // type debug_extensions + } // end SourceDebugExtension +// wrong: + ; + Attr(#9) { // SourceDebugExtension + [] { // debug_extensions + { // type debug_extension + []b { // type_path + } + } // type debug_extension + } // type debug_extensions + } // end SourceDebugExtension +// end wrong + } // Attributes + +} // end class diff --git a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java new file mode 100644 index 00000000000..8b5235ebc01 --- /dev/null +++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2014, 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 8040292 + * @library /testlibrary + * @summary Throw exceptions when duplicate attributes are detected. + * @run main DuplAttributesTest + */ + +import java.io.File; +import com.oracle.java.testlibrary.*; + +public class DuplAttributesTest { + + static final String testsrc = System.getProperty("test.src"); + + public static void runTest(String test, String result) throws Throwable { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-cp", testsrc + File.separator + "test.jar", test); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("java.lang.ClassFormatError: Multiple " + result); + } + + public static void main(String args[]) throws Throwable { + System.out.println("Regression test for bug 8040292"); + + runTest("ClassInvisAnnotsDup", "RuntimeInvisibleAnnotations"); + runTest("ClassVisAnnotsDup", "RuntimeVisibleAnnotations"); + runTest("SrcDbgExtDup", "SourceDebugExtension"); + + runTest("FieldInvisAnnotsDup", "RuntimeInvisibleAnnotations"); + runTest("FieldVisAnnotsDup", "RuntimeVisibleAnnotations"); + + runTest("AnnotationDefaultDup", "AnnotationDefault"); + runTest("MethInvisAnnotsDup", "RuntimeInvisibleAnnotations"); + runTest("MethVisAnnotsDup", "RuntimeVisibleAnnotations"); + runTest("MethInvisParamAnnotsDup", "RuntimeInvisibleParameterAnnotations"); + runTest("MethVisParamAnnotsDup", "RuntimeVisibleParameterAnnotations"); + } +} + diff --git a/hotspot/test/runtime/duplAttributes/test.jar b/hotspot/test/runtime/duplAttributes/test.jar new file mode 100644 index 0000000000000000000000000000000000000000..af160708f17c8d8f97e6dee6f3138bd73fe4d189 GIT binary patch literal 4478 zcma)=c|4Ts`^U#Rwh={kB1NAu2aLf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#ni`tXQF|GahM z1V4tJWSb=Bz?d-ET%|^#c zH%se*WBQ)vzq+_N$wn{s^I7r$y1%u$o6~GG8$X|goAtLgZgY~2Etc*})*~4FdzZ2~ z%f`+@Z^!HL2>2`Ehu8U)!fj5qQ8wwVWsM-mMY90tK_D*RqX`s*A~*fp{{TMJzxn_G literal 0 HcmV?d00001 From 24cbe2a44dae6890d03f550e285811beab21ae20 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Mon, 12 May 2014 20:20:19 -0400 Subject: [PATCH 071/185] 8032551: Remove UsePPCLWSYNC from globals.hpp Reviewed-by: lfoltan, zgu --- hotspot/src/share/vm/runtime/globals.hpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index ae4cc4e2149..9674e267960 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -525,13 +525,6 @@ class CommandLineFlags { product_pd(bool, UseMembar, \ "(Unstable) Issues membars on thread state transitions") \ \ - /* Temp PPC Flag to allow disabling the use of lwsync on ppc platforms \ - * that don't support it. This will be replaced by processor detection \ - * logic. \ - */ \ - product(bool, UsePPCLWSYNC, true, \ - "Use lwsync instruction if true, else use slower sync") \ - \ develop(bool, CleanChunkPoolAsync, falseInEmbedded, \ "Clean the chunk pool asynchronously") \ \ From db84d6b169f3bf12b2d4c51881adfff8953c720a Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Tue, 13 May 2014 16:06:12 +0400 Subject: [PATCH 072/185] 8042007: Javadoc cleanup of javax.sound.sampled.spi package Reviewed-by: pchelko, bagiras --- .../sound/sampled/spi/AudioFileReader.java | 139 ++++++++------ .../sound/sampled/spi/AudioFileWriter.java | 106 +++++----- .../sampled/spi/FormatConversionProvider.java | 181 +++++++++--------- .../sound/sampled/spi/MixerProvider.java | 53 +++-- 4 files changed, 248 insertions(+), 231 deletions(-) diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java index 7829a900bf2..cc476452126 100644 --- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java +++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -35,7 +35,7 @@ import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; /** - * Provider for audio file reading services. Classes providing concrete + * Provider for audio file reading services. Classes providing concrete * implementations can parse the format information from one or more types of * audio file, and can produce audio input streams from files of these types. * @@ -45,93 +45,106 @@ import javax.sound.sampled.UnsupportedAudioFileException; public abstract class AudioFileReader { /** - * Obtains the audio file format of the input stream provided. The stream must - * point to valid audio file data. In general, audio file readers may + * Obtains the audio file format of the input stream provided. The stream + * must point to valid audio file data. In general, audio file readers may * need to read some data from the stream before determining whether they - * support it. These parsers must - * be able to mark the stream, read enough data to determine whether they - * support the stream, and, if not, reset the stream's read pointer to its original - * position. If the input stream does not support this, this method may fail - * with an IOException. - * @param stream the input stream from which file format information should be - * extracted - * @return an AudioFileFormat object describing the audio file format - * @throws UnsupportedAudioFileException if the stream does not point to valid audio - * file data recognized by the system + * support it. These parsers must be able to mark the stream, read enough + * data to determine whether they support the stream, and, if not, reset the + * stream's read pointer to its original position. If the input stream does + * not support this, this method may fail with an {@code IOException}. + * + * @param stream the input stream from which file format information should + * be extracted + * @return an {@code AudioFileFormat} object describing the audio file + * format + * @throws UnsupportedAudioFileException if the stream does not point to + * valid audio file data recognized by the system * @throws IOException if an I/O exception occurs * @see InputStream#markSupported * @see InputStream#mark */ - public abstract AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException; + public abstract AudioFileFormat getAudioFileFormat(InputStream stream) + throws UnsupportedAudioFileException, IOException; /** - * Obtains the audio file format of the URL provided. The URL must - * point to valid audio file data. - * @param url the URL from which file format information should be - * extracted - * @return an AudioFileFormat object describing the audio file format - * @throws UnsupportedAudioFileException if the URL does not point to valid audio - * file data recognized by the system + * Obtains the audio file format of the URL provided. The URL must point to + * valid audio file data. + * + * @param url the URL from which file format information should be + * extracted + * @return an {@code AudioFileFormat} object describing the audio file + * format + * @throws UnsupportedAudioFileException if the URL does not point to valid + * audio file data recognized by the system * @throws IOException if an I/O exception occurs */ - public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException; + public abstract AudioFileFormat getAudioFileFormat(URL url) + throws UnsupportedAudioFileException, IOException; /** - * Obtains the audio file format of the File provided. The File must - * point to valid audio file data. - * @param file the File from which file format information should be - * extracted - * @return an AudioFileFormat object describing the audio file format - * @throws UnsupportedAudioFileException if the File does not point to valid audio - * file data recognized by the system + * Obtains the audio file format of the {@code File} provided. + * The {@code File} must point to valid audio file data. + * + * @param file the {@code File} from which file format information + * should be extracted + * @return an {@code AudioFileFormat} object describing the audio file + * format + * @throws UnsupportedAudioFileException if the {@code File} does not point + * to valid audio file data recognized by the system * @throws IOException if an I/O exception occurs */ - public abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException; + public abstract AudioFileFormat getAudioFileFormat(File file) + throws UnsupportedAudioFileException, IOException; /** - * Obtains an audio input stream from the input stream provided. The stream must - * point to valid audio file data. In general, audio file readers may + * Obtains an audio input stream from the input stream provided. The stream + * must point to valid audio file data. In general, audio file readers may * need to read some data from the stream before determining whether they - * support it. These parsers must - * be able to mark the stream, read enough data to determine whether they - * support the stream, and, if not, reset the stream's read pointer to its original - * position. If the input stream does not support this, this method may fail - * with an IOException. - * @param stream the input stream from which the AudioInputStream should be - * constructed - * @return an AudioInputStream object based on the audio file data contained - * in the input stream. - * @throws UnsupportedAudioFileException if the stream does not point to valid audio - * file data recognized by the system + * support it. These parsers must be able to mark the stream, read enough + * data to determine whether they support the stream, and, if not, reset the + * stream's read pointer to its original position. If the input stream does + * not support this, this method may fail with an {@code IOException}. + * + * @param stream the input stream from which the {@code AudioInputStream} + * should be constructed + * @return an {@code AudioInputStream} object based on the audio file data + * contained in the input stream. + * @throws UnsupportedAudioFileException if the stream does not point to + * valid audio file data recognized by the system * @throws IOException if an I/O exception occurs * @see InputStream#markSupported * @see InputStream#mark */ - public abstract AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException; + public abstract AudioInputStream getAudioInputStream(InputStream stream) + throws UnsupportedAudioFileException, IOException; /** - * Obtains an audio input stream from the URL provided. The URL must - * point to valid audio file data. - * @param url the URL for which the AudioInputStream should be - * constructed - * @return an AudioInputStream object based on the audio file data pointed - * to by the URL - * @throws UnsupportedAudioFileException if the URL does not point to valid audio - * file data recognized by the system + * Obtains an audio input stream from the URL provided. The URL must point + * to valid audio file data. + * + * @param url the URL for which the {@code AudioInputStream} should be + * constructed + * @return an {@code AudioInputStream} object based on the audio file data + * pointed to by the URL + * @throws UnsupportedAudioFileException if the URL does not point to valid + * audio file data recognized by the system * @throws IOException if an I/O exception occurs */ - public abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException; + public abstract AudioInputStream getAudioInputStream(URL url) + throws UnsupportedAudioFileException, IOException; /** - * Obtains an audio input stream from the File provided. The File must - * point to valid audio file data. - * @param file the File for which the AudioInputStream should be - * constructed - * @return an AudioInputStream object based on the audio file data pointed - * to by the File - * @throws UnsupportedAudioFileException if the File does not point to valid audio - * file data recognized by the system + * Obtains an audio input stream from the {@code File} provided. + * The {@code File} must point to valid audio file data. + * + * @param file the {@code File} for which the {@code AudioInputStream} + * should be constructed + * @return an {@code AudioInputStream} object based on the audio file data + * pointed to by the File + * @throws UnsupportedAudioFileException if the {@code File} does not point + * to valid audio file data recognized by the system * @throws IOException if an I/O exception occurs */ - public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException; + public abstract AudioInputStream getAudioInputStream(File file) + throws UnsupportedAudioFileException, IOException; } diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java index 0207a3b7124..a4cc31bdf18 100644 --- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java +++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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,16 +26,15 @@ package javax.sound.sampled.spi; import java.io.File; -import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; -import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; +import static javax.sound.sampled.AudioFileFormat.Type; /** - * Provider for audio file writing services. Classes providing concrete + * Provider for audio file writing services. Classes providing concrete * implementations can write one or more types of audio file from an audio * stream. * @@ -47,22 +46,23 @@ public abstract class AudioFileWriter { /** * Obtains the file types for which file writing support is provided by this * audio file writer. - * @return array of file types. If no file types are supported, - * an array of length 0 is returned. + * + * @return array of file types. If no file types are supported, an array of + * length 0 is returned. */ - public abstract AudioFileFormat.Type[] getAudioFileTypes(); - + public abstract Type[] getAudioFileTypes(); /** - * Indicates whether file writing support for the specified file type is provided - * by this audio file writer. - * @param fileType the file type for which write capabilities are queried - * @return true if the file type is supported, - * otherwise false + * Indicates whether file writing support for the specified file type is + * provided by this audio file writer. + * + * @param fileType the file type for which write capabilities are queried + * @return {@code true} if the file type is supported, otherwise + * {@code false} */ - public boolean isFileTypeSupported(AudioFileFormat.Type fileType) { + public boolean isFileTypeSupported(Type fileType) { - AudioFileFormat.Type types[] = getAudioFileTypes(); + Type types[] = getAudioFileTypes(); for(int i=0; itrue if the file type is supported for this audio input stream, - * otherwise false + * Indicates whether an audio file of the type specified can be written from + * the audio input stream indicated. + * + * @param fileType file type for which write capabilities are queried + * @param stream for which file writing support is queried + * @return {@code true} if the file type is supported for this audio input + * stream, otherwise {@code false} */ - public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) { + public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) { - AudioFileFormat.Type types[] = getAudioFileTypes( stream ); + Type types[] = getAudioFileTypes( stream ); for(int i=0; i - * The source format represents the format of the incoming - * audio data, which will be converted. + * The source format represents the format of the incoming audio data, which + * will be converted. *

    - * The target format represents the format of the processed, converted - * audio data. This is the format of the data that can be read from - * the stream returned by one of the getAudioInputStream methods. + * The target format represents the format of the processed, converted audio + * data. This is the format of the data that can be read from the stream + * returned by one of the {@code getAudioInputStream} methods. * * @author Kara Kytle * @since 1.3 */ public abstract class FormatConversionProvider { - - // NEW METHODS - /** - * Obtains the set of source format encodings from which format - * conversion services are provided by this provider. + * Obtains the set of source format encodings from which format conversion + * services are provided by this provider. + * * @return array of source format encodings. If for some reason provider - * does not provide any conversion services, an array of length 0 is - * returned. + * does not provide any conversion services, an array of length 0 is + * returned. */ - public abstract AudioFormat.Encoding[] getSourceEncodings(); - + public abstract Encoding[] getSourceEncodings(); /** - * Obtains the set of target format encodings to which format - * conversion services are provided by this provider. + * Obtains the set of target format encodings to which format conversion + * services are provided by this provider. + * * @return array of target format encodings. If for some reason provider - * does not provide any conversion services, an array of length 0 is - * returned. + * does not provide any conversion services, an array of length 0 is + * returned. */ - public abstract AudioFormat.Encoding[] getTargetEncodings(); - + public abstract Encoding[] getTargetEncodings(); /** * Indicates whether the format converter supports conversion from the * specified source format encoding. - * @param sourceEncoding the source format encoding for which support is queried - * @return true if the encoding is supported, otherwise false + * + * @param sourceEncoding the source format encoding for which support is + * queried + * @return {@code true} if the encoding is supported, otherwise + * {@code false} */ - public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){ + public boolean isSourceEncodingSupported(Encoding sourceEncoding) { - AudioFormat.Encoding sourceEncodings[] = getSourceEncodings(); + Encoding sourceEncodings[] = getSourceEncodings(); for(int i=0; itrue if the encoding is supported, otherwise false + * + * @param targetEncoding the target format encoding for which support is + * queried + * @return {@code true} if the encoding is supported, otherwise + * {@code false} */ - public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){ + public boolean isTargetEncodingSupported(Encoding targetEncoding) { - AudioFormat.Encoding targetEncodings[] = getTargetEncodings(); + Encoding targetEncodings[] = getTargetEncodings(); for(int i=0; itrue if the conversion is supported, otherwise false + * Indicates whether the format converter supports conversion to a + * particular encoding from a particular format. + * + * @param targetEncoding desired encoding of the outgoing data + * @param sourceFormat format of the incoming data + * @return {@code true} if the conversion is supported, otherwise + * {@code false} */ - public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){ + public boolean isConversionSupported(Encoding targetEncoding, + AudioFormat sourceFormat) { - AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat); + Encoding targetEncodings[] = getTargetEncodings(sourceFormat); for(int i=0; itrue if the conversion is supported, otherwise false + * + * @param targetFormat desired format of outgoing data + * @param sourceFormat format of the incoming data + * @return {@code true} if the conversion is supported, otherwise + * {@code false} */ - public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){ + public boolean isConversionSupported(AudioFormat targetFormat, + AudioFormat sourceFormat) { AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat ); @@ -173,28 +177,33 @@ public abstract class FormatConversionProvider { return false; } + /** + * Obtains an audio input stream with the specified encoding from the given + * audio input stream. + * + * @param targetEncoding desired encoding of the stream after processing + * @param sourceStream stream from which data to be processed should be + * read + * @return stream from which processed data with the specified target + * encoding may be read + * @throws IllegalArgumentException if the format combination supplied is + * not supported. + */ + public abstract AudioInputStream getAudioInputStream( + Encoding targetEncoding, AudioInputStream sourceStream); /** - * Obtains an audio input stream with the specified encoding from the given audio - * input stream. - * @param targetEncoding desired encoding of the stream after processing - * @param sourceStream stream from which data to be processed should be read - * @return stream from which processed data with the specified target encoding may be read + * Obtains an audio input stream with the specified format from the given + * audio input stream. + * + * @param targetFormat desired data format of the stream after processing + * @param sourceStream stream from which data to be processed should be + * read + * @return stream from which processed data with the specified format may be + * read * @throws IllegalArgumentException if the format combination supplied is - * not supported. + * not supported. */ - public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream); - - - /** - * Obtains an audio input stream with the specified format from the given audio - * input stream. - * @param targetFormat desired data format of the stream after processing - * @param sourceStream stream from which data to be processed should be read - * @return stream from which processed data with the specified format may be read - * @throws IllegalArgumentException if the format combination supplied is - * not supported. - */ - public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream); - + public abstract AudioInputStream getAudioInputStream( + AudioFormat targetFormat, AudioInputStream sourceStream); } diff --git a/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java b/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java index d1167c0b8a6..638de86b320 100644 --- a/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java +++ b/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -28,28 +28,27 @@ package javax.sound.sampled.spi; import javax.sound.sampled.Mixer; /** - * A provider or factory for a particular mixer type. - * This mechanism allows the implementation to determine - * how resources are managed in creation / management of - * a mixer. + * A provider or factory for a particular mixer type. This mechanism allows the + * implementation to determine how resources are managed in creation / + * management of a mixer. * * @author Kara Kytle * @since 1.3 */ public abstract class MixerProvider { - /** * Indicates whether the mixer provider supports the mixer represented by * the specified mixer info object. *

    - * The full set of mixer info objects that represent the mixers supported - * by this {@code MixerProvider} may be obtained - * through the {@code getMixerInfo} method. + * The full set of mixer info objects that represent the mixers supported by + * this {@code MixerProvider} may be obtained through the + * {@code getMixerInfo} method. * - * @param info an info object that describes the mixer for which support is queried - * @return {@code true} if the specified mixer is supported, - * otherwise {@code false} + * @param info an info object that describes the mixer for which support is + * queried + * @return {@code true} if the specified mixer is supported, otherwise + * {@code false} * @see #getMixerInfo() */ public boolean isMixerSupported(Mixer.Info info) { @@ -64,38 +63,34 @@ public abstract class MixerProvider { return false; } - /** - * Obtains the set of info objects representing the mixer - * or mixers provided by this MixerProvider. + * Obtains the set of info objects representing the mixer or mixers provided + * by this MixerProvider. *

    - * The {@code isMixerSupported} method returns {@code true} - * for all the info objects returned by this method. - * The corresponding mixer instances for the info objects - * are returned by the {@code getMixer} method. + * The {@code isMixerSupported} method returns {@code true} for all the info + * objects returned by this method. The corresponding mixer instances for + * the info objects are returned by the {@code getMixer} method. * * @return a set of mixer info objects - * @see #getMixer(javax.sound.sampled.Mixer.Info) getMixer(Mixer.Info) - * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info) + * @see #getMixer(Mixer.Info) + * @see #isMixerSupported(Mixer.Info) */ public abstract Mixer.Info[] getMixerInfo(); - /** * Obtains an instance of the mixer represented by the info object. *

    * The full set of the mixer info objects that represent the mixers - * supported by this {@code MixerProvider} may be obtained - * through the {@code getMixerInfo} method. - * Use the {@code isMixerSupported} method to test whether - * this {@code MixerProvider} supports a particular mixer. + * supported by this {@code MixerProvider} may be obtained through the + * {@code getMixerInfo} method. Use the {@code isMixerSupported} method to + * test whether this {@code MixerProvider} supports a particular mixer. * - * @param info an info object that describes the desired mixer + * @param info an info object that describes the desired mixer * @return mixer instance * @throws IllegalArgumentException if the info object specified does not - * match the info object for a mixer supported by this MixerProvider. + * match the info object for a mixer supported by this MixerProvider * @see #getMixerInfo() - * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info) + * @see #isMixerSupported(Mixer.Info) */ public abstract Mixer getMixer(Mixer.Info info); } From a89eab1dc79148333e7a713f9f4c48b5188591c6 Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Wed, 14 May 2014 18:19:14 +0400 Subject: [PATCH 073/185] 6945174: IndexOutOfBoundsException calling ImageIO.read() on malformed PNG Reviewed-by: prr, serb --- .../imageio/plugins/png/PNGImageReader.java | 8 +- .../plugins/png/ReadMalformedPngTest.java | 160 ++++++++++++++++++ 2 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/imageio/plugins/png/ReadMalformedPngTest.java diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java index 13f2d9349d0..3b2a081d860 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java @@ -664,6 +664,12 @@ public class PNGImageReader extends ImageReader { try { while (true) { int chunkLength = stream.readInt(); + + // verify the chunk length first + if (chunkLength < 0 || chunkLength + 4 < 0) { + throw new IIOException("Invalid chunk length " + chunkLength); + } + int chunkType = stream.readInt(); if (chunkType == IDAT_TYPE) { @@ -692,7 +698,7 @@ public class PNGImageReader extends ImageReader { // verify the chunk length if (chunkLength < 0) { - throw new IIOException("Invalid chunk lenght " + chunkLength); + throw new IIOException("Invalid chunk length " + chunkLength); }; try { diff --git a/jdk/test/javax/imageio/plugins/png/ReadMalformedPngTest.java b/jdk/test/javax/imageio/plugins/png/ReadMalformedPngTest.java new file mode 100644 index 00000000000..7aadebc627b --- /dev/null +++ b/jdk/test/javax/imageio/plugins/png/ReadMalformedPngTest.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2014, 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 6945174 + * @summary Test verifies that PNG image readr throw correct exception + * if image contains a chunk with incorrect length. + * @run main ReadMalformedPngTest + */ + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import javax.imageio.IIOException; +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.metadata.IIOMetadataNode; +import javax.imageio.stream.ImageOutputStream; +import org.w3c.dom.Node; + +public class ReadMalformedPngTest { + + public static void main(String[] args) throws IOException { + ByteArrayInputStream bais = new ByteArrayInputStream(createTestPng()); + + IIOException expected = null; + try { + ImageIO.read(bais); + } catch (IIOException e) { + expected = e; + } catch (Throwable e) { + throw new RuntimeException("Test failed!", e); + } + + if (expected == null) { + throw new RuntimeException("Test failed."); + } + + System.out.println("Test passed."); + } + + private static byte[] createTestPng() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + BufferedImage img = createTestImage(); + + try { + ImageOutputStream ios = ImageIO.createImageOutputStream(baos); + + ImageWriter w = ImageIO.getImageWritersByFormatName("PNG").next(); + + w.setOutput(ios); + + ImageWriteParam p = w.getDefaultWriteParam(); + + ImageTypeSpecifier t = ImageTypeSpecifier.createFromRenderedImage(img); + + IIOMetadata m = w.getDefaultImageMetadata(t, p); + + String nativeMetadataFormat = m.getNativeMetadataFormatName(); + + Node root = m.getAsTree(nativeMetadataFormat); + + IIOMetadataNode textEntry = new IIOMetadataNode("tEXtEntry"); + textEntry.setAttribute("keyword", "comment"); + textEntry.setAttribute("value", "This is a test image for JDK-6945174"); + + IIOMetadataNode text = new IIOMetadataNode("tEXt"); + text.appendChild(textEntry); + + root.appendChild(text); + + m.mergeTree(nativeMetadataFormat, root); + + IIOImage iio_img = new IIOImage(img, null, m); + + w.write(iio_img); + + w.dispose(); + ios.flush(); + ios.close(); + } catch (IOException e) { + throw new RuntimeException("Test failed.", e); + } + + baos.flush(); + + byte[] data = baos.toByteArray(); + + adjustCommentLength(Integer.MAX_VALUE + 0x1000, data); + + return data; + } + + private static void adjustCommentLength(int v, byte[] data) { + final int pos = getCommentPos(data); + data[pos + 3] = (byte) (v & 0xFF); + v = v >> 8; + data[pos + 2] = (byte) (v & 0xFF); + v = v >> 8; + data[pos + 1] = (byte) (v & 0xFF); + v = v >> 8; + data[pos + 0] = (byte) (v & 0xFF); + } + + private static int getCommentPos(byte[] d) { + int p = 8; + while (p + 8 < d.length) { + if (d[p + 4] == (byte) 0x74 && d[p + 5] == (byte) 0x45 && + d[p + 6] == (byte) 0x58 && d[p + 7] == (byte) 0x74) + { + return p; + } + p++; + } + throw new RuntimeException("Test chunk was not found!"); + } + + private static BufferedImage createTestImage() { + final int w = 128; + final int h = 128; + + BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR); + Graphics2D g = img.createGraphics(); + g.setPaint(new GradientPaint(0, 0, Color.blue, + w, h, Color.red)); + g.fillRect(0, 0, w, h); + g.dispose(); + return img; + } +} From 9aa0cef64a155a41e673b1e6ed4c671b5e60eb53 Mon Sep 17 00:00:00 2001 From: Oleg Pekhovskiy Date: Thu, 15 May 2014 20:09:38 +0400 Subject: [PATCH 074/185] 8014755: [TEST_BUG] frames didn't closed after execution some awt/dnd/ tests Reviewed-by: serb, pchelko --- .../DragInterceptorAppletTest.html | 48 ++ .../DragInterceptorAppletTest.java | 154 ++++++ .../DragInterceptorFrame.java | 128 +++++ .../InterprocessMessages.java | 32 ++ .../SourceFrame.java | 68 +++ .../InterJVMGetDropSuccessTest.html | 43 ++ .../InterJVMGetDropSuccessTest.java | 499 ++++++++++++++++++ .../NoFormatsCrashTest.html | 45 ++ .../NoFormatsCrashTest.java | 488 +++++++++++++++++ .../process/ProcessCommunicator.java | 62 ++- 10 files changed, 1545 insertions(+), 22 deletions(-) create mode 100644 jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html create mode 100644 jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java create mode 100644 jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java create mode 100644 jdk/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java create mode 100644 jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java create mode 100644 jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html create mode 100644 jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java create mode 100644 jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html create mode 100644 jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java diff --git a/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html new file mode 100644 index 00000000000..7d4a3a5a774 --- /dev/null +++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html @@ -0,0 +1,48 @@ + + + + + + Unsigned applet can retrieve the dragged information before drop action occurs + + + +

    DragInterceptorAppletTest
    Bug ID: 6887703

    + +

    This is an AUTOMATIC test, simply wait for completion

    + + + + diff --git a/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java new file mode 100644 index 00000000000..5f70e2de35b --- /dev/null +++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2007, 2014, 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 6887703 + @summary Unsigned applet can retrieve the dragged information before drop action occurs + @author : area=dnd + @run applet DragInterceptorAppletTest.html +*/ + +/** + * DragInterceptorAppletTest.java + * + * summary: Unsigned applet can retrieve the dragged information before drop action occurs + */ + +import static java.lang.Thread.sleep; + +import test.java.awt.regtesthelpers.process.ProcessCommunicator; +import test.java.awt.regtesthelpers.process.ProcessResults; +import test.java.awt.regtesthelpers.Util; +import java.applet.Applet; +import java.awt.*; +import java.awt.event.InputEvent; + +public class DragInterceptorAppletTest extends Applet { + + public void init() { + setLayout(new BorderLayout()); + }//End init() + + public void start() { + + SourceFrame sourceFrame = new SourceFrame(); + + Util.waitForIdle(null); + + String [] args = new String [] { + String.valueOf(sourceFrame.getNextLocationX()), + String.valueOf(sourceFrame.getNextLocationY()), + String.valueOf(sourceFrame.getDragSourcePointX()), + String.valueOf(sourceFrame.getDragSourcePointY()), + }; + String classpath = System.getProperty("java.class.path"); + ProcessResults processResults = + ProcessCommunicator.executeChildProcess(this.getClass(),classpath,args); + + verifyTestResults(processResults); + + }// start() + + private static void verifyTestResults(ProcessResults processResults) { + + switch (processResults.getExitValue()) { + case InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED: + processResults.printProcessErrorOutput(System.err); + throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " + + "without a clipboard permission and an exception handler was not triggered."); + //Unreachable... + + case InterprocessMessages.DATA_WAS_INTERCEPTED: + processResults.printProcessErrorOutput(System.err); + throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " + + "without a clipboard permission"); + //Unreachable... + + case InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED: + processResults.printProcessErrorOutput(System.err); + throw new RuntimeException("TEST IS FAILED: An exception handler was not triggered."); + //Unreachable... + + } + + // The child process throws an exception. do not look at the stderr. + processResults.verifyStdErr(System.err); + processResults.verifyProcessExitValue(System.err); + processResults.printProcessStandartOutput(System.out); + } + + //We cannot make an instance of the applet without the default constructor + public DragInterceptorAppletTest() { + super(); + } + + //We need in this constructor to pass frame position between JVMs + public DragInterceptorAppletTest(Point targetFrameLocation, Point dragSourcePoint) + throws InterruptedException + { + DragInterceptorFrame targetFrame = new DragInterceptorFrame(targetFrameLocation); + + Util.waitForIdle(null); + + final Robot robot = Util.createRobot(); + + robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY()); + sleep(100); + robot.mousePress(InputEvent.BUTTON1_MASK); + sleep(100); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + sleep(100); + + Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), + InputEvent.BUTTON1_MASK); + + sleep(2000); + ProcessCommunicator.destroyProcess(); + } + + enum InterprocessArguments { + TARGET_FRAME_X_POSITION_ARGUMENT, + TARGET_FRAME_Y_POSITION_ARGUMENT, + DRAG_SOURCE_POINT_X_ARGUMENT, + DRAG_SOURCE_POINT_Y_ARGUMENT; + + int extract (String [] args) { + return Integer.parseInt(args[this.ordinal()]); + } + } + + public static void main (String [] args) { + Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args), + InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args)); + Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args), + InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args)); + try { + new DragInterceptorAppletTest(targetFrameLocation, dragSourcePoint); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + +}// class DragInterceptorAppletTest diff --git a/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java new file mode 100644 index 00000000000..69d4a014ba9 --- /dev/null +++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2007, 2014, 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. + */ + +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.dnd.*; +import java.io.IOException; +import java.security.Permission; +import java.security.AccessControlException; + +class DragInterceptorFrame extends Frame implements DropTargetListener { + + private static int exitMessage = InterprocessMessages.TEST_PASSED; + private static boolean dataIsAccessible = false; + private static boolean exceptionHasBeenThrown = false; + + DragInterceptorFrame(Point location) { + System.setSecurityManager(new ClipboardDefender()); + initGUI(location); + setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY, + this)); + } + + private void initGUI(Point location) { + this.setLocation(location); + this.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + DragInterceptorFrame.this.dispose(); + } + }); + setSize (200, 200); + this.setVisible(true); + } + + public void dragEnter(DropTargetDragEvent dtde) { + // We want to set the exception handler on EDT + Thread.currentThread().setUncaughtExceptionHandler ( + new Thread.UncaughtExceptionHandler() { + public void uncaughtException(Thread t, Throwable e) { + exceptionHasBeenThrown = true; + } + } + ); + examineTransferable(dtde); + } + + public void dragOver(DropTargetDragEvent dtde) { + examineTransferable(dtde); + } + + public void dropActionChanged(DropTargetDragEvent dtde) { + examineTransferable(dtde); + } + + public void dragExit(DropTargetEvent dte) {} + + public void drop(DropTargetDropEvent dtde) { + + if (dataIsAccessible && !exceptionHasBeenThrown) { + exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED; + } else if (dataIsAccessible) { + exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED; + } else if (!exceptionHasBeenThrown) { + exitMessage = InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED; + } + + // This returns the diagnostic code from the child VM + System.exit(exitMessage); + } + + Point getDropTargetPoint() { + return new Point((int)getLocationOnScreen().getX()+(getWidth()/2), + (int)getLocationOnScreen().getY()+(getHeight()/2)); + } + + private void examineTransferable(DropTargetDragEvent dtde) { + if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.stringFlavor)) { + dtde.acceptDrag(DnDConstants.ACTION_COPY); + try{ + if (null != dtde.getTransferable().getTransferData(DataFlavor.stringFlavor)) { + dataIsAccessible = true; + } + } catch (IOException e) { + e.printStackTrace(); + exitMessage = InterprocessMessages.UNEXPECTED_IO_EXCEPTION; + } catch (UnsupportedFlavorException e) { + e.printStackTrace(); + exitMessage = InterprocessMessages.UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION; + } + } + } + + static class ClipboardDefender extends SecurityManager { + public void checkPermission(Permission p) { + if (p instanceof java.awt.AWTPermission && + p.getName().equals("accessClipboard")) { + throw new AccessControlException("access denied "); + } + } + } + + public static void main(String[] args) { + new DragInterceptorFrame(new Point(200,200)); + } +} diff --git a/jdk/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java new file mode 100644 index 00000000000..6506565cd05 --- /dev/null +++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2007, 2014, 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. + */ + +public interface InterprocessMessages { + final static int TEST_PASSED = 0; + final static int DATA_WAS_INTERCEPTED = 212; + final static int EXCEPTION_HANDLER_WAS_NOT_TRIGGERED = 213; + final static int DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED = 214; + + final static int UNEXPECTED_IO_EXCEPTION = 400; + final static int UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION = 401; +} diff --git a/jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java new file mode 100644 index 00000000000..7a7c833b91a --- /dev/null +++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2007, 2014, 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. + */ + +import test.java.awt.regtesthelpers.Util; + +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; + +class SourceFrame extends Frame implements DragGestureListener { + + SourceFrame() { + super("Source File List Frame"); + initGUI(); + new DragSource().createDefaultDragGestureRecognizer(this, + DnDConstants.ACTION_COPY,this); + } + + private void initGUI() { + this.addWindowListener(Util.getClosingWindowAdapter()); + this.setLocation(300,250); + this.setSize(200,200); + this.setVisible(true); + } + + int getNextLocationX() { + return getX()+getWidth(); + } + + int getNextLocationY() { + return getY(); + } + + int getDragSourcePointX() { + return (int)getLocationOnScreen().getX()+(getWidth()/2); + } + + int getDragSourcePointY() { + return (int)getLocationOnScreen().getY()+ (getHeight()/2); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, new StringSelection("A TEXT")); + } +} diff --git a/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html new file mode 100644 index 00000000000..2b3aa7aa60c --- /dev/null +++ b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html @@ -0,0 +1,43 @@ + + + + + + + + + +

    InterJVMGetDropSuccessTest
    Bug ID: 4658741

    + +

    This is an AUTOMATIC test, simply wait for completion

    + + + + diff --git a/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java new file mode 100644 index 00000000000..9307fa26df5 --- /dev/null +++ b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2014, 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 4658741 + @summary verifies that getDropSuccess() returns correct value for inter-JVM DnD + @author das@sparc.spb.su area=dnd + @run applet InterJVMGetDropSuccessTest.html +*/ + +// Note there is no @ in front of test above. This is so that the +// harness will not mistake this file as a test file. It should +// only see the html file as a test file. (the harness runs all +// valid test files, so it would run this test twice if this file +// were valid as well as the html file.) +// Also, note the area= after Your Name in the author tag. Here, you +// should put which functional area the test falls in. See the +// AWT-core home page -> test areas and/or -> AWT team for a list of +// areas. +// Note also the 'InterJVMGetDropSuccessTest.html' in the run tag. This should +// be changed to the name of the test. + + +/** + * InterJVMGetDropSuccessTest.java + * + * summary: verifies that getDropSuccess() returns correct value for inter-JVM DnD + */ + +import java.applet.Applet; +import java.awt.*; +import java.awt.datatransfer.*; +import java.awt.dnd.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; + + +//Automated tests should run as applet tests if possible because they +// get their environments cleaned up, including AWT threads, any +// test created threads, and any system resources used by the test +// such as file descriptors. (This is normally not a problem as +// main tests usually run in a separate VM, however on some platforms +// such as the Mac, separate VMs are not possible and non-applet +// tests will cause problems). Also, you don't have to worry about +// synchronisation stuff in Applet tests they way you do in main +// tests... + + +public class InterJVMGetDropSuccessTest extends Applet { + + private int returnCode = Util.CODE_NOT_RETURNED; + private boolean successCodes[] = { true, false }; + private int dropCount = 0; + + final Frame frame = new Frame("Target Frame"); + + final DropTargetListener dropTargetListener = new DropTargetAdapter() { + public void drop(DropTargetDropEvent dtde) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + dtde.dropComplete(successCodes[dropCount]); + dropCount++; + } + }; + final DropTarget dropTarget = new DropTarget(frame, dropTargetListener); + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + + String[] instructions = + { + "This is an AUTOMATIC test", + "simply wait until it is done" + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + frame.setTitle("Test frame"); + frame.setBounds(100, 100, 150, 150); + } // init() + + public void start() { + + frame.setVisible(true); + + try { + Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT); + + Point p = frame.getLocationOnScreen(); + Dimension d = frame.getSize(); + + String javaPath = System.getProperty("java.home", ""); + String command = javaPath + File.separator + "bin" + + File.separator + "java -cp " + System.getProperty("test.classes", ".") + + " Child " + + p.x + " " + p.y + " " + d.width + " " + d.height; + + Process process = Runtime.getRuntime().exec(command); + returnCode = process.waitFor(); + + InputStream errorStream = process.getErrorStream(); + int count = errorStream.available(); + if (count > 0) { + byte[] b = new byte[count]; + errorStream.read(b); + System.err.println("========= Child VM System.err ========"); + System.err.print(new String(b)); + System.err.println("======================================"); + } + + InputStream outputStream = process.getInputStream(); + count = outputStream.available(); + if (count > 0) { + byte[] b = new byte[count]; + outputStream.read(b); + System.err.println("========= Child VM System.out ========"); + System.err.print(new String(b)); + System.err.println("======================================"); + } + } catch (Throwable e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + switch (returnCode) { + case Util.CODE_NOT_RETURNED: + throw new RuntimeException("Child VM: failed to start"); + case Util.CODE_FAILURE: + throw new RuntimeException("Child VM: abnormal termination"); + default: + if (dropCount == 2) { + int expectedRetCode = 0; + if (successCodes[0]) { + expectedRetCode |= Util.CODE_FIRST_SUCCESS; + } + if (successCodes[1]) { + expectedRetCode |= Util.CODE_SECOND_SUCCESS; + } + if (expectedRetCode != returnCode) { + throw new RuntimeException("The test failed. Expected:" + + expectedRetCode + ". Returned:" + + returnCode); + } + } + break; + } + } // start() +} // class InterJVMGetDropSuccessTest + +final class Util implements AWTEventListener { + public static final int CODE_NOT_RETURNED = -1; + public static final int CODE_FIRST_SUCCESS = 0x2; + public static final int CODE_SECOND_SUCCESS = 0x2; + public static final int CODE_FAILURE = 0x1; + + public static final int FRAME_ACTIVATION_TIMEOUT = 3000; + + static final Object SYNC_LOCK = new Object(); + static final int MOUSE_RELEASE_TIMEOUT = 1000; + + static final Util theInstance = new Util(); + + static { + Toolkit.getDefaultToolkit().addAWTEventListener(theInstance, AWTEvent.MOUSE_EVENT_MASK); + } + + public static Point getCenterLocationOnScreen(Component c) { + Point p = c.getLocationOnScreen(); + Dimension d = c.getSize(); + p.translate(d.width / 2, d.height / 2); + return p; + } + + public static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } + + private Component clickedComponent = null; + + private void reset() { + clickedComponent = null; + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component)e.getSource(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + } + + public static boolean pointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + return theInstance.pointInComponentImpl(robot, p, comp); + } + + private boolean pointInComponentImpl(Robot robot, Point p, Component comp) + throws InterruptedException { + robot.waitForIdle(); + reset(); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + synchronized (SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_MASK); + SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT); + } + + Component c = clickedComponent; + + while (c != null && c != comp) { + c = c.getParent(); + } + + return c == comp; + } +} + +class Child { + static class DragSourceDropListener extends DragSourceAdapter { + private boolean finished = false; + private boolean dropSuccess = false; + + public void reset() { + finished = false; + dropSuccess = false; + } + + public boolean isDropFinished() { + return finished; + } + + public boolean getDropSuccess() { + return dropSuccess; + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + finished = true; + dropSuccess = dsde.getDropSuccess(); + synchronized (Util.SYNC_LOCK) { + Util.SYNC_LOCK.notifyAll(); + } + } + } + + final Frame frame = new Frame("Source Frame"); + final DragSource dragSource = DragSource.getDefaultDragSource(); + final DragSourceDropListener dragSourceListener = new DragSourceDropListener(); + final Transferable transferable = new StringSelection("TEXT"); + final DragGestureListener dragGestureListener = new DragGestureListener() { + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, transferable, dragSourceListener); + } + }; + final DragGestureRecognizer dragGestureRecognizer = + dragSource.createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_COPY, + dragGestureListener); + + public static void main(String[] args) { + Child child = new Child(); + child.run(args); + } + + public void run(String[] args) { + try { + if (args.length != 4) { + throw new RuntimeException("Incorrect command line arguments."); + } + + int x = Integer.parseInt(args[0]); + int y = Integer.parseInt(args[1]); + int w = Integer.parseInt(args[2]); + int h = Integer.parseInt(args[3]); + + frame.setBounds(300, 200, 150, 150); + frame.setVisible(true); + + Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT); + + Point sourcePoint = Util.getCenterLocationOnScreen(frame); + + Point targetPoint = new Point(x + w / 2, y + h / 2); + + Robot robot = new Robot(); + robot.mouseMove(sourcePoint.x, sourcePoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (Point p = new Point(sourcePoint); !p.equals(targetPoint); + p.translate(Util.sign(targetPoint.x - p.x), + Util.sign(targetPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + Thread.sleep(50); + } + + synchronized (Util.SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT); + } + + if (!dragSourceListener.isDropFinished()) { + throw new RuntimeException("Drop not finished"); + } + + boolean success1 = dragSourceListener.getDropSuccess(); + + dragSourceListener.reset(); + robot.mouseMove(sourcePoint.x, sourcePoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (Point p = new Point(sourcePoint); !p.equals(targetPoint); + p.translate(Util.sign(targetPoint.x - p.x), + Util.sign(targetPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + Thread.sleep(50); + } + + synchronized (Util.SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT); + } + + if (!dragSourceListener.isDropFinished()) { + throw new RuntimeException("Drop not finished"); + } + + boolean success2 = dragSourceListener.getDropSuccess(); + int retCode = 0; + + if (success1) { + retCode |= Util.CODE_FIRST_SUCCESS; + } + if (success2) { + retCode |= Util.CODE_SECOND_SUCCESS; + } + // This returns the diagnostic code from the child VM + System.exit(retCode); + } catch (Throwable e) { + e.printStackTrace(); + // This returns the diagnostic code from the child VM + System.exit(Util.CODE_FAILURE); + } + } // run() +} // class child + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout + { + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + + }// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog + { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("South", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + } + + }// TestDialog class diff --git a/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html new file mode 100644 index 00000000000..c19a0a02354 --- /dev/null +++ b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html @@ -0,0 +1,45 @@ + + + + + + + + + +

    NoFormatsCrashTest
    Bug ID: 4870762

    + +

    This is an AUTOMATIC test, simply wait for completion

    + + + + + diff --git a/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java new file mode 100644 index 00000000000..3be0adc666e --- /dev/null +++ b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java @@ -0,0 +1,488 @@ +/* + * Copyright (c) 2014, 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 4870762 + @summary tests that a drop target JVM doesn't crash if the source doesn't export + data in native formats. + @author das@sparc.spb.su area=dnd + @compile NoFormatsCrashTest.java + @run applet NoFormatsCrashTest.html +*/ + +// Note there is no @ in front of test above. This is so that the +// harness will not mistake this file as a test file. It should +// only see the html file as a test file. (the harness runs all +// valid test files, so it would run this test twice if this file +// were valid as well as the html file.) +// Also, note the area= after Your Name in the author tag. Here, you +// should put which functional area the test falls in. See the +// AWT-core home page -> test areas and/or -> AWT team for a list of +// areas. +// Note also the 'NoFormatsCrashTest.html' in the run tag. This should +// be changed to the name of the test. + + +/** + * NoFormatsCrashTest.java + * + * summary: tests that a drop target JVM doesn't crash if the source doesn't export + * data in native formats. + */ + +import java.applet.Applet; +import java.awt.*; +import java.awt.datatransfer.*; +import java.awt.dnd.*; +import java.awt.event.*; +import java.io.*; + + +//Automated tests should run as applet tests if possible because they +// get their environments cleaned up, including AWT threads, any +// test created threads, and any system resources used by the test +// such as file descriptors. (This is normally not a problem as +// main tests usually run in a separate VM, however on some platforms +// such as the Mac, separate VMs are not possible and non-applet +// tests will cause problems). Also, you don't have to worry about +// synchronisation stuff in Applet tests they way you do in main +// tests... + + +public class NoFormatsCrashTest extends Applet { + + final Frame frame = new Frame(); + private volatile Process process; + + static final int FRAME_ACTIVATION_TIMEOUT = 2000; + + public static void main(String[] args) { + NoFormatsCrashTest test = new NoFormatsCrashTest(); + test.run(args); + } + + public void run(String[] args) { + try { + if (args.length != 4) { + throw new RuntimeException("Incorrect command line arguments."); + } + + int x = Integer.parseInt(args[0]); + int y = Integer.parseInt(args[1]); + int w = Integer.parseInt(args[2]); + int h = Integer.parseInt(args[3]); + + Panel panel = new DragSourcePanel(); + + frame.setTitle("Drag source frame"); + frame.setLocation(500, 200); + frame.add(panel); + frame.pack(); + frame.setVisible(true); + + Thread.sleep(FRAME_ACTIVATION_TIMEOUT); + + Point sourcePoint = panel.getLocationOnScreen(); + Dimension d = panel.getSize(); + sourcePoint.translate(d.width / 2, d.height / 2); + + Point targetPoint = new Point(x + w / 2, y + h / 2); + + Robot robot = new Robot(); + robot.mouseMove(sourcePoint.x, sourcePoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_MASK); + for (; !sourcePoint.equals(targetPoint); + sourcePoint.translate(sign(targetPoint.x - sourcePoint.x), + sign(targetPoint.y - sourcePoint.y))) { + robot.mouseMove(sourcePoint.x, sourcePoint.y); + Thread.sleep(50); + } + robot.mouseRelease(InputEvent.BUTTON1_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + + Thread.sleep(FRAME_ACTIVATION_TIMEOUT); + + if (process.isAlive()) { + process.destroy(); + } + } catch (Throwable e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } // run() + + public void init() { + //Create instructions for the user here, as well as set up + // the environment -- set the layout manager, add buttons, + // etc. + + String[] instructions = + { + "This is an AUTOMATIC test", + "simply wait until it is done" + }; + Sysout.createDialog( ); + Sysout.printInstructions( instructions ); + + frame.setTitle("Drop target frame"); + frame.setLocation(200, 200); + + } // init() + + public void start() { + DropTargetPanel panel = new DropTargetPanel(); + frame.add(panel); + frame.pack(); + frame.setVisible(true); + + try { + Thread.sleep(FRAME_ACTIVATION_TIMEOUT); + + Point p = frame.getLocationOnScreen(); + Dimension d = frame.getSize(); + + String javaPath = System.getProperty("java.home", ""); + String command = javaPath + File.separator + "bin" + + File.separator + "java -cp " + System.getProperty("test.classes", ".") + + " NoFormatsCrashTest " + + p.x + " " + p.y + " " + d.width + " " + d.height; + + process = Runtime.getRuntime().exec(command); + ProcessResults pres = ProcessResults.doWaitFor(process); + System.err.println("Child VM return code: " + pres.exitValue); + + if (pres.stderr != null && pres.stderr.length() > 0) { + System.err.println("========= Child VM System.err ========"); + System.err.print(pres.stderr); + System.err.println("======================================"); + } + + if (pres.stdout != null && pres.stdout.length() > 0) { + System.err.println("========= Child VM System.out ========"); + System.err.print(pres.stdout); + System.err.println("======================================"); + } + + } catch (Throwable e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + if (panel.isTestFailed()) { + throw new RuntimeException(); + } + } // start() + + public static int sign(int n) { + return n < 0 ? -1 : n > 0 ? 1 : 0; + } +} // class NoFormatsCrashTest + +class TestTransferable implements Transferable { + + public static DataFlavor dataFlavor = null; + static final Object data = new Object(); + + static { + DataFlavor df = null; + try { + df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + + "; class=java.lang.Object"); + } catch (ClassNotFoundException e) { + throw new ExceptionInInitializerError(e); + } + dataFlavor = df; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataFlavor }; + } + + public boolean isDataFlavorSupported(DataFlavor df) { + return dataFlavor.equals(df); + } + + public Object getTransferData(DataFlavor df) + throws UnsupportedFlavorException, IOException { + if (!isDataFlavorSupported(df)) { + throw new UnsupportedFlavorException(df); + } + return data; + } +} + +class DragSourcePanel extends Panel { + public DragSourcePanel() { + final Transferable t = new TestTransferable(); + final DragSourceListener dsl = new DragSourceAdapter() { + public void dragDropEnd(DragSourceDropEvent dtde) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // This finishes child VM + System.exit(0); + } + }; + final DragGestureListener dgl = new DragGestureListener() { + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, t, dsl); + } + }; + final DragSource ds = DragSource.getDefaultDragSource(); + final DragGestureRecognizer dgr = + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + dgl); + } + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } +} + +class DropTargetPanel extends Panel { + private boolean testFailed = false; + public DropTargetPanel() { + final DropTargetListener dtl = new DropTargetAdapter() { + public void dragOver(DropTargetDragEvent dtde) { + try { + dtde.getCurrentDataFlavorsAsList(); + } catch (Exception e) { + testFailed = true; + e.printStackTrace(); + } + } + public void drop(DropTargetDropEvent dtde) { + dtde.rejectDrop(); + } + }; + final DropTarget dt = new DropTarget(this, dtl); + } + + public boolean isTestFailed() { + return testFailed; + } + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } +} + +class ProcessResults { + public int exitValue; + public String stdout; + public String stderr; + + public ProcessResults() { + exitValue = -1; + stdout = ""; + stderr = ""; + } + + /** + * Method to perform a "wait" for a process and return its exit value. + * This is a workaround for Process.waitFor() never returning. + */ + public static ProcessResults doWaitFor(Process p) { + ProcessResults pres = new ProcessResults(); + + InputStream in = null; + InputStream err = null; + + try { + in = p.getInputStream(); + err = p.getErrorStream(); + + boolean finished = false; + + while (!finished) { + try { + while (in.available() > 0) { + pres.stdout += (char)in.read(); + } + while (err.available() > 0) { + pres.stderr += (char)err.read(); + } + // Ask the process for its exitValue. If the process + // is not finished, an IllegalThreadStateException + // is thrown. If it is finished, we fall through and + // the variable finished is set to true. + pres.exitValue = p.exitValue(); + finished = true; + } + catch (IllegalThreadStateException e) { + // Process is not finished yet; + // Sleep a little to save on CPU cycles + Thread.currentThread().sleep(500); + } + } + if (in != null) in.close(); + if (err != null) err.close(); + } + catch (Throwable e) { + System.err.println("doWaitFor(): unexpected exception"); + e.printStackTrace(); + throw new RuntimeException(e); + } + return pres; + } +} + +/**************************************************** + Standard Test Machinery + DO NOT modify anything below -- it's a standard + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. + ****************************************************/ + +/** + This is part of the standard test machinery. + It creates a dialog (with the instructions), and is the interface + for sending text messages to the user. + To print the instructions, send an array of strings to Sysout.createDialog + WithInstructions method. Put one line of instructions per array entry. + To display a message for the tester to see, simply call Sysout.println + with the string to be displayed. + This mimics System.out.println but works within the test harness as well + as standalone. + */ + +class Sysout + { + private static TestDialog dialog; + + public static void createDialogWithInstructions( String[] instructions ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + dialog.printInstructions( instructions ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + public static void createDialog( ) + { + dialog = new TestDialog( new Frame(), "Instructions" ); + String[] defInstr = { "Instructions will appear here. ", "" } ; + dialog.printInstructions( defInstr ); + dialog.show(); + println( "Any messages for the tester will display here." ); + } + + + public static void printInstructions( String[] instructions ) + { + dialog.printInstructions( instructions ); + } + + + public static void println( String messageIn ) + { + dialog.displayMessage( messageIn ); + } + + }// Sysout class + +/** + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ +class TestDialog extends Dialog + { + + TextArea instructionsText; + TextArea messageText; + int maxStringLength = 80; + + //DO NOT call this directly, go through Sysout + public TestDialog( Frame frame, String name ) + { + super( frame, name ); + int scrollBoth = TextArea.SCROLLBARS_BOTH; + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); + add( "North", instructionsText ); + + messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); + add("South", messageText); + + pack(); + + show(); + }// TestDialog() + + //DO NOT call this directly, go through Sysout + public void printInstructions( String[] instructions ) + { + //Clear out any current instructions + instructionsText.setText( "" ); + + //Go down array of instruction strings + + String printStr, remainingStr; + for( int i=0; i < instructions.length; i++ ) + { + //chop up each into pieces maxSringLength long + remainingStr = instructions[ i ]; + while( remainingStr.length() > 0 ) + { + //if longer than max then chop off first max chars to print + if( remainingStr.length() >= maxStringLength ) + { + //Try to chop on a word boundary + int posOfSpace = remainingStr. + lastIndexOf( ' ', maxStringLength - 1 ); + + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; + + printStr = remainingStr.substring( 0, posOfSpace + 1 ); + remainingStr = remainingStr.substring( posOfSpace + 1 ); + } + //else just print + else + { + printStr = remainingStr; + remainingStr = ""; + } + + instructionsText.append( printStr + "\n" ); + + }// while + + }// for + + }//printInstructions() + + //DO NOT call this directly, go through Sysout + public void displayMessage( String messageIn ) + { + messageText.append( messageIn + "\n" ); + } + + }// TestDialog class diff --git a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java index 8c0e6db916a..8177a2d2ab3 100644 --- a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java +++ b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2014, 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 @@ -25,21 +25,22 @@ package test.java.awt.regtesthelpers.process; import java.io.*; -/** This class is created to solve interprocess communication problems. +/** + * This class is created to solve interprocess communication problems. * When you need to write a regression test which should verify inter jvm * behavior such as DnD data transfer, Clipboard data transfer, focus * transfer etc., you could use the next scenario: * * 1. Write an implementation for the parent JVM, using applet test. - * 2. Write an implimentation for the child JVM or native application, using + * 2. Write an implementation for the child JVM or native application, using * main() function. * 3. Execute child process using ProcessCommunicator.executeChildProcess() * method. - * 4. You can decide whetherthe test is passed on the basis of + * 4. You can decide whether the test is passed on the basis of * ProcessResults class data. * - * Note: The class is not thread safe. You should access its methods only from the same - * thread. + * Note: The class is not thread safe. You should access its methods only from + * the same thread. */ public class ProcessCommunicator { @@ -48,31 +49,34 @@ public class ProcessCommunicator { private static final String javaPath = javaHome + File.separator + "bin" + File.separator + "java "; private static String command = ""; + private static volatile Process process; private ProcessCommunicator() {} - /** The same as {#link #executeChildProcess(Class,String)} except - * the {@code classPathArgument} parameter. The class path - * parameter is for the debug purposes + /** + * The same as {#link #executeChildProcess(Class,String)} except + * the {@code classPathArgument} parameter. The class path + * parameter is for the debug purposes * - * @param classToExecute is passed to the child JVM - * @param classPathArguments class path for the child JVM - * @param args arguments that will be passed to the executed class - * @return results of the executed {@code Process} + * @param classToExecute is passed to the child JVM + * @param classPathArguments class path for the child JVM + * @param args arguments that will be passed to the executed class + * @return results of the executed {@code Process} */ public static ProcessResults executeChildProcess(final Class classToExecute, final String classPathArguments, final String [] args) { try { String command = buildCommand(classToExecute, classPathArguments, args); - Process process = Runtime.getRuntime().exec(command); + process = Runtime.getRuntime().exec(command); return doWaitFor(process); } catch (IOException e) { throw new RuntimeException(e); } } - /** Executes child {code Process} + /** + * Executes child {code Process} * * @param classToExecute class to be executed as a child java process * @param args args to be passed in to the child process @@ -86,11 +90,11 @@ public class ProcessCommunicator { /** * Waits for a process and return its results. - * This is a workaround for Process.waitFor() never returning. + * This is a workaround for {@code Process.waitFor()} never returning. * * @return results of the executed {@code Process} */ - private static ProcessResults doWaitFor(final Process p) { + public static ProcessResults doWaitFor(final Process p) { ProcessResults pres = new ProcessResults(); final InputStream in; @@ -133,13 +137,14 @@ public class ProcessCommunicator { return pres; } - /** Builds command on the basis of the passed class name, - * class path and arguments. + /** + * Builds command on the basis of the passed class name, + * class path and arguments. * * @param classToExecute with class will be executed in the new JVM * @param classPathArguments java class path (only for test purposes) * @param args arguments for the new application. This could be used - * to pass some information from the parnent to child JVM. + * to pass some information from the parent to child JVM. * @return command to execute the {@code Process} */ private static String buildCommand(final Class classToExecute, @@ -162,11 +167,24 @@ public class ProcessCommunicator { return command; } - /** Could be used for the debug purposes. + /** + * Could be used for the debug purposes. * - * @return command that was build to execute the child process + * @return command that was build to execute the child process */ public static String getExecutionCommand () { return command; } + + /** + * Terminates the process created by {@code executeChildProcess} methods. + */ + public static void destroyProcess() { + if (process != null) { + if (process.isAlive()) { + process.destroy(); + } + process = null; + } + } } From 5b7ccb7c0a20d9154ae64164f09e600deac0cad3 Mon Sep 17 00:00:00 2001 From: Anton Litvinov Date: Thu, 15 May 2014 20:21:17 +0400 Subject: [PATCH 075/185] 8041725: Nimbus JList selection colors persist across L&F changes Reviewed-by: alexsch, alexp --- .../classes/javax/swing/plaf/nimbus/skin.laf | 12 +-- .../swing/plaf/nimbus/8041725/bug8041725.java | 82 +++++++++++++++++++ 2 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf index 39010042190..394721e1c41 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf @@ -1,7 +1,7 @@ |lTwn3P@#>fl8+RJJ_E zv*+FdjUH33e3Rcy?s3-bp8EpZdzt+P1~zuu;w|_j5DK-3KJxIAcs}{mU8&E|eTImYwsixw0Qb8LWc_@wvMbR0mqwwPbX)kOkQE1R>RCA*C^j(g zIf9f)vPE!P&^Bi&R{p}CJ7K|X)rTE=W<|Sfb6~FhwIKEVhmNx`cYf1Dno>FDwhZo) zj5M14e?LN|4}1!sxL~`n*Du&O^UT2X=~f^=OC?vKF&5ga6T~%pMK{wl2_AjOpX6O2 zwBSN8d*l&gNRr$jSp-3um>pY(#RQU8N<*2Bez#Q11Ysw*@Sa)#s6Pvc4GHfI3>mFT z=3&bQ71(1)^&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P|K8RIUFqlqyvxsBRp`ATlrc%o8)WCo5qWir(AtH3>_*l#} zl>(|X7piz$@r?s-Q7A{zx7Gn8ztC3+a8_N0q$JJBQ4%oYjcvz6Kr921FI0cHB_KMQ ztqM)LyR>K%#Jh+u7c==60aR+Wx*nJR#jp_<7ibzIk;9{jh-v}RA*PBhTRxvr{y79} ziq>=F`CkP{t1i{0Tx}eei)#s`D;2qupS~+V$_f?9r^Fqns#W{eyCG&Hh{;E;i8TVI z!_{%=oVu`w%DxDtyIfKsa4$T-{;`7$7@Ag?C7gl zN!#N3NZR4~7Soh3qYZi}pxH)OWp#Evu`2)X;L+uCyqiyXEa1u2sUl^MV4o2mLb`kS z@)hxjCn{7F#;560)Xh|L`NY#95SZ3T+)O>6x<#vq+_1uPH4P;jz~+kBR$)UEw2^8fT>BHf zJ$QDMcPo^RYg*vTyZwEj9Iv;d0Entj`=wZ40o5YOa&OkH36Ypv16nH*=SoL@^_*RH0+Whhb;UQ+G+*UqnL zuKVjDL9)Mgw8^e$yF{}0Y`MOe5JgV5PixK7r+y=3K>K@<>s}b={2FCkJRtky39f&P zQg!)zl9fqyGbV|#%neBjs_pMhwnN2lPPPkZF`s*OsO>$ Date: Fri, 23 May 2014 16:24:43 +0100 Subject: [PATCH 142/185] 8042857: 14 stuck threads waiting for notification on LDAPRequest Reviewed-by: vinnie --- .../classes/com/sun/jndi/ldap/Connection.java | 4 +- .../com/sun/jndi/ldap/LdapTimeoutTest.java | 45 +++++++++++++++---- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java index 65a675ffdf5..a0643a6ad29 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, 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 @@ -459,10 +459,10 @@ public final class Connection implements Runnable { // will be woken up before readTimeout only if reply is // available ldr.wait(readTimeout); - waited = true; } else { ldr.wait(15 * 1000); // 15 second timeout } + waited = true; } else { break; } diff --git a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java index 0db3ab9239c..39270374488 100644 --- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java +++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, 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 @@ -64,11 +64,12 @@ public class LdapTimeoutTest { env.put(Context.SECURITY_PRINCIPAL, "user"); env.put(Context.SECURITY_CREDENTIALS, "password"); - env.put("com.sun.jndi.ldap.connect.timeout", "10"); - env.put("com.sun.jndi.ldap.read.timeout", "3000"); - InitialContext ctx = null; try { + new LdapTimeoutTest().deadServerNoTimeout(env); + + env.put("com.sun.jndi.ldap.connect.timeout", "10"); + env.put("com.sun.jndi.ldap.read.timeout", "3000"); new LdapTimeoutTest().ldapReadTimeoutTest(env, false); new LdapTimeoutTest().ldapReadTimeoutTest(env, true); new LdapTimeoutTest().simpleAuthConnectTest(env); @@ -84,7 +85,7 @@ public class LdapTimeoutTest { void ldapReadTimeoutTest(Hashtable env, boolean ssl) { InitialContext ctx = null; if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); - ScheduledFuture killer = killSwitch(); + ScheduledFuture killer = killSwitch(5000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -112,7 +113,7 @@ public class LdapTimeoutTest { void simpleAuthConnectTest(Hashtable env) { InitialContext ctx = null; - ScheduledFuture killer = killSwitch(); + ScheduledFuture killer = killSwitch(5000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -139,6 +140,32 @@ public class LdapTimeoutTest { } } + void deadServerNoTimeout(Hashtable env) { + InitialContext ctx = null; + ScheduledFuture killer = killSwitch(30000); + long start = System.nanoTime(); + try { + ctx = new InitialDirContext(env); + SearchControls scl = new SearchControls(); + scl.setSearchScope(SearchControls.SUBTREE_SCOPE); + NamingEnumeration answer = ((InitialDirContext)ctx) + .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl); + // shouldn't reach here + fail(); + } catch (NamingException e) { + long end = System.nanoTime(); + if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) { + System.err.println("fail: timeout should be at least 15 seconds, actual time: " + + TimeUnit.NANOSECONDS.toMillis(end - start)); + fail(); + } else { + pass(); + } + } finally { + if (!shutItDown(killer, ctx)) fail(); + } + } + boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { killer.cancel(true); try { @@ -149,15 +176,15 @@ public class LdapTimeoutTest { } } - ScheduledFuture killSwitch() { + ScheduledFuture killSwitch(int ms) { final Thread current = Thread.currentThread(); return LdapTimeoutTest.pool.schedule(new Callable() { public Void call() throws Exception { System.err.println("Fail: killSwitch()"); - current.interrupt(); + System.exit(0); return null; } - }, 5000, TimeUnit.MILLISECONDS); + }, ms, TimeUnit.MILLISECONDS); } static class Server extends Thread { From 659ff66142f2cd6227eb3a8f009cc1e71081750b Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Fri, 23 May 2014 09:06:34 -0700 Subject: [PATCH 143/185] 8043666: Remove unused files from jaxp repository Reviewed-by: alanb --- .../internal/xsltc/compiler/Makefile.inc | 60 ------------------- .../javax.xml.transform.TransformerFactory | 1 - ...che.xerces.dom.DOMImplementationSourceImpl | 1 - .../org.w3c.dom.DOMImplementationSourceList | 1 - .../javax.xml.datatype.DatatypeFactory | 1 - .../javax.xml.parsers.DocumentBuilderFactory | 1 - .../jaxp/javax.xml.parsers.SAXParserFactory | 1 - .../javax.xml.validation.SchemaFactory | 1 - ....apache.xerces.xni.parser.DTDConfiguration | 1 - ...pache.xerces.xni.parser.XML11Configuration | 1 - ...e.xerces.xni.parser.XMLParserConfiguration | 1 - .../internal/parsers/org.xml.sax.driver | 2 - .../stream/javax.xml.stream.XMLEventFactory | 1 - .../stream/javax.xml.stream.XMLInputFactory | 1 - .../stream/javax.xml.stream.XMLOutputFactory | 1 - jaxp/src/org/xml/sax/COPYING | 12 ---- jaxp/src/org/xml/sax/COPYING.txt | 39 ------------ 17 files changed, 126 deletions(-) delete mode 100644 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc delete mode 100644 jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration delete mode 100644 jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver delete mode 100644 jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory delete mode 100644 jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory delete mode 100644 jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory delete mode 100644 jaxp/src/org/xml/sax/COPYING delete mode 100644 jaxp/src/org/xml/sax/COPYING.txt diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc deleted file mode 100644 index 8c1f57a8b18..00000000000 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc +++ /dev/null @@ -1,60 +0,0 @@ -########################################################################### -# reserved comment block -# DO NOT REMOVE OR ALTER! -########################################################################### -########################################################################## -# Copyright 2001-2004 The Apache Software Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################## -# -# $Id: Makefile.inc,v 1.2 2004/02/17 16:32:49 minchau Exp $ -# -#################################################################### -# # -# Makefile.inc for XSLT compiler # -# # -#################################################################### - -#################################################################### -# Useful macros # -#################################################################### - -JAVAC = javac -#JAVAC_FLAGS = -g -d $(XSLT)/src/classes -JAVAC_FLAGS = -sourcepath $(XSLT)/src -JAVACC = javacc -JAVACC_FLAGS = -static=FALSE -JAVACUP = javacup -JAVACUP_FLAGS = -JAVALEX = jlex -JAVALEX_FLAGS = - -#################################################################### -# Explicit rules # -#################################################################### - -.SUFFIXES: .java .class .jj .lex .cup - -.java.class: - $(JAVAC) $(JAVAC_FLAGS) $< - -.jj.java: - $(JAVACC) $(JAVACC_FLAGS) $< - -.cup.java: - $(JAVACUP) $(JAVACUP_FLAGS) $< - -.lex.java: - $(JAVALEX) $(JAVALEX_FLAGS) $< - diff --git a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory deleted file mode 100644 index a607891fefd..00000000000 --- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl b/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl deleted file mode 100644 index 79c33dd2078..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList b/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList deleted file mode 100644 index 814f03139f0..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory deleted file mode 100644 index 4a5c28226b5..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory deleted file mode 100644 index dc39440e898..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory deleted file mode 100644 index cd8406950db..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory deleted file mode 100644 index 51d33a674c7..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration deleted file mode 100644 index 8f6ac8baba9..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.parsers.DTDConfiguration diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration deleted file mode 100644 index af1926488fd..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.parsers.XML11Configuration diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration deleted file mode 100644 index ca8bc3e7232..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration +++ /dev/null @@ -1 +0,0 @@ -com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration diff --git a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver deleted file mode 100644 index e1a387435c4..00000000000 --- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver +++ /dev/null @@ -1,2 +0,0 @@ -com.sun.org.apache.xerces.internal.parsers.SAXParser - diff --git a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory b/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory deleted file mode 100644 index adc26b34340..00000000000 --- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.xml.internal.stream.events.XMLEventFactoryImpl diff --git a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory b/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory deleted file mode 100644 index 456882c2cb3..00000000000 --- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.xml.internal.stream.XMLInputFactoryImpl diff --git a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory b/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory deleted file mode 100644 index 3de51905314..00000000000 --- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory +++ /dev/null @@ -1 +0,0 @@ -com.sun.xml.internal.stream.XMLOutputFactoryImpl diff --git a/jaxp/src/org/xml/sax/COPYING b/jaxp/src/org/xml/sax/COPYING deleted file mode 100644 index dd0b9813dbc..00000000000 --- a/jaxp/src/org/xml/sax/COPYING +++ /dev/null @@ -1,12 +0,0 @@ -SAX IS FREE ------------ - -I hereby abandon any property rights to SAX 2.0 (the Simple API for -XML), and release all of the SAX 2.0 source code, compiled code, and -documentation contained in this distribution into the Public Domain. -SAX comes with NO WARRANTY or guarantee of fitness for any purpose. - - -David Megginson -david@megginson.com -2000-01-14 diff --git a/jaxp/src/org/xml/sax/COPYING.txt b/jaxp/src/org/xml/sax/COPYING.txt deleted file mode 100644 index 27518b4b9cc..00000000000 --- a/jaxp/src/org/xml/sax/COPYING.txt +++ /dev/null @@ -1,39 +0,0 @@ - SAX COPYRIGHT STATUS - -Version 1.0 of the Simple API for XML (SAX), created collectively by -the membership of the XML-DEV mailing list, is hereby released into -the public domain. - -No one owns SAX: you may use it freely in both commercial and -non-commercial applications, bundle it with your software -distribution, include it on a CD-ROM, list the source code in a book, -mirror the documentation at your own web site, or use it in any other -way you see fit. - - - NO WARRANTY - -Because SAX is released to the public domain, there is no warranty for -the design or for the software implementation, to the extent permitted -by applicable law. Except when otherwise stated in writing the -copyright holders and/or other parties provide SAX "as is" without -warranty of any kind, either expressed or implied, including, but not -limited to, the implied warranties of merchantability and fitness for -a particular purpose. The entire risk as to the quality and -performance of SAX is with you. Should SAX prove defective, you -assume the cost of all necessary servicing, repair or correction. - -In no event unless required by applicable law or agreed to in writing -will any copyright holder, or any other party who may modify and/or -redistribute SAX, be liable to you for damages, including any general, -special, incidental or consequential damages arising out of the use or -inability to use SAX (including but not limited to loss of data or -data being rendered inaccurate or losses sustained by you or third -parties or a failure of the SAX to operate with any other programs), -even if such holder or other party has been advised of the possibility -of such damages. - - -David Megginson -1998-05-11 - From 7f334fe1a10fdc7b5a830f5740602ff3e63bfeca Mon Sep 17 00:00:00 2001 From: Rob McKenna Date: Fri, 23 May 2014 19:42:16 +0100 Subject: [PATCH 144/185] 8041451: com.sun.jndi.ldap.Connection:ReadTimeout should abandon ldap request Reviewed-by: vinnie --- jdk/src/share/classes/com/sun/jndi/ldap/Connection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java index a0643a6ad29..d41c94480e9 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java @@ -474,7 +474,7 @@ public final class Connection implements Runnable { } if ((rber == null) && waited) { - removeRequest(ldr); + abandonRequest(ldr, null); throw new NamingException("LDAP response read timed out, timeout used:" + readTimeout + "ms." ); From f7940fec73be71e6a5ea2c80d7087438c548db33 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Mon, 26 May 2014 15:48:25 +0530 Subject: [PATCH 145/185] 8043930: TypeError when attemping to create an instance of non-public class could be better Reviewed-by: attila, lagergren --- .../linker/NashornStaticClassLinker.java | 6 +++ .../runtime/resources/Messages.properties | 1 + nashorn/test/script/basic/JDK-8043930.js | 37 +++++++++++++++++++ .../test/script/basic/JDK-8043930.js.EXPECTED | 1 + 4 files changed, 45 insertions(+) create mode 100644 nashorn/test/script/basic/JDK-8043930.js create mode 100644 nashorn/test/script/basic/JDK-8043930.js.EXPECTED diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java index 272b4ec0ac4..f8ea9916041 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java @@ -25,6 +25,7 @@ package jdk.nashorn.internal.runtime.linker; +import java.lang.reflect.Modifier; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.beans.BeansLinker; import jdk.internal.dynalink.beans.StaticClass; @@ -65,10 +66,15 @@ final class NashornStaticClassLinker implements TypeBasedGuardingDynamicLinker { return null; } final Class receiverClass = ((StaticClass) self).getRepresentedClass(); + Bootstrap.checkReflectionAccess(receiverClass, true); final CallSiteDescriptor desc = request.getCallSiteDescriptor(); // We intercept "new" on StaticClass instances to provide additional capabilities if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) { + if (! Modifier.isPublic(receiverClass.getModifiers())) { + throw ECMAErrors.typeError("new.on.nonpublic.javatype", receiverClass.getName()); + } + // make sure new is on accessible Class Context.checkPackageAccess(receiverClass); diff --git a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties index 47248fce715..c98c1c7c84a 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties +++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties @@ -138,6 +138,7 @@ type.error.no.method.matches.args=Can not invoke method {0} with the passed argu type.error.method.not.constructor=Java method {0} can't be used as a constructor. type.error.env.not.object=$ENV must be an Object. type.error.unsupported.java.to.type=Unsupported Java.to target type {0}. +type.error.new.on.nonpublic.javatype=new cannot be used with non-public java type {0}. range.error.dataview.constructor.offset=Wrong offset or length in DataView constructor range.error.dataview.offset=Offset is outside the bounds of the DataView diff --git a/nashorn/test/script/basic/JDK-8043930.js b/nashorn/test/script/basic/JDK-8043930.js new file mode 100644 index 00000000000..a89b3541e37 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8043930.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2010, 2013, 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. + */ + +/** + * JDK-8043930: TypeError when attemping to create an instance of non-public class could be better + * + * @test + * @run + */ + +var NonPublicClass = Java.type("jdk.nashorn.test.models.NonPublicClass"); +try { + var obj = new NonPublicClass(); + fail("Expected TypeError to be thrown!"); +} catch (e) { + print(e); +} diff --git a/nashorn/test/script/basic/JDK-8043930.js.EXPECTED b/nashorn/test/script/basic/JDK-8043930.js.EXPECTED new file mode 100644 index 00000000000..ee5cf9dc81c --- /dev/null +++ b/nashorn/test/script/basic/JDK-8043930.js.EXPECTED @@ -0,0 +1 @@ +TypeError: new cannot be used with non-public java type jdk.nashorn.test.models.NonPublicClass. From 9de45895e7150984d299a81e4a380ccca6b0ecde Mon Sep 17 00:00:00 2001 From: Miroslav Kos Date: Mon, 26 May 2014 14:59:14 +0200 Subject: [PATCH 146/185] 8043762: Remove unused files from jaxws repository Reviewed-by: alanb --- ...l.internal.ws.spi.db.BindingContextFactory | 2 - .../tools/internal/jxc/gen/config/config.rng | 131 -- .../xjc/reader/dtd/bindinfo/bindingfile.rng | 317 --- .../xjc/reader/xmlschema/bindinfo/binding.rng | 913 -------- .../xmlschema/xmlschema-for-jaxb.rng | 1579 ------------- .../rngom/parse/compact/CompactSyntax.jj | 1963 ----------------- .../{pacakge-info.java => package-info.java} | 2 +- 7 files changed, 1 insertion(+), 4906 deletions(-) delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng delete mode 100644 jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj rename jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/{pacakge-info.java => package-info.java} (95%) diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory b/jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory deleted file mode 100644 index 36ea2a98abe..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory +++ /dev/null @@ -1,2 +0,0 @@ -com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory -# com.sun.xml.internal.ws.db.toplink.JAXBContextFactory diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng deleted file mode 100644 index 59bcb4e49bc..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - import java.util.List; - import java.util.ArrayList; - import java.io.File; - - - - private File baseDir; - private Classes classes; - private List schema = new ArrayList(); - public Classes getClasses() { return this.classes;} - public File getBaseDir() { return baseDir;} - public List getSchema() { return this.schema;} - - - - - bd = - baseDir = $runtime.getBaseDir(bd); - - - - (baseDir); - this.schema.add (_schema); - - - - - - - - import java.util.List; - import java.util.ArrayList; - - - private List includes = new ArrayList(); - public List getIncludes() { return $runtime.getIncludePatterns(this.includes);} - private List excludes = new ArrayList(); - public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);} - - - - - - - - this.includes.add(include_content); - - - - - - - - - - this.excludes.add(exclude_content); - - - - - - - - - - - - import java.io.File; - - - private File location; - private String namespace; - public String getNamespace() { return this.namespace;} - public File getLocation() { return this.location;} - - - - - namespace = - - - - - - loc = - location = new File(baseDir,loc); - - - - - diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng deleted file mode 100644 index 41c18ff0d1d..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - - - - - 1.0ea2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - class - - - - - - - - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sequence - choice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - list - set - vector - - - - - - - - - - - - - - - - - - - - - - - - preserve - replace - collapse - - - - - - - - - - - - value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng deleted file mode 100644 index f689228d585..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng +++ /dev/null @@ -1,913 +0,0 @@ - - - - -]> - - - - - import com.sun.codemodel.internal.*; - import com.sun.tools.internal.xjc.generator.bean.field.*; - import com.sun.tools.internal.xjc.model.*; - import com.sun.xml.internal.bind.api.impl.NameConverter; - import com.sun.xml.internal.bind.v2.WellKnownNamespace; - import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; - import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.*; - import com.sun.tools.internal.xjc.reader.Const; - import org.xml.sax.*; - import org.w3c.dom.Document; - import org.xml.sax.helpers.DefaultHandler; - import java.util.*; - import javax.xml.namespace.QName; - import javax.xml.parsers.ParserConfigurationException; - - - - - - - - - - - - - - - - import java.io.StringWriter; - import com.sun.xml.internal.bind.marshaller.DataWriter; - - - // customization declarations - public BindInfo bi; - - private StringWriter w; - - private SAX2DOMEx sax2dom; - - - - bi = new BindInfo($runtime.copyLocator()); - $runtime.currentBindInfo = bi; - - - - - - - - - - result = - bi.addDecl(result); - - - - - - - - - if($runtime.isExtensionURI($uri)) { - // parse this sub-tree as an extension - try { - sax2dom = new SAX2DOMEx(); - } catch( ParserConfigurationException e ) { - throw new Error(e); // impossible - } - $runtime.redirectSubtree(sax2dom,$uri,$localName,$qname); - } else { - // ignore this sub-tree - sax2dom = null; - $runtime.redirectSubtree(new DefaultHandler(),$uri,$localName,$qname); - } - - - if(sax2dom!=null) { - bi.addDecl(new BIXPluginCustomization(((Document)sax2dom.getDOM()).getDocumentElement(),$runtime.copyLocator())); - } - - - - - - - - - - - - msg = - bi.appendDocumentation($runtime.truncateDocComment(msg),true); - - - - - w = new StringWriter(); - DataWriter xw = new DataWriter(w,"UTF-8"); - xw.setXmlDecl(false); - $runtime.redirectSubtree(xw,$uri,$localName,$qname); - - - - "+ - $runtime.escapeMarkup($runtime.truncateDocComment(w.toString()))+ - "", - false ); - w=null; - ]]> - - - - - - - - - - - - - - - - - private BIDeclaration result; - - - - result = - result = - result = - result = - result = - result = - result = - - - - - - - - - - private Locator loc; - private Map globalConvs = new HashMap(); - private NameConverter nameConverter = NameConverter.standard; - private String enableJavaNamingConvention = "true"; - private String fixedAttrToConstantProperty = "false"; - private String needIsSetMethod = "false"; - private String simpleTypeSubstitution = "false"; - private boolean flattenClasses = false; - private Set enumBaseTypes = new HashSet(); - private int defaultEnumSizeCap = 256; - private boolean generateEnumMemberName = false; - private boolean choiceContentPropertyWithModelGroupBinding = false; - private boolean xSmartWildcardDefaultBinding = false; - private boolean xSimpleMode; - private boolean generateValueClass = true; - private boolean generateElementClass = false; - private boolean generateMixedExtensions = false; - - public BIGlobalBinding makeResult() { - if( enumBaseTypes.size()==0 ) - enumBaseTypes.add(new QName(WellKnownNamespace.XML_SCHEMA,"NCName")); // defaults to NCName - - return new BIGlobalBinding( - globalConvs,nameConverter, - choiceContentPropertyWithModelGroupBinding, - generateValueClass, - generateElementClass, - $runtime.parseBoolean(enableJavaNamingConvention), - $runtime.parseBoolean(fixedAttrToConstantProperty), - $runtime.parseBoolean(needIsSetMethod), - $runtime.parseBoolean(simpleTypeSubstitution), - generateEnumMemberName, - flattenClasses, - enumBaseTypes, - defaultEnumSizeCap, - ct, - serializable, - xSuperClass, - xSuperInterface, - xSimpleMode, - xSmartWildcardDefaultBinding, - loc); - } - - - loc = $runtime.copyLocator(); - - - - - asWordSeparator - - asCharInWord - nameConverter = NameConverter.jaxrpcCompatible; - - - - - - - - enableJavaNamingConvention = - - - - - - fixedAttrToConstantProperty = - - - - - - needIsSetMethod = - - - - - - simpleTypeSubstitution = - - - - - - - - nested - flattenClasses = false; - - - toplevel - flattenClasses = true; - - - - - - - - ct = - - - - - - - generateError - - generateName - generateEnumMemberName = true; - - - - - - - - - - value = - QName qn = $runtime.parseQName(value); - enumBaseTypes.add( qn ); - - - - - - - - - - value = - defaultEnumSizeCap = Integer.parseInt(value); - - - - - - - - - value = - choiceContentPropertyWithModelGroupBinding = $runtime.parseBoolean(value); - - - - - - value = - generateValueClass = $runtime.parseBoolean(value); - - - - - - value = - generateElementClass = $runtime.parseBoolean(value); - - - - - - value = - generateMixedExtensions = $runtime.parseBoolean(value); - - - - - - - value = - if( $runtime.parseBoolean(value)==true ) - $runtime.reportUnsupportedFeature("enableValidation"); - - - - - value = - if( $runtime.parseBoolean(value)==true ) - $runtime.reportUnsupportedFeature("enableFailFastCheck"); - - - - - - - - - xmlType = - - conv = - - globalConvs.put( $runtime.parseQName(xmlType), conv ); - - - - - serialuid = - - - if(serialuid!=null) - serializable = new BISerializable(Long.parseLong(serialuid)); - else - serializable = new BISerializable(null); - - - - serializable = - xSuperClass = - xSuperInterface = - - - - xSmartWildcardDefaultBinding = true; - - - - - xSimpleMode = true; - - - - - - - - - - - - - - - - - - - - - - - - - - private Locator loc; - public BISchemaBinding makeResult() { - return new BISchemaBinding(packageName,javadoc,tt,et,at,mt,nt,loc); - } - - - - loc = $runtime.copyLocator(); - - - - - packageName = - - - javadoc = - - - - - - - - - - - tt = - - - et = - - - at = - - - mt = - - - nt = - - - - - - - - - - - - private String prefix=""; - private String suffix=""; - - - - - - prefix = - - - - - suffix = - - - - - - - - - javadoc = - javadoc = $runtime.truncateDocComment(javadoc); - - - - - - private FieldRenderer r = null; - - type = - - if( type.equals("indexed") ) - r = FieldRenderer.ARRAY; - else - try { - r = new UntypedListFieldRenderer( $runtime.codeModel.ref(type) ); - } catch( ClassNotFoundException e ) { - throw new NoClassDefFoundError(e.getMessage()); - } - - - - - - - - private Locator loc; - public BIClass makeResult() { - return new BIClass(loc,name,implClass,javadoc); - } - - - - loc = $runtime.copyLocator(); - - javadoc = - - - - name = - - - - implClass = - - - - - - - - private Locator loc; - private Boolean isConst = null; - private Boolean isSet = null; - private Boolean genElemProp = null; - - public BIProperty makeResult() throws SAXException { - JType baseTypeRef = null; - if(baseType!=null) - baseTypeRef = $runtime.getType(baseType); - - return new BIProperty(loc,name,javadoc,baseTypeRef,conv,ct,isConst,isSet,genElemProp); - } - - - - loc = $runtime.copyLocator(); - - name = - - - baseType = - - - - ct = - - - - - isConstStr = - isConst = $runtime.parseBoolean(isConstStr)?Boolean.TRUE:Boolean.FALSE; - - - - - isSetStr = - isSet = $runtime.parseBoolean(isSetStr)?Boolean.TRUE:Boolean.FALSE; - - - - - genElemPropStr = - genElemProp = $runtime.parseBoolean(genElemPropStr)?Boolean.TRUE:Boolean.FALSE; - - - - - failFast = - - if( $runtime.parseBoolean(failFast) ) { - $runtime.reportUnimplementedFeature("generateFailFastSetterMethod"); - } - - - - - - javadoc = - - - - conv = - - - - - - - - - r = - - - - - - - - import com.sun.tools.internal.xjc.generator.util.WhitespaceNormalizer; - - - - - - parse = - - - print = - - - - - _context = - context = $runtime.parseBoolean(_context); - - - - - - - - - - import java.util.HashMap; - - - private HashMap members = new HashMap(); - private boolean dontBind = false; - private Locator loc,loc2; - - private BIEnum makeResult() { - return new BIEnum(loc,dontBind,name,javadoc,members); - } - - - - loc = $runtime.copyLocator(); - - - false - dontBind = true; - - - - name = - - - javadoc = - - - jname = null; - javadoc = null; - - loc2 = $runtime.copyLocator(); - - jname = - - value = - - javadoc = - - members.put( value, new BIEnumMember(loc2,jname,javadoc) ); - - - - - - - - - - - - - private Locator loc; - private BIEnumMember makeResult() { - return new BIEnumMember(loc,name,javadoc); - } - - - - loc = $runtime.copyLocator(); - name = - - javadoc = - - - - - - - - - private JDefinedClass makeResult() { - try { - JDefinedClass c = $runtime.codeModel._class(name); - c.hide(); - return c; - } catch( JClassAlreadyExistsException e ) { - return e.getExistingClass(); - } - } - - - - name = - - - - - - - private JDefinedClass makeResult() { - try { - JDefinedClass c = $runtime.codeModel._class(name,ClassType.INTERFACE); - c.hide(); - return c; - } catch( JClassAlreadyExistsException e ) { - return e.getExistingClass(); - } - } - - - - name = - - - - - - - private long uid = 1; - private BISerializable makeResult() { - return new BISerializable(uid); - } - - - -// loc = $runtime.copyLocator(); - - - v = - uid = Long.parseLong(v); - - - - - - - - - - complex - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng deleted file mode 100644 index 88eb2f56610..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng +++ /dev/null @@ -1,1579 +0,0 @@ - - - - - - - RELAX NG schema for XML Schema by Jeni Tennison. Based on - XML - Schema Part I: Structures Recommendation and XML Schema Part - II: Datatypes. - - - - Amended to comply with 10 August 2001 Tutorial. - - Removed key attributes. - Replaced not element with except elements. - - Replaced multiple consecutive optional attributes to use the - zeroOrMore/choice pattern. - - - Removed interleave elements inside list elements (which are no longer - permitted). - - - - - - This allows any number of attributes that are not in the XML Schema - namespace or are in no namespace. This is somewhat more complicated than - the XML Schema anyAttribute equivalent. - - - - - - - - - This allows any number of attributes that are not in the XML Schema - namespace or are in no namespace, an optional id attribute of type ID, - and an optional annotation element. This is used as the basis for many - element content models. - - - - - - - - - - - - - - - This gives the content model of the top level of the schema. - - - - - - - - - - - - This gives the components that can be redefined within the redefine - element. They also occur at the top level of the schema. - - - - - - - - - - - This gives the values for the various form attributes: - elementFormDefault and attributeFormDefault on the schema element, and - the form attributes on the element and attribute elements. - - - qualified - unqualified - - - - - - - This gives the values that can be taken in the lists used to control - derivation by extension or restriction (this is 'reduced' derivation - because some derivation can involve substitution). This RELAX NG schema, - like the XML Schema Recommendation here, allows the keywords 'extension' and - 'restriction' to be repeated any number of times. - - - - - extension - restriction - - - - - - - - This specifies the possible values for attributes that control derivation. - - - #all - - - - - - - This is the beginning point for the schema, and defines the schema - element. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This gives the value type for the maxOccurs attribute, which may be a - non-negative number or the keyword 'unbounded'. - - - - unbounded - - - - - - This specifies the occurs attributes, minOccurs and maxOccurs, as they - are normally used. - - - - - - - - - - - - - - - - This gives the possible content of complex types. - - - - - - - - - - - - This gives the particles that can make up a model group. - - - - - - - - - - - - - This specifies the relationship between fixed and default attributes on - element and attribute elements - if one is present, then the other cannot - be. This is a constraint that cannot be specified using XML Schema. - - - - - - - - - - - This specifies the relationship between the type attribute and the - simpleType element child of attribute elements - if one is present, then - the other cannot be, although it is possible for neither to be allowed. - - - - - - - - - - - - - This describes attribute elements when used in a local context. They - have an optional use attribute, possibly a fixed or default attribute, - and then can either have a ref attribute (referring to a top-level - attribute) or a name attribute with an optional form attribute and - specifying an attribute type. - - - - - - - optional - prohibited - required - - - - - - - - - - - - - - - - - - - - - - - - - - This describes attribute elements when used at the top level of the - schema. They must have a name, may have a fixed or default attribute, - and specify their type through a type attribute or child simpleType - element. The name attribute of each attribute element that appears at - the top level of the schema is unique. - - - - - - - - - - - - - - This gives the model group for specifying the attributes in a complex - type, an extension or restriction. - - - - - - - - - - - - - - - This specifies the anyAttribute wildcard. - - - - - - - - - This specifies the content of a complexType element. As children, it can - have a simpleContent, a complexContent or a model group. Only if it has - one of the latter two, may it have a mixed attribute. This latter - constraint is something that cannot be specified in XML Schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This specifies the basic content of a complexType element. - - - - - - - - - - - - - - - - - - - - - - - - - - - This describes a restriction element within a complexContent element - (i.e. one that restricts a complex type). It has a base attribute, may - contain a model group and may contain attribute declarations of various - sorts. - - - - - - - - - - - - - - - - This specifies the basic model for an extension element: adding a - required base attribute to the model used for most components. - - - - - - - - - - This describes an extension element within a complexContent element - (i.e. one that restricts a complex type). It may contain a model group - and may contain attribute declarations of various sorts. - - - - - - - - - - - - - This describes a complexContent element. It may have a mixed attribute, - and either a restriction or extension element as content. - - - - - - - - - - - - - - - - - - This describes a restriction element that appears within a simpleContent - or simpleType element (i.e. one that restricts a simple type). Its - content follows the simple restriction model that is detailed below, and - may include attribute declarations. - - - - - - - - - - - This describes an extension element that appears within a simpleContent - element (i.e. one that extends a simple type). Like other extensions, it - has a base type, but it can only be used to add attributes. - - - - - - - - - - This describes a simpleContent element, whose content can either hold a - restriction or extension element. - - - - - - - - - - - - - This gives the possible values for block attributes on element elements, - which includes substitution amongst the list of possible values. This - RELAX NG schema, like the XML Schema Recommendation, allows each of the - keywords 'extension', 'restriction' and 'substitution' to occur more than - once within the list. - - - #all - - - - extension - restriction - substitution - - - - - - - - - This describes the basic content model of an element element. It is - annotated, may have a fixed or default attribute, and may have nillable - and/or block attributes. Its type may be specified through a type - attribute, a local simple type or a local complex type - the choice - between these methods is something that cannot be indicated with XML - Schema. This content is optionally followed by some identify constraints. - - - - - - - - - - - - - - - - - - - - - - - - - - - This describes an element element that appears at the top level of the - schema. On top of the basic content for an element element, it has to - have a name, which is a unique identifier in the element symbol space. It - may have substitutionGroup, abstract and/or final attributes. - - - - - - - - - - - - - - - - - - - - - - - - - This describes an element element that appears locally, within a - complexType or group element. It may have minOccurs and/or maxOccurs - attributes. If it has a ref attribute, then that's all it can - have. Otherwise, it must have a name and specifies its type in the same - way as the basic element content model described above. It may in this - case also have a form element. These constraints on local elements - cannot be described within XML Schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This gives the content of a model group (not a group element) in the - normal run of things. It has occurrence attributes and any number of - particles within it. - - - - - - - - - - - This gives the content of a model group (not a group element) within a - named group - it differs from the above in that it doesn't have any - occurrence attributes. - - - - - - - - - - This describes an all element that appears outside a named group (i.e. as - the content of a complexType element). It has the standard model for an - all element, but adds minOccurs and maxOccurs attributes which can only - take certain values. - - - - - - - - - This describes a choice element that appears outside a named group. - - - - - - - - - This describes a sequence element that appears outside a named group. - - - - - - - - - This describes a wildcard element (i.e. any or anyAttribute). The - namespace attribute can take a list URIs interspersed with the keywords - '##targetNamespace' and/or '##local'. This RELAX NG schema, like the XML - Schema Recommendation, allows the keywords to be specified more than once - each within the list, if they're given. This model also specifies the - processContents attribute. - - - - - - - ##any - ##other - - - - - ##targetNamespace - ##local - - - - - - - - lax - skip - strict - - - - - - - - - This describes an any element as a wildcard. - - - - - - - - - - - - - - - - - - This describes an import element that's used when its parent schema - element specifies a targetNamespace. In these cases, the namespace - attribute on the import element is optional. - - - - - - - - - - - - - - - - - - - - - - - This is designed to describe the content of the appinfo elements in the - schema. At the moment this allows any mixed content without validation. - Note that this is fairly complex compared to the XML Schema equivalent, - which would be a single any element. - - - - - - - - - - - - This describes an appinfo element. It has an optional source attribute - and can currently contain anything at all. - - - - - - - - - - - - - - This is designed to describe the content of the documentation elements in - the schema. At the moment this allows any mixed content without - validation. Note that this is fairly complex compared to the XML Schema - equivalent, which would be a single any element. - - - - - - - This describes a documentation element. It has optional source - and xml:lang attributes and can currently contain anything at all. - - - - - - - - - - - - - - - - - - - This describes an annotation element. It can have any attributes, may - have an id attribute, and contains any number of documentation or appinfo - elements. - - - - - - - - - - - - - - - - - - - - This gives the various types of derivation of simple types. - - - - - - - - - - - This specifies the values of the final attribute for simple types. This - RELAX NG schema for XML Schema, like the XML Schema Recommendation, allows - the keywords 'list', 'union' and 'restriction' to appear more than once - within the list. - - - #all - - - - list - union - restriction - - - - - - - - - - - - - - This gives the basic content of a simple type. - - - - - - - - - - - - - - - - - - - - - - This specifies the types of facets that are valid in restrictions on the - built-in data types. This can only perform rudimentary checking, but - should be enough in most circumstances. Note that for xs:anySimpleType - and xs:string, the whiteSpace facet can take any value, for - xs:normalizedString it can be 'replace' or 'collapse', and for all other - built-in types it has to be 'collapse'. - - - - - - - - - - - - - - - - - - - This describes a list element. It can either specify a local simple type - or have a itemType attribute. This constraint cannot be expressed in XML - Schema. - - - - - - - - - - - - - - - This describes a union element. If the memberTypes attribute is missing - or empty, then it must contain one or more simpleType elements; if - it's present, then it can contain simpleType elements or list simple - types in the memberTypes attribute. This constraint cannot be expressed - in XML Schema. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is the basic content of a facet. It has an optional fixed attribute. - - - - - - - - - - - - This is the content of a facet that cannot be fixed (enumeration or - pattern). It has a value attribute that can take any kind of value. - - - - - - - - - - This describes an enumeration element. - - - - - - - - - diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj deleted file mode 100644 index c0b8d256cbd..00000000000 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj +++ /dev/null @@ -1,1963 +0,0 @@ -options { - STATIC = false; - UNICODE_INPUT = true; - JAVA_UNICODE_ESCAPE = true; -} - -PARSER_BEGIN(CompactSyntax) - -package com.sun.xml.internal.rngom.parse.compact; - -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; - -import com.sun.xml.internal.rngom.ast.builder.Annotations; -import com.sun.xml.internal.rngom.ast.builder.BuildException; -import com.sun.xml.internal.rngom.ast.builder.CommentList; -import com.sun.xml.internal.rngom.ast.builder.DataPatternBuilder; -import com.sun.xml.internal.rngom.ast.builder.Div; -import com.sun.xml.internal.rngom.ast.builder.ElementAnnotationBuilder; -import com.sun.xml.internal.rngom.ast.builder.Grammar; -import com.sun.xml.internal.rngom.ast.builder.GrammarSection; -import com.sun.xml.internal.rngom.ast.builder.Include; -import com.sun.xml.internal.rngom.ast.builder.IncludedGrammar; -import com.sun.xml.internal.rngom.ast.builder.NameClassBuilder; -import com.sun.xml.internal.rngom.ast.builder.SchemaBuilder; -import com.sun.xml.internal.rngom.ast.builder.Scope; -import com.sun.xml.internal.rngom.ast.om.Location; -import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation; -import com.sun.xml.internal.rngom.ast.om.ParsedNameClass; -import com.sun.xml.internal.rngom.ast.om.ParsedPattern; -import com.sun.xml.internal.rngom.parse.Context; -import com.sun.xml.internal.rngom.parse.IllegalSchemaException; -import com.sun.xml.internal.rngom.parse.Parseable; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.LocatorImpl; - -import com.sun.xml.internal.rngom.util.Localizer; -import com.sun.xml.internal.rngom.xml.util.WellKnownNamespaces; - - -public class CompactSyntax implements Context { - private static final int IN_ELEMENT = 0; - private static final int IN_ATTRIBUTE = 1; - private static final int IN_ANY_NAME = 2; - private static final int IN_NS_NAME = 4; - - private String defaultNamespace; - private String compatibilityPrefix = null; - private SchemaBuilder sb; - private NameClassBuilder ncb; - private String sourceUri; - /** - * This is what we are parsing right now. - */ - private CompactParseable parseable; - private ErrorHandler eh; - private final Hashtable namespaceTable = new Hashtable(); - private final Hashtable datatypesTable = new Hashtable(); - private boolean hadError = false; - private static final Localizer localizer = new Localizer(new Localizer(Parseable.class),CompactSyntax.class); - private final Hashtable attributeNameTable = new Hashtable(); - private boolean annotationsIncludeElements = false; - - /** - * String that represents the inherited namespace. - * - *

    - * HACK: we always allocate a new String instance so that - * we can distinguish inherited value from the explicitly - * given value. - */ - private /*final*/ String inheritedNs; // essentially final but JavaCC don't let us declare it as so. - - final class LocatedString { - private final String str; - private final Token tok; - - LocatedString(String str, Token tok) { - this.str = str; - this.tok = tok; - } - - String getString() { - return str; - } - - Location getLocation() { - return makeLocation(tok); - } - - Token getToken() { - return tok; - } - - } - - public CompactSyntax(CompactParseable parseable, Reader r, String sourceUri, SchemaBuilder sb, ErrorHandler eh, String inheritedNs) { - this(r); - this.sourceUri = sourceUri; - this.parseable = parseable; - this.sb = sb; - this.ncb = sb.getNameClassBuilder(); - this.eh = eh; - // this causes the root pattern to have non-null annotations - // which is useful because it gives a context to trang - this.topLevelComments = sb.makeCommentList(); - this.inheritedNs = defaultNamespace = new String(inheritedNs); - } - - ParsedPattern parse(Scope scope) throws IllegalSchemaException { - try { - ParsedPattern p = Input(scope); - if (!hadError) - return p; - } - catch (ParseException e) { - error("syntax_error", e.getMessage(), e.currentToken.next); - } - catch (EscapeSyntaxException e) { - reportEscapeSyntaxException(e); - } - throw new IllegalSchemaException(); - } - - ParsedPattern parseInclude(IncludedGrammar g) throws IllegalSchemaException { - try { - ParsedPattern p = IncludedGrammar(g); - if (!hadError) - return p; - } - catch (ParseException e) { - error("syntax_error", e.getMessage(), e.currentToken.next); - } - catch (EscapeSyntaxException e) { - reportEscapeSyntaxException(e); - } - throw new IllegalSchemaException(); - } - - private void checkNsName(int context, LocatedString ns) { - if ((context & IN_NS_NAME) != 0) - error("ns_name_except_contains_ns_name", ns.getToken()); - } - - private void checkAnyName(int context, Token t) { - if ((context & IN_NS_NAME) != 0) - error("ns_name_except_contains_any_name", t); - if ((context & IN_ANY_NAME) != 0) - error("any_name_except_contains_any_name", t); - } - - private void error(String key, Token tok) { - doError(localizer.message(key), tok); - } - - private void error(String key, String arg, Token tok) { - doError(localizer.message(key, arg), tok); - } - - private void error(String key, String arg1, String arg2, Token tok) { - doError(localizer.message(key, arg1, arg2), tok); - } - - private void doError(String message, Token tok) { - hadError = true; - if (eh != null) { - LocatorImpl loc = new LocatorImpl(); - loc.setLineNumber(tok.beginLine); - loc.setColumnNumber(tok.beginColumn); - loc.setSystemId(sourceUri); - try { - eh.error(new SAXParseException(message, loc)); - } - catch (SAXException se) { - throw new BuildException(se); - } - } - } - - private void reportEscapeSyntaxException(EscapeSyntaxException e) { - if (eh != null) { - LocatorImpl loc = new LocatorImpl(); - loc.setLineNumber(e.getLineNumber()); - loc.setColumnNumber(e.getColumnNumber()); - loc.setSystemId(sourceUri); - try { - eh.error(new SAXParseException(localizer.message(e.getKey()), loc)); - } - catch (SAXException se) { - throw new BuildException(se); - } - } - } - - private static String unquote(String s) { - if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) { - s = s.replace('\u0000', '\n'); - return s.substring(3, s.length() - 3); - } - else - return s.substring(1, s.length() - 1); - } - - Location makeLocation(Token t) { - return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn); - } - - private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) { - if (i >= patterns.length) { - ParsedPattern[] oldPatterns = patterns; - patterns = new ParsedPattern[oldPatterns.length*2]; - System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length); - } - patterns[i] = p; - return patterns; - } - - String getCompatibilityPrefix() { - if (compatibilityPrefix == null) { - compatibilityPrefix = "a"; - while (namespaceTable.get(compatibilityPrefix) != null) - compatibilityPrefix = compatibilityPrefix + "a"; - } - return compatibilityPrefix; - } - - public String resolveNamespacePrefix(String prefix) { - String result = (String)namespaceTable.get(prefix); - if (result.length() == 0) - return null; - return result; - } - - public Enumeration prefixes() { - return namespaceTable.keys(); - } - - public String getBaseUri() { - return sourceUri; - } - - public boolean isUnparsedEntity(String entityName) { - return false; - } - - public boolean isNotation(String notationName) { - return false; - } - - public Context copy() { - return this; - } - - private Context getContext() { - return this; - } - - private CommentList getComments() { - return getComments(getTopLevelComments()); - } - - private CommentList topLevelComments; - - private CommentList getTopLevelComments() { - CommentList tem = topLevelComments; - topLevelComments = null; - return tem; - } - - private void noteTopLevelComments() { - topLevelComments = getComments(topLevelComments); - } - - private void topLevelComments(GrammarSection section) { - section.topLevelComment(getComments(null)); - } - - private Token lastCommentSourceToken = null; - - private CommentList getComments(CommentList comments) { - Token nextToken = getToken(1); - if (lastCommentSourceToken != nextToken) { - if (lastCommentSourceToken == null) - lastCommentSourceToken = token; - do { - lastCommentSourceToken = lastCommentSourceToken.next; - Token t = lastCommentSourceToken.specialToken; - if (t != null) { - while (t.specialToken != null) - t = t.specialToken; - if (comments == null) - comments = sb.makeCommentList(); - for (; t != null; t = t.next) { - String s = mungeComment(t.image); - Location loc = makeLocation(t); - if (t.next != null - && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) { - StringBuffer buf = new StringBuffer(s); - do { - t = t.next; - buf.append('\n'); - buf.append(mungeComment(t.image)); - } while (t.next != null - && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE); - s = buf.toString(); - } - comments.addComment(s, loc); - } - } - } while (lastCommentSourceToken != nextToken); - } - return comments; - } - - private ParsedPattern afterComments(ParsedPattern p) { - CommentList comments = getComments(null); - if (comments == null) - return p; - return sb.commentAfter(p, comments); - } - - private ParsedNameClass afterComments(ParsedNameClass nc) { - CommentList comments = getComments(null); - if (comments == null) - return nc; - return ncb.commentAfter(nc, comments); - } - - private static String mungeComment(String image) { - int i = image.indexOf('#') + 1; - while (i < image.length() && image.charAt(i) == '#') - i++; - if (i < image.length() && image.charAt(i) == ' ') - i++; - return image.substring(i); - } - - private Annotations getCommentsAsAnnotations() { - CommentList comments = getComments(); - if (comments == null) - return null; - return sb.makeAnnotations(comments, getContext()); - } - - private Annotations addCommentsToChildAnnotations(Annotations a) { - CommentList comments = getComments(); - if (comments == null) - return a; - if (a == null) - a = sb.makeAnnotations(null, getContext()); - a.addComment(comments); - return a; - } - - private Annotations addCommentsToLeadingAnnotations(Annotations a) { - CommentList comments = getComments(); - if (comments == null) - return a; - if (a == null) - return sb.makeAnnotations(comments, getContext()); - a.addLeadingComment(comments); - return a; - } - - private Annotations getTopLevelCommentsAsAnnotations() { - CommentList comments = getTopLevelComments(); - if (comments == null) - return null; - return sb.makeAnnotations(comments, getContext()); - } - - private void clearAttributeList() { - attributeNameTable.clear(); - } - - private void addAttribute(Annotations a, String ns, String localName, String prefix, String value, Token tok) { - String key = ns + "#" + localName; - if (attributeNameTable.get(key) != null) - error("duplicate_attribute", ns, localName, tok); - else { - attributeNameTable.put(key, key); - a.addAttribute(ns, localName, prefix, value, makeLocation(tok)); - } - } - - private void checkExcept(Token[] except) { - if (except[0] != null) - error("except_missing_parentheses", except[0]); - } - - private String lookupPrefix(String prefix, Token t) { - String ns = (String)namespaceTable.get(prefix); - if (ns == null) { - error("undeclared_prefix", prefix, t); - return "#error"; - } - return ns; - } - private String lookupDatatype(String prefix, Token t) { - String ns = (String)datatypesTable.get(prefix); - if (ns == null) { - error("undeclared_prefix", prefix, t); - return ""; // XXX - } - return ns; - } - private String resolve(String str) { - try { - return new URL(new URL(sourceUri), str).toString(); - } - catch (MalformedURLException e) { } - return str; - } -} - -PARSER_END(CompactSyntax) - -ParsedPattern Input(Scope scope) : -{ - ParsedPattern p; -} -{ - Preamble() - (LOOKAHEAD(TopLevelLookahead()) p = TopLevelGrammar(scope) - | p = Expr(true, scope, null, null) { p = afterComments(p); } ) - { return p; } -} - -void TopLevelLookahead() : -{} -{ - "[" - | Identifier() ("[" | "=" | "&=" | "|=") - | LookaheadGrammarKeyword() - | LookaheadBody() LookaheadAfterAnnotations() - | LookaheadDocumentation() (LookaheadBody())? LookaheadAfterAnnotations() -} - -void LookaheadAfterAnnotations() : -{} -{ - Identifier() ("=" | "&=" | "|=") - | LookaheadGrammarKeyword() -} - -void LookaheadGrammarKeyword() : -{} -{ - "start" | "div" | "include" -} - -void LookaheadDocumentation() : -{} -{ - (( | ) ()*)+ -} - -void LookaheadBody() : -{} -{ - "[" - ( | UnprefixedName() | "=" | | "~" | LookaheadBody() )* - "]" -} - -ParsedPattern IncludedGrammar(IncludedGrammar g) : -{ - Annotations a; - ParsedPattern p; -} -{ - Preamble() - (LOOKAHEAD(TopLevelLookahead()) a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations()) - | a = Annotations() "grammar" "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}") - { p = afterComments(g.endIncludedGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } - - { return p; } -} - -ParsedPattern TopLevelGrammar(Scope scope) : -{ - Annotations a = getTopLevelCommentsAsAnnotations(); - Grammar g; - ParsedPattern p; -} -{ - { g = sb.makeGrammar(scope); } - a = GrammarBody(g, g, a) - { p = afterComments(g.endGrammar(sb.makeLocation(sourceUri, 1, 1), a)); } - - { return p; } -} - -void Preamble() : -{} -{ - (NamespaceDecl() | DatatypesDecl())* - { - namespaceTable.put("xml", WellKnownNamespaces.XML); - if (datatypesTable.get("xsd") == null) - datatypesTable.put("xsd", WellKnownNamespaces.XML_SCHEMA_DATATYPES); - } -} - -void NamespaceDecl() : -{ - LocatedString prefix = null; - boolean isDefault = false; - String namespaceName; -} -{ - { noteTopLevelComments(); } - (("namespace" prefix = UnprefixedName()) - | ("default" { isDefault = true; } - "namespace" (prefix = UnprefixedName())?)) - "=" - namespaceName = NamespaceName() - { - if (isDefault) - defaultNamespace = namespaceName; - if (prefix != null) { - if (prefix.getString().equals("xmlns")) - error("xmlns_prefix", prefix.getToken()); - else if (prefix.getString().equals("xml")) { - if (!namespaceName.equals(WellKnownNamespaces.XML)) - error("xml_prefix_bad_uri", prefix.getToken()); - } - else if (namespaceName.equals(WellKnownNamespaces.XML)) - error("xml_uri_bad_prefix", prefix.getToken()); - else { - if (namespaceName.equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS)) - compatibilityPrefix = prefix.getString(); - namespaceTable.put(prefix.getString(), namespaceName); - } - } - } -} - -String NamespaceName() : -{ - String r; -} -{ - (r = Literal() | "inherit" { r = this.inheritedNs; }) - { return r; } -} - -void DatatypesDecl() : -{ - LocatedString prefix; - String uri; -} -{ - { noteTopLevelComments(); } - "datatypes" prefix = UnprefixedName() "=" uri = Literal() - { - datatypesTable.put(prefix.getString(), uri); - } -} - -ParsedPattern AnnotatedPrimaryExpr(boolean topLevel, Scope scope, Token[] except) : -{ - Annotations a; - ParsedPattern p; - ParsedElementAnnotation e; - Token t; -} -{ - a = Annotations() - p = PrimaryExpr(topLevel, scope, a, except) - ( t = e = AnnotationElement(false) { - if (topLevel) - error("top_level_follow_annotation", t); - else - p = sb.annotateAfter(p, e); - })* - { return p; } -} - - -ParsedPattern PrimaryExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : -{ - ParsedPattern p; -} -{ - (p = ElementExpr(scope, a) - | p = AttributeExpr(scope, a) - | p = GrammarExpr(scope, a) - | p = ExternalRefExpr(scope, a) - | p = ListExpr(scope, a) - | p = MixedExpr(scope, a) - | p = ParenExpr(topLevel, scope, a) - | p = IdentifierExpr(scope, a) - | p = ParentExpr(scope, a) - | p = DataExpr(topLevel, scope, a, except) - | p = ValueExpr(topLevel, a) - | p = TextExpr(a) - | p = EmptyExpr(a) - | p = NotAllowedExpr(a)) - { return p; } -} - -ParsedPattern EmptyExpr(Annotations a) : -{ - Token t; -} -{ - t = "empty" - { return sb.makeEmpty(makeLocation(t), a); } -} - -ParsedPattern TextExpr(Annotations a) : -{ - Token t; -} -{ - t = "text" - { return sb.makeText(makeLocation(t), a); } -} - -ParsedPattern NotAllowedExpr(Annotations a) : -{ - Token t; -} -{ - t = "notAllowed" - { return sb.makeNotAllowed(makeLocation(t), a); } -} - -ParsedPattern Expr(boolean topLevel, Scope scope, Token t, Annotations a) : -{ - List patterns = new ArrayList(); - ParsedPattern p; - boolean[] hadOccur = new boolean[1]; - Token[] except = new Token[1]; -} -{ - p = UnaryExpr(topLevel, scope, hadOccur, except) - { patterns.add(p); } - ( - { checkExcept(except); } - (t = "|" p = UnaryExpr(topLevel, scope, null, except) - { patterns.add(p); checkExcept(except); } )+ - { p = sb.makeChoice(patterns, makeLocation(t), a); } - | (t = "&" p = UnaryExpr(topLevel, scope, null, except) - { patterns.add(p); checkExcept(except); } )+ - { p = sb.makeInterleave(patterns, makeLocation(t), a); } - | (t = "," p = UnaryExpr(topLevel, scope, null, except) - { patterns.add(p); checkExcept(except); } )+ - { p = sb.makeGroup(patterns, makeLocation(t), a); } - )? - { - if (patterns.size() == 1 && a != null) { - if (hadOccur[0]) - p = sb.annotate(p, a); - else - p = sb.makeGroup(patterns, makeLocation(t), a); - } - return p; - } -} - -ParsedPattern UnaryExpr(boolean topLevel, Scope scope, boolean[] hadOccur, Token[] except) : -{ - ParsedPattern p; - Token t; - ParsedElementAnnotation e; -} -{ - p = AnnotatedPrimaryExpr(topLevel, scope, except) - ( - { - if (hadOccur != null) hadOccur[0] = true; - p = afterComments(p); - } - (t = "+" { checkExcept(except); p = sb.makeOneOrMore(p, makeLocation(t), null); } - | t = "?" { checkExcept(except); p = sb.makeOptional(p, makeLocation(t), null); } - | t = "*" { checkExcept(except); p = sb.makeZeroOrMore(p, makeLocation(t), null); }) - ( t = e = AnnotationElement(false) { - if (topLevel) - error("top_level_follow_annotation", t); - else - p = sb.annotateAfter(p, e); - } )* - )? - { return p; } -} - -ParsedPattern ElementExpr(Scope scope, Annotations a) : -{ - Token t; - ParsedNameClass nc; - ParsedPattern p; -} -{ - t = "element" - nc = NameClass(IN_ELEMENT, null) - "{" - p = Expr(false, scope, null, null) - { p = afterComments(p); } - "}" - { return sb.makeElement(nc, p, makeLocation(t), a); } -} - -ParsedPattern AttributeExpr(Scope scope, Annotations a) : -{ - Token t; - ParsedNameClass nc; - ParsedPattern p; -} -{ - t = "attribute" - nc = NameClass(IN_ATTRIBUTE, null) - "{" - p = Expr(false, scope, null, null) - { p = afterComments(p); } - "}" - { return sb.makeAttribute(nc, p, makeLocation(t), a); } -} - -ParsedNameClass NameClass(int context, Annotations[] pa) : -{ - Annotations a; - ParsedNameClass nc; -} -{ - a = Annotations() - (nc = PrimaryNameClass(context, a) nc = AnnotateAfter(nc) nc = NameClassAlternatives(context, nc, pa) - | nc = AnyNameExceptClass(context, a, pa) - | nc = NsNameExceptClass(context, a, pa)) - { return nc; } -} - -ParsedNameClass AnnotateAfter(ParsedNameClass nc) : -{ - ParsedElementAnnotation e; -} -{ - ( e = AnnotationElement(false) { nc = ncb.annotateAfter(nc, e); })* - { return nc; } -} - -ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) : -{ - Token t; - ParsedNameClass[] nameClasses; - int nNameClasses; -} -{ - ( - { - nameClasses = new ParsedNameClass[2]; - nameClasses[0] = nc; - nNameClasses = 1; - } - (t = "|" nc = BasicNameClass(context) nc = AnnotateAfter(nc) - { - if (nNameClasses >= nameClasses.length) { - ParsedNameClass[] oldNameClasses = nameClasses; - nameClasses = new ParsedNameClass[oldNameClasses.length*2]; - System.arraycopy(oldNameClasses, 0, nameClasses, 0, oldNameClasses.length); - } - nameClasses[nNameClasses++] = nc; - })+ - { - Annotations a; - if (pa == null) - a = null; - else { - a = pa[0]; - pa[0] = null; - } - nc = ncb.makeChoice(Arrays.asList(nameClasses).subList(0,nNameClasses), makeLocation(t), a); - } - )? - { return nc; } -} - -ParsedNameClass BasicNameClass(int context) : -{ - Annotations a; - ParsedNameClass nc; -} -{ - a = Annotations() - (nc = PrimaryNameClass(context, a) - | nc = OpenNameClass(context, a)) - { return nc; } -} - -ParsedNameClass PrimaryNameClass(int context, Annotations a) : -{ - ParsedNameClass nc; -} -{ - (nc = UnprefixedNameClass(context, a) - | nc = PrefixedNameClass(a) - | nc = ParenNameClass(context, a)) - { return nc; } -} - -ParsedNameClass OpenNameClass(int context, Annotations a) : -{ - Token t; - LocatedString ns; -} -{ - ns = NsName() { checkNsName(context, ns); return ncb.makeNsName(ns.getString(), ns.getLocation(), a); } - | t = "*" { checkAnyName(context, t); return ncb.makeAnyName(makeLocation(t), a); } -} - - -ParsedNameClass UnprefixedNameClass(int context, Annotations a) : -{ - LocatedString name; -} -{ - name = UnprefixedName() - { - String ns; - if ((context & (IN_ATTRIBUTE|IN_ELEMENT)) == IN_ATTRIBUTE) - ns = ""; - else - ns = defaultNamespace; - return ncb.makeName(ns, name.getString(), null, name.getLocation(), a); - } -} - -ParsedNameClass PrefixedNameClass(Annotations a) : -{ - Token t; -} -{ - t = - { - String qn = t.image; - int colon = qn.indexOf(':'); - String prefix = qn.substring(0, colon); - return ncb.makeName(lookupPrefix(prefix, t), qn.substring(colon + 1), prefix, makeLocation(t), a); - } -} - -ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) : -{ - LocatedString ns; - ParsedNameClass nc; -} -{ - ns = NsName() - { checkNsName(context, ns); } - (nc = ExceptNameClass(context | IN_NS_NAME) - { nc = ncb.makeNsName(ns.getString(), nc, ns.getLocation(), a); } - nc = AnnotateAfter(nc) - | { nc = ncb.makeNsName(ns.getString(), ns.getLocation(), a); } - nc = AnnotateAfter(nc) - nc = NameClassAlternatives(context, nc, pa)) - { return nc; } -} - -LocatedString NsName() : -{ - Token t; -} -{ - t = - { - String qn = t.image; - String prefix = qn.substring(0, qn.length() - 2); - return new LocatedString(lookupPrefix(prefix, t), t); - } -} - -ParsedNameClass AnyNameExceptClass(int context, Annotations a, Annotations[] pa) : -{ - Token t; - ParsedNameClass nc; -} -{ - t = "*" - { checkAnyName(context, t); } - (nc = ExceptNameClass(context | IN_ANY_NAME) - { nc = ncb.makeAnyName(nc, makeLocation(t), a); } - nc = AnnotateAfter(nc) - | { nc = ncb.makeAnyName(makeLocation(t), a); } - nc = AnnotateAfter(nc) - nc = NameClassAlternatives(context, nc, pa)) - { return nc; } -} - -ParsedNameClass ParenNameClass(int context, Annotations a) : -{ - Token t; - ParsedNameClass nc; - Annotations[] pa = new Annotations[]{ a }; -} -{ - t = "(" nc = NameClass(context, pa) { nc = afterComments(nc); } ")" - { - if (pa[0] != null) - nc = ncb.makeChoice(Collections.singletonList(nc), makeLocation(t), pa[0]); - return nc; - } -} - -ParsedNameClass ExceptNameClass(int context) : -{ - ParsedNameClass nc; -} -{ - "-" nc = BasicNameClass(context) - { return nc; } -} - -ParsedPattern ListExpr(Scope scope, Annotations a) : -{ - Token t; - ParsedPattern p; -} -{ - t = "list" - "{" - p = Expr(false, scope, null, null) - { p = afterComments(p); } - "}" - { return sb.makeList(p, makeLocation(t), a); } -} - -ParsedPattern MixedExpr(Scope scope, Annotations a) : -{ - Token t; - ParsedPattern p; -} -{ - t = "mixed" - "{" - p = Expr(false, scope, null, null) - { p = afterComments(p); } - "}" - { return sb.makeMixed(p, makeLocation(t), a); } -} - -ParsedPattern GrammarExpr(Scope scope, Annotations a) : -{ - Token t; - Grammar g; -} -{ - t = "grammar" { g = sb.makeGrammar(scope); } - "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}" - { return g.endGrammar(makeLocation(t), a); } -} - -ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) : -{ - Token t; - ParsedPattern p; -} -{ - t = "(" p = Expr(topLevel, scope, t, a) { p = afterComments(p); } ")" - { return p; } -} - -Annotations GrammarBody(GrammarSection section, Scope scope, Annotations a) : -{ - ParsedElementAnnotation e; -} -{ - (LOOKAHEAD(2) e = AnnotationElementNotKeyword() - { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* - (GrammarComponent(section, scope))* - { return a; } -} - -void GrammarComponent(GrammarSection section, Scope scope) : -{ - ParsedElementAnnotation e; - Annotations a; -} -{ - (a = Annotations() - (Definition(section, scope, a) - | Include(section, scope, a) - | Div(section, scope, a))) - (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* -} - -void Definition(GrammarSection section, Scope scope, Annotations a) : -{} -{ - (Define(section, scope, a) | Start(section, scope, a)) -} - -void Start(GrammarSection section, Scope scope, Annotations a) : -{ - Token t; - GrammarSection.Combine combine; - ParsedPattern p; -} -{ - t = "start" combine = AssignOp() p = Expr(false, scope, null, null) - { section.define(GrammarSection.START, combine, p, makeLocation(t), a); } -} - -void Define(GrammarSection section, Scope scope, Annotations a) : -{ - LocatedString name; - GrammarSection.Combine combine; - ParsedPattern p; -} -{ - name = Identifier() combine = AssignOp() p = Expr(false, scope, null, null) - { section.define(name.getString(), combine, p, name.getLocation(), a); } -} - -GrammarSection.Combine AssignOp() : -{} -{ - "=" { return null; } - | "|=" { return GrammarSection.COMBINE_CHOICE; } - | "&=" { return GrammarSection.COMBINE_INTERLEAVE; } -} - -void Include(GrammarSection section, Scope scope, Annotations a) : -{ - Token t; - String href; - String ns; - Include include = section.makeInclude(); -} -{ - t = "include" href = Literal() - ns = Inherit() - ("{" a = IncludeBody(include, scope, a) { topLevelComments(include); } "}")? - { - try { - include.endInclude(parseable, resolve(href), ns, makeLocation(t), a); - } - catch (IllegalSchemaException e) { } - } -} - -Annotations IncludeBody(GrammarSection section, Scope scope, Annotations a) : -{ - ParsedElementAnnotation e; -} -{ - (LOOKAHEAD(2) e = AnnotationElementNotKeyword() - { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })* - (IncludeComponent(section, scope))* - { return a; } -} - - -void IncludeComponent(GrammarSection section, Scope scope) : -{ - ParsedElementAnnotation e; - Annotations a; -} -{ - (a = Annotations() (Definition(section, scope, a) - | IncludeDiv(section, scope, a))) - (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })* -} - -void Div(GrammarSection section, Scope scope, Annotations a) : -{ - Token t; - Div div = section.makeDiv(); -} -{ - t = "div" "{" a = GrammarBody(div, scope, a) { topLevelComments(div); } "}" - { div.endDiv(makeLocation(t), a); } -} - -void IncludeDiv(GrammarSection section, Scope scope, Annotations a) : -{ - Token t; - Div div = section.makeDiv(); -} -{ - t = "div" "{" a = IncludeBody(div, scope, a) { topLevelComments(div); } "}" - { div.endDiv(makeLocation(t), a); } -} - -ParsedPattern ExternalRefExpr(Scope scope, Annotations a) : -{ - Token t; - String href; - String ns; -} -{ - t = "external" href = Literal() - ns = Inherit() - { - try { - return sb.makeExternalRef(parseable, resolve(href), ns, scope, makeLocation(t), a); - } - catch (IllegalSchemaException e) { - return sb.makeErrorPattern(); - } - } -} - -String Inherit() : -{ - String ns = null; -} -{ - ("inherit" "=" ns = Prefix())? - { - if (ns == null) - ns = defaultNamespace; - return ns; - } -} - -ParsedPattern ParentExpr(Scope scope, Annotations a) : -{ - LocatedString name; -} -{ - "parent" { a = addCommentsToChildAnnotations(a); } name = Identifier() - { - if(scope==null) { - error("parent_ref_outside_grammar",name.getToken()); - return sb.makeErrorPattern(); - } else { - return scope.makeParentRef(name.getString(), name.getLocation(), a); - } - } -} - -ParsedPattern IdentifierExpr(Scope scope, Annotations a) : -{ - LocatedString name; -} -{ - name = Identifier() - { - if(scope==null) { - error("ref_outside_grammar",name.getToken()); - return sb.makeErrorPattern(); - } else { - return scope.makeRef(name.getString(), name.getLocation(), a); - } - } -} - -ParsedPattern ValueExpr(boolean topLevel, Annotations a) : -{ - LocatedString s; -} -{ - s = LocatedLiteral() - { - if (topLevel && annotationsIncludeElements) { - error("top_level_follow_annotation", s.getToken()); - a = null; - } - return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a); - } -} - -ParsedPattern DataExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) : -{ - Token datatypeToken; - Location loc; - String datatype; - String datatypeUri = null; - String s = null; - ParsedPattern e = null; - DataPatternBuilder dpb; -} -{ - datatypeToken = DatatypeName() - { - datatype = datatypeToken.image; - loc = makeLocation(datatypeToken); - int colon = datatype.indexOf(':'); - if (colon < 0) - datatypeUri = ""; - else { - String prefix = datatype.substring(0, colon); - datatypeUri = lookupDatatype(prefix, datatypeToken); - datatype = datatype.substring(colon + 1); - } - } - ((s = Literal() - { - if (topLevel && annotationsIncludeElements) { - error("top_level_follow_annotation", datatypeToken); - a = null; - } - return sb.makeValue(datatypeUri, datatype, s, getContext(), defaultNamespace, loc, a); - } - ) - | ( { dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc); } - ( (Params(dpb) (e = Except(scope, except))?) - | (e = Except(scope, except))?) - { return e == null ? dpb.makePattern(loc, a) : dpb.makePattern(e, loc, a); })) -} - -Token DatatypeName() : -{ - Token t; -} -{ - (t = "string" | t = "token" | t = ) - { return t; } -} - -LocatedString Identifier() : -{ - LocatedString s; - Token t; -} -{ - (t = { s = new LocatedString(t.image, t); } - | t = { s = new LocatedString(t.image.substring(1), t); }) - { return s; } -} - -String Prefix() : -{ - Token t; - String prefix; -} -{ - (t = { prefix = t.image; } - | t = { prefix = t.image.substring(1); } - | t = Keyword() { prefix = t.image; }) - { return lookupPrefix(prefix, t); } -} - -LocatedString UnprefixedName() : -{ - LocatedString s; - Token t; -} -{ - (s = Identifier() - | t = Keyword() { s = new LocatedString(t.image, t); }) - { return s; } -} - -void Params(DataPatternBuilder dpb) : -{} -{ - "{" (Param(dpb))* "}" -} - -void Param(DataPatternBuilder dpb) : -{ - LocatedString name; - Annotations a; - String value; -} -{ - a = Annotations() name = UnprefixedName() "=" { a = addCommentsToLeadingAnnotations(a); } value = Literal() - { dpb.addParam(name.getString(), value, getContext(), defaultNamespace, name.getLocation(), a); } -} - -ParsedPattern Except(Scope scope, Token[] except) : -{ - Annotations a; - ParsedPattern p; - Token t; - Token[] innerExcept = new Token[1]; -} -{ - t = "-" a = Annotations() p = PrimaryExpr(false, scope, a, innerExcept) - { - checkExcept(innerExcept); - except[0] = t; - return p; - } -} - -ParsedElementAnnotation Documentation() : -{ - CommentList comments = getComments(); - ElementAnnotationBuilder eab; - Token t; -} -{ - (t = | t = ) - { - eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS, - "documentation", - getCompatibilityPrefix(), - makeLocation(t), - comments, - getContext()); - eab.addText(mungeComment(t.image), makeLocation(t), null); - } - (t = { eab.addText("\n" + mungeComment(t.image), makeLocation(t), null); })* - { return eab.makeElementAnnotation(); } -} - -Annotations Annotations() : -{ - CommentList comments = getComments(); - Annotations a = null; - ParsedElementAnnotation e; -} -{ - ( { a = sb.makeAnnotations(comments, getContext()); } - (e = Documentation() { a.addElement(e); })+ - { - comments = getComments(); - if (comments != null) - a.addLeadingComment(comments); - } - )? - ("[" { if (a == null) a = sb.makeAnnotations(comments, getContext()); clearAttributeList(); annotationsIncludeElements = false; } - (LOOKAHEAD(2) PrefixedAnnotationAttribute(a, false) )* - ( e = AnnotationElement(false) { a.addElement(e); annotationsIncludeElements = true; } )* - { a.addComment(getComments()); } - "]")? - { - if (a == null && comments != null) - a = sb.makeAnnotations(comments, getContext()); - return a; - } -} - -void AnnotationAttribute(Annotations a) : -{} -{ - PrefixedAnnotationAttribute(a, true) | UnprefixedAnnotationAttribute(a) -} - -void PrefixedAnnotationAttribute(Annotations a, boolean nested) : -{ - Token t; - String value; -} -{ - t = "=" value = Literal() - { - String qn = t.image; - int colon = qn.indexOf(':'); - String prefix = qn.substring(0, colon); - String ns = lookupPrefix(prefix, t); - if (ns == this.inheritedNs) - error("inherited_annotation_namespace", t); - else if (ns.length() == 0 && !nested) - error("unqualified_annotation_attribute", t); - else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested) - error("relax_ng_namespace", t); - /*else if (ns.length() == 0 - && qn.length() - colon - 1 == 5 - && qn.regionMatches(colon + 1, "xmlns", 0, 5)) - error("xmlns_annotation_attribute", t);*/ - else if (ns.equals(WellKnownNamespaces.XMLNS)) - error("xmlns_annotation_attribute_uri", t); - else { - if (ns.length() == 0) - prefix = null; - addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t); - } - } -} - -void UnprefixedAnnotationAttribute(Annotations a) : -{ - LocatedString name; - String value; -} -{ - name = UnprefixedName() "=" value = Literal() - { - if (name.getString().equals("xmlns")) - error("xmlns_annotation_attribute", name.getToken()); - else - addAttribute(a, "", name.getString(), null, value, name.getToken()); - } -} - -ParsedElementAnnotation AnnotationElement(boolean nested) : -{ - ParsedElementAnnotation a; -} -{ - (a = PrefixedAnnotationElement(nested) - | a = UnprefixedAnnotationElement()) - { return a; } -} - -ParsedElementAnnotation AnnotationElementNotKeyword() : -{ - ParsedElementAnnotation a; -} -{ - (a = PrefixedAnnotationElement(false) - | a = IdentifierAnnotationElement()) - { return a; } -} - -ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) : -{ - CommentList comments = getComments(); - Token t; - ElementAnnotationBuilder eab; -} -{ - t = - { - String qn = t.image; - int colon = qn.indexOf(':'); - String prefix = qn.substring(0, colon); - String ns = lookupPrefix(prefix, t); - if (ns == this.inheritedNs) { - error("inherited_annotation_namespace", t); - ns = ""; - } - else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) { - error("relax_ng_namespace", t); - ns = ""; - } - else { - if (ns.length() == 0) - prefix = null; - } - eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix, - makeLocation(t), comments, getContext()); - } - AnnotationElementContent(eab) - { return eab.makeElementAnnotation(); } -} - -ParsedElementAnnotation UnprefixedAnnotationElement() : -{ - CommentList comments = getComments(); - LocatedString name; - ElementAnnotationBuilder eab; -} -{ - name = UnprefixedName() - { - eab = sb.makeElementAnnotationBuilder("", name.getString(), null, - name.getLocation(), comments, getContext()); - } - AnnotationElementContent(eab) - { return eab.makeElementAnnotation(); } -} - -ParsedElementAnnotation IdentifierAnnotationElement() : -{ - CommentList comments = getComments(); - LocatedString name; - ElementAnnotationBuilder eab; -} -{ - name = Identifier() - { - eab = sb.makeElementAnnotationBuilder("", name.getString(), null, - name.getLocation(), comments, getContext()); - } - AnnotationElementContent(eab) - { return eab.makeElementAnnotation(); } -} - -void AnnotationElementContent(ElementAnnotationBuilder eab) : -{ - ParsedElementAnnotation e; -} -{ - "[" { clearAttributeList(); } - (LOOKAHEAD(2) AnnotationAttribute(eab))* - ((AnnotationElementLiteral(eab) - ("~" AnnotationElementLiteral(eab))*) - | e = AnnotationElement(true) { eab.addElement(e); })* - { eab.addComment(getComments()); } - "]" -} - -void AnnotationElementLiteral(ElementAnnotationBuilder eab) : -{ - Token t; - CommentList comments = getComments(); -} -{ - t = { eab.addText(unquote(t.image), makeLocation(t), comments); } -} - -String Literal() : -{ - Token t; - String s; - StringBuffer buf; -} -{ - t = - { - s = unquote(t.image); - } - ( - { buf = new StringBuffer(s); } - ("~" t = { buf.append(unquote(t.image)); })+ - { s = buf.toString(); } - )? - { return s; } -} - -LocatedString LocatedLiteral() : -{ - Token t; - Token t2; - String s; - StringBuffer buf; -} -{ - t = - { - s = unquote(t.image); - } - ( - { buf = new StringBuffer(s); } - ("~" t2 = { buf.append(unquote(t2.image)); })+ - { s = buf.toString(); } - )? - { return new LocatedString(s, t); } -} - -Token Keyword() : -{ - Token t; -} -{ - (t = "element" - | t = "attribute" - | t = "namespace" - | t = "list" - | t = "mixed" - | t = "grammar" - | t = "empty" - | t = "text" - | t = "parent" - | t = "external" - | t = "notAllowed" - | t = "start" - | t = "include" - | t = "default" - | t = "inherit" - | t = "string" - | t = "token" - | t = "datatypes" - | t = "div") - { return t; } -} - -<*> -SKIP: { - < #NEWLINE : [ "\u0000", "\n" ] > - | < #NOT_NEWLINE : ~[ "\u0000", "\n" ] > - | < WS: ([ "\u0000", " ", "\n", "\t" ])+ > : DEFAULT -} - -TOKEN : -{ - < DOCUMENTATION: "##" ()* > : AFTER_DOCUMENTATION -} - - -TOKEN : -{ - < DOCUMENTATION_CONTINUE: ([" ", "\t"])* > -} - -SPECIAL_TOKEN: -{ - < SINGLE_LINE_COMMENT: "#" ()* > : AFTER_SINGLE_LINE_COMMENT -} - - -TOKEN : -{ - < DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: ([" ", "\t"])* > : AFTER_DOCUMENTATION -} - - -SPECIAL_TOKEN : -{ - < SINGLE_LINE_COMMENT_CONTINUE: ([" ", "\t"])* > -} - -TOKEN : -{ - < #BASE_CHAR : [ - "\u0041" - "\u005a", - "\u0061" - "\u007a", - "\u00c0" - "\u00d6", - "\u00d8" - "\u00f6", - "\u00f8" - "\u00ff", - "\u0100" - "\u0131", - "\u0134" - "\u013e", - "\u0141" - "\u0148", - "\u014a" - "\u017e", - "\u0180" - "\u01c3", - "\u01cd" - "\u01f0", - "\u01f4" - "\u01f5", - "\u01fa" - "\u0217", - "\u0250" - "\u02a8", - "\u02bb" - "\u02c1", - "\u0386", - "\u0388" - "\u038a", - "\u038c", - "\u038e" - "\u03a1", - "\u03a3" - "\u03ce", - "\u03d0" - "\u03d6", - "\u03da", - "\u03dc", - "\u03de", - "\u03e0", - "\u03e2" - "\u03f3", - "\u0401" - "\u040c", - "\u040e" - "\u044f", - "\u0451" - "\u045c", - "\u045e" - "\u0481", - "\u0490" - "\u04c4", - "\u04c7" - "\u04c8", - "\u04cb" - "\u04cc", - "\u04d0" - "\u04eb", - "\u04ee" - "\u04f5", - "\u04f8" - "\u04f9", - "\u0531" - "\u0556", - "\u0559", - "\u0561" - "\u0586", - "\u05d0" - "\u05ea", - "\u05f0" - "\u05f2", - "\u0621" - "\u063a", - "\u0641" - "\u064a", - "\u0671" - "\u06b7", - "\u06ba" - "\u06be", - "\u06c0" - "\u06ce", - "\u06d0" - "\u06d3", - "\u06d5", - "\u06e5" - "\u06e6", - "\u0905" - "\u0939", - "\u093d", - "\u0958" - "\u0961", - "\u0985" - "\u098c", - "\u098f" - "\u0990", - "\u0993" - "\u09a8", - "\u09aa" - "\u09b0", - "\u09b2", - "\u09b6" - "\u09b9", - "\u09dc" - "\u09dd", - "\u09df" - "\u09e1", - "\u09f0" - "\u09f1", - "\u0a05" - "\u0a0a", - "\u0a0f" - "\u0a10", - "\u0a13" - "\u0a28", - "\u0a2a" - "\u0a30", - "\u0a32" - "\u0a33", - "\u0a35" - "\u0a36", - "\u0a38" - "\u0a39", - "\u0a59" - "\u0a5c", - "\u0a5e", - "\u0a72" - "\u0a74", - "\u0a85" - "\u0a8b", - "\u0a8d", - "\u0a8f" - "\u0a91", - "\u0a93" - "\u0aa8", - "\u0aaa" - "\u0ab0", - "\u0ab2" - "\u0ab3", - "\u0ab5" - "\u0ab9", - "\u0abd", - "\u0ae0", - "\u0b05" - "\u0b0c", - "\u0b0f" - "\u0b10", - "\u0b13" - "\u0b28", - "\u0b2a" - "\u0b30", - "\u0b32" - "\u0b33", - "\u0b36" - "\u0b39", - "\u0b3d", - "\u0b5c" - "\u0b5d", - "\u0b5f" - "\u0b61", - "\u0b85" - "\u0b8a", - "\u0b8e" - "\u0b90", - "\u0b92" - "\u0b95", - "\u0b99" - "\u0b9a", - "\u0b9c", - "\u0b9e" - "\u0b9f", - "\u0ba3" - "\u0ba4", - "\u0ba8" - "\u0baa", - "\u0bae" - "\u0bb5", - "\u0bb7" - "\u0bb9", - "\u0c05" - "\u0c0c", - "\u0c0e" - "\u0c10", - "\u0c12" - "\u0c28", - "\u0c2a" - "\u0c33", - "\u0c35" - "\u0c39", - "\u0c60" - "\u0c61", - "\u0c85" - "\u0c8c", - "\u0c8e" - "\u0c90", - "\u0c92" - "\u0ca8", - "\u0caa" - "\u0cb3", - "\u0cb5" - "\u0cb9", - "\u0cde", - "\u0ce0" - "\u0ce1", - "\u0d05" - "\u0d0c", - "\u0d0e" - "\u0d10", - "\u0d12" - "\u0d28", - "\u0d2a" - "\u0d39", - "\u0d60" - "\u0d61", - "\u0e01" - "\u0e2e", - "\u0e30", - "\u0e32" - "\u0e33", - "\u0e40" - "\u0e45", - "\u0e81" - "\u0e82", - "\u0e84", - "\u0e87" - "\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94" - "\u0e97", - "\u0e99" - "\u0e9f", - "\u0ea1" - "\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa" - "\u0eab", - "\u0ead" - "\u0eae", - "\u0eb0", - "\u0eb2" - "\u0eb3", - "\u0ebd", - "\u0ec0" - "\u0ec4", - "\u0f40" - "\u0f47", - "\u0f49" - "\u0f69", - "\u10a0" - "\u10c5", - "\u10d0" - "\u10f6", - "\u1100", - "\u1102" - "\u1103", - "\u1105" - "\u1107", - "\u1109", - "\u110b" - "\u110c", - "\u110e" - "\u1112", - "\u113c", - "\u113e", - "\u1140", - "\u114c", - "\u114e", - "\u1150", - "\u1154" - "\u1155", - "\u1159", - "\u115f" - "\u1161", - "\u1163", - "\u1165", - "\u1167", - "\u1169", - "\u116d" - "\u116e", - "\u1172" - "\u1173", - "\u1175", - "\u119e", - "\u11a8", - "\u11ab", - "\u11ae" - "\u11af", - "\u11b7" - "\u11b8", - "\u11ba", - "\u11bc" - "\u11c2", - "\u11eb", - "\u11f0", - "\u11f9", - "\u1e00" - "\u1e9b", - "\u1ea0" - "\u1ef9", - "\u1f00" - "\u1f15", - "\u1f18" - "\u1f1d", - "\u1f20" - "\u1f45", - "\u1f48" - "\u1f4d", - "\u1f50" - "\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f" - "\u1f7d", - "\u1f80" - "\u1fb4", - "\u1fb6" - "\u1fbc", - "\u1fbe", - "\u1fc2" - "\u1fc4", - "\u1fc6" - "\u1fcc", - "\u1fd0" - "\u1fd3", - "\u1fd6" - "\u1fdb", - "\u1fe0" - "\u1fec", - "\u1ff2" - "\u1ff4", - "\u1ff6" - "\u1ffc", - "\u2126", - "\u212a" - "\u212b", - "\u212e", - "\u2180" - "\u2182", - "\u3041" - "\u3094", - "\u30a1" - "\u30fa", - "\u3105" - "\u312c", - "\uac00" - "\ud7a3" - ] > - | < #IDEOGRAPHIC : [ - "\u4e00" - "\u9fa5", - "\u3007", - "\u3021" - "\u3029" - ] > - | < #LETTER : ( | ) > - | < #COMBINING_CHAR : [ - "\u0300" - "\u0345", - "\u0360" - "\u0361", - "\u0483" - "\u0486", - "\u0591" - "\u05a1", - "\u05a3" - "\u05b9", - "\u05bb" - "\u05bd", - "\u05bf", - "\u05c1" - "\u05c2", - "\u05c4", - "\u064b" - "\u0652", - "\u0670", - "\u06d6" - "\u06dc", - "\u06dd" - "\u06df", - "\u06e0" - "\u06e4", - "\u06e7" - "\u06e8", - "\u06ea" - "\u06ed", - "\u0901" - "\u0903", - "\u093c", - "\u093e" - "\u094c", - "\u094d", - "\u0951" - "\u0954", - "\u0962" - "\u0963", - "\u0981" - "\u0983", - "\u09bc", - "\u09be", - "\u09bf", - "\u09c0" - "\u09c4", - "\u09c7" - "\u09c8", - "\u09cb" - "\u09cd", - "\u09d7", - "\u09e2" - "\u09e3", - "\u0a02", - "\u0a3c", - "\u0a3e", - "\u0a3f", - "\u0a40" - "\u0a42", - "\u0a47" - "\u0a48", - "\u0a4b" - "\u0a4d", - "\u0a70" - "\u0a71", - "\u0a81" - "\u0a83", - "\u0abc", - "\u0abe" - "\u0ac5", - "\u0ac7" - "\u0ac9", - "\u0acb" - "\u0acd", - "\u0b01" - "\u0b03", - "\u0b3c", - "\u0b3e" - "\u0b43", - "\u0b47" - "\u0b48", - "\u0b4b" - "\u0b4d", - "\u0b56" - "\u0b57", - "\u0b82" - "\u0b83", - "\u0bbe" - "\u0bc2", - "\u0bc6" - "\u0bc8", - "\u0bca" - "\u0bcd", - "\u0bd7", - "\u0c01" - "\u0c03", - "\u0c3e" - "\u0c44", - "\u0c46" - "\u0c48", - "\u0c4a" - "\u0c4d", - "\u0c55" - "\u0c56", - "\u0c82" - "\u0c83", - "\u0cbe" - "\u0cc4", - "\u0cc6" - "\u0cc8", - "\u0cca" - "\u0ccd", - "\u0cd5" - "\u0cd6", - "\u0d02" - "\u0d03", - "\u0d3e" - "\u0d43", - "\u0d46" - "\u0d48", - "\u0d4a" - "\u0d4d", - "\u0d57", - "\u0e31", - "\u0e34" - "\u0e3a", - "\u0e47" - "\u0e4e", - "\u0eb1", - "\u0eb4" - "\u0eb9", - "\u0ebb" - "\u0ebc", - "\u0ec8" - "\u0ecd", - "\u0f18" - "\u0f19", - "\u0f35", - "\u0f37", - "\u0f39", - "\u0f3e", - "\u0f3f", - "\u0f71" - "\u0f84", - "\u0f86" - "\u0f8b", - "\u0f90" - "\u0f95", - "\u0f97", - "\u0f99" - "\u0fad", - "\u0fb1" - "\u0fb7", - "\u0fb9", - "\u20d0" - "\u20dc", - "\u20e1", - "\u302a" - "\u302f", - "\u3099", - "\u309a" - ] > - | < #DIGIT : [ - "\u0030" - "\u0039", - "\u0660" - "\u0669", - "\u06f0" - "\u06f9", - "\u0966" - "\u096f", - "\u09e6" - "\u09ef", - "\u0a66" - "\u0a6f", - "\u0ae6" - "\u0aef", - "\u0b66" - "\u0b6f", - "\u0be7" - "\u0bef", - "\u0c66" - "\u0c6f", - "\u0ce6" - "\u0cef", - "\u0d66" - "\u0d6f", - "\u0e50" - "\u0e59", - "\u0ed0" - "\u0ed9", - "\u0f20" - "\u0f29" - ] > - | < #EXTENDER : [ - "\u00b7", - "\u02d0", - "\u02d1", - "\u0387", - "\u0640", - "\u0e46", - "\u0ec6", - "\u3005", - "\u3031" - "\u3035", - "\u309d" - "\u309e", - "\u30fc" - "\u30fe" - ] > - | < #NMSTART : ( | "_") > - | < #NMCHAR : ( | | | | "." | "-" | "_") > - | < #NCNAME: ()* > -} - -TOKEN : -{ - < IDENTIFIER: > - | < ESCAPED_IDENTIFIER: "\\" > - | < PREFIX_STAR: ":*" > - | < PREFIXED_NAME: ":" > - | < LITERAL : ("\"" (~["\u0000", "\""])* "\"") - | ("'" (~["\u0000", "'"])* "'") - | ("\"\"\"" (~["\""] - | ("\"" ~["\""]) - | ("\"\"" ~["\""]))* "\"\"\"") - | ("'''" (~["'"] - | ("'" ~["'"]) - | ("''" ~["'"]))* "'''") > - | < FANNOTATE : ">>" > -} - -/* This avoids lexical errors from JavaCC. */ -<*> -TOKEN : -{ - < ILLEGAL_CHAR : [ "\u0000" - "\u0008", "\u000b" - "\uffff" ] > -} diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/pacakge-info.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/package-info.java similarity index 95% rename from jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/pacakge-info.java rename to jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/package-info.java index c64df853e20..e3fff6d0645 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/pacakge-info.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 From 5fa1e08e4231cf3293c94d4a5418e7f4e7388086 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 26 May 2014 17:22:04 -0400 Subject: [PATCH 147/185] 8043975: Update README for jdk9 Reviewed-by: tbell --- README | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README b/README index 40c9fbc6a77..e1fdec5d4ab 100644 --- a/README +++ b/README @@ -1,15 +1,15 @@ README: This file should be located at the top of the OpenJDK Mercurial root repository. A full OpenJDK repository set (forest) should also include - the following 6 nested repositories: - "jdk", "hotspot", "langtools", "corba", "jaxws" and "jaxp". + the following 7 nested repositories: + "jdk", "hotspot", "langtools", "nashorn", "corba", "jaxws" and "jaxp". The root repository can be obtained with something like: - hg clone http://hg.openjdk.java.net/jdk8/jdk8 openjdk8 + hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9 You can run the get_source.sh script located in the root repository to get the other needed repositories: - cd openjdk8 && sh ./get_source.sh + cd openjdk9 && sh ./get_source.sh People unfamiliar with Mercurial should read the first few chapters of the Mercurial book: http://hgbook.red-bean.com/read/ @@ -19,9 +19,9 @@ README: Simple Build Instructions: 0. Get the necessary system software/packages installed on your system, see - http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html + http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html - 1. If you don't have a jdk7u7 or newer jdk, download and install it from + 1. If you don't have a jdk8 or newer jdk, download and install it from http://java.sun.com/javase/downloads/index.jsp Add the /bin directory of this installation to your PATH environment variable. @@ -37,4 +37,4 @@ where make is GNU make 3.81 or newer, /usr/bin/make on Linux usually is 3.81 or newer. Note that on Solaris, GNU make is called "gmake". Complete details are available in the file: - http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html + http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html From 9442603fcd6193694b9615dc6533af0e4ec61747 Mon Sep 17 00:00:00 2001 From: James Cheng Date: Mon, 26 May 2014 18:34:26 -0700 Subject: [PATCH 148/185] 8035974: Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler Move the lopp from DigestBase.engineUpdate() to new private method implCompressMultiBlock() which can be intrinsified. Reviewed-by: psandoz, ascarpino, forax --- .../sun/security/provider/DigestBase.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/sun/security/provider/DigestBase.java b/jdk/src/share/classes/sun/security/provider/DigestBase.java index 58812f30ec3..98af71afdf0 100644 --- a/jdk/src/share/classes/sun/security/provider/DigestBase.java +++ b/jdk/src/share/classes/sun/security/provider/DigestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -122,10 +122,10 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable { } } // compress complete blocks - while (len >= blockSize) { - implCompress(b, ofs); - len -= blockSize; - ofs += blockSize; + if (len >= blockSize) { + int limit = ofs + len; + ofs = implCompressMultiBlock(b, ofs, limit - blockSize); + len = limit - ofs; } // copy remainder to buffer if (len > 0) { @@ -134,6 +134,14 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable { } } + // compress complete blocks + private int implCompressMultiBlock(byte[] b, int ofs, int limit) { + for (; ofs <= limit; ofs += blockSize) { + implCompress(b, ofs); + } + return ofs; + } + // reset this object. See JCA doc. protected final void engineReset() { if (bytesProcessed == 0) { From 989151115e14e12c0e71c589f572ffd0a0be4c30 Mon Sep 17 00:00:00 2001 From: Masayoshi Okutsu Date: Tue, 27 May 2014 16:20:09 +0900 Subject: [PATCH 149/185] 8033627: UTC+02:00 time zones are not detected correctly on Windows Reviewed-by: peytoia --- jdk/src/windows/lib/tzmappings | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/src/windows/lib/tzmappings b/jdk/src/windows/lib/tzmappings index 706eff6eb69..953ea10be7a 100644 --- a/jdk/src/windows/lib/tzmappings +++ b/jdk/src/windows/lib/tzmappings @@ -137,8 +137,8 @@ Central:36,37::America/Chicago: Central Standard Time:36,37::America/Chicago: Eastern:38,39::America/New_York: Eastern Standard Time:38,39::America/New_York: -E. Europe:4,5:BY:Europe/Minsk: -E. Europe Standard Time:4,5:BY:Europe/Minsk: +E. Europe:4,5::EET: +E. Europe Standard Time:4,5::EET: Egypt:4,68::Africa/Cairo: Egypt Standard Time:4,68::Africa/Cairo: South Africa:4,69::Africa/Harare: @@ -192,5 +192,6 @@ Magadan Standard Time:924,924::Asia/Magadan: Kaliningrad Standard Time:925,925:RU:Europe/Kaliningrad: Turkey Standard Time:926,926::Asia/Istanbul: Bahia Standard Time:927,927::America/Bahia: -Western Brazilian Standard Time:928,928:BR:America/Rio_Branco: -Armenian Standard Time:929,929:AM:Asia/Yerevan: +Libya Standard Time:928,928:LY:Africa/Tripoli: +Western Brazilian Standard Time:929,929:BR:America/Rio_Branco: +Armenian Standard Time:930,930:AM:Asia/Yerevan: From 91d93715666b9d44a4bc9b709ca9de2c579ee5d1 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Tue, 27 May 2014 17:26:52 -0700 Subject: [PATCH 150/185] 8043592: The basic XML parser based on UKit fails to read XML files encoded in UTF-16BE or LE Reviewed-by: sherman, lancea --- .../jdk/internal/util/xml/impl/Parser.java | 80 ++++++++++++++++--- .../java/util/Properties/LoadAndStoreXML.java | 29 +++++-- 2 files changed, 90 insertions(+), 19 deletions(-) diff --git a/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java index 7eb918d7b7b..6db4d4fdb6d 100644 --- a/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java +++ b/jdk/src/share/classes/jdk/internal/util/xml/impl/Parser.java @@ -2860,14 +2860,25 @@ public abstract class Parser { } else { // Get encoding from BOM or the xml text decl. reader = bom(is.getByteStream(), ' '); + /** + * [#4.3.3] requires BOM for UTF-16, however, it's not uncommon + * that it may be missing. A mature technique exists in Xerces + * to further check for possible UTF-16 encoding + */ + if (reader == null) { + reader = utf16(is.getByteStream()); + } + if (reader == null) { // Encoding is defined by the xml text decl. reader = enc("UTF-8", is.getByteStream()); expenc = xml(reader); - if (expenc.startsWith("UTF-16")) { - panic(FAULT); // UTF-16 must have BOM [#4.3.3] + if (!expenc.equals("UTF-8")) { + if (expenc.startsWith("UTF-16")) { + panic(FAULT); // UTF-16 must have BOM [#4.3.3] + } + reader = enc(expenc, is.getByteStream()); } - reader = enc(expenc, is.getByteStream()); } else { // Encoding is defined by the BOM. xml(reader); @@ -2956,6 +2967,49 @@ public abstract class Parser { } } + + /** + * Using a mature technique from Xerces, this method checks further after + * the bom method above to see if the encoding is UTF-16 + * + * @param is A byte stream of the entity. + * @return a reader, may be null + * @exception Exception is parser specific exception form panic method. + * @exception IOException + */ + private Reader utf16(InputStream is) + throws Exception { + if (mChIdx != 0) { + //The bom method has read ONE byte into the buffer. + byte b0 = (byte)mChars[0]; + if (b0 == 0x00 || b0 == 0x3C) { + int b1 = is.read(); + int b2 = is.read(); + int b3 = is.read(); + if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) { + // UTF-16, big-endian, no BOM + mChars[0] = (char)(b1); + mChars[mChIdx++] = (char)(b3); + return new ReaderUTF16(is, 'b'); + } else if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) { + // UTF-16, little-endian, no BOM + mChars[0] = (char)(b0); + mChars[mChIdx++] = (char)(b2); + return new ReaderUTF16(is, 'l'); + } else { + /**not every InputStream supports reset, so we have to remember + * the state for further parsing + **/ + mChars[0] = (char)(b0); + mChars[mChIdx++] = (char)(b1); + mChars[mChIdx++] = (char)(b2); + mChars[mChIdx++] = (char)(b3); + } + + } + } + return null; + } /** * Parses the xml text declaration. * @@ -2974,17 +3028,17 @@ public abstract class Parser { String enc = "UTF-8"; char ch; int val; - short st; - // Read the xml text declaration into the buffer - if (mChIdx != 0) { - // The bom method have read ONE char into the buffer. - st = (short) ((mChars[0] == '<') ? 1 : -1); - } else { - st = 0; - } + short st = 0; + int byteRead = mChIdx; //number of bytes read prior to entering this method + while (st >= 0 && mChIdx < mChars.length) { - ch = ((val = reader.read()) >= 0) ? (char) val : EOS; - mChars[mChIdx++] = ch; + if (st < byteRead) { + ch = mChars[st]; + } else { + ch = ((val = reader.read()) >= 0) ? (char) val : EOS; + mChars[mChIdx++] = ch; + } + switch (st) { case 0: // read '<' of xml declaration switch (ch) { diff --git a/jdk/test/java/util/Properties/LoadAndStoreXML.java b/jdk/test/java/util/Properties/LoadAndStoreXML.java index 5353c645b81..241a783053f 100644 --- a/jdk/test/java/util/Properties/LoadAndStoreXML.java +++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java @@ -32,6 +32,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; @@ -47,6 +48,7 @@ import java.util.Properties; import java.util.PropertyPermission; public class LoadAndStoreXML { + static final String bomChar = "\uFEFF"; /** * Simple policy implementation that grants a set of permissions to @@ -125,13 +127,14 @@ public class LoadAndStoreXML { * Sanity test that properties saved with Properties#storeToXML can be * read with Properties#loadFromXML. */ - static void testLoadAndStore(String encoding) throws IOException { + static void testLoadAndStore(String encoding, boolean appendBOM) throws IOException { System.out.println("testLoadAndStore, encoding=" + encoding); Properties props = new Properties(); + props.put("k0", "\u6C34"); props.put("k1", "foo"); props.put("k2", "bar"); - props.put("k3", "\\u0020\\u0391\\u0392\\u0393\\u0394\\u0395\\u0396\\u0397"); + props.put("k3", "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397"); props.put("k4", "\u7532\u9aa8\u6587"); props.put("k5", "/lib/jaxp.properties"); @@ -141,7 +144,17 @@ public class LoadAndStoreXML { throw new RuntimeException("OutputStream closed by storeToXML"); Properties p = new Properties(); - TestInputStream in = new TestInputStream(out.toByteArray()); + TestInputStream in; + if (appendBOM) { + byte[] byteOrderMark = bomChar.getBytes(Charset.forName(encoding)); + byte[] outArray = out.toByteArray(); + byte[] inputArray = new byte[byteOrderMark.length + outArray.length]; + System.arraycopy(byteOrderMark, 0, inputArray, 0, byteOrderMark.length); + System.arraycopy(outArray, 0, inputArray, byteOrderMark.length, outArray.length); + in = new TestInputStream(inputArray); + } else { + in = new TestInputStream(out.toByteArray()); + } p.loadFromXML(in); if (in.isOpen()) throw new RuntimeException("InputStream not closed by loadFromXML"); @@ -231,8 +244,12 @@ public class LoadAndStoreXML { public static void main(String[] args) throws IOException { - testLoadAndStore("UTF-8"); - testLoadAndStore("UTF-16"); + testLoadAndStore("UTF-8", false); + testLoadAndStore("UTF-16", false); + testLoadAndStore("UTF-16BE", false); + testLoadAndStore("UTF-16LE", false); + testLoadAndStore("UTF-16BE", true); + testLoadAndStore("UTF-16LE", true); testLoadWithoutEncoding(); testLoadWithBadEncoding(); testStoreWithBadEncoding(); @@ -250,7 +267,7 @@ public class LoadAndStoreXML { Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { - testLoadAndStore("UTF-8"); + testLoadAndStore("UTF-8", false); } finally { // turn off security manager and restore policy System.setSecurityManager(null); From 2f8bdbc5fd69e3179f1280572363f46d255988c0 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Wed, 28 May 2014 11:41:26 +0400 Subject: [PATCH 151/185] 8039319: (smartcardio) Card.transmitControlCommand() does not work on Mac OS X Reviewed-by: valeriep --- jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c b/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c index dfe9c421c19..f344f4a00d9 100644 --- a/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c +++ b/jdk/src/solaris/native/sun/security/smartcardio/pcsc_md.c @@ -136,5 +136,9 @@ JNIEXPORT void JNICALL Java_sun_security_smartcardio_PlatformPCSC_initialize if ((*env)->ExceptionCheck(env)) { return; } +#ifndef __APPLE__ scardControl = (FPTR_SCardControl) findFunction(env, hModule, "SCardControl"); +#else + scardControl = (FPTR_SCardControl) findFunction(env, hModule, "SCardControl132"); +#endif // __APPLE__ } From f7f994834fa63dd8d5a7e883f8c4fcbda57ba86d Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Tue, 27 May 2014 10:27:51 +0100 Subject: [PATCH 152/185] 8024832: ServerSocketChannel.socket().accept() throws IllegalBlockingModeException if not bound Reviewed-by: chegar, michaelm, alanb, mr --- .../sun/nio/ch/ServerSocketAdaptor.java | 4 +- .../sun/nio/ch/ServerSocketAdaptorTest.java | 64 +++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java index 4357ffc4e73..e7a2cbb73be 100644 --- a/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java +++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketAdaptor.java @@ -93,9 +93,9 @@ public class ServerSocketAdaptor // package-private public Socket accept() throws IOException { synchronized (ssc.blockingLock()) { - if (!ssc.isBound()) - throw new IllegalBlockingModeException(); try { + if (!ssc.isBound()) + throw new NotYetBoundException(); if (timeout == 0) { SocketChannel sc = ssc.accept(); if (sc == null && !ssc.isBlocking()) diff --git a/jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java b/jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java new file mode 100644 index 00000000000..062fc784520 --- /dev/null +++ b/jdk/test/sun/nio/ch/ServerSocketAdaptorTest.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2014, 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 8024832 + */ + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.SocketException; +import java.nio.channels.ServerSocketChannel; + +public class ServerSocketAdaptorTest { + + public static void main(String[] args) throws IOException { + + String message = null; + + try (ServerSocket s = new ServerSocket()) { + s.accept(); + throw new AssertionError(); + } catch (IOException e) { + message = e.getMessage(); + } + + try (ServerSocket ss = ServerSocketChannel.open().socket()) { + + assert !ss.isBound() : "the assumption !ss.isBound() doesn't hold"; + + try { + ss.accept(); + throw new AssertionError(); + } catch (Exception e) { + if (e instanceof SocketException && message.equals(e.getMessage())) { + return; + } else { + throw new AssertionError( + "Expected to throw SocketException with a particular message", e); + } + } + } + } +} From 2a4f86523419d915212529cc83b197df326a5103 Mon Sep 17 00:00:00 2001 From: Jonathan Lu Date: Tue, 27 May 2014 17:56:35 +0800 Subject: [PATCH 153/185] 8043495: Add native FileChannelImpl.transferTo0() implementation for AIX Reviewed-by: alanb --- .../native/sun/nio/ch/FileChannelImpl.c | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c index d47cc3da10b..895289067d6 100644 --- a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c +++ b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c @@ -39,6 +39,8 @@ #if defined(__linux__) || defined(__solaris__) #include +#elif defined(_AIX) +#include #elif defined(_ALLBSD_SOURCE) #include #include @@ -207,9 +209,7 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, numBytes = count; -#ifdef __APPLE__ result = sendfile(srcFD, dstFD, position, &numBytes, NULL, 0); -#endif if (numBytes > 0) return numBytes; @@ -228,7 +228,48 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this, } return result; + +#elif defined(_AIX) + jlong max = (jlong)java_lang_Integer_MAX_VALUE; + struct sf_parms sf_iobuf; + jlong result; + + if (position > max) + return IOS_UNSUPPORTED_CASE; + + if (count > max) + count = max; + + memset(&sf_iobuf, 0, sizeof(sf_iobuf)); + sf_iobuf.file_descriptor = srcFD; + sf_iobuf.file_offset = (off_t)position; + sf_iobuf.file_bytes = count; + + result = send_file(&dstFD, &sf_iobuf, SF_SYNC_CACHE); + + /* AIX send_file() will return 0 when this operation complete successfully, + * return 1 when partial bytes transfered and return -1 when an error has + * Occured. + */ + if (result == -1) { + if (errno == EWOULDBLOCK) + return IOS_UNAVAILABLE; + if ((errno == EINVAL) && ((ssize_t)count >= 0)) + return IOS_UNSUPPORTED_CASE; + if (errno == EINTR) + return IOS_INTERRUPTED; + if (errno == ENOTSOCK) + return IOS_UNSUPPORTED; + JNU_ThrowIOExceptionWithLastError(env, "Transfer failed"); + return IOS_THROWN; + } + + if (sf_iobuf.bytes_sent > 0) + return (jlong)sf_iobuf.bytes_sent; + + return IOS_UNSUPPORTED_CASE; #else return IOS_UNSUPPORTED_CASE; #endif } + From d779eeab899f0757597d90394fead7934b0ff31e Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Tue, 27 May 2014 17:40:19 +0530 Subject: [PATCH 154/185] 8044000: Access to undefined property yields "null" instead of "undefined" Reviewed-by: lagergren, jlaskey --- .../internal/runtime/linker/Bootstrap.java | 14 +++++++-- .../runtime/linker/JSObjectLinker.java | 19 ++++++++++-- .../runtime/linker/NashornGuards.java | 15 ++++++++++ .../api/scripting/ScriptObjectMirrorTest.java | 29 +++++++++++++++++++ 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java index c8f39fcfaca..48821036d25 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java @@ -61,9 +61,17 @@ public final class Bootstrap { private static final DynamicLinker dynamicLinker; static { final DynamicLinkerFactory factory = new DynamicLinkerFactory(); - factory.setPrioritizedLinkers(new NashornLinker(), new NashornPrimitiveLinker(), new NashornStaticClassLinker(), - new BoundDynamicMethodLinker(), new JavaSuperAdapterLinker(), new JSObjectLinker(), new ReflectionCheckLinker()); - factory.setFallbackLinkers(new NashornBeansLinker(), new NashornBottomLinker()); + final NashornBeansLinker nashornBeansLinker = new NashornBeansLinker(); + final JSObjectLinker jsObjectLinker = new JSObjectLinker(nashornBeansLinker); + factory.setPrioritizedLinkers( + new NashornLinker(), + new NashornPrimitiveLinker(), + new NashornStaticClassLinker(), + new BoundDynamicMethodLinker(), + new JavaSuperAdapterLinker(), + jsObjectLinker, + new ReflectionCheckLinker()); + factory.setFallbackLinkers(nashornBeansLinker, new NashornBottomLinker()); factory.setSyncOnRelink(true); final int relinkThreshold = Options.getIntProperty("nashorn.unstable.relink.threshold", -1); if (relinkThreshold > -1) { diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java index f3c8284be86..52fb46bc5c7 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java @@ -30,6 +30,7 @@ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.util.HashMap; import java.util.Map; +import javax.script.Bindings; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.GuardedTypeConversion; @@ -48,14 +49,23 @@ import jdk.nashorn.internal.runtime.JSType; * as ScriptObjects from other Nashorn contexts. */ final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory { + private final NashornBeansLinker nashornBeansLinker; + + JSObjectLinker(final NashornBeansLinker nashornBeansLinker) { + this.nashornBeansLinker = nashornBeansLinker; + } + @Override public boolean canLinkType(final Class type) { return canLinkTypeStatic(type); } static boolean canLinkTypeStatic(final Class type) { - // can link JSObject - return JSObject.class.isAssignableFrom(type); + // can link JSObject also handles Map, Bindings to make + // sure those are not JSObjects. + return Map.class.isAssignableFrom(type) || + Bindings.class.isAssignableFrom(type) || + JSObject.class.isAssignableFrom(type); } @Override @@ -72,6 +82,11 @@ final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTy final GuardedInvocation inv; if (self instanceof JSObject) { inv = lookup(desc); + } else if (self instanceof Map || self instanceof Bindings) { + // guard to make sure the Map or Bindings does not turn into JSObject later! + final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices); + inv = new GuardedInvocation(beanInv.getInvocation(), + NashornGuards.combineGuards(beanInv.getGuard(), NashornGuards.getNotJSObjectGuard())); } else { throw new AssertionError(); // Should never reach here. } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java index ca3e10c48d4..77c5e93cb77 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java @@ -31,6 +31,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.ref.WeakReference; import jdk.internal.dynalink.CallSiteDescriptor; +import jdk.nashorn.api.scripting.JSObject; import jdk.nashorn.internal.codegen.ObjectClassGenerator; import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.Property; @@ -43,6 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; */ public final class NashornGuards { private static final MethodHandle IS_SCRIPTOBJECT = findOwnMH("isScriptObject", boolean.class, Object.class); + private static final MethodHandle IS_NOT_JSOBJECT = findOwnMH("isNotJSObject", boolean.class, Object.class); private static final MethodHandle IS_SCRIPTFUNCTION = findOwnMH("isScriptFunction", boolean.class, Object.class); private static final MethodHandle IS_MAP = findOwnMH("isMap", boolean.class, Object.class, PropertyMap.class); private static final MethodHandle SAME_OBJECT = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class); @@ -60,6 +62,14 @@ public final class NashornGuards { return IS_SCRIPTOBJECT; } + /** + * Get the guard that checks if an item is not a {@code JSObject} + * @return method handle for guard + */ + public static MethodHandle getNotJSObjectGuard() { + return IS_NOT_JSOBJECT; + } + /** * Get the guard that checks if an item is a {@code ScriptFunction} * @return method handle for guard @@ -156,6 +166,11 @@ public final class NashornGuards { return self instanceof ScriptObject; } + @SuppressWarnings("unused") + private static boolean isNotJSObject(final Object self) { + return !(self instanceof JSObject); + } + @SuppressWarnings("unused") private static boolean isScriptFunction(final Object self) { return self instanceof ScriptFunction; diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java index 241f22c39ea..30eaefcadb5 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java @@ -29,6 +29,8 @@ import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.script.Bindings; +import javax.script.ScriptContext; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; @@ -276,4 +278,31 @@ public class ScriptObjectMirrorTest { "({ toString: function() { return 'foo' } })"); assertEquals("foo", obj.to(String.class)); } + + // @bug 8044000: Access to undefined property yields "null" instead of "undefined" + @Test + public void mapScriptObjectMirrorCallsiteTest() throws ScriptException { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine engine = m.getEngineByName("nashorn"); + final String TEST_SCRIPT = "typeof obj.foo"; + + final Bindings global = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE); + engine.eval("var obj = java.util.Collections.emptyMap()"); + // this will drive callsite "obj.foo" of TEST_SCRIPT + // to use "obj instanceof Map" as it's guard + engine.eval(TEST_SCRIPT, global); + // redefine 'obj' to be a script object + engine.eval("obj = {}"); + + final Bindings newGlobal = engine.createBindings(); + // transfer 'obj' from default global to new global + // new global will get a ScriptObjectMirror wrapping 'obj' + newGlobal.put("obj", global.get("obj")); + + // Every ScriptObjectMirror is a Map! If callsite "obj.foo" + // does not see the new 'obj' is a ScriptObjectMirror, it'll + // continue to use Map's get("obj.foo") instead of ScriptObjectMirror's + // getMember("obj.foo") - thereby getting null instead of undefined + assertEquals("undefined", engine.eval(TEST_SCRIPT, newGlobal)); + } } From 649331e00faa70d9f3a1b95a4f8aa3caa8976363 Mon Sep 17 00:00:00 2001 From: Paul Govereau Date: Tue, 27 May 2014 18:57:44 +0100 Subject: [PATCH 155/185] 8041704: wrong error message when mixing lambda expression and inner class Reviewed-by: vromero --- .../com/sun/tools/javac/comp/Attr.java | 20 ++++++++++++++++--- ...ambdaExpressionWithNonAccessibleIdTest.out | 3 +-- .../lambda/T8041704/ErrorMessageTest.java | 12 +++++++++++ .../lambda/T8041704/ErrorMessageTest.out | 2 ++ 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.java create mode 100644 langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 335704eaef4..89656d48a01 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -4678,16 +4678,30 @@ public class Attr extends JCTree.Visitor { private void initTypeIfNeeded(JCTree that) { if (that.type == null) { if (that.hasTag(METHODDEF)) { - that.type = dummyMethodType(); + that.type = dummyMethodType((JCMethodDecl)that); } else { that.type = syms.unknownType; } } } + /* Construct a dummy method type. If we have a method declaration, + * and the declared return type is void, then use that return type + * instead of UNKNOWN to avoid spurious error messages in lambda + * bodies (see:JDK-8041704). + */ + private Type dummyMethodType(JCMethodDecl md) { + Type restype = syms.unknownType; + if (md != null && md.restype.hasTag(TYPEIDENT)) { + JCPrimitiveTypeTree prim = (JCPrimitiveTypeTree)md.restype; + if (prim.typetag == VOID) + restype = syms.voidType; + } + return new MethodType(List.nil(), restype, + List.nil(), syms.methodClass); + } private Type dummyMethodType() { - return new MethodType(List.nil(), syms.unknownType, - List.nil(), syms.methodClass); + return dummyMethodType(null); } @Override diff --git a/langtools/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out b/langtools/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out index d253b9c660b..3b2266c0b21 100644 --- a/langtools/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out +++ b/langtools/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out @@ -1,3 +1,2 @@ -CrashLambdaExpressionWithNonAccessibleIdTest.java:15:35: compiler.err.missing.ret.stmt CrashLambdaExpressionWithNonAccessibleIdTest.java:14:17: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, CrashLambdaExpressionWithNonAccessibleIdTest, null) -2 errors +1 error diff --git a/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.java b/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.java new file mode 100644 index 00000000000..5bd38c79d59 --- /dev/null +++ b/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.java @@ -0,0 +1,12 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8041704 + * @summary wrong error message when mixing lambda expression and inner class + * @compile/fail/ref=ErrorMessageTest.out -XDrawDiagnostics ErrorMessageTest.java + */ + +public class ErrorMessageTest { + void f(Runnable r) { + f(() -> { f(new MISSING() { public void run() {} }); }); + } +} diff --git a/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.out b/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.out new file mode 100644 index 00000000000..bdd25993c86 --- /dev/null +++ b/langtools/test/tools/javac/lambda/T8041704/ErrorMessageTest.out @@ -0,0 +1,2 @@ +ErrorMessageTest.java:10:25: compiler.err.cant.resolve.location: kindname.class, MISSING, , , (compiler.misc.location: kindname.class, ErrorMessageTest, null) +1 error From 0b1c40b161ca58bd44adc74ea0195b6caa50a251 Mon Sep 17 00:00:00 2001 From: Paul Govereau Date: Tue, 27 May 2014 22:26:53 +0100 Subject: [PATCH 156/185] 8042741: Java 8 compiler throws NullPointerException depending location in source file Reviewed-by: vromero, jlahoda --- .../com/sun/tools/javac/comp/Flow.java | 11 +++- .../test/tools/javac/flow/T8042741/A.java | 37 +++++++++++ .../javac/flow/T8042741/PositionTest.java | 62 +++++++++++++++++++ 3 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/flow/T8042741/A.java create mode 100644 langtools/test/tools/javac/flow/T8042741/PositionTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java index ba2bdc89e20..a9e13874512 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java @@ -231,7 +231,8 @@ public class Flow { } } - public List analyzeLambdaThrownTypes(Env env, JCLambda that, TreeMaker make) { + public List analyzeLambdaThrownTypes(final Env env, + JCLambda that, TreeMaker make) { //we need to disable diagnostics temporarily; the problem is that if //a lambda expression contains e.g. an unreachable statement, an error //message will be reported and will cause compilation to skip the flow analyis @@ -239,7 +240,13 @@ public class Flow { //related errors, which will allow for more errors to be detected Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log); try { - new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit).analyzeTree(env); + new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit) { + @Override + protected boolean trackable(VarSymbol sym) { + return !env.info.scope.includes(sym) && + sym.owner.kind == MTH; + } + }.analyzeTree(env); LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer(); flowAnalyzer.analyzeTree(env, that, make); return flowAnalyzer.inferredThrownTypes; diff --git a/langtools/test/tools/javac/flow/T8042741/A.java b/langtools/test/tools/javac/flow/T8042741/A.java new file mode 100644 index 00000000000..36deb2d172f --- /dev/null +++ b/langtools/test/tools/javac/flow/T8042741/A.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014, 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. + */ + +// str must be at absolute position greater than that of lambda +// expression in PositionTest.java +// padding..........................................................padding +// padding..........................................................padding +// padding..........................................................padding +// padding..........................................................padding +// padding..........................................................padding + +public class A { + public final String str; + { + str = ""; + } +} diff --git a/langtools/test/tools/javac/flow/T8042741/PositionTest.java b/langtools/test/tools/javac/flow/T8042741/PositionTest.java new file mode 100644 index 00000000000..cc0da15e4f5 --- /dev/null +++ b/langtools/test/tools/javac/flow/T8042741/PositionTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, 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 8042741 + * @summary Java 8 compiler throws NullPointerException depending location in source file + * @compile A.java PositionTest.java + */ + +public class PositionTest extends A { + void test(SAM r) throws E { + test(() -> { System.err.println(str); }); + } + interface SAM { + public void run() throws E; + } + void f() { + try { + test(() -> { + test(() -> { + try { + test(() -> { System.err.println(str); }); + System.err.println(str); + } catch (Exception e) {} + System.err.println(str); + }); + System.err.println(str); + }); + } catch (Exception e) { } + } + void g() throws Exception { + test(() -> { + try { + try { + test(() -> { System.err.println(str); }); + } catch (Exception e) {} + System.err.println(str); + } catch (Exception e) {} + System.err.println(str); + }); + } +} From 773e460c33a752a63147079f7ae11c9ec3454a3c Mon Sep 17 00:00:00 2001 From: Paul Govereau Date: Tue, 27 May 2014 14:23:55 -0400 Subject: [PATCH 157/185] 7177211: SharedNameTable.create and .dispose are not used Reviewed-by: jjg --- .../src/share/classes/com/sun/tools/javac/util/Names.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java index 57058c99340..af96c77b066 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java @@ -317,9 +317,9 @@ public class Names { protected Name.Table createTable(Options options) { boolean useUnsharedTable = options.isSet("useUnsharedTable"); if (useUnsharedTable) - return new UnsharedNameTable(this); + return UnsharedNameTable.create(this); else - return new SharedNameTable(this); + return SharedNameTable.create(this); } public void dispose() { From bccd5e4671da0800a1bc4c46d18bf7955af30cb8 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 27 May 2014 12:15:08 -0700 Subject: [PATCH 158/185] 8044034: Remove unused com/sun/tools/hat files Reviewed-by: sla --- .../classes/com/sun/tools/hat/MANIFEST.mf | 2 - .../classes/com/sun/tools/hat/README.txt | 20 ----- .../share/classes/com/sun/tools/hat/build.xml | 82 ------------------- 3 files changed, 104 deletions(-) delete mode 100644 jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf delete mode 100644 jdk/src/share/classes/com/sun/tools/hat/README.txt delete mode 100644 jdk/src/share/classes/com/sun/tools/hat/build.xml diff --git a/jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf b/jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf deleted file mode 100644 index 35334c8e34c..00000000000 --- a/jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: com.sun.tools.hat.Main diff --git a/jdk/src/share/classes/com/sun/tools/hat/README.txt b/jdk/src/share/classes/com/sun/tools/hat/README.txt deleted file mode 100644 index 9bc0b9a3351..00000000000 --- a/jdk/src/share/classes/com/sun/tools/hat/README.txt +++ /dev/null @@ -1,20 +0,0 @@ --------------- -This HAT source originally came from the http://hat.dev.java.net site. - -The utility has been named 'jhat' in the JDK, it is basically the same tool. - -Q: Where do I make changes? In the JDK or hat.dev.java.net? - -A: It depends on whether the change is intended for the JDK jhat version only, - or expected to be given back to the java.net project. - In general, we should putback changes to the java.net project and - bringover those changes to the JDK. - -Q: I want to build just jhat.jar instead of building entire JDK. What should I do? - -A: Use ant makefile (build.xml) in the current directory. This builds just the -jhat sources and creates jhat.jar under ./build directory. - -To run the built jhat.jar, you can use the command: - - java -jar build/jhat.jar heap_dump diff --git a/jdk/src/share/classes/com/sun/tools/hat/build.xml b/jdk/src/share/classes/com/sun/tools/hat/build.xml deleted file mode 100644 index 2d7bdc800fd..00000000000 --- a/jdk/src/share/classes/com/sun/tools/hat/build.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 20e26966e1c4e18d7df65ef2d07e87687eb6acfc Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Tue, 27 May 2014 16:05:04 -0400 Subject: [PATCH 159/185] 8003488: (process) Provide Process.getPid() Add Process.getPid Reviewed-by: alanb, martin, igerasim --- jdk/src/share/classes/java/lang/Process.java | 14 +++++ .../classes/java/lang/UNIXProcess.java | 5 ++ .../classes/java/lang/ProcessImpl.java | 22 +++++--- .../windows/native/java/lang/ProcessImpl_md.c | 11 ++++ jdk/test/java/lang/ProcessBuilder/Basic.java | 54 ++++++++++++++++++- 5 files changed, 98 insertions(+), 8 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Process.java b/jdk/src/share/classes/java/lang/Process.java index 4e945382465..9d9bc3316ba 100644 --- a/jdk/src/share/classes/java/lang/Process.java +++ b/jdk/src/share/classes/java/lang/Process.java @@ -262,4 +262,18 @@ public abstract class Process { return true; } } + + /** + * Returns the native process id of the subprocess. + * The native process id is an identification number that the operating + * system assigns to the process. + * + * @return the native process id of the subprocess + * @throws UnsupportedOperationException if the Process implementation + * does not support this operation + * @since 1.9 + */ + public long getPid() { + throw new UnsupportedOperationException(); + } } diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java b/jdk/src/solaris/classes/java/lang/UNIXProcess.java index 35d37e6b5d3..56ba83f036f 100644 --- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java +++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java @@ -482,6 +482,11 @@ final class UNIXProcess extends Process { return this; } + @Override + public long getPid() { + return pid; + } + @Override public synchronized boolean isAlive() { return !hasExited; diff --git a/jdk/src/windows/classes/java/lang/ProcessImpl.java b/jdk/src/windows/classes/java/lang/ProcessImpl.java index b288dbd28dc..02e0c7bf346 100644 --- a/jdk/src/windows/classes/java/lang/ProcessImpl.java +++ b/jdk/src/windows/classes/java/lang/ProcessImpl.java @@ -25,15 +25,15 @@ package java.lang; -import java.io.IOException; -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileDescriptor; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.lang.ProcessBuilder.Redirect; import java.security.AccessController; import java.security.PrivilegedAction; @@ -482,6 +482,14 @@ final class ProcessImpl extends Process { private static native void terminateProcess(long handle); + @Override + public long getPid() { + int pid = getProcessId0(handle); + return pid; + } + + private static native int getProcessId0(long handle); + @Override public boolean isAlive() { return isProcessAlive(handle); diff --git a/jdk/src/windows/native/java/lang/ProcessImpl_md.c b/jdk/src/windows/native/java/lang/ProcessImpl_md.c index a432f1198dc..59f907cd99b 100644 --- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c +++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c @@ -248,6 +248,17 @@ static void restoreIOEHandleState( } } +/* + * Class: java_lang_ProcessImpl + * Method: getProcessId0 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_java_lang_ProcessImpl_getProcessId0 + (JNIEnv *env, jclass clazz, jlong handle) { + DWORD pid = GetProcessId((HANDLE) jlong_to_ptr(handle)); + return (jint)pid; +} + /* Please, read about the MS inheritance problem http://support.microsoft.com/kb/315939 and critical section/synchronized block solution. */ diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index ce0bad7772f..039feb16404 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -26,7 +26,7 @@ * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689 * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313 * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958 - * 4947220 7018606 7034570 4244896 5049299 + * 4947220 7018606 7034570 4244896 5049299 8003488 * @summary Basic tests for Process and Environment Variable code * @run main/othervm/timeout=300 Basic * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic @@ -1136,6 +1136,53 @@ public class Basic { } } + static void checkProcessPid() { + long actualPid = 0; + long expectedPid = -1; + if (Windows.is()) { + String[] argsTasklist = {"tasklist.exe", "/NH", "/FI", "\"IMAGENAME eq tasklist.exe\""}; + ProcessBuilder pb = new ProcessBuilder(argsTasklist); + try { + Process proc = pb.start(); + expectedPid = proc.getPid(); + + String output = commandOutput(proc); + String[] splits = output.split("\\s+"); + actualPid = Integer.valueOf(splits[2]); + } catch (Throwable t) { + unexpected(t); + } + } else if (Unix.is() || MacOSX.is()) { + String[] shArgs = {"sh", "-c", "echo $$"}; + ProcessBuilder pb = new ProcessBuilder(shArgs); + try { + Process proc = pb.start(); + expectedPid = proc.getPid(); + + String output = commandOutput(proc); + String[] splits = output.split("\\s+"); + actualPid = Integer.valueOf(splits[0]); + } catch (Throwable t) { + unexpected(t); + } + } else { + fail("No test for checkProcessPid on platform: " + System.getProperty("os.name")); + return; + } + + equal(actualPid, expectedPid); + + // Test the default implementation of Process.getPid + try { + DelegatingProcess p = new DelegatingProcess(null); + p.getPid(); + fail("non-overridden Process.getPid method should throw UOE"); + } catch (UnsupportedOperationException uoe) { + // correct + } + + } + private static void realMain(String[] args) throws Throwable { if (Windows.is()) System.out.println("This appears to be a Windows system."); @@ -1147,6 +1194,11 @@ public class Basic { try { testIORedirection(); } catch (Throwable t) { unexpected(t); } + //---------------------------------------------------------------- + // Basic tests for getPid() + //---------------------------------------------------------------- + checkProcessPid(); + //---------------------------------------------------------------- // Basic tests for setting, replacing and deleting envvars //---------------------------------------------------------------- From 849ed753e2052eade5193e30faa8a13a9ec507c9 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 27 May 2014 16:32:56 -0600 Subject: [PATCH 160/185] 8042338: Refactor Types.upperBound to treat wildcards and variables separately Reviewed-by: vromero --- .../com/sun/tools/javac/api/JavacTrees.java | 2 +- .../com/sun/tools/javac/code/Types.java | 137 +++++++----------- .../com/sun/tools/javac/comp/Attr.java | 4 +- .../com/sun/tools/javac/comp/Check.java | 4 +- .../com/sun/tools/javac/comp/Lower.java | 4 +- .../com/sun/tools/javac/comp/Resolve.java | 4 +- 6 files changed, 59 insertions(+), 96 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java index eb4b43f3622..56296d458c6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -394,7 +394,7 @@ public class JavacTrees extends DocTrees { paramTypes = lb.toList(); } - ClassSymbol sym = (ClassSymbol) types.upperBound(tsym.type).tsym; + ClassSymbol sym = (ClassSymbol) types.cvarUpperBound(tsym.type).tsym; Symbol msym = (memberName == sym.name) ? findConstructor(sym, paramTypes) diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 15b79180844..9066a03ae2a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -118,37 +118,34 @@ public class Types { } // - // + // /** - * The "rvalue conversion".
    - * The upper bound of most types is the type - * itself. Wildcards, on the other hand have upper - * and lower bounds. - * @param t a type - * @return the upper bound of the given type + * Get a wildcard's upper bound, returning non-wildcards unchanged. + * @param t a type argument, either a wildcard or a type */ - public Type upperBound(Type t) { - return upperBound.visit(t); + public Type wildUpperBound(Type t) { + if (t.hasTag(WILDCARD)) { + WildcardType w = (WildcardType) t; + if (w.isSuperBound()) + return w.bound == null ? syms.objectType : w.bound.bound; + else + return wildUpperBound(w.type); + } + else return t; } - // where - private final MapVisitor upperBound = new MapVisitor() { - @Override - public Type visitWildcardType(WildcardType t, Void ignored) { - if (t.isSuperBound()) - return t.bound == null ? syms.objectType : t.bound.bound; - else - return visit(t.type); - } + /** + * Get a capture variable's upper bound, returning other types unchanged. + * @param t a type + */ + public Type cvarUpperBound(Type t) { + if (t.hasTag(TYPEVAR)) { + TypeVar v = (TypeVar) t; + return v.isCaptured() ? cvarUpperBound(v.bound) : v; + } + else return t; + } - @Override - public Type visitCapturedType(CapturedType t, Void ignored) { - return visit(t.bound); - } - }; - //
    - - // /** * Get a wildcard's lower bound, returning non-wildcards unchanged. * @param t a type argument, either a wildcard or a type @@ -160,9 +157,7 @@ public class Types { } else return t; } - // - // /** * Get a capture variable's lower bound, returning other types unchanged. * @param t a type @@ -894,7 +889,7 @@ public class Types { s.getAnnotationMirrors()); changed = true; } else if (s != orig) { - s = new WildcardType(upperBound(s), + s = new WildcardType(wildUpperBound(s), BoundKind.EXTENDS, syms.boundClass, s.getAnnotationMirrors()); @@ -1104,7 +1099,7 @@ public class Types { //check that u == t, where u has been set by Type.withTypeVar return s.isSuperBound() && !s.isExtendsBound() && - visit(t, upperBound(s)); + visit(t, wildUpperBound(s)); } } default: @@ -1131,7 +1126,7 @@ public class Types { return visit(s, t); if (s.isSuperBound() && !s.isExtendsBound()) - return visit(t, upperBound(s)) && visit(t, wildLowerBound(s)); + return visit(t, wildUpperBound(s)) && visit(t, wildLowerBound(s)); if (t.isCompound() && s.isCompound()) { if (!visit(supertype(t), supertype(s))) @@ -1298,7 +1293,7 @@ public class Types { switch(wt.kind) { case UNBOUND: //similar to ? extends Object case EXTENDS: { - Type bound = upperBound(s); + Type bound = wildUpperBound(s); undetvar.addBound(InferenceBound.UPPER, bound, this); break; } @@ -1359,28 +1354,6 @@ public class Types { // where private TypeRelation containsType = new TypeRelation() { - private Type U(Type t) { - while (t.hasTag(WILDCARD)) { - WildcardType w = (WildcardType)t; - if (w.isSuperBound()) - return w.bound == null ? syms.objectType : w.bound.bound; - else - t = w.type; - } - return t; - } - - private Type L(Type t) { - while (t.hasTag(WILDCARD)) { - WildcardType w = (WildcardType)t; - if (w.isExtendsBound()) - return syms.botType; - else - t = w.type; - } - return t; - } - public Boolean visitType(Type t, Type s) { if (s.isPartial()) return containedBy(s, t); @@ -1392,13 +1365,13 @@ public class Types { // System.err.println(); // System.err.format(" does %s contain %s?%n", t, s); // System.err.format(" %s U(%s) <: U(%s) %s = %s%n", -// upperBound(s), s, t, U(t), +// wildUpperBound(s), s, t, wildUpperBound(t), // t.isSuperBound() -// || isSubtypeNoCapture(upperBound(s), U(t))); +// || isSubtypeNoCapture(wildUpperBound(s), wildUpperBound(t))); // System.err.format(" %s L(%s) <: L(%s) %s = %s%n", -// L(t), t, s, wildLowerBound(s), +// wildLowerBound(t), t, s, wildLowerBound(s), // t.isExtendsBound() -// || isSubtypeNoCapture(L(t), wildLowerBound(s))); +// || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))); // System.err.println(); // } @@ -1410,8 +1383,9 @@ public class Types { // debugContainsType(t, s); return isSameWildcard(t, s) || isCaptureOf(s, t) - || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), wildLowerBound(s))) && - (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t)))); + || ((t.isExtendsBound() || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))) && + // TODO: JDK-8039214, cvarUpperBound call here is incorrect + (t.isSuperBound() || isSubtypeNoCapture(cvarUpperBound(wildUpperBound(s)), wildUpperBound(t)))); } } @@ -1529,7 +1503,7 @@ public class Types { @Override public Boolean visitWildcardType(WildcardType t, Type s) { - return isCastable(upperBound(t), s, warnStack.head); + return isCastable(wildUpperBound(t), s, warnStack.head); } @Override @@ -1770,12 +1744,12 @@ public class Types { if (t.isExtendsBound()) { if (s.isExtendsBound()) - return !isCastableRecursive(t.type, upperBound(s)); + return !isCastableRecursive(t.type, wildUpperBound(s)); else if (s.isSuperBound()) return notSoftSubtypeRecursive(wildLowerBound(s), t.type); } else if (t.isSuperBound()) { if (s.isExtendsBound()) - return notSoftSubtypeRecursive(t.type, upperBound(s)); + return notSoftSubtypeRecursive(t.type, wildUpperBound(s)); } return false; } @@ -1811,7 +1785,7 @@ public class Types { noWarnings); } if (!s.hasTag(WILDCARD)) - s = upperBound(s); + s = cvarUpperBound(s); return !isSubtype(t, relaxBound(s)); } @@ -1868,7 +1842,7 @@ public class Types { // public boolean isArray(Type t) { while (t.hasTag(WILDCARD)) - t = upperBound(t); + t = wildUpperBound(t); return t.hasTag(ARRAY); } @@ -1878,7 +1852,7 @@ public class Types { public Type elemtype(Type t) { switch (t.getTag()) { case WILDCARD: - return elemtype(upperBound(t)); + return elemtype(wildUpperBound(t)); case ARRAY: return ((ArrayType)t).elemtype; case FORALL: @@ -2080,7 +2054,7 @@ public class Types { @Override public Type visitWildcardType(WildcardType t, Symbol sym) { - return memberType(upperBound(t), sym); + return memberType(wildUpperBound(t), sym); } @Override @@ -2208,7 +2182,7 @@ public class Types { @Override public Type visitWildcardType(WildcardType t, Boolean recurse) { final List annos = t.getAnnotationMirrors(); - Type erased = erasure(upperBound(t), recurse); + Type erased = erasure(wildUpperBound(t), recurse); if (!annos.isEmpty()) { erased = erased.annotatedType(annos); } @@ -2417,8 +2391,7 @@ public class Types { if (t.hasErasedSupertypes()) { t.interfaces_field = erasureRecursive(interfaces); } else if (formals.nonEmpty()) { - t.interfaces_field = - upperBounds(subst(interfaces, formals, actuals)); + t.interfaces_field = subst(interfaces, formals, actuals); } else { t.interfaces_field = interfaces; @@ -2987,7 +2960,7 @@ public class Types { t.getAnnotationMirrors()); } else { Type st = subst(supertype(t)); - List is = upperBounds(subst(interfaces(t))); + List is = subst(interfaces(t)); if (st == supertype(t) && is == interfaces(t)) return t; else @@ -3004,7 +2977,7 @@ public class Types { return t; } else { if (t.isExtendsBound() && bound.isExtendsBound()) - bound = upperBound(bound); + bound = wildUpperBound(bound); return new WildcardType(bound, t.kind, syms.boundClass, t.bound, t.getAnnotationMirrors()); } @@ -3458,8 +3431,8 @@ public class Types { TypePair pair = new TypePair(c1, c2); Type m; if (mergeCache.add(pair)) { - m = new WildcardType(lub(upperBound(act1.head), - upperBound(act2.head)), + m = new WildcardType(lub(wildUpperBound(act1.head), + wildUpperBound(act2.head)), BoundKind.EXTENDS, syms.boundClass, Type.noAnnotations); @@ -4041,16 +4014,6 @@ public class Types { // // - private List upperBounds(List ss) { - if (ss.isEmpty()) return ss; - Type head = upperBound(ss.head); - List tail = upperBounds(ss.tail); - if (head != ss.head || tail != ss.tail) - return tail.prepend(head); - else - return ss; - } - private boolean sideCast(Type from, Type to, Warner warn) { // We are casting from type $from$ to type $to$, which are // non-final unrelated types. This method @@ -4207,7 +4170,7 @@ public class Types { @Override public Void visitWildcardType(WildcardType source, Type target) throws AdaptFailure { if (source.isExtendsBound()) - adaptRecursive(upperBound(source), upperBound(target)); + adaptRecursive(wildUpperBound(source), wildUpperBound(target)); else if (source.isSuperBound()) adaptRecursive(wildLowerBound(source), wildLowerBound(target)); return null; @@ -4224,7 +4187,7 @@ public class Types { val = isSubtype(wildLowerBound(val), wildLowerBound(target)) ? target : val; } else if (val.isExtendsBound() && target.isExtendsBound()) { - val = isSubtype(upperBound(val), upperBound(target)) + val = isSubtype(wildUpperBound(val), wildUpperBound(target)) ? val : target; } else if (!isSameType(val, target)) { throw new AdaptFailure(); @@ -4335,7 +4298,7 @@ public class Types { } public Type visitType(Type t, Void s) { - return high ? upperBound(t) : t; + return t; } @Override diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 89656d48a01..defa825bfe5 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1176,7 +1176,7 @@ public class Attr extends JCTree.Visitor { //the Formal Parameter of a for-each loop is not in the scope when //attributing the for-each expression; we mimick this by attributing //the for-each expression first (against original scope). - Type exprType = types.upperBound(attribExpr(tree.expr, loopEnv)); + Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv)); attribStat(tree.var, loopEnv); chk.checkNonVoid(tree.pos(), exprType); Type elemtype = types.elemtype(exprType); // perhaps expr is an array? @@ -1193,7 +1193,7 @@ public class Attr extends JCTree.Visitor { List iterableParams = base.allparams(); elemtype = iterableParams.isEmpty() ? syms.objectType - : types.upperBound(iterableParams.head); + : types.wildUpperBound(iterableParams.head); } } chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type); diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index 1283d87d27b..7cfb78ec5dd 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -621,10 +621,10 @@ public class Check { if (a.isUnbound()) { return true; } else if (!a.hasTag(WILDCARD)) { - a = types.upperBound(a); + a = types.cvarUpperBound(a); return types.isSubtype(a, bound); } else if (a.isExtendsBound()) { - return types.isCastable(bound, types.upperBound(a), types.noWarnings); + return types.isCastable(bound, types.wildUpperBound(a), types.noWarnings); } else if (a.isSuperBound()) { return !types.notSoftSubtype(types.wildLowerBound(a), bound); } diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java index 33762e0d9d4..5bffdebdca7 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java @@ -3522,7 +3522,7 @@ public class Lower extends TreeTranslator { private void visitIterableForeachLoop(JCEnhancedForLoop tree) { make_at(tree.expr.pos()); Type iteratorTarget = syms.objectType; - Type iterableType = types.asSuper(types.upperBound(tree.expr.type), + Type iterableType = types.asSuper(types.cvarUpperBound(tree.expr.type), syms.iterableType.tsym); if (iterableType.getTypeArguments().nonEmpty()) iteratorTarget = types.erasure(iterableType.getTypeArguments().head); @@ -3556,7 +3556,7 @@ public class Lower extends TreeTranslator { List.nil()); JCExpression vardefinit = make.App(make.Select(make.Ident(itvar), next)); if (tree.var.type.isPrimitive()) - vardefinit = make.TypeCast(types.upperBound(iteratorTarget), vardefinit); + vardefinit = make.TypeCast(types.cvarUpperBound(iteratorTarget), vardefinit); else vardefinit = make.TypeCast(tree.var.type, vardefinit); JCVariableDecl indexDef = (JCVariableDecl)make.VarDef(tree.var.mods, diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index a058f4a742b..fffe05c55a0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -347,7 +347,7 @@ public class Resolve { boolean isAccessible(Env env, Type t, boolean checkInner) { return (t.hasTag(ARRAY)) - ? isAccessible(env, types.upperBound(types.elemtype(t))) + ? isAccessible(env, types.cvarUpperBound(types.elemtype(t))) : isAccessible(env, t.tsym, checkInner); } @@ -1014,7 +1014,7 @@ public class Resolve { */ private Type U(Type found) { return found == pt ? - found : types.upperBound(found); + found : types.cvarUpperBound(found); } @Override From 2b4c40d39b77b36b9b5aa2e530880cac4053db43 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 27 May 2014 16:39:05 -0600 Subject: [PATCH 161/185] 8044050: Move misplaced inference tests to test/tools/javac/generics/inference Reviewed-by: vromero --- .../EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java | 0 .../EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java | 0 .../EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out | 0 .../EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java | 0 .../EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename langtools/test/tools/javac/{ => generics}/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java (100%) rename langtools/test/tools/javac/{ => generics}/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java (100%) rename langtools/test/tools/javac/{ => generics}/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out (100%) rename langtools/test/tools/javac/{ => generics}/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java (100%) rename langtools/test/tools/javac/{ => generics}/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out (100%) diff --git a/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java similarity index 100% rename from langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java rename to langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java diff --git a/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java similarity index 100% rename from langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java rename to langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java diff --git a/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out similarity index 100% rename from langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out rename to langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out diff --git a/langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java similarity index 100% rename from langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java rename to langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java diff --git a/langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out b/langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out similarity index 100% rename from langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out rename to langtools/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out From e0f445082543401a6295c70bb883cf4ab1dca9b1 Mon Sep 17 00:00:00 2001 From: Stephane Epardaud Date: Wed, 28 May 2014 21:47:30 +0100 Subject: [PATCH 162/185] 8037934: Javac generates invalid signatures for local types Reviewed-by: vromero, rfield --- .../com/sun/tools/javac/code/Types.java | 2 +- .../test/tools/javac/types/BadSigTest.java | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/types/BadSigTest.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 9066a03ae2a..783f6282d10 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -4696,7 +4696,7 @@ public class Types { assembleClassSig(rawOuter ? types.erasure(outer) : outer); - append('.'); + append(rawOuter ? '$' : '.'); Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname)); append(rawOuter ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength() + 1, c.flatname.getByteLength()) diff --git a/langtools/test/tools/javac/types/BadSigTest.java b/langtools/test/tools/javac/types/BadSigTest.java new file mode 100644 index 00000000000..14b3ff9cbb0 --- /dev/null +++ b/langtools/test/tools/javac/types/BadSigTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014, 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 8037934 + * @summary Javac generates invalid signatures for local types + * @run main BadSigTest + */ + +public class BadSigTest { + void m(){ + class Local1{} + class Local2 extends Local1{} + Local2.class.getTypeParameters(); + } + public static void main(String[] args) { + new BadSigTest().m(); + } +} From 6f8ef3eab3ea546f9513dbbacc67102905e54edf Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Thu, 29 May 2014 01:50:50 +0400 Subject: [PATCH 163/185] 7047033: (smartcardio) Card.disconnect(boolean reset) does not reset when reset is true Reviewed-by: valeriep --- jdk/src/share/classes/sun/security/smartcardio/CardImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java b/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java index 40cc25596fa..322726f9c35 100644 --- a/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java +++ b/jdk/src/share/classes/sun/security/smartcardio/CardImpl.java @@ -246,7 +246,7 @@ final class CardImpl extends Card { } checkExclusive(); try { - SCardDisconnect(cardId, (reset ? SCARD_LEAVE_CARD : SCARD_RESET_CARD)); + SCardDisconnect(cardId, (reset ? SCARD_RESET_CARD : SCARD_LEAVE_CARD)); } catch (PCSCException e) { throw new CardException("disconnect() failed", e); } finally { From 1b1639105a33dfa3c3a8114a00fc022ce7091d12 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 29 May 2014 10:36:06 +0800 Subject: [PATCH 164/185] 8036709: Java 7 jarsigner displays warning about cert policy tree Reviewed-by: mullan --- .../sun/security/tools/jarsigner/Main.java | 22 ++++- .../security/tools/jarsigner/certpolicy.sh | 80 +++++++++++++++++++ 2 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 jdk/test/sun/security/tools/jarsigner/certpolicy.sh diff --git a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java index ec2247d81b6..63afd87af31 100644 --- a/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java +++ b/jdk/src/share/classes/sun/security/tools/jarsigner/Main.java @@ -1560,8 +1560,7 @@ public class Main { first = false; } try { - CertPath cp = certificateFactory.generateCertPath(certs); - validator.validate(cp, pkixParameters); + validateCertChain(certs); } catch (Exception e) { if (debug) { e.printStackTrace(); @@ -1871,8 +1870,7 @@ public class Main { printCert("", certChain[0], true, null, true); try { - CertPath cp = certificateFactory.generateCertPath(Arrays.asList(certChain)); - validator.validate(cp, pkixParameters); + validateCertChain(Arrays.asList(certChain)); } catch (Exception e) { if (debug) { e.printStackTrace(); @@ -1937,6 +1935,22 @@ public class Main { System.exit(1); } + void validateCertChain(List certs) throws Exception { + int cpLen = 0; + out: for (; cpLen 0) { + CertPath cp = certificateFactory.generateCertPath( + (cpLen == certs.size())? certs: certs.subList(0, cpLen)); + validator.validate(cp, pkixParameters); + } + } + char[] getPass(String prompt) { System.err.print(prompt); diff --git a/jdk/test/sun/security/tools/jarsigner/certpolicy.sh b/jdk/test/sun/security/tools/jarsigner/certpolicy.sh new file mode 100644 index 00000000000..20cf92b1618 --- /dev/null +++ b/jdk/test/sun/security/tools/jarsigner/certpolicy.sh @@ -0,0 +1,80 @@ +# +# Copyright (c) 2014, 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 8036709 +# @summary Java 7 jarsigner displays warning about cert policy tree +# +# @run shell certpolicy.sh +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +KT="$TESTJAVA/bin/keytool $TESTTOOLVMOPTS \ + -keypass changeit -storepass changeit -keystore ks -keyalg rsa" +JS="$TESTJAVA/bin/jarsigner $TESTTOOLVMOPTS -storepass changeit -keystore ks" +JAR="$TESTJAVA/bin/jar $TESTTOOLVMOPTS" + +rm ks 2> /dev/null +$KT -genkeypair -alias ca -dname CN=CA -ext bc +$KT -genkeypair -alias int -dname CN=Int +$KT -genkeypair -alias ee -dname CN=EE + +# CertificatePolicies [[PolicyId: [1.2.3]], [PolicyId: [1.2.4]]] +# PolicyConstraints: [Require: 0; Inhibit: unspecified] +$KT -certreq -alias int | \ + $KT -gencert -rfc -alias ca \ + -ext 2.5.29.32="30 0C 30 04 06 02 2A 03 30 04 06 02 2A 04" \ + -ext "2.5.29.36=30 03 80 01 00" -ext bc | \ + $KT -import -alias int + +# CertificatePolicies [[PolicyId: [1.2.3]]] +$KT -certreq -alias ee | \ + $KT -gencert -rfc -alias int \ + -ext 2.5.29.32="30 06 30 04 06 02 2A 03" | \ + $KT -import -alias ee + +$KT -export -alias ee -rfc > cc +$KT -export -alias int -rfc >> cc +$KT -export -alias ca -rfc >> cc + +$KT -delete -alias int + +ERR='' +$JAR cvf a.jar cc + +# Make sure the certchain in the signed jar contains all 3 certs +$JS -strict -certchain cc a.jar ee -debug || ERR="sign" +$JS -strict -verify a.jar -debug || ERR="$ERR verify" + +if [ "$ERR" = "" ]; then + echo "Success" + exit 0 +else + echo "Failed: $ERR" + exit 1 +fi + From 720929349533a72fccc63b62344ac33de020f37c Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Wed, 28 May 2014 23:08:49 -0700 Subject: [PATCH 165/185] 8043916: Fix fallthrough lint warnings in java/lang/UNIXProcess.java Reviewed-by: lancea, alanb --- jdk/src/solaris/classes/java/lang/UNIXProcess.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/solaris/classes/java/lang/UNIXProcess.java b/jdk/src/solaris/classes/java/lang/UNIXProcess.java index 56ba83f036f..85f15407c8f 100644 --- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java +++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java @@ -97,6 +97,7 @@ final class UNIXProcess extends Process { EnumSet.copyOf(Arrays.asList(launchMechanisms)); } + @SuppressWarnings("fallthrough") private String helperPath(String javahome, String osArch) { switch (this) { case SOLARIS: From b6e32cb88d34692b113f85082eca5428ab2229f1 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Thu, 29 May 2014 10:17:08 +0400 Subject: [PATCH 166/185] 8043720: (smartcardio) Native memory should be handled more accurately Reviewed-by: valeriep --- .../native/sun/security/smartcardio/pcsc.c | 78 +++++++++---------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/jdk/src/share/native/sun/security/smartcardio/pcsc.c b/jdk/src/share/native/sun/security/smartcardio/pcsc.c index ab30e138120..ec2d21a3a1c 100644 --- a/jdk/src/share/native/sun/security/smartcardio/pcsc.c +++ b/jdk/src/share/native/sun/security/smartcardio/pcsc.c @@ -122,35 +122,28 @@ JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext /** * Convert a multi string to a java string array, */ -jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) { +jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec, DWORD size) { jobjectArray result; jclass stringClass; - char *cp, **tab; + char* tab[PCSCLITE_MAX_READERS_CONTEXTS]; jstring js; int cnt = 0; + DWORD i; - cp = spec; - while (*cp != 0) { - cp += (strlen(cp) + 1); - ++cnt; - } - - tab = (char **)malloc(cnt * sizeof(char *)); - if (tab == NULL) { - throwOutOfMemoryError(env, NULL); - return NULL; - } - - cnt = 0; - cp = spec; - while (*cp != 0) { - tab[cnt++] = cp; - cp += (strlen(cp) + 1); + if (spec && size) { + spec[size - 1] = 0; + for (i = 0; i < size && spec[i]; ++i) { + tab[cnt++] = spec + i; + if (cnt == PCSCLITE_MAX_READERS_CONTEXTS) { + break; + } + for (++i; i < size && spec[i]; ++i) { + } + } } stringClass = (*env)->FindClass(env, "java/lang/String"); if (stringClass == NULL) { - free(tab); return NULL; } @@ -159,18 +152,15 @@ jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) { while (cnt-- > 0) { js = (*env)->NewStringUTF(env, tab[cnt]); if ((*env)->ExceptionCheck(env)) { - free(tab); return NULL; } (*env)->SetObjectArrayElement(env, result, cnt, js); if ((*env)->ExceptionCheck(env)) { - free(tab); return NULL; } (*env)->DeleteLocalRef(env, js); } } - free(tab); return result; } @@ -179,7 +169,7 @@ JNIEXPORT jobjectArray JNICALL Java_sun_security_smartcardio_PCSC_SCardListReade { SCARDCONTEXT context = (SCARDCONTEXT)jContext; LONG rv; - LPTSTR mszReaders; + LPTSTR mszReaders = NULL; DWORD size = 0; jobjectArray result; @@ -190,20 +180,22 @@ JNIEXPORT jobjectArray JNICALL Java_sun_security_smartcardio_PCSC_SCardListReade } dprintf1("-size: %d\n", size); - mszReaders = malloc(size); - if (mszReaders == NULL) { - throwOutOfMemoryError(env, NULL); - return NULL; + if (size) { + mszReaders = malloc(size); + if (mszReaders == NULL) { + throwOutOfMemoryError(env, NULL); + return NULL; + } + + rv = CALL_SCardListReaders(context, NULL, mszReaders, &size); + if (handleRV(env, rv)) { + free(mszReaders); + return NULL; + } + dprintf1("-String: %s\n", mszReaders); } - rv = CALL_SCardListReaders(context, NULL, mszReaders, &size); - if (handleRV(env, rv)) { - free(mszReaders); - return NULL; - } - dprintf1("-String: %s\n", mszReaders); - - result = pcsc_multi2jstring(env, mszReaders); + result = pcsc_multi2jstring(env, mszReaders, size); free(mszReaders); return result; } @@ -336,7 +328,7 @@ JNIEXPORT jintArray JNICALL Java_sun_security_smartcardio_PCSC_SCardGetStatusCha const char *readerName; readerState = calloc(readers, sizeof(SCARD_READERSTATE)); - if (readerState == NULL) { + if (readerState == NULL && readers > 0) { throwOutOfMemoryError(env, NULL); return NULL; } @@ -347,6 +339,10 @@ JNIEXPORT jintArray JNICALL Java_sun_security_smartcardio_PCSC_SCardGetStatusCha return NULL; } + for (i = 0; i < readers; i++) { + readerState[i].szReader = NULL; + } + for (i = 0; i < readers; i++) { jobject jReaderName = (*env)->GetObjectArrayElement(env, jReaderNames, i); if ((*env)->ExceptionCheck(env)) { @@ -369,9 +365,11 @@ JNIEXPORT jintArray JNICALL Java_sun_security_smartcardio_PCSC_SCardGetStatusCha (*env)->DeleteLocalRef(env, jReaderName); } - rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers); - if (handleRV(env, rv)) { - goto cleanup; + if (readers > 0) { + rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers); + if (handleRV(env, rv)) { + goto cleanup; + } } jEventState = (*env)->NewIntArray(env, readers); From 0c8a57200970051f54fb880173ce7800396ee83c Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Thu, 29 May 2014 13:27:36 +0400 Subject: [PATCH 167/185] 8035186: j2se_jdk/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java - assertion error Reviewed-by: psandoz --- .../lambda/LogGeneratedClassesTest.java | 64 ++++++++++++++----- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java index dc34bba24b9..33acc50d667 100644 --- a/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/jdk/test/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -33,11 +33,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.nio.file.Files; -import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.PosixFileAttributeView; -import java.util.stream.Stream; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -163,34 +161,66 @@ public class LogGeneratedClassesTest extends LUtils { tr.assertZero("Should still return 0"); } + private static boolean isWriteableDirectory(Path p) { + if (!Files.isDirectory(p)) { + return false; + } + Path test = p.resolve(Paths.get("test")); + try { + Files.createFile(test); + assertTrue(Files.exists(test)); + return true; + } catch (IOException e) { + assertFalse(Files.exists(test)); + return false; + } finally { + if (Files.exists(test)) { + try { + Files.delete(test); + } catch (IOException e) { + throw new Error(e); + } + } + } + } + @Test public void testDumpDirNotWritable() throws IOException { - if (! Files.getFileStore(Paths.get(".")) - .supportsFileAttributeView(PosixFileAttributeView.class)) { + if (!Files.getFileStore(Paths.get(".")) + .supportsFileAttributeView(PosixFileAttributeView.class)) { // No easy way to setup readonly directory without POSIX // We would like to skip the test with a cause with // throw new SkipException("Posix not supported"); // but jtreg will report failure so we just pass the test // which we can look at if jtreg changed its behavior + System.out.println("WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test."); return; } Files.createDirectory(Paths.get("readOnly"), asFileAttribute(fromString("r-xr-xr-x"))); + try { + if (isWriteableDirectory(Paths.get("readOnly"))) { + // Skipping the test: it's allowed to write into read-only directory + // (e.g. current user is super user). + System.out.println("WARNING: readOnly directory is writeable. Skipping testDumpDirNotWritable test."); + return; + } - TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), - "-cp", ".", - "-Djdk.internal.lambda.dumpProxyClasses=readOnly", - "-Djava.security.manager", - "com.example.TestLambda"); - assertEquals(tr.testOutput.stream() - .filter(s -> s.startsWith("WARNING")) - .peek(s -> assertTrue(s.contains("not writable"))) - .count(), - 1, "only show error once"); - tr.assertZero("Should still return 0"); - - TestUtil.removeAll(Paths.get("readOnly")); + TestResult tr = doExec(JAVA_CMD.getAbsolutePath(), + "-cp", ".", + "-Djdk.internal.lambda.dumpProxyClasses=readOnly", + "-Djava.security.manager", + "com.example.TestLambda"); + assertEquals(tr.testOutput.stream() + .filter(s -> s.startsWith("WARNING")) + .peek(s -> assertTrue(s.contains("not writable"))) + .count(), + 1, "only show error once"); + tr.assertZero("Should still return 0"); + } finally { + TestUtil.removeAll(Paths.get("readOnly")); + } } @Test From 92e2e96714df45ea68d19ead6ac5fdf378084aa0 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Thu, 29 May 2014 15:28:01 +0100 Subject: [PATCH 168/185] 8037937: javac: AssertionError during LVT generation, wrong variable ranges Reviewed-by: mcimadamore --- .../classes/com/sun/tools/javac/jvm/Code.java | 19 +++++++++++-------- .../classes/com/sun/tools/javac/jvm/Gen.java | 3 +-- .../test/tools/javac/flow/LVTHarness.java | 10 +++++----- .../javac/flow/tests/TestCaseIfElse.java | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java index 8f28fa0550e..b933b4632b6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java @@ -1925,6 +1925,13 @@ public class Code { return aliveRanges.isEmpty() ? null : aliveRanges.get(aliveRanges.size() - 1); } + void removeLastRange() { + Range lastRange = lastRange(); + if (lastRange != null) { + aliveRanges.remove(lastRange); + } + } + @Override public String toString() { if (aliveRanges == null) { @@ -1955,9 +1962,7 @@ public class Code { } } } else { - if (!aliveRanges.isEmpty()) { - aliveRanges.remove(aliveRanges.size() - 1); - } + removeLastRange(); } } @@ -1965,16 +1970,14 @@ public class Code { if (aliveRanges.isEmpty()) { return false; } - Range range = lastRange(); - return range.length == Character.MAX_VALUE; + return lastRange().length == Character.MAX_VALUE; } public boolean isLastRangeInitialized() { if (aliveRanges.isEmpty()) { return false; } - Range range = lastRange(); - return range.start_pc != Character.MAX_VALUE; + return lastRange().start_pc != Character.MAX_VALUE; } public Range getWidestRange() { @@ -2095,7 +2098,7 @@ public class Code { v.closeRange(length); putVar(v); } else { - v.lastRange().start_pc = Character.MAX_VALUE; + v.removeLastRange(); } } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java index 943fbb58d62..37050775fb8 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -1800,8 +1800,7 @@ public class Gen extends JCTree.Visitor { genStat(tree.thenpart, env, CRT_STATEMENT | CRT_FLOW_TARGET); thenExit = code.branch(goto_); if (varDebugInfo && lvtRanges.containsKey(code.meth, tree.thenpart)) { - code.closeAliveRanges(tree.thenpart, - thenExit != null && tree.elsepart == null ? thenExit.pc : code.cp); + code.closeAliveRanges(tree.thenpart, code.cp); } } if (elseChain != null) { diff --git a/langtools/test/tools/javac/flow/LVTHarness.java b/langtools/test/tools/javac/flow/LVTHarness.java index c679f52f526..7039a626a57 100644 --- a/langtools/test/tools/javac/flow/LVTHarness.java +++ b/langtools/test/tools/javac/flow/LVTHarness.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 @@ -23,8 +23,8 @@ /* * @test - * @bug 7047734 8027660 - * @summary The LVT is not generated correctly during some try/catch scenarios; + * @bug 7047734 8027660 8037937 + * @summary The LVT is not generated correctly during some try/catch scenarios * javac crash while creating LVT entry for a local variable defined in * an inner block * @library /tools/javac/lib @@ -120,7 +120,7 @@ public class LVTHarness { for (Map.Entry entry : aliveRangeMap.entrySet()) { if (!seenAliveRanges.contains(entry.getKey())) { error("Redundant @AliveRanges annotation on method " + - entry.getKey().elem); + entry.getKey().elem + " with key " + entry.getKey()); } } } @@ -134,7 +134,7 @@ public class LVTHarness { for (Method method : classFile.methods) { for (ElementKey elementKey: aliveRangeMap.keySet()) { String methodDesc = method.getName(constantPool) + - method.descriptor.getParameterTypes(constantPool); + method.descriptor.getParameterTypes(constantPool).replace(" ", ""); if (methodDesc.equals(elementKey.elem.toString())) { checkMethod(constantPool, method, aliveRangeMap.get(elementKey)); seenAliveRanges.add(elementKey); diff --git a/langtools/test/tools/javac/flow/tests/TestCaseIfElse.java b/langtools/test/tools/javac/flow/tests/TestCaseIfElse.java index 3e6cc893794..d789853b43a 100644 --- a/langtools/test/tools/javac/flow/tests/TestCaseIfElse.java +++ b/langtools/test/tools/javac/flow/tests/TestCaseIfElse.java @@ -33,7 +33,7 @@ public class TestCaseIfElse { @AliveRange(varName="o", bytecodeStart=10, bytecodeLength=8) @AliveRange(varName="o", bytecodeStart=21, bytecodeLength=9) - void m2(String[] args) { + void m2() { Object o; int i = 5; if (i != 5) { @@ -45,4 +45,19 @@ public class TestCaseIfElse { } o = "finish"; } + + @AliveRange(varName="o", bytecodeStart=11, bytecodeLength=3) + @AliveRange(varName="o", bytecodeStart=17, bytecodeLength=2) + Object m3(boolean cond1, boolean cond2) { + Object o; + if (cond1) { + if (cond2) { + o = "then"; + } else { + o = "else"; + return null; + } + } + return null; + } } From 1eef4367dfb91bd795e6266d0e1270995de531c6 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Thu, 29 May 2014 15:50:36 +0100 Subject: [PATCH 169/185] 8044038: Security tests fail on 32 bit linux platform Reviewed-by: xuelei, weijun --- jdk/test/sun/security/pkcs11/PKCS11Test.java | 4 ++-- jdk/test/sun/security/tools/keytool/autotest.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java index 3699f880456..f1b179b00f5 100644 --- a/jdk/test/sun/security/pkcs11/PKCS11Test.java +++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, 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 @@ -457,7 +457,7 @@ public abstract class PKCS11Test { osMap.put("SunOS-x86-32", new String[]{"/usr/lib/mps/"}); osMap.put("SunOS-amd64-64", new String[]{"/usr/lib/mps/64/"}); osMap.put("Linux-i386-32", new String[]{ - "/usr/lib/i386-linux-gnu/", "/usr/lib/"}); + "/usr/lib/i386-linux-gnu/", "/usr/lib32/", "/usr/lib/"}); osMap.put("Linux-amd64-64", new String[]{ "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/", "/usr/lib64/"}); diff --git a/jdk/test/sun/security/tools/keytool/autotest.sh b/jdk/test/sun/security/tools/keytool/autotest.sh index 90e0a66a268..8154af5939b 100644 --- a/jdk/test/sun/security/tools/keytool/autotest.sh +++ b/jdk/test/sun/security/tools/keytool/autotest.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2014, 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 @@ -72,6 +72,8 @@ case "$OS" in Linux ) if [ $B32 = true ]; then LIBNAME=`find_one \ + "/usr/lib32/libsoftokn3.so" \ + "/usr/lib32/nss/libsoftokn3.so" \ "/usr/lib/libsoftokn3.so" \ "/usr/lib/i386-linux-gnu/nss/libsoftokn3.so" \ "/usr/lib/nss/libsoftokn3.so"` From e85046645b2c6c246a77b4e2a24e4b89f874b1f3 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Fri, 30 May 2014 02:33:20 +0400 Subject: [PATCH 170/185] 8044342: build failure on Windows noticed with recent smartcardio fix Reviewed-by: valeriep --- .../native/sun/security/smartcardio/pcsc.c | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/native/sun/security/smartcardio/pcsc.c b/jdk/src/share/native/sun/security/smartcardio/pcsc.c index ec2d21a3a1c..b837234761d 100644 --- a/jdk/src/share/native/sun/security/smartcardio/pcsc.c +++ b/jdk/src/share/native/sun/security/smartcardio/pcsc.c @@ -122,28 +122,35 @@ JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext /** * Convert a multi string to a java string array, */ -jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec, DWORD size) { +jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) { jobjectArray result; jclass stringClass; - char* tab[PCSCLITE_MAX_READERS_CONTEXTS]; + char *cp, **tab = NULL; jstring js; int cnt = 0; - DWORD i; - if (spec && size) { - spec[size - 1] = 0; - for (i = 0; i < size && spec[i]; ++i) { - tab[cnt++] = spec + i; - if (cnt == PCSCLITE_MAX_READERS_CONTEXTS) { - break; - } - for (++i; i < size && spec[i]; ++i) { - } - } + cp = spec; + while (*cp != 0) { + cp += (strlen(cp) + 1); + ++cnt; + } + + tab = (char **)malloc(cnt * sizeof(char *)); + if (tab == NULL) { + throwOutOfMemoryError(env, NULL); + return NULL; + } + + cnt = 0; + cp = spec; + while (*cp != 0) { + tab[cnt++] = cp; + cp += (strlen(cp) + 1); } stringClass = (*env)->FindClass(env, "java/lang/String"); if (stringClass == NULL) { + free(tab); return NULL; } @@ -152,15 +159,18 @@ jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec, DWORD size) { while (cnt-- > 0) { js = (*env)->NewStringUTF(env, tab[cnt]); if ((*env)->ExceptionCheck(env)) { + free(tab); return NULL; } (*env)->SetObjectArrayElement(env, result, cnt, js); if ((*env)->ExceptionCheck(env)) { + free(tab); return NULL; } (*env)->DeleteLocalRef(env, js); } } + free(tab); return result; } @@ -195,7 +205,7 @@ JNIEXPORT jobjectArray JNICALL Java_sun_security_smartcardio_PCSC_SCardListReade dprintf1("-String: %s\n", mszReaders); } - result = pcsc_multi2jstring(env, mszReaders, size); + result = pcsc_multi2jstring(env, mszReaders); free(mszReaders); return result; } From 2a838667917d0b2afdf1a8175f6347acf07e429d Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:31:59 -0700 Subject: [PATCH 171/185] Added tag jdk9-b15 for changeset e4801f790a3c --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index b370baabdcc..e60713ac318 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -257,3 +257,4 @@ ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11 59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12 5800456add07e1a68170a229fb5e27376f8875e5 jdk9-b13 4e3aa9723e9972623e3dafc321b368e7db7e9b3b jdk9-b14 +b114474fb25af4e73cb7219f7c04bd8994da03a5 jdk9-b15 From 539ec26cc654fc6f0786d3195a71bd64b5057d92 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:02 -0700 Subject: [PATCH 172/185] Added tag jdk9-b15 for changeset 20d187781c7f --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 3f510f7c8a2..29ff1978725 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -257,3 +257,4 @@ a4bf701ac316946c2e5e83138ad8e687da6a4b30 jdk9-b06 e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12 088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13 a2b82f863ba95a596da555a4c1b871c404863e7e jdk9-b14 +e54022d0dd92106fff7f7fe670010cd7e6517ee3 jdk9-b15 From a8ec75f4cc3b25bbda4bef07281f82bacb2d8f59 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:04 -0700 Subject: [PATCH 173/185] Added tag jdk9-b15 for changeset 8e732d204328 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 00898012217..ab6aa356e85 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -417,3 +417,4 @@ ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10 1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12 456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13 bd333491bb6c012d7b606939406d0fa9a5ac7ffd jdk9-b14 +170f6d733d7aec062f743a6b8c1cce940a7a984a jdk9-b15 From 1ca52c4779ddbd2b22bd6a4cc29391764a268435 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:09 -0700 Subject: [PATCH 174/185] Added tag jdk9-b15 for changeset e96eee24c138 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 7cda4470598..f6504ed115a 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -257,3 +257,4 @@ f93a792fe37279d4d37aea86a99f3abbdc6fe79b jdk9-b09 e88cecf5a21b760ff7d7761c2db6bb8c82bc9f0c jdk9-b12 5eaf717f6e36037a6d3744ffeee0e4c88e64a0d2 jdk9-b13 32b3fc4bc7374a34d52b7f4e2391b4b4b0c084e8 jdk9-b14 +6bad71866c7598587860e0981b0b0e51ec8c0476 jdk9-b15 From 33541c0e7181112ec14d06ac346ad8998ec5aa1d Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:10 -0700 Subject: [PATCH 175/185] Added tag jdk9-b15 for changeset 039c0ea8c5c6 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index c7dda23a67d..7f510c46e5f 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -260,3 +260,4 @@ c9e8bb8c1144a966ca7b481142c6b5e55d14a29c jdk9-b09 779f8b21c75f83e3918dac8499e4d0ecb3a54ed7 jdk9-b12 3d42204854c9f703e3ccdc8891248e73057713ab jdk9-b13 02e58850b7062825308413d420f2b02c1f25a724 jdk9-b14 +e9780330017a6b464a385356d77e5136f9de8d09 jdk9-b15 From 27917f7eaa2384a1e9234d47290869ce72e07c54 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:11 -0700 Subject: [PATCH 176/185] Added tag jdk9-b15 for changeset 0e30add0f485 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index fdf62aef521..0316b38ce62 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -257,3 +257,4 @@ ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10 83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12 c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13 5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14 +4537360f09fe23ab339ee588747b657feb12d0c8 jdk9-b15 From 1834c52c4d65392723d13e1e5da7add8b8f03525 Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:18 -0700 Subject: [PATCH 177/185] Added tag jdk9-b15 for changeset dbec02c24c7a --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index d59728d0fb2..d963cacab98 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -257,3 +257,4 @@ f04fccfbd880c819affc3ef33e0083aab9556409 jdk9-b11 72efbe612e494f98b9c3ede1b4a3d02304e1e9cc jdk9-b12 2c8bb81b5d48161019218c7604fa88c67edc6105 jdk9-b13 1df3f53b9d980b66739f05e14053381ffb0f38ee jdk9-b14 +8666a9611eb8ba711b001bf8d942282e3e2d8e3d jdk9-b15 From 38325cc800ce773aa4e8f83d0019aef1cc20941a Mon Sep 17 00:00:00 2001 From: David Katleman Date: Thu, 29 May 2014 22:32:20 -0700 Subject: [PATCH 178/185] Added tag jdk9-b15 for changeset 67e22e0e8473 --- nashorn/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/nashorn/.hgtags b/nashorn/.hgtags index f5e58e3f192..0a256647f7b 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -248,3 +248,4 @@ b3517e51f40477f10db8bc30a557aa0ea712c274 jdk9-b02 282e9a675e079cc84dbfaa4c10050f08397faab0 jdk9-b12 be4580ae56e2ef0ce521d3f840753eaa83cacf33 jdk9-b13 806df06b6ac58d3e9c9c6a680dbdd7a6c94ca700 jdk9-b14 +32b66f4661eac52f8b04fb3d7703feb2c96febb7 jdk9-b15 From a57ab24f5361de38b6f38466ac3a28c15fcc0214 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 30 May 2014 14:37:43 +0800 Subject: [PATCH 179/185] 8036779: sun.security.krb5.KdcComm interprets kdc_timeout as msec instead of sec Reviewed-by: xuelei --- .../classes/sun/security/krb5/KdcComm.java | 30 +++++++++++++++-- jdk/test/sun/security/krb5/auto/KDC.java | 32 +++++++++++++------ jdk/test/sun/security/krb5/auto/UdpTcp.java | 14 +++++--- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/jdk/src/share/classes/sun/security/krb5/KdcComm.java b/jdk/src/share/classes/sun/security/krb5/KdcComm.java index caaf20a86f8..721c105d345 100644 --- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java +++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, 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 @@ -144,7 +144,8 @@ public final class KdcComm { try { Config cfg = Config.getInstance(); String temp = cfg.get("libdefaults", "kdc_timeout"); - timeout = parsePositiveIntString(temp); + timeout = parseTimeString(temp); + temp = cfg.get("libdefaults", "max_retries"); max_retries = parsePositiveIntString(temp); temp = cfg.get("libdefaults", "udp_preference_limit"); @@ -425,6 +426,25 @@ public final class KdcComm { } } + /** + * Parses a time value string. If it ends with "s", parses as seconds. + * Otherwise, parses as milliseconds. + * @param s the time string + * @return the integer value in milliseconds, or -1 if input is null or + * has an invalid format + */ + private static int parseTimeString(String s) { + if (s == null) { + return -1; + } + if (s.endsWith("s")) { + int seconds = parsePositiveIntString(s.substring(0, s.length()-1)); + return (seconds < 0) ? -1 : (seconds*1000); + } else { + return parsePositiveIntString(s); + } + } + /** * Returns krb5.conf setting of {@code key} for a specific realm, * which can be: @@ -446,7 +466,11 @@ public final class KdcComm { try { String value = Config.getInstance().get("realms", realm, key); - temp = parsePositiveIntString(value); + if (key.equals("kdc_timeout")) { + temp = parseTimeString(value); + } else { + temp = parsePositiveIntString(value); + } } catch (Exception exc) { // Ignored, defValue will be picked up } diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java index 356f84e9856..686e238579e 100644 --- a/jdk/test/sun/security/krb5/auto/KDC.java +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -141,6 +141,8 @@ public class KDC { private BlockingQueue q = new ArrayBlockingQueue<>(100); // Options private Map options = new HashMap<>(); + // Realm-specific krb5.conf settings + private List conf = new ArrayList<>(); private Thread thread1, thread2, thread3; DatagramSocket u1 = null; @@ -243,7 +245,7 @@ public class KDC { /** * Sets an option * @param key the option name - * @param obj the value + * @param value the value */ public void setOption(Option key, Object value) { if (value == null) { @@ -372,6 +374,13 @@ public class KDC { return kdc; } + /** + * Add realm-specific krb5.conf setting + */ + public void addConf(String s) { + conf.add(s); + } + /** * Writes a krb5.conf for one or more KDC that includes KDC locations for * each realm and the default realm name. You can also add extra strings @@ -397,6 +406,7 @@ public class KDC { * [realms] * REALM.NAME = { * kdc = host:port_number + * # realm-specific settings * } * * @@ -444,10 +454,10 @@ public class KDC { } } sb.append("\n[realms]\n"); - sb.append(realmLineForKDC(kdc)); + sb.append(kdc.realmLine()); for (Object o: more) { if (o instanceof KDC) { - sb.append(realmLineForKDC((KDC)o)); + sb.append(((KDC)o).realmLine()); } } FileOutputStream fos = new FileOutputStream(f); @@ -1133,14 +1143,16 @@ public class KDC { /** * Generates a line for a KDC to put inside [realms] of krb5.conf - * @param kdc the KDC - * @return REALM.NAME = { kdc = host:port } + * @return REALM.NAME = { kdc = host:port etc } */ - private static String realmLineForKDC(KDC kdc) { - return String.format("%s = {\n kdc = %s:%d\n}\n", - kdc.realm, - kdc.kdc, - kdc.port); + private String realmLine() { + StringBuilder sb = new StringBuilder(); + sb.append(realm).append(" = {\n kdc = ") + .append(kdc).append(':').append(port).append('\n'); + for (String s: conf) { + sb.append(" ").append(s).append('\n'); + } + return sb.append("}\n").toString(); } /** diff --git a/jdk/test/sun/security/krb5/auto/UdpTcp.java b/jdk/test/sun/security/krb5/auto/UdpTcp.java index e66f5d459fb..ae54b793527 100644 --- a/jdk/test/sun/security/krb5/auto/UdpTcp.java +++ b/jdk/test/sun/security/krb5/auto/UdpTcp.java @@ -43,9 +43,15 @@ public class UdpTcp { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); - KDC.saveConfig(OneKDC.KRB5_CONF, kdc, - "udp_preference_limit = " - + (args[0].equals("UDP") ? "1000" : "100")); + // Two styles of kdc_timeout setting. One global, one realm-specific. + if (args[0].equals("UDP")) { + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + "kdc_timeout = 10s"); + } else { + kdc.addConf("kdc_timeout = 10s"); + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + "udp_preference_limit = 1"); + } Config.refresh(); ByteArrayOutputStream bo = new ByteArrayOutputStream(); @@ -56,7 +62,7 @@ public class UdpTcp { for (String line: new String(bo.toByteArray()).split("\n")) { if (line.contains(">>> KDCCommunication")) { - if (!line.contains(args[0])) { + if (!line.contains(args[0]) || !line.contains("timeout=10000")) { throw new Exception("No " + args[0] + " in: " + line); } } From 2f910049e8188aa3d981c9305af2eb45762e054b Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Fri, 30 May 2014 12:54:16 +0200 Subject: [PATCH 180/185] 8031967: For some sources compiler compiles for ever Avoid creating DeferredTypes for method calls with method calls as receivers if the site can be determined reliably Co-authored-by: Maurizio Cimadamore Reviewed-by: mcimadamore, vromero --- .../sun/tools/javac/comp/DeferredAttr.java | 192 ++++++++++++------ .../test/tools/javac/lambda/T8031967.java | 137 +++++++++++++ 2 files changed, 271 insertions(+), 58 deletions(-) create mode 100644 langtools/test/tools/javac/lambda/T8031967.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 6265199a8d7..151794853f6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -1221,25 +1221,102 @@ public class DeferredAttr extends JCTree.Visitor { } //slow path + Symbol sym = quicklyResolveMethod(env, tree); + + if (sym == null) { + result = ArgumentExpressionKind.POLY; + return; + } + + result = analyzeCandidateMethods(sym, ArgumentExpressionKind.PRIMITIVE, + argumentKindAnalyzer); + } + //where + private boolean isSimpleReceiver(JCTree rec) { + switch (rec.getTag()) { + case IDENT: + return true; + case SELECT: + return isSimpleReceiver(((JCFieldAccess)rec).selected); + case TYPEAPPLY: + case TYPEARRAY: + return true; + case ANNOTATED_TYPE: + return isSimpleReceiver(((JCAnnotatedType)rec).underlyingType); + case APPLY: + return true; + default: + return false; + } + } + private ArgumentExpressionKind reduce(ArgumentExpressionKind kind) { + return argumentKindAnalyzer.reduce(result, kind); + } + MethodAnalyzer argumentKindAnalyzer = + new MethodAnalyzer() { + @Override + public ArgumentExpressionKind process(MethodSymbol ms) { + return ArgumentExpressionKind.methodKind(ms, types); + } + @Override + public ArgumentExpressionKind reduce(ArgumentExpressionKind kind1, + ArgumentExpressionKind kind2) { + switch (kind1) { + case PRIMITIVE: return kind2; + case NO_POLY: return kind2.isPoly() ? kind2 : kind1; + case POLY: return kind1; + default: + Assert.error(); + return null; + } + } + @Override + public boolean shouldStop(ArgumentExpressionKind result) { + return result.isPoly(); + } + }; + + @Override + public void visitLiteral(JCLiteral tree) { + Type litType = attr.litType(tree.typetag); + result = ArgumentExpressionKind.standaloneKind(litType, types); + } + + @Override + void skip(JCTree tree) { + result = ArgumentExpressionKind.NO_POLY; + } + + private Symbol quicklyResolveMethod(Env env, final JCMethodInvocation tree) { final JCExpression rec = tree.meth.hasTag(SELECT) ? ((JCFieldAccess)tree.meth).selected : null; if (rec != null && !isSimpleReceiver(rec)) { - //give up if receiver is too complex (to cut down analysis time) - result = ArgumentExpressionKind.POLY; - return; + return null; } - Type site = rec != null ? - attribSpeculative(rec, env, attr.unknownTypeExprInfo).type : - env.enclClass.sym.type; + Type site; - while (site.hasTag(TYPEVAR)) { - site = site.getUpperBound(); + if (rec != null) { + if (rec.hasTag(APPLY)) { + Symbol recSym = quicklyResolveMethod(env, (JCMethodInvocation) rec); + if (recSym == null) + return null; + Symbol resolvedReturnType = + analyzeCandidateMethods(recSym, syms.errSymbol, returnSymbolAnalyzer); + if (resolvedReturnType == null) + return null; + site = resolvedReturnType.type; + } else { + site = attribSpeculative(rec, env, attr.unknownTypeExprInfo).type; + } + } else { + site = env.enclClass.sym.type; } List args = rs.dummyArgs(tree.args.length()); + Name name = TreeInfo.name(tree.meth); Resolve.LookupHelper lh = rs.new LookupHelper(name, site, args, List.nil(), MethodResolutionPhase.VARARITY) { @Override @@ -1254,61 +1331,60 @@ public class DeferredAttr extends JCTree.Visitor { } }; - Symbol sym = rs.lookupMethod(env, tree, site.tsym, rs.arityMethodCheck, lh); + return rs.lookupMethod(env, tree, site.tsym, rs.arityMethodCheck, lh); + } + //where: + MethodAnalyzer returnSymbolAnalyzer = new MethodAnalyzer() { + @Override + public Symbol process(MethodSymbol ms) { + ArgumentExpressionKind kind = ArgumentExpressionKind.methodKind(ms, types); + return kind != ArgumentExpressionKind.POLY ? ms.getReturnType().tsym : null; + } + @Override + public Symbol reduce(Symbol s1, Symbol s2) { + return s1 == syms.errSymbol ? s2 : s1 == s2 ? s1 : null; + } + @Override + public boolean shouldStop(Symbol result) { + return result == null; + } + }; - if (sym.kind == Kinds.AMBIGUOUS) { - Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol(); - result = ArgumentExpressionKind.PRIMITIVE; - for (Symbol s : err.ambiguousSyms) { - if (result.isPoly()) break; - if (s.kind == Kinds.MTH) { - result = reduce(ArgumentExpressionKind.methodKind(s, types)); + /** + * Process the result of Resolve.lookupMethod. If sym is a method symbol, the result of + * MethodAnalyzer.process is returned. If sym is an ambiguous symbol, all the candidate + * methods are inspected one by one, using MethodAnalyzer.process. The outcomes are + * reduced using MethodAnalyzer.reduce (using defaultValue as the first value over which + * the reduction runs). MethodAnalyzer.shouldStop can be used to stop the inspection early. + */ + E analyzeCandidateMethods(Symbol sym, E defaultValue, MethodAnalyzer analyzer) { + switch (sym.kind) { + case Kinds.MTH: + return analyzer.process((MethodSymbol) sym); + case Kinds.AMBIGUOUS: + Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol(); + E res = defaultValue; + for (Symbol s : err.ambiguousSyms) { + if (s.kind == Kinds.MTH) { + res = analyzer.reduce(res, analyzer.process((MethodSymbol) s)); + if (analyzer.shouldStop(res)) + return res; + } } - } - } else { - result = (sym.kind == Kinds.MTH) ? - ArgumentExpressionKind.methodKind(sym, types) : - ArgumentExpressionKind.NO_POLY; + return res; + default: + return defaultValue; } } - //where - private boolean isSimpleReceiver(JCTree rec) { - switch (rec.getTag()) { - case IDENT: - return true; - case SELECT: - return isSimpleReceiver(((JCFieldAccess)rec).selected); - case TYPEAPPLY: - case TYPEARRAY: - return true; - case ANNOTATED_TYPE: - return isSimpleReceiver(((JCAnnotatedType)rec).underlyingType); - default: - return false; - } - } - private ArgumentExpressionKind reduce(ArgumentExpressionKind kind) { - switch (result) { - case PRIMITIVE: return kind; - case NO_POLY: return kind.isPoly() ? kind : result; - case POLY: return result; - default: - Assert.error(); - return null; - } - } - - @Override - public void visitLiteral(JCLiteral tree) { - Type litType = attr.litType(tree.typetag); - result = ArgumentExpressionKind.standaloneKind(litType, types); - } - - @Override - void skip(JCTree tree) { - result = ArgumentExpressionKind.NO_POLY; - } } + + /** Analyzer for methods - used by analyzeCandidateMethods. */ + interface MethodAnalyzer { + E process(MethodSymbol ms); + E reduce(E e1, E e2); + boolean shouldStop(E result); + } + //where private EnumSet deferredCheckerTags = EnumSet.of(LAMBDA, REFERENCE, PARENS, TYPECAST, diff --git a/langtools/test/tools/javac/lambda/T8031967.java b/langtools/test/tools/javac/lambda/T8031967.java new file mode 100644 index 00000000000..3836ecd0406 --- /dev/null +++ b/langtools/test/tools/javac/lambda/T8031967.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2014, 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 8031967 + * @summary Ensure javac can handle very deeply nested chain of method invocations occurring as + * a parameter to other method invocations. + * @run main T8031967 + */ + +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import java.util.List; + +import javax.tools.DiagnosticListener; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +import com.sun.source.util.JavacTask; + +public class T8031967 { + + public static void main(String... args) throws IOException { + new T8031967().run(); + } + + final int depth = 50; + + private void run() throws IOException { + runTestCase(true); + runTestCase(false); + } + + private void runTestCase(boolean withErrors) throws IOException { + StringBuilder code = new StringBuilder(); + + code.append("public class Test {\n" + + " private void test() {\n" + + " GroupLayout l = new GroupLayout();\n" + + " l.setHorizontalGroup(\n"); + + gen(code, depth); + code.append(" );\n" + + " }\n"); + if (!withErrors) { + code.append(" class GroupLayout {\n" + + " ParallelGroup createParallelGroup() {return null;}\n" + + " ParallelGroup createParallelGroup(int i) {return null;}\n" + + " ParallelGroup createParallelGroup(int i, int j) {return null;}\n" + + " void setHorizontalGroup(Group g) { }\n" + + " }\n" + + " \n" + + " class Group {\n" + + " Group addGroup(Group g) { return this; }\n" + + " Group addGroup(int i, Group g) { return this; }\n" + + " Group addGap(int i) { return this; }\n" + + " Group addGap(long l) { return this; }\n" + + " Group addGap(int i, int j) { return this; }\n" + + " Group addComponent(Object c) { return this; }\n" + + " Group addComponent(int i, Object c) { return this; }\n" + + " }\n" + + " class ParallelGroup extends Group {\n" + + " Group addGroup(Group g) { return this; }\n" + + " Group addGroup(int i, Group g) { return this; }\n" + + " Group addGap(int i) { return this; }\n" + + " Group addGap(int i, int j) { return this; }\n" + + " Group addComponent(Object c) { return this; }\n" + + " Group addComponent(int i, Object c) { return this; }\n" + + " }\n"); + } + + code.append("}\n"); + + JavaSource source = new JavaSource(code.toString()); + List sourceList = Arrays.asList(source); + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + DiagnosticListener noErrors = (diagnostic) -> { + throw new IllegalStateException("Should not produce errors: " + diagnostic); + }; + JavacTask task = (JavacTask) compiler.getTask(null, null, withErrors ? null : noErrors, + null, null, sourceList); + + task.analyze(); + } + + private void gen(StringBuilder code, int depth) { + code.append("l.createParallelGroup()\n"); + if (depth > 0) { + code.append(".addGroup(\n"); + gen(code, depth - 1); + code.append(")"); + } + + code.append(".addGap(1)\n" + + ".addComponent(new Object())\n" + + ".addGap(1)\n" + + ".addComponent(new Object())"); + } + + class JavaSource extends SimpleJavaFileObject { + + final String code; + public JavaSource(String code) { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + this.code = code; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return code; + } + } +} From 07b40bb298454a8c36500368492368f2e563e544 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 30 May 2014 17:22:38 +0530 Subject: [PATCH 181/185] 8044415: ant makefile should have a target to generate javadoc only for jdk.nashorn.api and sub-packages Reviewed-by: jlaskey --- nashorn/make/build.xml | 21 +++- nashorn/samples/filebrowser.js | 100 ++++++++++++++++++ nashorn/samples/word_histogram.js | 53 ++++++++++ .../api/scripting/ScriptObjectMirror.java | 1 + .../nashorn/api/scripting/package-info.java | 3 +- .../internal/ir/annotations/Reference.java | 2 - 6 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 nashorn/samples/filebrowser.js create mode 100644 nashorn/samples/word_histogram.js diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index 88c4e9cf379..83cbb91bd4b 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -196,14 +196,16 @@ - - + + - + @@ -211,6 +213,19 @@ + + + + + + + + + + + + diff --git a/nashorn/samples/filebrowser.js b/nashorn/samples/filebrowser.js new file mode 100644 index 00000000000..da00553a4ec --- /dev/null +++ b/nashorn/samples/filebrowser.js @@ -0,0 +1,100 @@ +#// Usage: jjs -fx filebrowser.js -- + +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Uses -fx and javafx TreeView to visualize directories +if (!$OPTIONS._fx) { + print("Usage: jjs -fx filebrowser.js -- "); + exit(1); +} + +// Java classes used +var File = Java.type("java.io.File"); +var Files = Java.type("java.nio.file.Files"); + +// check directory argument, if passed +var dir = arguments.length > 0? new File(arguments[0]) : new File("."); +if (! dir.isDirectory()) { + print(dir + " is not a directory!"); + exit(2); +} + +// JavaFX classes used +var FXCollections = Java.type("javafx.collections.FXCollections"); +var Scene = Java.type("javafx.scene.Scene"); +var TreeItem = Java.type("javafx.scene.control.TreeItem"); +var TreeView = Java.type("javafx.scene.control.TreeView"); + +// create a subclass of JavaFX TreeItem class +var LazyTreeItem = Java.extend(TreeItem); + +// lazily filling children of a directory LazyTreeItem +function buildChildren(dir) { + var children = FXCollections.observableArrayList(); + var stream = Files.list(dir.toPath()); + stream.forEach(function(path) { + var file = path.toFile(); + var item = file.isDirectory()? + makeLazyTreeItem(file) : new TreeItem(file.name); + children.add(item); + }); + stream.close(); + return children; +} + +// create an instance LazyTreeItem with override methods +function makeLazyTreeItem(dir) { + var item = new LazyTreeItem(dir.name) { + expanded: false, + isLeaf: function() false, + getChildren: function() { + if (! this.expanded) { + // call super class (TreeItem) method + Java.super(item).getChildren().setAll(buildChildren(dir)); + this.expanded = true; + } + // call super class (TreeItem) method + return Java.super(item).getChildren(); + } + } + return item; +} + +// JavaFX start method +function start(stage) { + stage.title = dir.absolutePath; + var rootItem = makeLazyTreeItem(dir); + rootItem.expanded = true; + var tree = new TreeView(rootItem); + stage.scene = new Scene(tree, 300, 450); + stage.show(); +} diff --git a/nashorn/samples/word_histogram.js b/nashorn/samples/word_histogram.js new file mode 100644 index 00000000000..9c739ea0375 --- /dev/null +++ b/nashorn/samples/word_histogram.js @@ -0,0 +1,53 @@ +#nashorn word histogram of a file + +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Oracle nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This example demonstrates how to print word histogram + * of a given text file using regex, array and JSON + * functions. + */ + +if (arguments.length < 1) { + print("Usage: jjs -scripting word_histogram.js -- "); + exit(1); +} + +var obj = {}; + +readFully(arguments[0]). + split(/[^\w+]/). + forEach(function(x) + (x in obj? obj[x]++ : obj[x] = 1)); + +print(JSON.stringify(obj)); + diff --git a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java index b12553369d4..07f4e8a6864 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java +++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java @@ -621,6 +621,7 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin /** * Utilitity to convert this script object to the given type. * + * @param destination type to convert to * @param type destination type to convert to * @return converted object */ diff --git a/nashorn/src/jdk/nashorn/api/scripting/package-info.java b/nashorn/src/jdk/nashorn/api/scripting/package-info.java index 6876151e330..f017ba9ef4f 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/package-info.java +++ b/nashorn/src/jdk/nashorn/api/scripting/package-info.java @@ -32,7 +32,8 @@ * ScriptEngine nashornEngine = new ScriptEngineManager().getEngineByName("Nashorn"); * *

    Nashorn script engines implement the optional {@link javax.script.Invocable} and {@link javax.script.Compilable} - * interfaces, allowing for efficient pre-compilation and repeated execution of scripts. See + * interfaces, allowing for efficient pre-compilation and repeated execution of scripts. In addition, + * this package provides nashorn specific extension classes, interfaces and methods. See * {@link jdk.nashorn.api.scripting.NashornScriptEngineFactory} for further details. */ package jdk.nashorn.api.scripting; diff --git a/nashorn/src/jdk/nashorn/internal/ir/annotations/Reference.java b/nashorn/src/jdk/nashorn/internal/ir/annotations/Reference.java index 20c8ffca53b..27f6a697666 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/annotations/Reference.java +++ b/nashorn/src/jdk/nashorn/internal/ir/annotations/Reference.java @@ -32,9 +32,7 @@ import java.lang.annotation.RetentionPolicy; * Reference node in AST, i.e. anything not a copy. Important for * AST traversal and cloning. Cloning currently as a rule uses * existingOrSame for references and otherwise existingOrCopy - *

    */ - @Retention(value=RetentionPolicy.RUNTIME) public @interface Reference { // EMPTY From d4d56555567d37bf8e97c6a80236962de54590f1 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 30 May 2014 14:32:01 +0100 Subject: [PATCH 182/185] 8044027: Remove unused XML Signature schema and dtd files from source Reviewed-by: mullan --- jdk/make/CopyIntoClasses.gmk | 1 - .../security/resource/schema/etsi.xsd | 347 ------------------ .../security/resource/schema/xenc-schema.rng | 219 ----------- .../security/resource/schema/xenc-schema.xsd | 146 -------- .../resource/schema/xmldsig-core-schema.dtd | 171 --------- .../resource/schema/xmldsig-core-schema.rng | 339 ----------------- .../resource/schema/xmldsig-core-schema.xsd | 318 ---------------- 7 files changed, 1541 deletions(-) delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng delete mode 100644 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd diff --git a/jdk/make/CopyIntoClasses.gmk b/jdk/make/CopyIntoClasses.gmk index b3a216fb90e..fdf2a173aca 100644 --- a/jdk/make/CopyIntoClasses.gmk +++ b/jdk/make/CopyIntoClasses.gmk @@ -30,7 +30,6 @@ COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \ # These directories should not be copied at all EXCLUDES += \ - com/sun/org/apache/xml/internal/security/resource/schema \ java/awt/doc-files \ java/lang/doc-files \ javax/swing/doc-files \ diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd deleted file mode 100644 index d69852ff842..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/etsi.xsd +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng deleted file mode 100644 index 895e033a626..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.rng +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd deleted file mode 100644 index 85af68b5518..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xenc-schema.xsd +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - ]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd deleted file mode 100644 index b2cc19f63a1..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.dtd +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng deleted file mode 100644 index 03330fb1fee..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.rng +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd deleted file mode 100644 index e8288a526c3..00000000000 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/schema/xmldsig-core-schema.xsd +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - ]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 68287b3fe87e37bb674ca3e5de8b8cdc29f32f07 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Fri, 30 May 2014 19:09:46 +0200 Subject: [PATCH 183/185] 8044418: Add com/sun/jdi/JdbReadTwiceTest.sh to ProblemList.txt Reviewed-by: alanb, allwin --- jdk/test/ProblemList.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt index dd045badca7..64c5ba9036a 100644 --- a/jdk/test/ProblemList.txt +++ b/jdk/test/ProblemList.txt @@ -261,6 +261,10 @@ com/sun/jdi/JdbMethodExitTest.sh generic-all # 8041934 com/sun/jdi/RepStep.java generic-all +# 8044419 +com/sun/jdi/JdbReadTwiceTest.sh generic-all + + ############################################################################ # jdk_util From 1b0c4c65947e32181655148c1dc5025771d9e387 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 19:41:14 +0200 Subject: [PATCH 184/185] Added tag jdk9-b14 for changeset 97932f6ad950 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 36ba8ab267f..e7144757c53 100644 --- a/.hgtags +++ b/.hgtags @@ -256,3 +256,4 @@ efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09 0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11 0d1f816217dce5e72187f167cc1816080cbeb453 jdk9-b12 1a30593dcb9802faec3b6edb24d86ca088594e4e jdk9-b13 +97932f6ad950ae5a73a9da5c96e6e58503ff646b jdk9-b14 From 91bdbac03aec14b30fcf2eb52a082db4477c71ef Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 19:42:33 +0200 Subject: [PATCH 185/185] Added tag jdk9-b15 for changeset 74eb0778e4f2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e7144757c53..f50083fb987 100644 --- a/.hgtags +++ b/.hgtags @@ -257,3 +257,4 @@ efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09 0d1f816217dce5e72187f167cc1816080cbeb453 jdk9-b12 1a30593dcb9802faec3b6edb24d86ca088594e4e jdk9-b13 97932f6ad950ae5a73a9da5c96e6e58503ff646b jdk9-b14 +74eb0778e4f2dbff6628e718378449fba27c4265 jdk9-b15