diff --git a/.hgtags b/.hgtags index c0ec7d20a99..1bd0c05f284 100644 --- a/.hgtags +++ b/.hgtags @@ -243,3 +243,4 @@ f5b521ade7a35cea18df78ee86322207729f5611 jdk8-b118 87b743b2263cc53955266411b7797b365a0fb050 jdk8-b119 a1ee9743f4ee165eae59389a020f2552f895dac8 jdk8-b120 13b877757b0b1c0d5813298df85364f41d7ba6fe jdk9-b00 +f130ca87de6637acae7d99fcd7a8573eea1cbaed jdk9-b01 diff --git a/.hgtags-top-repo b/.hgtags-top-repo index cc3e3f4e682..6a7cb46c540 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -243,3 +243,4 @@ a4afb0a8d55ef75aef5b0d77b434070468fb89f8 jdk8-b117 9e90215673be68a3e77a9e444e4232076373734d jdk8-b119 cd3825b2983045784d6fc6d1729c799b08215752 jdk8-b120 1e1f86d5d4e22c15a9bf9f1581acddb8c59abae2 jdk9-b00 +50669e45cec4491de0d921d3118a3fe2e767020a jdk9-b01 diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4 index 27652953114..a4805a92c03 100644 --- a/common/autoconf/boot-jdk.m4 +++ b/common/autoconf/boot-jdk.m4 @@ -324,8 +324,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], fi # When is adding -client something that speeds up the JVM? # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) - ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA]) - ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA]) ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA]) # Disable special log output when a debug build is used as Boot JDK... ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index cf6b1bf6e5e..43e26631193 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -3865,7 +3865,7 @@ fi #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1389186094 +DATE_WHEN_GENERATED=1389815815 ############################################################################### # @@ -11156,6 +11156,12 @@ fi as_fn_error $? "Update version must have a value" "$LINENO" 5 elif test "x$with_update_version" != x; then JDK_UPDATE_VERSION="$with_update_version" + # On macosx 10.7, it's not possible to set --with-update-version=0X due + # to a bug in expr (which reduces it to just X). To work around this, we + # always add a 0 to one digit update versions. + if test "${#JDK_UPDATE_VERSION}" = "1"; then + JDK_UPDATE_VERSION="0${JDK_UPDATE_VERSION}" + fi fi @@ -16068,36 +16074,6 @@ fi # When is adding -client something that speeds up the JVM? # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) - $ECHO "Check if jvm arg is ok: -XX:PermSize=32m" >&5 - $ECHO "Command: $JAVA -XX:PermSize=32m -version" >&5 - OUTPUT=`$JAVA -XX:PermSize=32m -version 2>&1` - FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn` - FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""` - if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then - boot_jdk_jvmargs="$boot_jdk_jvmargs -XX:PermSize=32m" - JVM_ARG_OK=true - else - $ECHO "Arg failed:" >&5 - $ECHO "$OUTPUT" >&5 - JVM_ARG_OK=false - fi - - - $ECHO "Check if jvm arg is ok: -XX:MaxPermSize=160m" >&5 - $ECHO "Command: $JAVA -XX:MaxPermSize=160m -version" >&5 - OUTPUT=`$JAVA -XX:MaxPermSize=160m -version 2>&1` - FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn` - FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""` - if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then - boot_jdk_jvmargs="$boot_jdk_jvmargs -XX:MaxPermSize=160m" - JVM_ARG_OK=true - else - $ECHO "Arg failed:" >&5 - $ECHO "$OUTPUT" >&5 - JVM_ARG_OK=false - fi - - $ECHO "Check if jvm arg is ok: -XX:ThreadStackSize=$STACK_SIZE" >&5 $ECHO "Command: $JAVA -XX:ThreadStackSize=$STACK_SIZE -version" >&5 OUTPUT=`$JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1` @@ -20011,9 +19987,9 @@ $as_echo "$PROPER_COMPILER_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, keeping CC" >&5 $as_echo "no, keeping CC" >&6; } - CC="$TEST_COMPILER" fi + COMPILER=$CC COMPILER_NAME=$COMPILER_NAME @@ -21590,9 +21566,9 @@ $as_echo "$PROPER_COMPILER_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, keeping CXX" >&5 $as_echo "no, keeping CXX" >&6; } - CXX="$TEST_COMPILER" fi + COMPILER=$CXX COMPILER_NAME=$COMPILER_NAME diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 index 4397fb81123..9db8c238030 100644 --- a/common/autoconf/jdk-options.m4 +++ b/common/autoconf/jdk-options.m4 @@ -105,7 +105,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS], fi # Replace the commas with AND for use in the build directory name. - ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'` + ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'` COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'` if test "x$COUNT_VARIANTS" != "x,1"; then BUILDING_MULTIPLE_JVM_VARIANTS=yes @@ -423,6 +423,12 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS], AC_MSG_ERROR([Update version must have a value]) elif test "x$with_update_version" != x; then JDK_UPDATE_VERSION="$with_update_version" + # On macosx 10.7, it's not possible to set --with-update-version=0X due + # to a bug in expr (which reduces it to just X). To work around this, we + # always add a 0 to one digit update versions. + if test "${#JDK_UPDATE_VERSION}" = "1"; then + JDK_UPDATE_VERSION="0${JDK_UPDATE_VERSION}" + fi fi AC_ARG_WITH(user-release-suffix, [AS_HELP_STRING([--with-user-release-suffix], diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4 index c8b66e89dd0..84793969b92 100644 --- a/common/autoconf/toolchain.m4 +++ b/common/autoconf/toolchain.m4 @@ -166,8 +166,8 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER], $1="$PROPER_COMPILER_$1" else AC_MSG_RESULT([no, keeping $1]) - $1="$TEST_COMPILER" fi + TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME]) ]) diff --git a/corba/.hgtags b/corba/.hgtags index b110af22954..914430fb54c 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -243,3 +243,4 @@ d6820a414f182a011a53a29a52370c696cd58dab jdk8-b118 379fc7609beb7a3d85ebc0cc21a8a51c60d3c7d3 jdk8-b119 53fd772d28c8a9f0f43adfc06f75f6b3cfa93cb5 jdk8-b120 a7d3638deb2f4e33217b1ecf889479e90f9e5b50 jdk9-b00 +79a8136b18c1c6848f500088f5a4b39f262f082d jdk9-b01 diff --git a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java index 1b03be02dd1..0f3428ac029 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java @@ -82,11 +82,18 @@ public class AnyImpl extends Any super((ORB)orb); } - public org.omg.CORBA.portable.InputStream create_input_stream() - { - return new AnyInputStream( - (com.sun.corba.se.impl.encoding.EncapsInputStream) - super.create_input_stream()); + public org.omg.CORBA.portable.InputStream create_input_stream() { + final org.omg.CORBA.portable.InputStream is = super + .create_input_stream(); + AnyInputStream aIS = AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public AnyInputStream run() { + return new AnyInputStream( + (com.sun.corba.se.impl.encoding.EncapsInputStream) is); + } + }); + return aIS; } } diff --git a/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java index da7e9165449..7853812f89d 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -36,11 +36,10 @@ import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; import com.sun.corba.se.spi.orb.ORB; - import com.sun.corba.se.spi.logging.CORBALogDomains; - import com.sun.corba.se.impl.logging.ORBUtilSystemException; +import sun.corba.EncapsInputStreamFactory; /** * Encapsulations are supposed to explicitly define their * code sets and GIOP version. The original resolution to issue 2784 @@ -148,7 +147,7 @@ public class EncapsInputStream extends CDRInputStream } public CDRInputStream dup() { - return new EncapsInputStream(this); + return EncapsInputStreamFactory.newEncapsInputStream(this); } protected CodeSetConversion.BTCConverter createCharBTCConverter() { diff --git a/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java index 5f1b0e8bde8..4f908dc8569 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -39,6 +39,8 @@ import com.sun.corba.se.impl.encoding.BufferManagerFactory; import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; import com.sun.corba.se.impl.orbutil.ORBConstants; +import sun.corba.EncapsInputStreamFactory; + /** * Encapsulations are supposed to explicitly define their * code sets and GIOP version. The original resolution to issue 2784 @@ -107,11 +109,11 @@ public class EncapsOutputStream extends CDROutputStream public org.omg.CORBA.portable.InputStream create_input_stream() { freeInternalCaches(); - return new EncapsInputStream(orb(), - getByteBuffer(), - getSize(), - isLittleEndian(), - getGIOPVersion()); + return EncapsInputStreamFactory.newEncapsInputStream(orb(), + getByteBuffer(), + getSize(), + isLittleEndian(), + getGIOPVersion()); } protected CodeSetConversion.CTBConverter createCharCTBConverter() { diff --git a/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java index 0bce54b930e..ae91457f161 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -64,6 +64,8 @@ import com.sun.corba.se.impl.encoding.CDRInputStream; import com.sun.corba.se.impl.encoding.CDROutputStream; import com.sun.corba.se.impl.encoding.MarshalInputStream; +import sun.corba.EncapsInputStreamFactory; + public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader { private Map typeMap = null; @@ -157,11 +159,13 @@ public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeRe // create an encapsulation using the marshal buffer if (is instanceof CDRInputStream) { - encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length, - ((CDRInputStream)is).isLittleEndian(), - ((CDRInputStream)is).getGIOPVersion()); + encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb, + encapBuffer, encapBuffer.length, + ((CDRInputStream) is).isLittleEndian(), + ((CDRInputStream) is).getGIOPVersion()); } else { - encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length); + encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb, + encapBuffer, encapBuffer.length); } encap.setEnclosingInputStream(is); encap.makeEncapsulation(); diff --git a/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java index 94f6466013a..93f7c97c50d 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java @@ -61,6 +61,8 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.nio.ByteBuffer; +import sun.corba.EncapsInputStreamFactory; + public final class TypeCodeOutputStream extends EncapsOutputStream { private OutputStream enclosure = null; @@ -77,9 +79,9 @@ public final class TypeCodeOutputStream extends EncapsOutputStream public org.omg.CORBA.portable.InputStream create_input_stream() { - //return new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian()); - TypeCodeInputStream tcis - = new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian(), getGIOPVersion()); + TypeCodeInputStream tcis = EncapsInputStreamFactory + .newTypeCodeInputStream((ORB) orb(), getByteBuffer(), + getIndex(), isLittleEndian(), getGIOPVersion()); //if (TypeCodeImpl.debug) { //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent"); //tcis.printBuffer(); diff --git a/corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java b/corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java index 6f469e2dc7d..235b8956de1 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java @@ -33,6 +33,8 @@ import org.omg.CORBA.LocalObject; import com.sun.corba.se.spi.ior.iiop.GIOPVersion; import com.sun.corba.se.spi.logging.CORBALogDomains; +import sun.corba.EncapsInputStreamFactory; + import com.sun.corba.se.impl.corba.AnyImpl; import com.sun.corba.se.impl.encoding.EncapsInputStream; import com.sun.corba.se.impl.encoding.EncapsOutputStream; @@ -193,8 +195,9 @@ public final class CDREncapsCodec // it is turned into a FormatMismatch exception. try { - EncapsInputStream cdrIn = new EncapsInputStream( orb, data, - data.length, giopVersion ); + EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data, + data.length, giopVersion ); + cdrIn.consumeEndian(); diff --git a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java index 88b2518c990..e14b25ebb1b 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java @@ -370,7 +370,7 @@ public class IIOPInputStream * @exception IOException Any of the usual Input/Output related exceptions. * @since JDK1.1 */ - public final Object readObjectDelegate() throws IOException + public final synchronized Object readObjectDelegate() throws IOException { try { @@ -389,7 +389,7 @@ public class IIOPInputStream } } - final Object simpleReadObject(Class clz, + final synchronized Object simpleReadObject(Class clz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, int offset) @@ -461,7 +461,7 @@ public class IIOPInputStream return obj; } - public final void simpleSkipObject(String repositoryID, + public final synchronized void simpleSkipObject(String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender) /* throws OptionalDataException, ClassNotFoundException, IOException */ { @@ -559,7 +559,7 @@ public class IIOPInputStream * objects. * @since JDK1.1 */ - public final void defaultReadObjectDelegate() + final synchronized void defaultReadObjectDelegate() /* throws IOException, ClassNotFoundException, NotActiveException */ { try { @@ -988,7 +988,7 @@ public class IIOPInputStream } } - private Object inputObject(Class clz, + private synchronized Object inputObject(Class clz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, int offset) @@ -1317,7 +1317,7 @@ public class IIOPInputStream * a form of custom marshaling. * */ - private Object inputObjectUsingFVD(Class clz, + private synchronized Object inputObjectUsingFVD(Class clz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, int offset) diff --git a/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java b/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java index 9ad13b37ab7..f4198e386de 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java @@ -201,7 +201,7 @@ public abstract class InputStreamHook extends ObjectInputStream readObjectState.endDefaultReadObject(this); } - public abstract void defaultReadObjectDelegate(); + abstract void defaultReadObjectDelegate(); abstract void readFields(java.util.Map fieldToValueMap) throws java.io.InvalidClassException, java.io.StreamCorruptedException, diff --git a/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java b/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java index 8f6f01b0da5..63cdcae2bee 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java @@ -47,6 +47,8 @@ import com.sun.corba.se.impl.encoding.CDROutputStream ; import com.sun.corba.se.impl.encoding.EncapsOutputStream ; import com.sun.corba.se.impl.encoding.EncapsInputStream ; +import sun.corba.EncapsInputStreamFactory; + /** * This static utility class contains various utility methods for reading and * writing CDR encapsulations. @@ -108,8 +110,8 @@ public class EncapsulationUtility static public InputStream getEncapsulationStream( InputStream is ) { byte[] data = readOctets( is ) ; - EncapsInputStream result = new EncapsInputStream( is.orb(), data, - data.length ) ; + EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data, + data.length ) ; result.consumeEndian() ; return result ; } diff --git a/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java index 00840373662..d774994b977 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -49,6 +49,8 @@ import com.sun.corba.se.impl.ior.ObjectKeyImpl ; import com.sun.corba.se.impl.logging.IORSystemException ; import com.sun.corba.se.impl.encoding.EncapsInputStream ; +import sun.corba.EncapsInputStreamFactory; + /** Based on the magic and scid, return the appropriate * ObjectKeyTemplate. Expects to be called with a valid @@ -217,7 +219,7 @@ public class ObjectKeyFactoryImpl implements ObjectKeyFactory public ObjectKey create( byte[] key ) { OctetSeqHolder osh = new OctetSeqHolder() ; - EncapsInputStream is = new EncapsInputStream( orb, key, key.length ) ; + EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length ); ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ; if (oktemp == null) diff --git a/corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java index 4a7b0b921de..060dd3f338e 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java @@ -70,6 +70,8 @@ import com.sun.corba.se.impl.ior.EncapsulationUtility ; import com.sun.corba.se.impl.encoding.EncapsInputStream ; import com.sun.corba.se.impl.encoding.EncapsOutputStream ; +import sun.corba.EncapsInputStreamFactory; + import com.sun.corba.se.impl.util.JDKBridge; import com.sun.corba.se.impl.logging.IORSystemException; @@ -170,8 +172,8 @@ public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile throw wrapper.invalidTaggedProfile() ; } - EncapsInputStream istr = new EncapsInputStream((ORB)orb, profile.profile_data, - profile.profile_data.length); + EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data, + profile.profile_data.length); istr.consumeEndian(); init( istr ) ; } diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java index f05d0ca0673..ae7c9f8d97d 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package com.sun.corba.se.impl.presentation.rmi ; +import java.io.SerializablePermission; import java.lang.reflect.InvocationHandler ; import java.lang.reflect.Proxy ; @@ -38,11 +39,18 @@ public abstract class StubFactoryDynamicBase extends StubFactoryBase { protected final ClassLoader loader ; - public StubFactoryDynamicBase( PresentationManager.ClassData classData, - ClassLoader loader ) - { - super( classData ) ; + private static Void checkPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new SerializablePermission( + "enableSubclassImplementation")); + } + return null; + } + private StubFactoryDynamicBase(Void unused, + PresentationManager.ClassData classData, ClassLoader loader) { + super(classData); // this.loader must not be null, or the newProxyInstance call // will fail. if (loader == null) { @@ -55,5 +63,11 @@ public abstract class StubFactoryDynamicBase extends StubFactoryBase } } + public StubFactoryDynamicBase( PresentationManager.ClassData classData, + ClassLoader loader ) + { + this (checkPermission(), classData, loader); + } + public abstract org.omg.CORBA.Object makeStub() ; } diff --git a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java index e3fe932f4e4..ae0587f76ad 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,14 +25,22 @@ package com.sun.corba.se.impl.presentation.rmi; +import java.security.AccessController; +import java.security.PrivilegedAction; import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; public class StubFactoryFactoryProxyImpl extends StubFactoryFactoryDynamicBase { public PresentationManager.StubFactory makeDynamicStubFactory( - PresentationManager pm, PresentationManager.ClassData classData, - ClassLoader classLoader ) + PresentationManager pm, final PresentationManager.ClassData classData, + final ClassLoader classLoader ) { - return new StubFactoryProxyImpl( classData, classLoader ) ; + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public StubFactoryProxyImpl run() { + return new StubFactoryProxyImpl(classData, classLoader); + } + }); } } diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java index 1878596aca3..5c669dda9f9 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -115,6 +115,7 @@ import com.sun.corba.se.impl.util.JDKBridge; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; +import sun.corba.EncapsInputStreamFactory; /** * ClientDelegate is the RMI client-side subcontract or representation @@ -847,8 +848,8 @@ public class CorbaClientRequestDispatcherImpl } byte[] data = ((UnknownServiceContext)sc).getData(); EncapsInputStream in = - new EncapsInputStream((ORB)messageMediator.getBroker(), - data, data.length); + EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(), + data, data.length); in.consumeEndian(); String msg = diff --git a/corba/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java index 27002a37d50..9f9a5f65e27 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -36,7 +36,8 @@ import java.io.IOException; import java.util.Iterator; import java.rmi.RemoteException; import java.nio.ByteBuffer; - +import java.security.AccessController; +import java.security.PrivilegedAction; import javax.rmi.CORBA.Util; import javax.rmi.CORBA.Tie; @@ -111,6 +112,7 @@ import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr; import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr; import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; +import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; import com.sun.corba.se.impl.util.JDKBridge; /** @@ -156,10 +158,17 @@ public class SharedCDRClientRequestDispatcherImpl ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo(); cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); - - CDRInputObject cdrInputObject = - new CDRInputObject(orb, null, bbwi.byteBuffer, - cdrOutputObject.getMessageHeader()); + final ORB inOrb = orb; + final ByteBuffer inBuffer = bbwi.byteBuffer; + final Message inMsg = cdrOutputObject.getMessageHeader(); + CDRInputObject cdrInputObject = AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public CDRInputObject run() { + return new CDRInputObject(inOrb, null, inBuffer, + inMsg); + } + }); messageMediator.setInputObject(cdrInputObject); cdrInputObject.setMessageMediator(messageMediator); @@ -192,9 +201,17 @@ public class SharedCDRClientRequestDispatcherImpl cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject(); bbwi = cdrOutputObject.getByteBufferWithInfo(); cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); - cdrInputObject = - new CDRInputObject(orb, null, bbwi.byteBuffer, - cdrOutputObject.getMessageHeader()); + final ORB inOrb2 = orb; + final ByteBuffer inBuffer2 = bbwi.byteBuffer; + final Message inMsg2 = cdrOutputObject.getMessageHeader(); + cdrInputObject = AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public CDRInputObject run() { + return new CDRInputObject(inOrb2, null, inBuffer2, + inMsg2); + } + }); messageMediator.setInputObject(cdrInputObject); cdrInputObject.setMessageMediator(messageMediator); diff --git a/corba/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java b/corba/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java index fb56e001f54..91976a2b5a2 100644 --- a/corba/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java +++ b/corba/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -36,6 +36,8 @@ import java.util.Collections ; import org.omg.CosNaming.NamingContextExt ; import org.omg.CosNaming.NamingContextExtHelper ; +import sun.corba.EncapsInputStreamFactory; + import com.sun.corba.se.spi.ior.IOR; import com.sun.corba.se.spi.ior.IORTemplate; import com.sun.corba.se.spi.ior.ObjectKey; @@ -114,8 +116,8 @@ public class INSURLOperationImpl implements Operation buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0); buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F); } - EncapsInputStream s = new EncapsInputStream(orb, buf, buf.length, - orb.getORBData().getGIOPVersion()); + EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length, + orb.getORBData().getGIOPVersion()); s.consumeEndian(); return s.read_Object() ; } diff --git a/corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java b/corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java index 13ff23435da..ea4569b1a14 100644 --- a/corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java +++ b/corba/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -58,6 +58,9 @@ import com.sun.corba.se.impl.orbutil.ORBUtility ; import com.sun.corba.se.impl.util.Utility ; import com.sun.corba.se.impl.logging.ORBUtilSystemException ; +import sun.corba.EncapsInputStreamFactory; + + public class ServiceContexts { private static boolean isDebugging( OutputStream os ) { @@ -198,11 +201,11 @@ public class ServiceContexts { // Note: As of Jan 2001, no standard OMG or Sun service contexts // ship wchar data or are defined as using anything but GIOP 1.0 CDR. EncapsInputStream eis - = new EncapsInputStream(orb, - data, - data.length, - giopVersion, - codeBase); + = EncapsInputStreamFactory.newEncapsInputStream(orb, + data, + data.length, + giopVersion, + codeBase); eis.consumeEndian(); // Now the input stream passed to a ServiceContext diff --git a/corba/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java b/corba/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java index 2d5e788a88b..90d9ea65286 100644 --- a/corba/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java +++ b/corba/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -31,6 +31,10 @@ package org.omg.CORBA_2_3.portable; +import java.io.SerializablePermission; +import java.security.AccessController; +import java.security.PrivilegedAction; + /** * InputStream provides for the reading of all of the mapped IDL types * from the stream. It extends org.omg.CORBA.portable.InputStream. This @@ -43,6 +47,43 @@ package org.omg.CORBA_2_3.portable; public abstract class InputStream extends org.omg.CORBA.portable.InputStream { + + private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass"; + + private static final boolean allowSubclass = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Boolean run() { + String prop = System.getProperty(ALLOW_SUBCLASS_PROP); + return prop == null ? false : + (prop.equalsIgnoreCase("false") ? false : true); + } + }); + + private static Void checkPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + if (!allowSubclass) + sm.checkPermission(new + SerializablePermission("enableSubclassImplementation")); + } + return null; + } + + private InputStream(Void ignore) { } + + /** + * Create a new instance of this class. + * + * throw SecurityException if SecurityManager is installed and + * enableSubclassImplementation SerializablePermission + * is not granted or jdk.corba.allowOutputStreamSubclass system + * property is either not set or is set to 'false' + */ + public InputStream() { + this(checkPermission()); + } + /** * Unmarshalls a value type from the input stream. * @return the value type unmarshalled from the input stream diff --git a/corba/src/share/classes/sun/corba/EncapsInputStreamFactory.java b/corba/src/share/classes/sun/corba/EncapsInputStreamFactory.java new file mode 100644 index 00000000000..236a680cada --- /dev/null +++ b/corba/src/share/classes/sun/corba/EncapsInputStreamFactory.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 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. 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.corba; + +import java.nio.ByteBuffer; +import java.security.AccessController; +import java.security.PrivilegedAction; + + +import com.sun.corba.se.impl.encoding.EncapsInputStream; +import com.sun.corba.se.impl.encoding.TypeCodeInputStream; +import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; +import com.sun.corba.se.pept.protocol.MessageMediator; +import com.sun.corba.se.spi.ior.iiop.GIOPVersion; +import com.sun.corba.se.spi.orb.ORB; +import com.sun.org.omg.SendingContext.CodeBase; + +public class EncapsInputStreamFactory { + + public static EncapsInputStream newEncapsInputStream( + final org.omg.CORBA.ORB orb, final byte[] buf, final int size, + final boolean littleEndian, final GIOPVersion version) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, buf, size, + littleEndian, version); + } + }); + } + + public static EncapsInputStream newEncapsInputStream( + final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, + final int size, final boolean littleEndian, + final GIOPVersion version) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, byteBuffer, size, + littleEndian, version); + } + }); + } + + public static EncapsInputStream newEncapsInputStream( + final org.omg.CORBA.ORB orb, final byte[] data, final int size) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size); + } + }); + } + + public static EncapsInputStream newEncapsInputStream( + final EncapsInputStream eis) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(eis); + } + }); + } + + public static EncapsInputStream newEncapsInputStream( + final org.omg.CORBA.ORB orb, final byte[] data, final int size, + final GIOPVersion version) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size, version); + } + }); + } + + public static EncapsInputStream newEncapsInputStream( + final org.omg.CORBA.ORB orb, final byte[] data, final int size, + final GIOPVersion version, final CodeBase codeBase) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public EncapsInputStream run() { + return new EncapsInputStream(orb, data, size, version, + codeBase); + } + }); + } + + public static TypeCodeInputStream newTypeCodeInputStream( + final org.omg.CORBA.ORB orb, final byte[] buf, final int size, + final boolean littleEndian, final GIOPVersion version) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, buf, size, + littleEndian, version); + } + }); + } + + public static TypeCodeInputStream newTypeCodeInputStream( + final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, + final int size, final boolean littleEndian, + final GIOPVersion version) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, byteBuffer, size, + littleEndian, version); + } + }); + } + + public static TypeCodeInputStream newTypeCodeInputStream( + final org.omg.CORBA.ORB orb, final byte[] data, final int size) { + return AccessController + .doPrivileged(new PrivilegedAction() { + @Override + public TypeCodeInputStream run() { + return new TypeCodeInputStream(orb, data, size); + } + }); + } +} diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 7bab298f14e..7b9d7597d6e 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -403,3 +403,4 @@ ce42d815dd2130250acf6132b51b624001638f0d jdk8-b119 05fedd51e40da22c9460bf17c7185889e435db3d hs25-b62 fca262db9c4309f99d2f5542ab0780e45c2f1578 jdk8-b120 ce2d7e46f3c7e41241f3b407705a4071323a11ab jdk9-b00 +050a626a88951140df874f7b163e304d07b6c296 jdk9-b01 diff --git a/hotspot/agent/make/Makefile b/hotspot/agent/make/Makefile index e00bbf2b36f..5efd67e649c 100644 --- a/hotspot/agent/make/Makefile +++ b/hotspot/agent/make/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/os/linux/libproc.h b/hotspot/agent/src/os/linux/libproc.h index 4cde0c19d76..30bacaf07b9 100644 --- a/hotspot/agent/src/os/linux/libproc.h +++ b/hotspot/agent/src/os/linux/libproc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/os/linux/salibelf.c b/hotspot/agent/src/os/linux/salibelf.c index 4c860a0fe08..1466119c0f9 100644 --- a/hotspot/agent/src/os/linux/salibelf.c +++ b/hotspot/agent/src/os/linux/salibelf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/os/linux/symtab.c b/hotspot/agent/src/os/linux/symtab.c index f9fc33f14ec..7aae801ce20 100644 --- a/hotspot/agent/src/os/linux/symtab.c +++ b/hotspot/agent/src/os/linux/symtab.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -214,8 +214,10 @@ static int open_file_from_debug_link(const char *name, + 2); strcpy(debug_pathname, name); char *last_slash = strrchr(debug_pathname, '/'); - if (last_slash == NULL) + if (last_slash == NULL) { + free(debug_pathname); return -1; + } /* Look in the same directory as the object. */ strcpy(last_slash+1, debug_filename); diff --git a/hotspot/agent/src/os/solaris/proc/saproc.cpp b/hotspot/agent/src/os/solaris/proc/saproc.cpp index f2d148e7ec4..5a910d3a357 100644 --- a/hotspot/agent/src/os/solaris/proc/saproc.cpp +++ b/hotspot/agent/src/os/solaris/proc/saproc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/os/win32/windbg/sawindbg.cpp b/hotspot/agent/src/os/win32/windbg/sawindbg.cpp index 5dd64f9e5ae..a6a8b7af2e7 100644 --- a/hotspot/agent/src/os/win32/windbg/sawindbg.cpp +++ b/hotspot/agent/src/os/win32/windbg/sawindbg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java index 9e8d016dcc2..a5393107aa5 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java index 354f0b906b3..e200826e467 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java index d50cbaa5140..9ae362baa48 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java index ae28eb3b283..d1badc37096 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java index 9d351cb0917..993bf7bb477 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 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 c1e6d503196..c0db13d1365 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -95,9 +95,15 @@ public class ciEnv extends VMObject { int entryBci = task.osrBci(); int compLevel = task.compLevel(); Klass holder = method.getMethodHolder(); - out.println("compile " + holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + - entryBci + " " + compLevel); + out.print("compile " + holder.getName().asString() + " " + + OopUtilities.escapeString(method.getName().asString()) + " " + + method.getSignature().asString() + " " + + entryBci + " " + compLevel); + Compile compiler = compilerData(); + if (compiler != null) { + // Dump inlining data. + compiler.dumpInlineData(out); + } + out.println(); } } 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 d50e36c2a74..cdf21c946ac 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java index 243a5397a0d..7c8d43a287a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java index 0a4273f3ef8..8a01fbbc35f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java index f25d50ff23c..bab70f28026 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java index 34e848b4295..d7576d8ba07 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java index cff29ce8edc..d350f09b4db 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java index 5fffbd32377..f282a228df6 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java index 99291aada29..4fd5bc1c7f2 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java index cf8e073208b..dea4e09e56d 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java index d2370c96319..53a2e26a84b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java index 04c4abbe0a9..ce219b986af 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java index 22957a27deb..afe11938c42 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java index fe4052f3512..69ad04da51b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java index 5c5f1f161e7..dbc8b71f35c 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java index 245dbf82323..102cc79c2c4 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java @@ -24,19 +24,29 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.oops.ArrayKlass; -import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ObjArrayKlass; -import sun.jvm.hotspot.oops.TypeArrayKlass; -import sun.jvm.hotspot.oops.Klass; import sun.jvm.hotspot.oops.Instance; +import sun.jvm.hotspot.oops.InstanceKlass; +import sun.jvm.hotspot.oops.Klass; +import sun.jvm.hotspot.oops.ObjArrayKlass; import sun.jvm.hotspot.oops.Symbol; -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; +import sun.jvm.hotspot.oops.TypeArrayKlass; + +import com.sun.jdi.ArrayReference; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.VirtualMachine; public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType { protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) { @@ -75,7 +85,8 @@ public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType { } } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set handledInterfaces) { // arrays don't have methods } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java index 755889d7c68..50a710e9122 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java @@ -24,12 +24,30 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Klass; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.Field; +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.InvalidTypeException; +import com.sun.jdi.InvocationException; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public class ClassTypeImpl extends ReferenceTypeImpl implements ClassType @@ -195,22 +213,26 @@ public class ClassTypeImpl extends ReferenceTypeImpl return null; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = interfaces().iterator(); + Iterator iter = interfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } ClassTypeImpl clazz = (ClassTypeImpl)superclass(); if (clazz != null) { - clazz.addVisibleMethods(methodMap); + clazz.addVisibleMethods(methodMap, seenInterfaces); } addToMethodMap(methodMap, methods()); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java index 5c4f2abcafb..4bc4201ef8a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java @@ -24,15 +24,22 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.Iterator; -import java.util.Collections; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { @@ -96,16 +103,20 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl return implementors; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = superinterfaces().iterator(); + Iterator iter = superinterfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } addToMethodMap(methodMap, methods()); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java index dbf09b29119..0dcb772f913 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java index d3a2ea9d291..dd235f9ffef 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java @@ -24,24 +24,45 @@ package sun.jvm.hotspot.jdi; -import java.io.*; - -import com.sun.jdi.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.memory.SystemDictionary; +import sun.jvm.hotspot.oops.ArrayKlass; +import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ArrayKlass; import sun.jvm.hotspot.oops.JVMDIClassStatus; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.ObjArray; import sun.jvm.hotspot.oops.Oop; import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.utilities.Assert; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassObjectReference; +import com.sun.jdi.Field; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public abstract class ReferenceTypeImpl extends TypeImpl implements ReferenceType { @@ -421,7 +442,8 @@ implements ReferenceType { } } - abstract void addVisibleMethods(Map methodMap); + abstract void addVisibleMethods(Map methodMap, Set seenInterfaces); + public final List visibleMethods() throws ClassNotPreparedException { checkPrepared(); /* @@ -430,8 +452,8 @@ implements ReferenceType { * concatenation of name and signature. */ //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this); - Map map = new HashMap(); - addVisibleMethods(map); + Map map = new HashMap(); + addVisibleMethods(map, new HashSet()); /* * ... but the hash map destroys order. Methods should be @@ -441,7 +463,7 @@ implements ReferenceType { */ //System.out.println("jj: RTI: Calling allMethods for:" + this); - List list = new ArrayList(allMethods()); + List list = new ArrayList(allMethods()); //System.out.println("jj: allMethods = " + jjstr(list)); //System.out.println("jj: map = " + map.toString()); //System.out.println("jj: map = " + jjstr(map.values())); diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java index f28caad66e7..28205ae0b03 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java index 301410408d2..3d4a9f6392e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java index 3069cf6b377..7510d08bfd0 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java index 9530cdd977a..ba9422ca8ee 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index 01104f59515..75aa05c3954 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java index 19a3668c7f3..9e1561bd390 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java index 854aa818c89..ec2cbbe9f4b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 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 eb643483fe5..41c121468ea 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java index e663ee8e18f..d550a935fa3 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -364,7 +364,7 @@ public class ObjectHeap { } catch (AddressException e) { // This is okay at the top of these regions - } + } catch (UnknownOopException e) { // This is okay at the top of these regions } @@ -373,7 +373,7 @@ public class ObjectHeap { visitor.epilogue(); } - private void addLiveRegions(List input, List output) { + private void addLiveRegions(String name, List input, List output) { for (Iterator itr = input.iterator(); itr.hasNext();) { MemRegion reg = (MemRegion) itr.next(); Address top = reg.end(); @@ -386,6 +386,9 @@ public class ObjectHeap { } output.add(top); output.add(bottom); + if (DEBUG) { + System.err.println("Live region: " + name + ": " + bottom + ", " + top); + } } } @@ -395,7 +398,7 @@ public class ObjectHeap { } public void doSpace(Space s) { - addLiveRegions(s.getLiveRegions(), liveRegions); + addLiveRegions(s.toString(), s.getLiveRegions(), liveRegions); } private List liveRegions; } @@ -426,11 +429,11 @@ public class ObjectHeap { ParallelScavengeHeap psh = (ParallelScavengeHeap) heap; PSYoungGen youngGen = psh.youngGen(); // Add eden space - addLiveRegions(youngGen.edenSpace().getLiveRegions(), liveRegions); + addLiveRegions("eden", youngGen.edenSpace().getLiveRegions(), liveRegions); // Add from-space but not to-space - addLiveRegions(youngGen.fromSpace().getLiveRegions(), liveRegions); + addLiveRegions("from", youngGen.fromSpace().getLiveRegions(), liveRegions); PSOldGen oldGen = psh.oldGen(); - addLiveRegions(oldGen.objectSpace().getLiveRegions(), liveRegions); + addLiveRegions("old ", oldGen.objectSpace().getLiveRegions(), liveRegions); } else if (heap instanceof G1CollectedHeap) { G1CollectedHeap g1h = (G1CollectedHeap) heap; g1h.heapRegionIterate(lrc); @@ -451,23 +454,27 @@ public class ObjectHeap { if (VM.getVM().getUseTLAB()) { for (JavaThread thread = VM.getVM().getThreads().first(); thread != null; thread = thread.next()) { - if (thread.isJavaThread()) { - ThreadLocalAllocBuffer tlab = thread.tlab(); - if (tlab.start() != null) { - if ((tlab.top() == null) || (tlab.end() == null)) { - System.err.print("Warning: skipping invalid TLAB for thread "); + ThreadLocalAllocBuffer tlab = thread.tlab(); + if (tlab.start() != null) { + if ((tlab.top() == null) || (tlab.end() == null)) { + System.err.print("Warning: skipping invalid TLAB for thread "); + thread.printThreadIDOn(System.err); + System.err.println(); + } else { + if (DEBUG) { + System.err.print("TLAB for " + thread.getThreadName() + ", #"); thread.printThreadIDOn(System.err); - System.err.println(); - } else { - // Go from: - // - below start() to start() - // - start() to top() - // - end() and above - liveRegions.add(tlab.start()); - liveRegions.add(tlab.start()); - liveRegions.add(tlab.top()); - liveRegions.add(tlab.hardEnd()); + System.err.print(": "); + tlab.printOn(System.err); } + // Go from: + // - below start() to start() + // - start() to top() + // - end() and above + liveRegions.add(tlab.start()); + liveRegions.add(tlab.start()); + liveRegions.add(tlab.top()); + liveRegions.add(tlab.hardEnd()); } } } @@ -480,6 +487,15 @@ public class ObjectHeap { Assert.that(liveRegions.size() % 2 == 0, "Must have even number of region boundaries"); } + if (DEBUG) { + System.err.println("liveRegions:"); + for (int i = 0; i < liveRegions.size(); i += 2) { + Address bottom = (Address) liveRegions.get(i); + Address top = (Address) liveRegions.get(i+1); + System.err.println(" " + bottom + " - " + top); + } + } + return liveRegions; } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java index 9e4cfa73b09..6e06fb5ef18 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java @@ -25,6 +25,7 @@ package sun.jvm.hotspot.opto; import java.util.*; +import java.io.PrintStream; import sun.jvm.hotspot.ci.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; @@ -92,4 +93,13 @@ public class Compile extends VMObject { } return null; } + + public void dumpInlineData(PrintStream out) { + InlineTree inlTree = ilt(); + if (inlTree != null) { + out.print(" inline " + inlTree.count()); + inlTree.dumpReplayData(out); + } + } + } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java index 4021e706e88..53f024183a8 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java @@ -87,6 +87,11 @@ public class InlineTree extends VMObject { return GrowableArray.create(addr, inlineTreeConstructor); } + public int inlineLevel() { + JVMState jvms = callerJvms(); + return (jvms != null) ? jvms.depth() : 0; + } + public void printImpl(PrintStream st, int indent) { for (int i = 0; i < indent; i++) st.print(" "); st.printf(" @ %d ", callerBci()); @@ -101,4 +106,28 @@ public class InlineTree extends VMObject { public void print(PrintStream st) { printImpl(st, 2); } + + // Count number of nodes in this subtree + public int count() { + int result = 1; + GrowableArray subt = subtrees(); + for (int i = 0 ; i < subt.length(); i++) { + result += subt.at(i).count(); + } + return result; + } + + public void dumpReplayData(PrintStream out) { + out.printf(" %d %d ", inlineLevel(), callerBci()); + Method method = (Method)method().getMetadata(); + Klass holder = method.getMethodHolder(); + out.print(holder.getName().asString() + " " + + OopUtilities.escapeString(method.getName().asString()) + " " + + method.getSignature().asString()); + + GrowableArray subt = subtrees(); + for (int i = 0 ; i < subt.length(); i++) { + subt.at(i).dumpReplayData(out); + } + } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java index 52996ee763e..65e0d7a98f8 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java @@ -88,6 +88,10 @@ public class JVMState extends VMObject { return (int)bciField.getValue(getAddress()); } + public int depth() { + return (int)depthField.getValue(getAddress()); + } + public JVMState caller() { return create(callerField.getValue(getAddress())); } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java index 66344b553f6..4429754a5fe 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java index 738dc94fa91..74530b8f101 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -109,6 +109,6 @@ public class ThreadLocalAllocBuffer extends VMObject { public void printOn(PrintStream tty) { tty.println(" [" + start() + "," + - top() + "," + end() + ")"); + top() + "," + end() + ",{" + hardEnd() + "})"); } } diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java index 8088a49993c..29bf9efea7d 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java index 03e35de5695..47571dfdf7d 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java index 2a8ca2cfb7a..58819a0a7dd 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java index 37fa4c83c26..38244c3b84f 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java index e2da202acb9..1b93504313a 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java index f87457c3c3e..32c1358cbe2 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java index bec93e65d9d..7469de28f40 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java index c2e5ed52f84..fc281406d86 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java index 52fb6654e70..b8609bcdbeb 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java index 6c6c555badf..ddedcae5394 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java index e18aa76cfa6..43bcd593f30 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java index bbb0b081b2d..6f519a74b14 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java index 01465574006..ada81adf58e 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java index 9fd86ccb347..d1da9cfbaaf 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java index db6dc339394..bd7e4c4ce45 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java index 67f5ed1e920..eceabd39a98 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java index 12325863163..910e15e0f37 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java index e1829a332da..9bc7e4b4e48 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java index 382d2477b52..5dbf8984158 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java index 47494e826b3..dbb95d392b4 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index 6f66723db99..60df0ffe92b 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java index a76e5ddbf31..069a40326a2 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js index 4253740369b..a700f1bc6bd 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/make/bsd/makefiles/adlc.make b/hotspot/make/bsd/makefiles/adlc.make index cf5c05e2ac7..e37e60ca97b 100644 --- a/hotspot/make/bsd/makefiles/adlc.make +++ b/hotspot/make/bsd/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make index 840148e6321..8f708eab3df 100644 --- a/hotspot/make/bsd/makefiles/gcc.make +++ b/hotspot/make/bsd/makefiles/gcc.make @@ -260,14 +260,13 @@ ifeq ($(USE_CLANG), true) WARNINGS_ARE_ERRORS += -Wno-empty-body endif -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" +ifeq ($(USE_CLANG),) # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit # conversions which might affect the values. Only enable it in earlier versions. - WARNING_FLAGS = -Wunused-function - ifeq ($(USE_CLANG),) - WARNING_FLAGS += -Wconversion + ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" + WARNINGS_FLAGS += -Wconversion endif endif diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-debug b/hotspot/make/bsd/makefiles/mapfile-vers-debug index 9a8fc822bc4..d446cc81d84 100644 --- a/hotspot/make/bsd/makefiles/mapfile-vers-debug +++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug @@ -242,11 +242,6 @@ _JVM_Yield _JVM_handle_bsd_signal - # debug _JVM - _JVM_AccessVMBooleanFlag - _JVM_AccessVMIntFlag - _JVM_VMBreakPoint - # miscellaneous functions _jio_fprintf _jio_printf diff --git a/hotspot/make/bsd/makefiles/minimal1.make b/hotspot/make/bsd/makefiles/minimal1.make index d045db79099..03845fd12b7 100644 --- a/hotspot/make/bsd/makefiles/minimal1.make +++ b/hotspot/make/bsd/makefiles/minimal1.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 diff --git a/hotspot/make/hotspot.script b/hotspot/make/hotspot.script index c6259ba2eee..9177f6efef8 100644 --- a/hotspot/make/hotspot.script +++ b/hotspot/make/hotspot.script @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. +# 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 diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 7b808d9b2ae..8a866917b80 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 diff --git a/hotspot/make/linux/makefiles/jsig.make b/hotspot/make/linux/makefiles/jsig.make index 1064a965249..6e13959482a 100644 --- a/hotspot/make/linux/makefiles/jsig.make +++ b/hotspot/make/linux/makefiles/jsig.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug index 68be2ffefb3..4936ba711f9 100644 --- a/hotspot/make/linux/makefiles/mapfile-vers-debug +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug @@ -244,11 +244,6 @@ SUNWprivate_1.1 { JVM_Yield; JVM_handle_linux_signal; - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; - # miscellaneous functions jio_fprintf; jio_printf; diff --git a/hotspot/make/linux/makefiles/minimal1.make b/hotspot/make/linux/makefiles/minimal1.make index d045db79099..03845fd12b7 100644 --- a/hotspot/make/linux/makefiles/minimal1.make +++ b/hotspot/make/linux/makefiles/minimal1.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 diff --git a/hotspot/make/linux/makefiles/saproc.make b/hotspot/make/linux/makefiles/saproc.make index 90c91136185..7e8f7c430f9 100644 --- a/hotspot/make/linux/makefiles/saproc.make +++ b/hotspot/make/linux/makefiles/saproc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 diff --git a/hotspot/make/sa.files b/hotspot/make/sa.files index 44308c2a217..faad4dd109f 100644 --- a/hotspot/make/sa.files +++ b/hotspot/make/sa.files @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make index 642a7ca6136..88d9d2bc476 100644 --- a/hotspot/make/solaris/makefiles/adlc.make +++ b/hotspot/make/solaris/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +# 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 diff --git a/hotspot/make/solaris/makefiles/gcc.make b/hotspot/make/solaris/makefiles/gcc.make index e946d65d256..fe65ad4f5bf 100644 --- a/hotspot/make/solaris/makefiles/gcc.make +++ b/hotspot/make/solaris/makefiles/gcc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1998, 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 diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-debug b/hotspot/make/solaris/makefiles/mapfile-vers-debug index 234d391b604..f6b63d5a4bf 100644 --- a/hotspot/make/solaris/makefiles/mapfile-vers-debug +++ b/hotspot/make/solaris/makefiles/mapfile-vers-debug @@ -28,10 +28,6 @@ SUNWprivate_1.1 { global: - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; # miscellaneous }; diff --git a/hotspot/make/windows/build_vm_def.sh b/hotspot/make/windows/build_vm_def.sh index fa82d26a81a..3d905198cb6 100644 --- a/hotspot/make/windows/build_vm_def.sh +++ b/hotspot/make/windows/build_vm_def.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 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 diff --git a/hotspot/make/windows/makefiles/adlc.make b/hotspot/make/windows/makefiles/adlc.make index 7bcaef718fd..781e3ac4048 100644 --- a/hotspot/make/windows/makefiles/adlc.make +++ b/hotspot/make/windows/makefiles/adlc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 diff --git a/hotspot/make/windows/makefiles/debug.make b/hotspot/make/windows/makefiles/debug.make index 14a07083434..f4e54fc52fb 100644 --- a/hotspot/make/windows/makefiles/debug.make +++ b/hotspot/make/windows/makefiles/debug.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +# 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 diff --git a/hotspot/make/windows/makefiles/product.make b/hotspot/make/windows/makefiles/product.make index 713ec0e54ca..c1ce35a163c 100644 --- a/hotspot/make/windows/makefiles/product.make +++ b/hotspot/make/windows/makefiles/product.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 diff --git a/hotspot/make/windows/makefiles/rules.make b/hotspot/make/windows/makefiles/rules.make index d728263171b..c5d565a2880 100644 --- a/hotspot/make/windows/makefiles/rules.make +++ b/hotspot/make/windows/makefiles/rules.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make index 5b5cc2d723c..2208da9e3d8 100644 --- a/hotspot/make/windows/makefiles/sa.make +++ b/hotspot/make/windows/makefiles/sa.make @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 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 @@ -94,7 +94,7 @@ SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "WIN SA_LD_FLAGS = bufferoverflowU.lib !endif !else -SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 -Gm $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -YX -FD -GZ -c +SA_CFLAGS = -nologo $(MS_RUNTIME_OPTION) -W3 $(GX_OPTION) -Od -D "WIN32" -D "_WINDOWS" -D "_DEBUG" -D "_CONSOLE" -D "_MBCS" -FD -RTC1 -c !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" SA_CFLAGS = $(SA_CFLAGS) -ZI !endif diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp index 3192a855569..ccbc43e5a92 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp index ade531a3f82..2e5ba210199 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp index c6039055300..8584037f1ca 100644 --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp index e6e7212ed4a..87a95e5ec8c 100644 --- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp index 6d10ab81aaf..3da6cd8cf21 100644 --- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp index 742cacc226b..0b065201261 100644 --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp index c6cf521272d..57f871247b0 100644 --- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp index e4fe6bb00a4..fba1d414c36 100644 --- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/sparc/vm/c2_init_sparc.cpp b/hotspot/src/cpu/sparc/vm/c2_init_sparc.cpp index 6ad04df863d..b4b3bbd45b9 100644 --- a/hotspot/src/cpu/sparc/vm/c2_init_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c2_init_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/sparc/vm/disassembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/disassembler_sparc.hpp index a1f576b26a7..069840975d2 100644 --- a/hotspot/src/cpu/sparc/vm/disassembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/disassembler_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp index 774e8f3f0f5..61ef794abd0 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp index cadaffe73c7..dd0319f0374 100644 --- a/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/globalDefinitions_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp index ecc6eb61524..63ab5efa808 100644 --- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/sparc/vm/jni_sparc.h b/hotspot/src/cpu/sparc/vm/jni_sparc.h index 2b0ce0081c5..a7540600488 100644 --- a/hotspot/src/cpu/sparc/vm/jni_sparc.h +++ b/hotspot/src/cpu/sparc/vm/jni_sparc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp index aa362012dcf..29273e7fe61 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/register_sparc.hpp b/hotspot/src/cpu/sparc/vm/register_sparc.hpp index 423a424c936..7d0096ccf59 100644 --- a/hotspot/src/cpu/sparc/vm/register_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/register_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp index 4b6b1c7c00d..e35133122ab 100644 --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 9d3856245f2..19283874280 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -757,7 +757,7 @@ void verify_oops_warning(const MachNode *n, int ideal_op, int mem_op) { #endif -void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int tertiary, +void emit_form3_mem_reg(CodeBuffer &cbuf, PhaseRegAlloc* ra, const MachNode* n, int primary, int tertiary, int src1_enc, int disp32, int src2_enc, int dst_enc) { #ifdef ASSERT @@ -912,8 +912,14 @@ void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int te uint index = src2_enc; int disp = disp32; - if (src1_enc == R_SP_enc || src1_enc == R_FP_enc) + if (src1_enc == R_SP_enc || src1_enc == R_FP_enc) { disp += STACK_BIAS; + // Quick fix for JDK-8029668: check that stack offset fits, bailout if not + if (!Assembler::is_simm13(disp)) { + ra->C->record_method_not_compilable("unable to handle large constant offsets"); + return; + } + } // We should have a compiler bailout here rather than a guarantee. // Better yet would be some mechanism to handle variable-size matches correctly. @@ -1279,20 +1285,15 @@ static enum RC rc_class( OptoReg::Name reg ) { return rc_float; } -static int impl_helper( const MachNode *mach, CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, bool is_load, int offset, int reg, int opcode, const char *op_str, int size, outputStream* st ) { - if( cbuf ) { - // Better yet would be some mechanism to handle variable-size matches correctly - if (!Assembler::is_simm13(offset + STACK_BIAS)) { - ra_->C->record_method_not_compilable("unable to handle large constant offsets"); - } else { - emit_form3_mem_reg(*cbuf, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]); - } +static int impl_helper(const MachNode* mach, CodeBuffer* cbuf, PhaseRegAlloc* ra, bool do_size, bool is_load, int offset, int reg, int opcode, const char *op_str, int size, outputStream* st ) { + if (cbuf) { + emit_form3_mem_reg(*cbuf, ra, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]); } #ifndef PRODUCT - else if( !do_size ) { - if( size != 0 ) st->print("\n\t"); - if( is_load ) st->print("%s [R_SP + #%d],R_%s\t! spill",op_str,offset,OptoReg::regname(reg)); - else st->print("%s R_%s,[R_SP + #%d]\t! spill",op_str,OptoReg::regname(reg),offset); + else if (!do_size) { + if (size != 0) st->print("\n\t"); + if (is_load) st->print("%s [R_SP + #%d],R_%s\t! spill",op_str,offset,OptoReg::regname(reg)); + else st->print("%s R_%s,[R_SP + #%d]\t! spill",op_str,OptoReg::regname(reg),offset); } #endif return size+4; @@ -2087,22 +2088,22 @@ encode %{ %} enc_class form3_mem_reg( memory mem, iRegI dst ) %{ - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, + emit_form3_mem_reg(cbuf, ra_, this, $primary, $tertiary, $mem$$base, $mem$$disp, $mem$$index, $dst$$reg); %} enc_class simple_form3_mem_reg( memory mem, iRegI dst ) %{ - emit_form3_mem_reg(cbuf, this, $primary, -1, + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, $dst$$reg); %} enc_class form3_mem_prefetch_read( memory mem ) %{ - emit_form3_mem_reg(cbuf, this, $primary, -1, + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, 0/*prefetch function many-reads*/); %} enc_class form3_mem_prefetch_write( memory mem ) %{ - emit_form3_mem_reg(cbuf, this, $primary, -1, + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, 2/*prefetch function many-writes*/); %} @@ -2110,8 +2111,8 @@ encode %{ assert(Assembler::is_simm13($mem$$disp ), "need disp and disp+4"); assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4"); guarantee($mem$$index == R_G0_enc, "double index?"); - emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc ); - emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg ); + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc ); + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg ); emit3_simm13( cbuf, Assembler::arith_op, $reg$$reg, Assembler::sllx_op3, $reg$$reg, 0x1020 ); emit3( cbuf, Assembler::arith_op, $reg$$reg, Assembler::or_op3, $reg$$reg, 0, R_O7_enc ); %} @@ -2121,14 +2122,14 @@ encode %{ assert(Assembler::is_simm13($mem$$disp+4), "need disp and disp+4"); guarantee($mem$$index == R_G0_enc, "double index?"); // Load long with 2 instructions - emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 ); - emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 ); + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 ); + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 ); %} //%%% form3_mem_plus_4_reg is a hack--get rid of it enc_class form3_mem_plus_4_reg( memory mem, iRegI dst ) %{ guarantee($mem$$disp, "cannot offset a reg-reg operand by 4"); - emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg); + emit_form3_mem_reg(cbuf, ra_, this, $primary, -1, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg); %} enc_class form3_g0_rs2_rd_move( iRegI rs2, iRegI rd ) %{ diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index 612ae118ee4..b9911828174 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp index da9e9040683..63fb86a1509 100644 --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp index 1b23479a1f9..a94f5977f9d 100644 --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp index 11f829385b8..56805aed838 100644 --- a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp index 84aff34fafd..bae7b3510cd 100644 --- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp index c8faa7836b6..b8d63f4f862 100644 --- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.cpp b/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.cpp index 56129cc2d2e..3088400c801 100644 --- a/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.cpp +++ b/hotspot/src/cpu/x86/vm/bytecodeInterpreter_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp index 1e0c3d9c55c..a6e7731bdd5 100644 --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp index 8ef1bea5d83..f75eca72868 100644 --- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp index 2d1b5f1f3c7..ddd358cc5d9 100644 --- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp index baecb9df93d..12b01bfab42 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp index 805fe5a48ca..0aeb8d7979a 100644 --- a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp index 2f562bbd318..fd6302d21be 100644 --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp index 13f3df82c29..2e99c41949f 100644 --- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp index a45bd9624e5..935c6a21f34 100644 --- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/cpu/x86/vm/frame_x86.cpp b/hotspot/src/cpu/x86/vm/frame_x86.cpp index f0de7a44e76..4e83863a9f9 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp @@ -94,13 +94,6 @@ bool frame::safe_for_sender(JavaThread *thread) { // other generic buffer blobs are more problematic so we just assume they are // ok. adapter blobs never have a frame complete and are never ok. - // check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc - - if (!Interpreter::contains(_pc) && _cb->frame_size() <= 0) { - //assert(0, "Invalid frame_size"); - return false; - } - if (!_cb->is_frame_complete_at(_pc)) { if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { return false; @@ -144,6 +137,11 @@ bool frame::safe_for_sender(JavaThread *thread) { // must be some sort of compiled/runtime frame // fp does not have to be safe (although it could be check for c1?) + // check for a valid frame_size, otherwise we are unlikely to get a valid sender_pc + if (_cb->frame_size() <= 0) { + return false; + } + sender_sp = _unextended_sp + _cb->frame_size(); // On Intel the return_address is always the word on the stack sender_pc = (address) *(sender_sp-1); diff --git a/hotspot/src/cpu/x86/vm/frame_x86.hpp b/hotspot/src/cpu/x86/vm/frame_x86.hpp index 0033077dde4..8c6a72c2e97 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp index 3c5c225c399..bb161c9d4ea 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp index 0771794ff99..cfe52751d6b 100644 --- a/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp +++ b/hotspot/src/cpu/x86/vm/globalDefinitions_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp index f8a9407933b..8ed435dc3eb 100644 --- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp +++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp index 003e70b8066..719644cde05 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp index fbd344c57b5..6960f6de082 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/cpu/x86/vm/templateInterpreter_x86.hpp b/hotspot/src/cpu/x86/vm/templateInterpreter_x86.hpp index ed2cef16e58..071defbab0d 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86.hpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp b/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp index 847d08ed207..89cbc3b15a5 100644 --- a/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp +++ b/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp index 3e7b4243510..73c2f3ca20d 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, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp index 4fc385f9737..089b368d015 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/cpu/zero/vm/assembler_zero.cpp b/hotspot/src/cpu/zero/vm/assembler_zero.cpp index 5438c9209b6..4a60af98fd4 100644 --- a/hotspot/src/cpu/zero/vm/assembler_zero.cpp +++ b/hotspot/src/cpu/zero/vm/assembler_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp index 27c9af71f17..5142870244d 100644 --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp b/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp index 97b185c3aab..5c6be60bab4 100644 --- a/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp +++ b/hotspot/src/cpu/zero/vm/entryFrame_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/frame_zero.cpp b/hotspot/src/cpu/zero/vm/frame_zero.cpp index c8623f9aade..4be75fdc3b3 100644 --- a/hotspot/src/cpu/zero/vm/frame_zero.cpp +++ b/hotspot/src/cpu/zero/vm/frame_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp index 7f6ca09978c..8c968599864 100644 --- a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp +++ b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/globals_zero.hpp b/hotspot/src/cpu/zero/vm/globals_zero.hpp index 9a304c7f3fb..fda6a191b44 100644 --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/icBuffer_zero.cpp b/hotspot/src/cpu/zero/vm/icBuffer_zero.cpp index bf2849b6ecc..9a82782ab3a 100644 --- a/hotspot/src/cpu/zero/vm/icBuffer_zero.cpp +++ b/hotspot/src/cpu/zero/vm/icBuffer_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/interp_masm_zero.hpp b/hotspot/src/cpu/zero/vm/interp_masm_zero.hpp index 97a105bea80..ccba37b249f 100644 --- a/hotspot/src/cpu/zero/vm/interp_masm_zero.hpp +++ b/hotspot/src/cpu/zero/vm/interp_masm_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/interpreter_zero.cpp b/hotspot/src/cpu/zero/vm/interpreter_zero.cpp index 371d65cf9bb..7172443db8f 100644 --- a/hotspot/src/cpu/zero/vm/interpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/interpreter_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/jni_zero.h b/hotspot/src/cpu/zero/vm/jni_zero.h index 11157f4f06a..ecf743b65e1 100644 --- a/hotspot/src/cpu/zero/vm/jni_zero.h +++ b/hotspot/src/cpu/zero/vm/jni_zero.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/nativeInst_zero.hpp b/hotspot/src/cpu/zero/vm/nativeInst_zero.hpp index 00599206126..559bde79ab6 100644 --- a/hotspot/src/cpu/zero/vm/nativeInst_zero.hpp +++ b/hotspot/src/cpu/zero/vm/nativeInst_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/register_zero.cpp b/hotspot/src/cpu/zero/vm/register_zero.cpp index f11bf829aa6..5d695430171 100644 --- a/hotspot/src/cpu/zero/vm/register_zero.cpp +++ b/hotspot/src/cpu/zero/vm/register_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp index f50190829c0..a042bccfc14 100644 --- a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp +++ b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp index 2c419b14822..a9ebd9a121c 100644 --- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp +++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp b/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp index 505241b147f..ff26fbccf86 100644 --- a/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp +++ b/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp index 1203c315879..b88df23737b 100644 --- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp +++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/vmStructs_zero.hpp b/hotspot/src/cpu/zero/vm/vmStructs_zero.hpp index 0bbc1f40f45..72783cf341a 100644 --- a/hotspot/src/cpu/zero/vm/vmStructs_zero.hpp +++ b/hotspot/src/cpu/zero/vm/vmStructs_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/cpu/zero/vm/vtableStubs_zero.cpp b/hotspot/src/cpu/zero/vm/vtableStubs_zero.cpp index 67f0ea88839..4e52a4ed125 100644 --- a/hotspot/src/cpu/zero/vm/vtableStubs_zero.cpp +++ b/hotspot/src/cpu/zero/vm/vtableStubs_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os/bsd/dtrace/hotspot.d b/hotspot/src/os/bsd/dtrace/hotspot.d index 0e4802b5105..996e1d782e5 100644 --- a/hotspot/src/os/bsd/dtrace/hotspot.d +++ b/hotspot/src/os/bsd/dtrace/hotspot.d @@ -47,8 +47,8 @@ provider hotspot { probe mem__pool__gc__end( char*, uintptr_t, char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); - probe thread__probe__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); - probe thread__probe__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + probe thread__start(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + probe thread__stop(char*, uintptr_t, uintptr_t, uintptr_t, uintptr_t); probe thread__sleep__begin(long long); probe thread__sleep__end(int); probe thread__yield(); @@ -68,7 +68,7 @@ provider hotspot { probe monitor__contended__entered(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__contended__exit(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__wait(uintptr_t, uintptr_t, char*, uintptr_t, uintptr_t); - probe monitor__probe__waited(uintptr_t, uintptr_t, char*, uintptr_t); + probe monitor__waited(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__notify(uintptr_t, uintptr_t, char*, uintptr_t); probe monitor__notifyAll(uintptr_t, uintptr_t, char*, uintptr_t); diff --git a/hotspot/src/os/bsd/dtrace/jvm_dtrace.c b/hotspot/src/os/bsd/dtrace/jvm_dtrace.c index 6cdad788572..36d8b61b19f 100644 --- a/hotspot/src/os/bsd/dtrace/jvm_dtrace.c +++ b/hotspot/src/os/bsd/dtrace/jvm_dtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/hotspot/src/os/posix/vm/os_posix.hpp b/hotspot/src/os/posix/vm/os_posix.hpp index 16a065acf30..406baf17237 100644 --- a/hotspot/src/os/posix/vm/os_posix.hpp +++ b/hotspot/src/os/posix/vm/os_posix.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os/solaris/dtrace/jvm_dtrace.c b/hotspot/src/os/solaris/dtrace/jvm_dtrace.c index 6cdad788572..36d8b61b19f 100644 --- a/hotspot/src/os/solaris/dtrace/jvm_dtrace.c +++ b/hotspot/src/os/solaris/dtrace/jvm_dtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/hotspot/src/os/solaris/vm/globals_solaris.hpp b/hotspot/src/os/solaris/vm/globals_solaris.hpp index 2abbe15a7fd..ba5458803e8 100644 --- a/hotspot/src/os/solaris/vm/globals_solaris.hpp +++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/os/windows/vm/decoder_windows.hpp b/hotspot/src/os/windows/vm/decoder_windows.hpp index 2555e8c9b79..731b3a3f5dc 100644 --- a/hotspot/src/os/windows/vm/decoder_windows.hpp +++ b/hotspot/src/os/windows/vm/decoder_windows.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s index 3275996f0c7..3f6958ce385 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s +++ b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 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 diff --git a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s index 2f70fce77a3..95cea3bf2a3 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s +++ b/hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_64.s @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 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 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 a1d7075af55..df24bcdc594 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp index b1460eddc0c..32d0fdc66a2 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp b/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp index 44f72df22cf..e7b7f55d03d 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp index 7903217291b..c857b552689 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp b/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp index 983aea1a2a6..7afef93eda2 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/thread_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp b/hotspot/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp index 6673f448f81..48e40a8e33f 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp b/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp index 844279e41e0..b3a215d2b83 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/linux_sparc/vm/linux_sparc.s b/hotspot/src/os_cpu/linux_sparc/vm/linux_sparc.s index d7c2ce87414..33474ecd9c0 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/linux_sparc.s +++ b/hotspot/src/os_cpu/linux_sparc/vm/linux_sparc.s @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 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 diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index e7879bee690..5eaab2d5259 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp index 38bc63e6496..1e9280fe36c 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp index 622928aa17b..4ecaeee3354 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.s b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.s index 7936cbf52bd..26cfa51e162 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.s +++ b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.s @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.s b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.s index fb688e7a7b6..89d98cb5837 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.s +++ b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_64.s @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 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 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 9a7605e696b..195982529ef 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp index fbca6909bb5..1ccfad76fe7 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp index 828f992d8ba..897e48aa19f 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp index 4e0be5c79f3..663f0ac45c6 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index 2618519e2a4..f5f44e0a77b 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp b/hotspot/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp index 34b82a96d79..fe0cc5e10a1 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp index e0ed6961e3a..30c955debca 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.il b/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.il index 47398351b39..16bd6902a3e 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.il +++ b/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.il @@ -1,5 +1,5 @@ // -// Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2002, 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 diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.s b/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.s index 39aaa77f664..a0f6ddff431 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.s +++ b/hotspot/src/os_cpu/solaris_sparc/vm/solaris_sparc.s @@ -1,5 +1,5 @@ !! -!! Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. +!! Copyright (c) 2005, 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 diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp index 40d6ae735aa..08a5fb3980a 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp b/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp index c1f656b99f8..e6329c28942 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.s b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.s index 19e790b6013..a48294ab909 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.s +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.s @@ -1,5 +1,5 @@ // -// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2004, 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 diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.s b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.s index 487b569e58c..9a3e03f175c 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.s +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.s @@ -1,5 +1,5 @@ / -/ Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. +/ Copyright (c) 2004, 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 diff --git a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp index 523fdc7cc42..9304bb7242e 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp index 10e0aaff747..de91c32ad33 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp index 09735dae0c6..6178f1988e5 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp index 22ffeb5dc34..1ac00b10455 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp index a392b63632c..b629e23205a 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java index c4a77c02aac..c36f4cae67d 100644 --- a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java +++ b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 diff --git a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java index de80e9a1043..c24a2103eb0 100644 --- a/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java +++ b/hotspot/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java index b7a99a652db..9afeb42d422 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java +++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/tools/hsdis/hsdis.c b/hotspot/src/share/tools/hsdis/hsdis.c index 162e2aba3e7..248acfaf37c 100644 --- a/hotspot/src/share/tools/hsdis/hsdis.c +++ b/hotspot/src/share/tools/hsdis/hsdis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 diff --git a/hotspot/src/share/vm/adlc/adlc.hpp b/hotspot/src/share/vm/adlc/adlc.hpp index 8d48ed601af..18f98884c3c 100644 --- a/hotspot/src/share/vm/adlc/adlc.hpp +++ b/hotspot/src/share/vm/adlc/adlc.hpp @@ -38,6 +38,9 @@ #include "stdarg.h" #include +/* Make sure that we have the intptr_t and uintptr_t definitions */ +#ifdef _WIN32 + #if _MSC_VER >= 1300 using namespace std; #endif @@ -46,8 +49,6 @@ using namespace std; #define strdup _strdup #endif -/* Make sure that we have the intptr_t and uintptr_t definitions */ -#ifdef _WIN32 #ifndef _INTPTR_T_DEFINED #ifdef _WIN64 typedef __int64 intptr_t; @@ -65,6 +66,7 @@ typedef unsigned int uintptr_t; #endif #define _UINTPTR_T_DEFINED #endif + #endif // _WIN32 #if defined(LINUX) || defined(_ALLBSD_SOURCE) diff --git a/hotspot/src/share/vm/adlc/adlparse.cpp b/hotspot/src/share/vm/adlc/adlparse.cpp index 8704c68da69..0d5595c6c04 100644 --- a/hotspot/src/share/vm/adlc/adlparse.cpp +++ b/hotspot/src/share/vm/adlc/adlparse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/adlc/archDesc.cpp b/hotspot/src/share/vm/adlc/archDesc.cpp index fd60e25acb7..97b8999d4a1 100644 --- a/hotspot/src/share/vm/adlc/archDesc.cpp +++ b/hotspot/src/share/vm/adlc/archDesc.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. +// 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 @@ -43,32 +43,6 @@ char *toUpper(const char *str) { return result; } -// Utilities to characterize effect statements -static bool is_def(int usedef) { - switch(usedef) { - case Component::DEF: - case Component::USE_DEF: return true; break; - } - return false; -} - -static bool is_use(int usedef) { - switch(usedef) { - case Component::USE: - case Component::USE_DEF: - case Component::USE_KILL: return true; break; - } - return false; -} - -static bool is_kill(int usedef) { - switch(usedef) { - case Component::KILL: - case Component::USE_KILL: return true; break; - } - return false; -} - //---------------------------ChainList Methods------------------------------- ChainList::ChainList() { } diff --git a/hotspot/src/share/vm/adlc/dfa.cpp b/hotspot/src/share/vm/adlc/dfa.cpp index 6b15911a067..80ef1af3602 100644 --- a/hotspot/src/share/vm/adlc/dfa.cpp +++ b/hotspot/src/share/vm/adlc/dfa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/adlc/dict2.cpp b/hotspot/src/share/vm/adlc/dict2.cpp index 24d7fcba023..f341a2b67b0 100644 --- a/hotspot/src/share/vm/adlc/dict2.cpp +++ b/hotspot/src/share/vm/adlc/dict2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index cfa9f5b6222..01aedd36a70 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/adlc/formssel.hpp b/hotspot/src/share/vm/adlc/formssel.hpp index 3bc22b8e269..5f7c970e228 100644 --- a/hotspot/src/share/vm/adlc/formssel.hpp +++ b/hotspot/src/share/vm/adlc/formssel.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/adlc/main.cpp b/hotspot/src/share/vm/adlc/main.cpp index b0035cbe7ef..3ca5e61c6b4 100644 --- a/hotspot/src/share/vm/adlc/main.cpp +++ b/hotspot/src/share/vm/adlc/main.cpp @@ -29,7 +29,6 @@ static void usage(ArchDesc& AD); // Print usage message and exit static char *strip_ext(char *fname); // Strip off name extension static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string -static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text ArchDesc* globalAD = NULL; // global reference to Architecture Description object diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp index b8978591355..0d92a23119e 100644 --- a/hotspot/src/share/vm/adlc/output_c.cpp +++ b/hotspot/src/share/vm/adlc/output_c.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -35,23 +35,6 @@ static bool is_def(int usedef) { return false; } -static bool is_use(int usedef) { - switch(usedef) { - case Component::USE: - case Component::USE_DEF: - case Component::USE_KILL: return true; break; - } - return false; -} - -static bool is_kill(int usedef) { - switch(usedef) { - case Component::KILL: - case Component::USE_KILL: return true; break; - } - return false; -} - // Define an array containing the machine register names, strings. static void defineRegNames(FILE *fp, RegisterForm *registers) { if (registers) { diff --git a/hotspot/src/share/vm/adlc/output_h.cpp b/hotspot/src/share/vm/adlc/output_h.cpp index 0b01d06dc31..56ba9a582c2 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index ae3034bc969..0eadb5dc273 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/asm/assembler.hpp b/hotspot/src/share/vm/asm/assembler.hpp index 8a9e2758a58..eb21a3d1503 100644 --- a/hotspot/src/share/vm/asm/assembler.hpp +++ b/hotspot/src/share/vm/asm/assembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp index f885c415332..7e585990091 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.cpp +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/asm/macroAssembler.hpp b/hotspot/src/share/vm/asm/macroAssembler.hpp index 96c6b01dc34..3a729d41dbf 100644 --- a/hotspot/src/share/vm/asm/macroAssembler.hpp +++ b/hotspot/src/share/vm/asm/macroAssembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp index e61fc37d96e..7fa323749d4 100644 --- a/hotspot/src/share/vm/asm/macroAssembler.inline.hpp +++ b/hotspot/src/share/vm/asm/macroAssembler.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp index f98edc6f563..932bfb30b95 100644 --- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp +++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp b/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp index 43ce4a41c14..c1191830ed0 100644 --- a/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp +++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp index 5f4a04c5b6c..d3c5a0d8bbb 100644 --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_Compilation.cpp b/hotspot/src/share/vm/c1/c1_Compilation.cpp index 574fda19401..404c4e336f3 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.cpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp index 679ff609a84..8953d527d1d 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp @@ -259,6 +259,9 @@ class Compilation: public StackObj { } ciKlass* cha_exact_type(ciType* type); + + // Dump inlining replay data to the stream. + void dump_inline_data(outputStream* out) { /* do nothing now */ } }; diff --git a/hotspot/src/share/vm/c1/c1_Compiler.cpp b/hotspot/src/share/vm/c1/c1_Compiler.cpp index 0fb723c8a95..f673b236f19 100644 --- a/hotspot/src/share/vm/c1/c1_Compiler.cpp +++ b/hotspot/src/share/vm/c1/c1_Compiler.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 @@ -43,7 +43,8 @@ #include "runtime/sharedRuntime.hpp" -Compiler::Compiler () {} +Compiler::Compiler() : AbstractCompiler(c1) { +} void Compiler::init_c1_runtime() { BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); diff --git a/hotspot/src/share/vm/c1/c1_Compiler.hpp b/hotspot/src/share/vm/c1/c1_Compiler.hpp index fe95c8cd780..cae2f6122a2 100644 --- a/hotspot/src/share/vm/c1/c1_Compiler.hpp +++ b/hotspot/src/share/vm/c1/c1_Compiler.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 @@ -42,8 +42,6 @@ class Compiler: public AbstractCompiler { // Name of this compiler virtual const char* name() { return "C1"; } - virtual bool is_c1() { return true; }; - // Missing feature tests virtual bool supports_native() { return true; } virtual bool supports_osr () { return true; } diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp index f5eef6f0b3b..455cfe278ee 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp index 98bb86f8f74..052621e8d66 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 1bfd4bad45d..8d7d4e36d2a 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -4338,11 +4338,15 @@ void GraphBuilder::print_stats() { #endif // PRODUCT void GraphBuilder::profile_call(ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined) { - // A default method's holder is an interface - if (known_holder != NULL && known_holder->is_interface()) { - assert(known_holder->is_instance_klass() && ((ciInstanceKlass*)known_holder)->has_default_methods(), "should be default method"); - known_holder = NULL; + assert(known_holder == NULL || (known_holder->is_instance_klass() && + (!known_holder->is_interface() || + ((ciInstanceKlass*)known_holder)->has_default_methods())), "should be default method"); + if (known_holder != NULL) { + if (known_holder->exact_klass() == NULL) { + known_holder = compilation()->cha_exact_type(known_holder); + } } + append(new ProfileCall(method(), bci(), callee, recv, known_holder, obj_args, inlined)); } diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp index ce83cb73fe2..c783878efa1 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_IR.cpp b/hotspot/src/share/vm/c1/c1_IR.cpp index 13a7f790f6f..c377e56ecef 100644 --- a/hotspot/src/share/vm/c1/c1_IR.cpp +++ b/hotspot/src/share/vm/c1/c1_IR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_IR.hpp b/hotspot/src/share/vm/c1/c1_IR.hpp index bc57300c1f0..ba1abee0d01 100644 --- a/hotspot/src/share/vm/c1/c1_IR.hpp +++ b/hotspot/src/share/vm/c1/c1_IR.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_Instruction.cpp b/hotspot/src/share/vm/c1/c1_Instruction.cpp index e5829611e66..99d00bdec27 100644 --- a/hotspot/src/share/vm/c1/c1_Instruction.cpp +++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp b/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp index 2ad20d3e65a..a3a91033d70 100644 --- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp +++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index 9ae527054fe..5a49c0d2da7 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -858,9 +858,7 @@ void LIR_Assembler::move_op(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) { #ifndef PRODUCT - if (VerifyOopMaps || VerifyOops) { - bool v = VerifyOops; - VerifyOops = true; + if (VerifyOops) { OopMapStream s(info->oop_map()); while (!s.is_done()) { OopMapValue v = s.current(); @@ -883,7 +881,6 @@ void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) { s.next(); } - VerifyOops = v; } #endif } diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index 52dff2642c1..089058aa71f 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/c1/c1_Optimizer.cpp b/hotspot/src/share/vm/c1/c1_Optimizer.cpp index 90667b46f39..f366462f60c 100644 --- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp +++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp index 12cdce62fee..599cedb99d0 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, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp index b022a81374b..f7b68af9862 100644 --- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp +++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.hpp b/hotspot/src/share/vm/c1/c1_Runtime1.hpp index e41f2f188dc..276ca44ffbe 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.cpp b/hotspot/src/share/vm/c1/c1_ValueMap.cpp index 370afe46b93..fb52819facc 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.cpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.hpp b/hotspot/src/share/vm/c1/c1_ValueMap.hpp index 1404aa0b8a8..e394118b1ce 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/c1/c1_globals.cpp b/hotspot/src/share/vm/c1/c1_globals.cpp index 553b9aa4322..93e641ab698 100644 --- a/hotspot/src/share/vm/c1/c1_globals.cpp +++ b/hotspot/src/share/vm/c1/c1_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp index c7136909c40..66476716d1c 100644 --- a/hotspot/src/share/vm/c1/c1_globals.hpp +++ b/hotspot/src/share/vm/c1/c1_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -269,9 +269,6 @@ develop(bool, PrintNotLoaded, false, \ "Prints where classes are not loaded during code generation") \ \ - notproduct(bool, VerifyOopMaps, false, \ - "Adds oopmap verification code to the generated code") \ - \ develop(bool, PrintLIR, false, \ "print low-level IR") \ \ diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp index e2fca4845b1..24b2830ed83 100644 --- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp +++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.hpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.hpp index 3c701b6a4e8..74a0d3106b7 100644 --- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.hpp +++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/ci/ciArray.cpp b/hotspot/src/share/vm/ci/ciArray.cpp index fdcc63a0dec..56f57b360dd 100644 --- a/hotspot/src/share/vm/ci/ciArray.cpp +++ b/hotspot/src/share/vm/ci/ciArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciArray.hpp b/hotspot/src/share/vm/ci/ciArray.hpp index c5c86265d61..d5ff40ba695 100644 --- a/hotspot/src/share/vm/ci/ciArray.hpp +++ b/hotspot/src/share/vm/ci/ciArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciClassList.hpp b/hotspot/src/share/vm/ci/ciClassList.hpp index c3131f5ee67..ee82685a4df 100644 --- a/hotspot/src/share/vm/ci/ciClassList.hpp +++ b/hotspot/src/share/vm/ci/ciClassList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciConstant.hpp b/hotspot/src/share/vm/ci/ciConstant.hpp index 7a72a7de1e5..5af058f4e9b 100644 --- a/hotspot/src/share/vm/ci/ciConstant.hpp +++ b/hotspot/src/share/vm/ci/ciConstant.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 9cc86db9052..dcb3472802c 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1147,6 +1147,33 @@ ciInstance* ciEnv::unloaded_ciinstance() { // Don't change thread state and acquire any locks. // Safe to call from VM error reporter. + +void ciEnv::dump_compile_data(outputStream* out) { + CompileTask* task = this->task(); + Method* method = task->method(); + int entry_bci = task->osr_bci(); + int comp_level = task->comp_level(); + out->print("compile %s %s %s %d %d", + method->klass_name()->as_quoted_ascii(), + method->name()->as_quoted_ascii(), + method->signature()->as_quoted_ascii(), + entry_bci, comp_level); + if (compiler_data() != NULL) { + if (is_c2_compile(comp_level)) { // C2 or Shark +#ifdef COMPILER2 + // Dump C2 inlining data. + ((Compile*)compiler_data())->dump_inline_data(out); +#endif + } else if (is_c1_compile(comp_level)) { // C1 +#ifdef COMPILER1 + // Dump C1 inlining data. + ((Compilation*)compiler_data())->dump_inline_data(out); +#endif + } + } + out->cr(); +} + void ciEnv::dump_replay_data_unsafe(outputStream* out) { ResourceMark rm; #if INCLUDE_JVMTI @@ -1160,16 +1187,7 @@ void ciEnv::dump_replay_data_unsafe(outputStream* out) { for (int i = 0; i < objects->length(); i++) { objects->at(i)->dump_replay_data(out); } - CompileTask* task = this->task(); - Method* method = task->method(); - int entry_bci = task->osr_bci(); - int comp_level = task->comp_level(); - // Klass holder = method->method_holder(); - out->print_cr("compile %s %s %s %d %d", - method->klass_name()->as_quoted_ascii(), - method->name()->as_quoted_ascii(), - method->signature()->as_quoted_ascii(), - entry_bci, comp_level); + dump_compile_data(out); out->flush(); } @@ -1179,3 +1197,45 @@ void ciEnv::dump_replay_data(outputStream* out) { dump_replay_data_unsafe(out); ) } + +void ciEnv::dump_replay_data(int compile_id) { + static char buffer[O_BUFLEN]; + int ret = jio_snprintf(buffer, O_BUFLEN, "replay_pid%p_compid%d.log", os::current_process_id(), compile_id); + if (ret > 0) { + int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd != -1) { + FILE* replay_data_file = os::open(fd, "w"); + 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); + } else { + tty->print_cr("# Can't open file to dump replay data."); + } + } + } +} + +void ciEnv::dump_inline_data(int compile_id) { + static char buffer[O_BUFLEN]; + int ret = jio_snprintf(buffer, O_BUFLEN, "inline_pid%p_compid%d.log", os::current_process_id(), compile_id); + if (ret > 0) { + int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd != -1) { + FILE* inline_data_file = os::open(fd, "w"); + if (inline_data_file != NULL) { + fileStream replay_data_stream(inline_data_file, /*need_close=*/true); + GUARDED_VM_ENTRY( + MutexLocker ml(Compile_lock); + dump_compile_data(&replay_data_stream); + ) + replay_data_stream.flush(); + tty->print("# Compiler inline data is saved as: "); + tty->print_cr(buffer); + } else { + tty->print_cr("# Can't open file to dump inline data."); + } + } + } +} diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp index b235f3b148b..5a0bd1f1352 100644 --- a/hotspot/src/share/vm/ci/ciEnv.hpp +++ b/hotspot/src/share/vm/ci/ciEnv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -451,8 +451,11 @@ public: void metadata_do(void f(Metadata*)) { _factory->metadata_do(f); } // Dump the compilation replay data for the ciEnv to the stream. + void dump_replay_data(int compile_id); + void dump_inline_data(int compile_id); void dump_replay_data(outputStream* out); void dump_replay_data_unsafe(outputStream* out); + void dump_compile_data(outputStream* out); }; #endif // SHARE_VM_CI_CIENV_HPP diff --git a/hotspot/src/share/vm/ci/ciFlags.hpp b/hotspot/src/share/vm/ci/ciFlags.hpp index 87e19466f27..60d5632f4bb 100644 --- a/hotspot/src/share/vm/ci/ciFlags.hpp +++ b/hotspot/src/share/vm/ci/ciFlags.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciInstance.cpp b/hotspot/src/share/vm/ci/ciInstance.cpp index 8b48b1b3706..f276a53fb5d 100644 --- a/hotspot/src/share/vm/ci/ciInstance.cpp +++ b/hotspot/src/share/vm/ci/ciInstance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp index 34eb84ccfeb..41c42935a6a 100644 --- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp +++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciKlass.cpp b/hotspot/src/share/vm/ci/ciKlass.cpp index 2a4a25acded..0cd20e5b904 100644 --- a/hotspot/src/share/vm/ci/ciKlass.cpp +++ b/hotspot/src/share/vm/ci/ciKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciKlass.hpp b/hotspot/src/share/vm/ci/ciKlass.hpp index 7e03c1ede61..8e6574b22fd 100644 --- a/hotspot/src/share/vm/ci/ciKlass.hpp +++ b/hotspot/src/share/vm/ci/ciKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp index dd411642ad2..923331edee3 100644 --- a/hotspot/src/share/vm/ci/ciMethod.cpp +++ b/hotspot/src/share/vm/ci/ciMethod.cpp @@ -1357,15 +1357,21 @@ ciMethodBlocks *ciMethod::get_method_blocks() { #undef FETCH_FLAG_FROM_VM +void ciMethod::dump_name_as_ascii(outputStream* st) { + Method* method = get_Method(); + st->print("%s %s %s", + method->klass_name()->as_quoted_ascii(), + method->name()->as_quoted_ascii(), + method->signature()->as_quoted_ascii()); +} + void ciMethod::dump_replay_data(outputStream* st) { ResourceMark rm; Method* method = get_Method(); MethodCounters* mcs = method->method_counters(); - Klass* holder = method->method_holder(); - st->print_cr("ciMethod %s %s %s %d %d %d %d %d", - holder->name()->as_quoted_ascii(), - method->name()->as_quoted_ascii(), - method->signature()->as_quoted_ascii(), + st->print("ciMethod "); + dump_name_as_ascii(st); + st->print_cr(" %d %d %d %d %d", mcs == NULL ? 0 : mcs->invocation_counter()->raw_counter(), mcs == NULL ? 0 : mcs->backedge_counter()->raw_counter(), interpreter_invocation_count(), diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index 604babb00dd..d7ddba87b8e 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -310,10 +310,13 @@ class ciMethod : public ciMetadata { bool is_accessor () const; bool is_initializer () const; bool can_be_statically_bound() const { return _can_be_statically_bound; } - void dump_replay_data(outputStream* st); bool is_boxing_method() const; bool is_unboxing_method() const; + // Replay data methods + void dump_name_as_ascii(outputStream* st); + void dump_replay_data(outputStream* st); + // Print the bytecodes of this method. void print_codes_on(outputStream* st); void print_codes() { diff --git a/hotspot/src/share/vm/ci/ciMethodData.cpp b/hotspot/src/share/vm/ci/ciMethodData.cpp index e8b6ee6af5e..025146885db 100644 --- a/hotspot/src/share/vm/ci/ciMethodData.cpp +++ b/hotspot/src/share/vm/ci/ciMethodData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/ci/ciMethodData.hpp b/hotspot/src/share/vm/ci/ciMethodData.hpp index 0eeb510e348..f1a7f2634e4 100644 --- a/hotspot/src/share/vm/ci/ciMethodData.hpp +++ b/hotspot/src/share/vm/ci/ciMethodData.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp index 91f2ebc42a0..2b035c2af0f 100644 --- a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp +++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp b/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp index 7a45e867438..e50814c0f8e 100644 --- a/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp +++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp index a22fcf62c8c..d257e8ac467 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp index ba3d88c1202..c1baca0ee62 100644 --- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp +++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 3c8ccf9bb87..e880815098d 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -24,6 +24,8 @@ #include "precompiled.hpp" #include "ci/ciMethodData.hpp" #include "ci/ciReplay.hpp" +#include "ci/ciSymbol.hpp" +#include "ci/ciKlass.hpp" #include "ci/ciUtilities.hpp" #include "compiler/compileBroker.hpp" #include "memory/allocation.inline.hpp" @@ -37,74 +39,107 @@ // ciReplay typedef struct _ciMethodDataRecord { - const char* klass; - const char* method; - const char* signature; - int state; - int current_mileage; - intptr_t* data; - int data_length; - char* orig_data; - int orig_data_length; - int oops_length; - jobject* oops_handles; - int* oops_offsets; + const char* _klass_name; + const char* _method_name; + const char* _signature; + + int _state; + int _current_mileage; + + intptr_t* _data; + char* _orig_data; + jobject* _oops_handles; + int* _oops_offsets; + int _data_length; + int _orig_data_length; + int _oops_length; } ciMethodDataRecord; typedef struct _ciMethodRecord { - const char* klass; - const char* method; - const char* signature; - int instructions_size; - int interpreter_invocation_count; - int interpreter_throwout_count; - int invocation_counter; - int backedge_counter; + const char* _klass_name; + const char* _method_name; + const char* _signature; + + int _instructions_size; + int _interpreter_invocation_count; + int _interpreter_throwout_count; + int _invocation_counter; + int _backedge_counter; } ciMethodRecord; -class CompileReplay; +typedef struct _ciInlineRecord { + const char* _klass_name; + const char* _method_name; + const char* _signature; + + int _inline_depth; + int _inline_bci; +} ciInlineRecord; + +class CompileReplay; static CompileReplay* replay_state; class CompileReplay : public StackObj { private: - FILE* stream; - Thread* thread; - Handle protection_domain; - Handle loader; + FILE* _stream; + Thread* _thread; + Handle _protection_domain; + Handle _loader; - GrowableArray ci_method_records; - GrowableArray ci_method_data_records; + GrowableArray _ci_method_records; + GrowableArray _ci_method_data_records; + + // Use pointer because we may need to return inline records + // without destroying them. + GrowableArray* _ci_inline_records; const char* _error_message; - char* bufptr; - char* buffer; - int buffer_length; - int buffer_end; - int line_no; + char* _bufptr; + char* _buffer; + int _buffer_length; + int _buffer_pos; + + // "compile" data + ciKlass* _iklass; + Method* _imethod; + int _entry_bci; + int _comp_level; public: CompileReplay(const char* filename, TRAPS) { - thread = THREAD; - loader = Handle(thread, SystemDictionary::java_system_loader()); - stream = fopen(filename, "rt"); - if (stream == NULL) { + _thread = THREAD; + _loader = Handle(_thread, SystemDictionary::java_system_loader()); + _protection_domain = Handle(); + + _stream = fopen(filename, "rt"); + if (_stream == NULL) { fprintf(stderr, "ERROR: Can't open replay file %s\n", filename); } - buffer_length = 32; - buffer = NEW_RESOURCE_ARRAY(char, buffer_length); + + _ci_inline_records = NULL; _error_message = NULL; + _buffer_length = 32; + _buffer = NEW_RESOURCE_ARRAY(char, _buffer_length); + _bufptr = _buffer; + _buffer_pos = 0; + + _imethod = NULL; + _iklass = NULL; + _entry_bci = 0; + _comp_level = 0; + test(); } ~CompileReplay() { - if (stream != NULL) fclose(stream); + if (_stream != NULL) fclose(_stream); } void test() { - strcpy(buffer, "1 2 foo 4 bar 0x9 \"this is it\""); - bufptr = buffer; + strcpy(_buffer, "1 2 foo 4 bar 0x9 \"this is it\""); + _bufptr = _buffer; assert(parse_int("test") == 1, "what"); assert(parse_int("test") == 2, "what"); assert(strcmp(parse_string(), "foo") == 0, "what"); @@ -115,18 +150,18 @@ class CompileReplay : public StackObj { } bool had_error() { - return _error_message != NULL || thread->has_pending_exception(); + return _error_message != NULL || _thread->has_pending_exception(); } bool can_replay() { - return !(stream == NULL || had_error()); + return !(_stream == NULL || had_error()); } void report_error(const char* msg) { _error_message = msg; - // Restore the buffer contents for error reporting - for (int i = 0; i < buffer_end; i++) { - if (buffer[i] == '\0') buffer[i] = ' '; + // Restore the _buffer contents for error reporting + for (int i = 0; i < _buffer_pos; i++) { + if (_buffer[i] == '\0') _buffer[i] = ' '; } } @@ -137,10 +172,10 @@ class CompileReplay : public StackObj { int v = 0; int read; - if (sscanf(bufptr, "%i%n", &v, &read) != 1) { + if (sscanf(_bufptr, "%i%n", &v, &read) != 1) { report_error(label); } else { - bufptr += read; + _bufptr += read; } return v; } @@ -152,31 +187,31 @@ class CompileReplay : public StackObj { intptr_t v = 0; int read; - if (sscanf(bufptr, INTPTR_FORMAT "%n", &v, &read) != 1) { + if (sscanf(_bufptr, INTPTR_FORMAT "%n", &v, &read) != 1) { report_error(label); } else { - bufptr += read; + _bufptr += read; } return v; } void skip_ws() { // Skip any leading whitespace - while (*bufptr == ' ' || *bufptr == '\t') { - bufptr++; + while (*_bufptr == ' ' || *_bufptr == '\t') { + _bufptr++; } } char* scan_and_terminate(char delim) { - char* str = bufptr; - while (*bufptr != delim && *bufptr != '\0') { - bufptr++; + char* str = _bufptr; + while (*_bufptr != delim && *_bufptr != '\0') { + _bufptr++; } - if (*bufptr != '\0') { - *bufptr++ = '\0'; + if (*_bufptr != '\0') { + *_bufptr++ = '\0'; } - if (bufptr == str) { + if (_bufptr == str) { // nothing here return NULL; } @@ -195,8 +230,8 @@ class CompileReplay : public StackObj { skip_ws(); - if (*bufptr == '"') { - bufptr++; + if (*_bufptr == '"') { + _bufptr++; return scan_and_terminate('"'); } else { return scan_and_terminate(' '); @@ -273,7 +308,12 @@ class CompileReplay : public StackObj { const char* str = parse_escaped_string(); Symbol* klass_name = SymbolTable::lookup(str, (int)strlen(str), CHECK_NULL); if (klass_name != NULL) { - Klass* k = SystemDictionary::resolve_or_fail(klass_name, loader, protection_domain, true, THREAD); + Klass* k = NULL; + if (_iklass != NULL) { + k = (Klass*)_iklass->find_klass(ciSymbol::make(klass_name->as_C_string()))->constant_encoding(); + } else { + k = SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD); + } if (HAS_PENDING_EXCEPTION) { oop throwable = PENDING_EXCEPTION; java_lang_Throwable::print(throwable, tty); @@ -289,7 +329,7 @@ class CompileReplay : public StackObj { // Lookup a klass Klass* resolve_klass(const char* klass, TRAPS) { Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL); - return SystemDictionary::resolve_or_fail(klass_name, loader, protection_domain, true, CHECK_NULL); + return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL); } // Parse the standard tuple of @@ -304,40 +344,45 @@ class CompileReplay : public StackObj { return m; } - // Process each line of the replay file executing each command until - // the file ends. - void process(TRAPS) { - line_no = 1; - int pos = 0; - int c = getc(stream); + int get_line(int c) { while(c != EOF) { - if (pos + 1 >= buffer_length) { - int newl = buffer_length * 2; - char* newb = NEW_RESOURCE_ARRAY(char, newl); - memcpy(newb, buffer, pos); - buffer = newb; - buffer_length = newl; + if (_buffer_pos + 1 >= _buffer_length) { + int new_length = _buffer_length * 2; + // Next call will throw error in case of OOM. + _buffer = REALLOC_RESOURCE_ARRAY(char, _buffer, _buffer_length, new_length); + _buffer_length = new_length; } if (c == '\n') { - // null terminate it, reset the pointer and process the line - buffer[pos] = '\0'; - buffer_end = pos++; - bufptr = buffer; - process_command(CHECK); - if (had_error()) { - tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message); - tty->print_cr("%s", buffer); - return; - } - pos = 0; - buffer_end = 0; - line_no++; + c = getc(_stream); // get next char + break; } else if (c == '\r') { // skip LF } else { - buffer[pos++] = c; + _buffer[_buffer_pos++] = c; } - c = getc(stream); + c = getc(_stream); + } + // null terminate it, reset the pointer + _buffer[_buffer_pos] = '\0'; // NL or EOF + _buffer_pos = 0; + _bufptr = _buffer; + return c; + } + + // Process each line of the replay file executing each command until + // the file ends. + void process(TRAPS) { + int line_no = 1; + int c = getc(_stream); + while(c != EOF) { + c = get_line(c); + process_command(CHECK); + if (had_error()) { + tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message); + tty->print_cr("%s", _buffer); + return; + } + line_no++; } } @@ -396,7 +441,37 @@ class CompileReplay : public StackObj { return true; } - // compile + // compile inline ... + void* process_inline(ciMethod* imethod, Method* m, int entry_bci, int comp_level, TRAPS) { + _imethod = m; + _iklass = imethod->holder(); + _entry_bci = entry_bci; + _comp_level = comp_level; + int line_no = 1; + int c = getc(_stream); + while(c != EOF) { + c = get_line(c); + // Expecting only lines with "compile" command in inline replay file. + char* cmd = parse_string(); + if (cmd == NULL || strcmp("compile", cmd) != 0) { + return NULL; + } + process_compile(CHECK_NULL); + if (had_error()) { + tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message); + tty->print_cr("%s", _buffer); + return NULL; + } + if (_ci_inline_records != NULL && _ci_inline_records->length() > 0) { + // Found inlining record for the requested method. + return _ci_inline_records; + } + line_no++; + } + return NULL; + } + + // compile inline ... void process_compile(TRAPS) { Method* method = parse_method(CHECK); if (had_error()) return; @@ -410,6 +485,43 @@ class CompileReplay : public StackObj { if (!is_valid_comp_level(comp_level)) { return; } + if (_imethod != NULL) { + // Replay Inlining + if (entry_bci != _entry_bci || comp_level != _comp_level) { + return; + } + const char* iklass_name = _imethod->method_holder()->name()->as_utf8(); + const char* imethod_name = _imethod->name()->as_utf8(); + const char* isignature = _imethod->signature()->as_utf8(); + const char* klass_name = method->method_holder()->name()->as_utf8(); + const char* method_name = method->name()->as_utf8(); + const char* signature = method->signature()->as_utf8(); + if (strcmp(iklass_name, klass_name) != 0 || + strcmp(imethod_name, method_name) != 0 || + strcmp(isignature, signature) != 0) { + return; + } + } + int inline_count = 0; + if (parse_tag_and_count("inline", inline_count)) { + // Record inlining data + _ci_inline_records = new GrowableArray(); + for (int i = 0; i < inline_count; i++) { + int depth = parse_int("inline_depth"); + int bci = parse_int("inline_bci"); + if (had_error()) { + break; + } + Method* inl_method = parse_method(CHECK); + if (had_error()) { + break; + } + new_ciInlineRecord(inl_method, bci, depth); + } + } + if (_imethod != NULL) { + return; // Replay Inlining + } Klass* k = method->method_holder(); ((InstanceKlass*)k)->initialize(THREAD); if (HAS_PENDING_EXCEPTION) { @@ -442,11 +554,11 @@ class CompileReplay : public StackObj { Method* method = parse_method(CHECK); if (had_error()) return; ciMethodRecord* rec = new_ciMethod(method); - rec->invocation_counter = parse_int("invocation_counter"); - rec->backedge_counter = parse_int("backedge_counter"); - rec->interpreter_invocation_count = parse_int("interpreter_invocation_count"); - rec->interpreter_throwout_count = parse_int("interpreter_throwout_count"); - rec->instructions_size = parse_int("instructions_size"); + rec->_invocation_counter = parse_int("invocation_counter"); + rec->_backedge_counter = parse_int("backedge_counter"); + rec->_interpreter_invocation_count = parse_int("interpreter_invocation_count"); + rec->_interpreter_throwout_count = parse_int("interpreter_throwout_count"); + rec->_instructions_size = parse_int("instructions_size"); } // ciMethodData orig # # ... data # # ... oops @@ -471,32 +583,32 @@ class CompileReplay : public StackObj { // collect and record all the needed information for later ciMethodDataRecord* rec = new_ciMethodData(method); - rec->state = parse_int("state"); - rec->current_mileage = parse_int("current_mileage"); + rec->_state = parse_int("state"); + rec->_current_mileage = parse_int("current_mileage"); - rec->orig_data = parse_data("orig", rec->orig_data_length); - if (rec->orig_data == NULL) { + rec->_orig_data = parse_data("orig", rec->_orig_data_length); + if (rec->_orig_data == NULL) { return; } - rec->data = parse_intptr_data("data", rec->data_length); - if (rec->data == NULL) { + rec->_data = parse_intptr_data("data", rec->_data_length); + if (rec->_data == NULL) { return; } - if (!parse_tag_and_count("oops", rec->oops_length)) { + if (!parse_tag_and_count("oops", rec->_oops_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->_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++) { int offset = parse_int("offset"); if (had_error()) { return; } Klass* k = parse_klass(CHECK); - rec->oops_offsets[i] = offset; + 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->_oops_handles[i] = (jobject)kh; } } @@ -570,6 +682,9 @@ class CompileReplay : public StackObj { case JVM_CONSTANT_Utf8: case JVM_CONSTANT_Integer: case JVM_CONSTANT_Float: + case JVM_CONSTANT_MethodHandle: + case JVM_CONSTANT_MethodType: + case JVM_CONSTANT_InvokeDynamic: if (tag != cp->tag_at(i).value()) { report_error("tag mismatch: wrong class files?"); return; @@ -729,10 +844,10 @@ class CompileReplay : public StackObj { // Create and initialize a record for a ciMethod ciMethodRecord* new_ciMethod(Method* method) { ciMethodRecord* rec = NEW_RESOURCE_OBJ(ciMethodRecord); - rec->klass = method->method_holder()->name()->as_utf8(); - rec->method = method->name()->as_utf8(); - rec->signature = method->signature()->as_utf8(); - ci_method_records.append(rec); + rec->_klass_name = method->method_holder()->name()->as_utf8(); + rec->_method_name = method->name()->as_utf8(); + rec->_signature = method->signature()->as_utf8(); + _ci_method_records.append(rec); return rec; } @@ -741,11 +856,11 @@ class CompileReplay : public StackObj { const char* klass_name = method->method_holder()->name()->as_utf8(); const char* method_name = method->name()->as_utf8(); const char* signature = method->signature()->as_utf8(); - for (int i = 0; i < ci_method_records.length(); i++) { - ciMethodRecord* rec = ci_method_records.at(i); - if (strcmp(rec->klass, klass_name) == 0 && - strcmp(rec->method, method_name) == 0 && - strcmp(rec->signature, signature) == 0) { + for (int i = 0; i < _ci_method_records.length(); i++) { + ciMethodRecord* rec = _ci_method_records.at(i); + if (strcmp(rec->_klass_name, klass_name) == 0 && + strcmp(rec->_method_name, method_name) == 0 && + strcmp(rec->_signature, signature) == 0) { return rec; } } @@ -755,10 +870,10 @@ class CompileReplay : public StackObj { // Create and initialize a record for a ciMethodData ciMethodDataRecord* new_ciMethodData(Method* method) { ciMethodDataRecord* rec = NEW_RESOURCE_OBJ(ciMethodDataRecord); - rec->klass = method->method_holder()->name()->as_utf8(); - rec->method = method->name()->as_utf8(); - rec->signature = method->signature()->as_utf8(); - ci_method_data_records.append(rec); + rec->_klass_name = method->method_holder()->name()->as_utf8(); + rec->_method_name = method->name()->as_utf8(); + rec->_signature = method->signature()->as_utf8(); + _ci_method_data_records.append(rec); return rec; } @@ -767,25 +882,65 @@ class CompileReplay : public StackObj { const char* klass_name = method->method_holder()->name()->as_utf8(); const char* method_name = method->name()->as_utf8(); const char* signature = method->signature()->as_utf8(); - for (int i = 0; i < ci_method_data_records.length(); i++) { - ciMethodDataRecord* rec = ci_method_data_records.at(i); - if (strcmp(rec->klass, klass_name) == 0 && - strcmp(rec->method, method_name) == 0 && - strcmp(rec->signature, signature) == 0) { + for (int i = 0; i < _ci_method_data_records.length(); i++) { + ciMethodDataRecord* rec = _ci_method_data_records.at(i); + if (strcmp(rec->_klass_name, klass_name) == 0 && + strcmp(rec->_method_name, method_name) == 0 && + strcmp(rec->_signature, signature) == 0) { return rec; } } return NULL; } + // Create and initialize a record for a ciInlineRecord + ciInlineRecord* new_ciInlineRecord(Method* method, int bci, int depth) { + ciInlineRecord* rec = NEW_RESOURCE_OBJ(ciInlineRecord); + rec->_klass_name = method->method_holder()->name()->as_utf8(); + rec->_method_name = method->name()->as_utf8(); + rec->_signature = method->signature()->as_utf8(); + rec->_inline_bci = bci; + rec->_inline_depth = depth; + _ci_inline_records->append(rec); + return rec; + } + + // Lookup inlining data for a ciMethod + ciInlineRecord* find_ciInlineRecord(Method* method, int bci, int depth) { + if (_ci_inline_records != NULL) { + return find_ciInlineRecord(_ci_inline_records, method, bci, depth); + } + return NULL; + } + + static ciInlineRecord* find_ciInlineRecord(GrowableArray* records, + Method* method, int bci, int depth) { + if (records != NULL) { + const char* klass_name = method->method_holder()->name()->as_utf8(); + const char* method_name = method->name()->as_utf8(); + const char* signature = method->signature()->as_utf8(); + for (int i = 0; i < records->length(); i++) { + ciInlineRecord* rec = records->at(i); + if ((rec->_inline_bci == bci) && + (rec->_inline_depth == depth) && + (strcmp(rec->_klass_name, klass_name) == 0) && + (strcmp(rec->_method_name, method_name) == 0) && + (strcmp(rec->_signature, signature) == 0)) { + return rec; + } + } + } + return NULL; + } + const char* error_message() { return _error_message; } void reset() { _error_message = NULL; - ci_method_records.clear(); - ci_method_data_records.clear(); + _ci_method_records.clear(); + _ci_method_data_records.clear(); } // Take an ascii string contain \u#### escapes and convert it to utf8 @@ -845,6 +1000,37 @@ void ciReplay::replay(TRAPS) { vm_exit(exit_code); } +void* ciReplay::load_inline_data(ciMethod* method, int entry_bci, int comp_level) { + if (FLAG_IS_DEFAULT(InlineDataFile)) { + tty->print_cr("ERROR: no inline replay data file specified (use -XX:InlineDataFile=inline_pid12345.txt)."); + return NULL; + } + + VM_ENTRY_MARK; + // Load and parse the replay data + CompileReplay rp(InlineDataFile, THREAD); + if (!rp.can_replay()) { + tty->print_cr("ciReplay: !rp.can_replay()"); + return NULL; + } + void* data = rp.process_inline(method, method->get_Method(), entry_bci, comp_level, THREAD); + if (HAS_PENDING_EXCEPTION) { + oop throwable = PENDING_EXCEPTION; + CLEAR_PENDING_EXCEPTION; + java_lang_Throwable::print(throwable, tty); + tty->cr(); + java_lang_Throwable::print_stack_trace(throwable, tty); + tty->cr(); + return NULL; + } + + if (rp.had_error()) { + tty->print_cr("ciReplay: Failed on %s", rp.error_message()); + return NULL; + } + return data; +} + int ciReplay::replay_impl(TRAPS) { HandleMark hm; ResourceMark rm; @@ -890,7 +1076,6 @@ int ciReplay::replay_impl(TRAPS) { return exit_code; } - void ciReplay::initialize(ciMethodData* m) { if (replay_state == NULL) { return; @@ -909,28 +1094,28 @@ void ciReplay::initialize(ciMethodData* m) { method->print_name(tty); tty->cr(); } else { - 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"); + 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"); // 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]) = + 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)()); } // Copy the updated profile data into place as intptr_ts #ifdef _LP64 - Copy::conjoint_jlongs_atomic((jlong *)rec->data, (jlong *)m->_data, rec->data_length); + Copy::conjoint_jlongs_atomic((jlong *)rec->_data, (jlong *)m->_data, rec->_data_length); #else - Copy::conjoint_jints_atomic((jint *)rec->data, (jint *)m->_data, rec->data_length); + Copy::conjoint_jints_atomic((jint *)rec->_data, (jint *)m->_data, rec->_data_length); #endif } // copy in the original header - Copy::conjoint_jbytes(rec->orig_data, (char*)&m->_orig, rec->orig_data_length); + Copy::conjoint_jbytes(rec->_orig_data, (char*)&m->_orig, rec->_orig_data_length); } } @@ -939,12 +1124,38 @@ bool ciReplay::should_not_inline(ciMethod* method) { if (replay_state == NULL) { return false; } - VM_ENTRY_MARK; // ciMethod without a record shouldn't be inlined. return replay_state->find_ciMethodRecord(method->get_Method()) == NULL; } +bool ciReplay::should_inline(void* data, ciMethod* method, int bci, int inline_depth) { + if (data != NULL) { + GrowableArray* records = (GrowableArray*)data; + VM_ENTRY_MARK; + // Inline record are ordered by bci and depth. + return CompileReplay::find_ciInlineRecord(records, method->get_Method(), bci, inline_depth) != NULL; + } else if (replay_state != NULL) { + VM_ENTRY_MARK; + // Inline record are ordered by bci and depth. + return replay_state->find_ciInlineRecord(method->get_Method(), bci, inline_depth) != NULL; + } + return false; +} + +bool ciReplay::should_not_inline(void* data, ciMethod* method, int bci, int inline_depth) { + if (data != NULL) { + GrowableArray* records = (GrowableArray*)data; + VM_ENTRY_MARK; + // Inline record are ordered by bci and depth. + return CompileReplay::find_ciInlineRecord(records, method->get_Method(), bci, inline_depth) == NULL; + } else if (replay_state != NULL) { + VM_ENTRY_MARK; + // Inline record are ordered by bci and depth. + return replay_state->find_ciInlineRecord(method->get_Method(), bci, inline_depth) == NULL; + } + return false; +} void ciReplay::initialize(ciMethod* m) { if (replay_state == NULL) { @@ -965,14 +1176,14 @@ void ciReplay::initialize(ciMethod* m) { tty->cr(); } else { EXCEPTION_CONTEXT; - // m->_instructions_size = rec->instructions_size; + // m->_instructions_size = rec->_instructions_size; m->_instructions_size = -1; - m->_interpreter_invocation_count = rec->interpreter_invocation_count; - m->_interpreter_throwout_count = rec->interpreter_throwout_count; + m->_interpreter_invocation_count = rec->_interpreter_invocation_count; + m->_interpreter_throwout_count = rec->_interpreter_throwout_count; MethodCounters* mcs = method->get_method_counters(CHECK_AND_CLEAR); guarantee(mcs != NULL, "method counters allocation failed"); - mcs->invocation_counter()->_counter = rec->invocation_counter; - mcs->backedge_counter()->_counter = rec->backedge_counter; + mcs->invocation_counter()->_counter = rec->_invocation_counter; + mcs->backedge_counter()->_counter = rec->_backedge_counter; } } diff --git a/hotspot/src/share/vm/ci/ciReplay.hpp b/hotspot/src/share/vm/ci/ciReplay.hpp index 8fff3454d27..90c503a64d8 100644 --- a/hotspot/src/share/vm/ci/ciReplay.hpp +++ b/hotspot/src/share/vm/ci/ciReplay.hpp @@ -29,6 +29,73 @@ // ciReplay +// +// Replay compilation of a java method by using an information in replay file. +// Replay inlining decisions during compilation by using an information in inline file. +// +// NOTE: these replay functions only exist in debug version of VM. +// +// Replay compilation. +// ------------------- +// +// Replay data file replay.txt can be created by Serviceability Agent +// from a core file, see agent/doc/cireplay.html +// +// $ java -cp /lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB +// hsdb> attach /bin/java ./core +// hsdb> threads +// t@10 Service Thread +// t@9 C2 CompilerThread0 +// t@8 Signal Dispatcher +// t@7 Finalizer +// t@6 Reference Handler +// t@2 main +// hsdb> dumpreplaydata t@9 > replay.txt +// hsdb> quit +// +// (Note: SA could be also used to extract app.jar and boot.jar files +// from core file to replay compilation if only core file is available) +// +// Replay data file replay_pid%p.log is also created when VM crashes +// in Compiler thread during compilation. It is controlled by +// DumpReplayDataOnError flag which is ON by default. +// +// Replay file replay_pid%p_compid%d.log can be created +// for the specified java method during normal execution using +// CompileCommand option DumpReplay: +// +// -XX:CompileCommand=option,Benchmark::test,DumpReplay +// +// In this case the file name has additional compilation id "_compid%d" +// because the method could be compiled several times. +// +// To replay compilation the replay file should be specified: +// +// -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid2133.log +// +// VM thread reads data from the file immediately after VM initialization +// and puts the compilation task on compile queue. After that it goes into +// wait state (BackgroundCompilation flag is set to false) since there is no +// a program to execute. VM exits when the compilation is finished. +// +// +// Replay inlining. +// ---------------- +// +// Replay inlining file inline_pid%p_compid%d.log is created for +// a specific java method during normal execution of a java program +// using CompileCommand option DumpInline: +// +// -XX:CompileCommand=option,Benchmark::test,DumpInline +// +// To replay inlining the replay file and the method should be specified: +// +// -XX:CompileCommand=option,Benchmark::test,ReplayInline -XX:InlineDataFile=inline_pid3244_compid6.log +// +// The difference from replay compilation is that replay inlining +// is performed during normal java program execution. +// + class ciReplay { CI_PACKAGE_ACCESS @@ -37,7 +104,11 @@ class ciReplay { static int replay_impl(TRAPS); public: + // Replay specified compilation and exit VM. static void replay(TRAPS); + // Load inlining decisions from file and use them + // during compilation of specified method. + static void* load_inline_data(ciMethod* method, int entry_bci, int comp_level); // These are used by the CI to fill in the cached data from the // replay file when replaying compiles. @@ -48,6 +119,8 @@ class ciReplay { static bool is_loaded(Klass* klass); static bool should_not_inline(ciMethod* method); + static bool should_inline(void* data, ciMethod* method, int bci, int inline_depth); + static bool should_not_inline(void* data, ciMethod* method, int bci, int inline_depth); #endif }; diff --git a/hotspot/src/share/vm/ci/ciStreams.hpp b/hotspot/src/share/vm/ci/ciStreams.hpp index 92a1a4adf88..091aa1bdf53 100644 --- a/hotspot/src/share/vm/ci/ciStreams.hpp +++ b/hotspot/src/share/vm/ci/ciStreams.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciType.cpp b/hotspot/src/share/vm/ci/ciType.cpp index e74dd921804..15c884213bb 100644 --- a/hotspot/src/share/vm/ci/ciType.cpp +++ b/hotspot/src/share/vm/ci/ciType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/ci/ciType.hpp b/hotspot/src/share/vm/ci/ciType.hpp index 25f79e01263..c3901e4b06f 100644 --- a/hotspot/src/share/vm/ci/ciType.hpp +++ b/hotspot/src/share/vm/ci/ciType.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/ci/ciTypeArray.cpp b/hotspot/src/share/vm/ci/ciTypeArray.cpp index 2d013e21c0e..15113348e21 100644 --- a/hotspot/src/share/vm/ci/ciTypeArray.cpp +++ b/hotspot/src/share/vm/ci/ciTypeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp b/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp index b88aecb9c6c..607c00cc50b 100644 --- a/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp +++ b/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp index b76dd3d0fe3..48bcaf369a9 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/ci/ciUtilities.hpp b/hotspot/src/share/vm/ci/ciUtilities.hpp index 2032a8f35e1..bba611fc3b6 100644 --- a/hotspot/src/share/vm/ci/ciUtilities.hpp +++ b/hotspot/src/share/vm/ci/ciUtilities.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp index 77b6a9ea747..cbf3baf7945 100644 --- a/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp +++ b/hotspot/src/share/vm/classfile/bytecodeAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/classfile/classFileStream.cpp b/hotspot/src/share/vm/classfile/classFileStream.cpp index 1c69dfb2ea6..27479acb64a 100644 --- a/hotspot/src/share/vm/classfile/classFileStream.cpp +++ b/hotspot/src/share/vm/classfile/classFileStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/classfile/classFileStream.hpp b/hotspot/src/share/vm/classfile/classFileStream.hpp index 19da924abf2..691ed808fec 100644 --- a/hotspot/src/share/vm/classfile/classFileStream.hpp +++ b/hotspot/src/share/vm/classfile/classFileStream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index 273e0184d8e..892ea92fb00 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -648,12 +648,12 @@ GrowableArray* ClassLoaderDataGraph::new_clds() { return array; } -#ifndef PRODUCT -// for debugging and hsfind(x) -bool ClassLoaderDataGraph::contains(address x) { - // I think we need the _metaspace_lock taken here because the class loader - // data graph could be changing while we are walking it (new entries added, - // new entries being unloaded, etc). +// For profiling and hsfind() only. Otherwise, this is unsafe (and slow). This +// is done lock free to avoid lock inversion problems. It is safe because +// new ClassLoaderData are added to the end of the CLDG, and only removed at +// safepoint. The _unloading list can be deallocated concurrently with CMS so +// this doesn't look in metaspace for classes that have been unloaded. +bool ClassLoaderDataGraph::contains(const void* x) { if (DumpSharedSpaces) { // There are only two metaspaces to worry about. ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data(); @@ -670,16 +670,11 @@ bool ClassLoaderDataGraph::contains(address x) { } } - // Could also be on an unloading list which is okay, ie. still allocated - // for a little while. - for (ClassLoaderData* ucld = _unloading; ucld != NULL; ucld = ucld->next()) { - if (ucld->metaspace_or_null() != NULL && ucld->metaspace_or_null()->contains(x)) { - return true; - } - } + // Do not check unloading list because deallocation can be concurrent. return false; } +#ifndef PRODUCT bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) { for (ClassLoaderData* data = _head; data != NULL; data = data->next()) { if (loader_data == data) { diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp index 2cb21801de5..9e76b50441f 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp @@ -90,9 +90,9 @@ class ClassLoaderDataGraph : public AllStatic { static void dump() { dump_on(tty); } static void verify(); -#ifndef PRODUCT // expensive test for pointer in metaspace for debugging - static bool contains(address x); + static bool contains(const void* x); +#ifndef PRODUCT static bool contains_loader_data(ClassLoaderData* loader_data); #endif diff --git a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp index 018b6761c50..11014f25cbb 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp index 129eecbad3b..0ebeecc624b 100644 --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp @@ -349,6 +349,7 @@ class MethodFamily : public ResourceObj { } Symbol* generate_no_defaults_message(TRAPS) const; + Symbol* generate_method_message(Symbol *klass_name, Method* method, TRAPS) const; Symbol* generate_conflicts_message(GrowableArray* methods, TRAPS) const; public: @@ -414,21 +415,25 @@ class MethodFamily : public ResourceObj { } } - if (qualified_methods.length() == 0) { - _exception_message = generate_no_defaults_message(CHECK); + if (num_defaults == 0) { + if (qualified_methods.length() == 0) { + _exception_message = generate_no_defaults_message(CHECK); + } else { + assert(root != NULL, "Null root class"); + _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); + } _exception_name = vmSymbols::java_lang_AbstractMethodError(); // If only one qualified method is default, select that } else if (num_defaults == 1) { _selected_target = qualified_methods.at(default_index); } else if (num_defaults > 1) { - _exception_message = generate_conflicts_message(&qualified_methods,CHECK); - _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); + _exception_message = generate_conflicts_message(&qualified_methods,CHECK); + _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); if (TraceDefaultMethods) { _exception_message->print_value_on(tty); tty->print_cr(""); } } - // leave abstract methods alone, they will be found via normal search path } bool contains_signature(Symbol* query) { @@ -486,6 +491,19 @@ Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const { return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL); } +Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const { + stringStream ss; + ss.print("Method "); + Symbol* name = method->name(); + Symbol* signature = method->signature(); + ss.write((const char*)klass_name->bytes(), klass_name->utf8_length()); + ss.print("."); + ss.write((const char*)name->bytes(), name->utf8_length()); + ss.write((const char*)signature->bytes(), signature->utf8_length()); + ss.print(" is abstract"); + return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); +} + Symbol* MethodFamily::generate_conflicts_message(GrowableArray* methods, TRAPS) const { stringStream ss; ss.print("Conflicting default methods:"); @@ -1026,7 +1044,8 @@ static void merge_in_new_methods(InstanceKlass* klass, Array* merged_methods = MetadataFactory::new_array( klass->class_loader_data(), new_size, NULL, CHECK); - if (original_ordering != NULL && original_ordering->length() > 0) { + // original_ordering might be empty if this class has no methods of its own + if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { merged_ordering = MetadataFactory::new_array( klass->class_loader_data(), new_size, CHECK); } @@ -1053,6 +1072,8 @@ static void merge_in_new_methods(InstanceKlass* klass, merged_methods->at_put(i, orig_method); original_methods->at_put(orig_idx, NULL); if (merged_ordering->length() > 0) { + assert(original_ordering != NULL && original_ordering->length() > 0, + "should have original order information for this method"); merged_ordering->at_put(i, original_ordering->at(orig_idx)); } ++orig_idx; @@ -1081,13 +1102,14 @@ static void merge_in_new_methods(InstanceKlass* klass, // Replace klass methods with new merged lists klass->set_methods(merged_methods); klass->set_initial_method_idnum(new_size); + klass->set_method_ordering(merged_ordering); + // Free metadata ClassLoaderData* cld = klass->class_loader_data(); - if (original_methods ->length() > 0) { + if (original_methods->length() > 0) { MetadataFactory::free_array(cld, original_methods); } - if (original_ordering->length() > 0) { - klass->set_method_ordering(merged_ordering); + if (original_ordering != NULL && original_ordering->length() > 0) { MetadataFactory::free_array(cld, original_ordering); } } diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 06e75ea25d7..d9bd3a4d713 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -3286,7 +3286,7 @@ void JavaClasses::compute_offsets() { sun_reflect_ConstantPool::compute_offsets(); sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets(); } - if (JDK_Version::is_jdk18x_version()) + if (JDK_Version::is_gte_jdk18x_version()) java_lang_reflect_Parameter::compute_offsets(); // generated interpreter code wants to know about the offsets we just computed: diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index ee311b6a85f..f5c5c017dcd 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1049,6 +1049,9 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name, add_to_hierarchy(k, CHECK_NULL); // No exception, but can block // But, do not add to system dictionary. + + // compiled code dependencies need to be validated anyway + notice_modification(); } // Rewrite and patch constant pool here. diff --git a/hotspot/src/share/vm/classfile/vmSymbols.cpp b/hotspot/src/share/vm/classfile/vmSymbols.cpp index cc38c6d2cd6..855c6bdd773 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.cpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 9a06792793a..58485959f66 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -654,9 +654,9 @@ do_intrinsic(_addExactI, java_lang_Math, addExact_name, int2_int_signature, F_S) \ do_intrinsic(_addExactL, java_lang_Math, addExact_name, long2_long_signature, F_S) \ do_intrinsic(_decrementExactI, java_lang_Math, decrementExact_name, int_int_signature, F_S) \ - do_intrinsic(_decrementExactL, java_lang_Math, decrementExact_name, long2_long_signature, F_S) \ + do_intrinsic(_decrementExactL, java_lang_Math, decrementExact_name, long_long_signature, F_S) \ do_intrinsic(_incrementExactI, java_lang_Math, incrementExact_name, int_int_signature, F_S) \ - do_intrinsic(_incrementExactL, java_lang_Math, incrementExact_name, long2_long_signature, F_S) \ + do_intrinsic(_incrementExactL, java_lang_Math, incrementExact_name, long_long_signature, F_S) \ do_intrinsic(_multiplyExactI, java_lang_Math, multiplyExact_name, int2_int_signature, F_S) \ do_intrinsic(_multiplyExactL, java_lang_Math, multiplyExact_name, long2_long_signature, F_S) \ do_intrinsic(_negateExactI, java_lang_Math, negateExact_name, int_int_signature, F_S) \ diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp index 489e649fadc..251a4c79c43 100644 --- a/hotspot/src/share/vm/code/compiledIC.cpp +++ b/hotspot/src/share/vm/code/compiledIC.cpp @@ -418,7 +418,7 @@ void CompiledIC::compute_monomorphic_entry(methodHandle method, TRAPS) { nmethod* method_code = method->code(); address entry = NULL; - if (method_code != NULL) { + if (method_code != NULL && method_code->is_in_use()) { // Call to compiled code if (static_bound || is_optimized) { entry = method_code->verified_entry_point(); @@ -545,7 +545,7 @@ void CompiledStaticCall::set(const StaticCallInfo& info) { void CompiledStaticCall::compute_entry(methodHandle m, StaticCallInfo& info) { nmethod* m_code = m->code(); info._callee = m; - if (m_code != NULL) { + if (m_code != NULL && m_code->is_in_use()) { info._to_interpreter = false; info._entry = m_code->verified_entry_point(); } else { diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp index 598cbe949e2..0d522af63fe 100644 --- a/hotspot/src/share/vm/code/compiledIC.hpp +++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/compressedStream.cpp b/hotspot/src/share/vm/code/compressedStream.cpp index 82b05fc03f9..1716ffac651 100644 --- a/hotspot/src/share/vm/code/compressedStream.cpp +++ b/hotspot/src/share/vm/code/compressedStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/debugInfo.hpp b/hotspot/src/share/vm/code/debugInfo.hpp index 7a4f7e2d41d..cf0a9a6d39f 100644 --- a/hotspot/src/share/vm/code/debugInfo.hpp +++ b/hotspot/src/share/vm/code/debugInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp index 4419bdd986c..b4a3aee7f54 100644 --- a/hotspot/src/share/vm/code/dependencies.cpp +++ b/hotspot/src/share/vm/code/dependencies.cpp @@ -655,8 +655,6 @@ inline Metadata* Dependencies::DepStream::recorded_metadata_at(int i) { } else { o = _deps->oop_recorder()->metadata_at(i); } - assert(o == NULL || o->is_metaspace_object(), - err_msg("Should be metadata " PTR_FORMAT, o)); return o; } diff --git a/hotspot/src/share/vm/code/icBuffer.hpp b/hotspot/src/share/vm/code/icBuffer.hpp index 47db2d6b269..471706aaa6d 100644 --- a/hotspot/src/share/vm/code/icBuffer.hpp +++ b/hotspot/src/share/vm/code/icBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 68718499a00..b9dd9903440 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -459,7 +459,7 @@ const char* nmethod::compile_kind() const { // Fill in default values for various flag fields void nmethod::init_defaults() { - _state = alive; + _state = in_use; _marked_for_reclamation = 0; _has_flushed_dependencies = 0; _has_unsafe_access = 0; @@ -1660,8 +1660,8 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) CompiledICHolder* cichk_oop = ic->cached_icholder(); if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) && cichk_oop->holder_klass()->is_loader_alive(is_alive)) { - continue; - } + continue; + } } else { Metadata* ic_oop = ic->cached_metadata(); if (ic_oop != NULL) { @@ -1677,8 +1677,8 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) ShouldNotReachHere(); } } - } - ic->set_to_clean(); + } + ic->set_to_clean(); } } } @@ -2393,8 +2393,8 @@ void nmethod::verify() { void nmethod::verify_interrupt_point(address call_site) { // Verify IC only when nmethod installation is finished. - bool is_installed = (method()->code() == this) // nmethod is in state 'alive' and installed - || !this->is_in_use(); // nmethod is installed, but not in 'alive' state + bool is_installed = (method()->code() == this) // nmethod is in state 'in_use' and installed + || !this->is_in_use(); // nmethod is installed, but not in 'in_use' state if (is_installed) { Thread *cur = Thread::current(); if (CompiledIC_lock->owner() == cur || diff --git a/hotspot/src/share/vm/code/nmethod.hpp b/hotspot/src/share/vm/code/nmethod.hpp index 538bcf77837..4e1afcc046b 100644 --- a/hotspot/src/share/vm/code/nmethod.hpp +++ b/hotspot/src/share/vm/code/nmethod.hpp @@ -184,11 +184,12 @@ class nmethod : public CodeBlob { bool _oops_are_stale; // indicates that it's no longer safe to access oops section #endif - enum { alive = 0, - not_entrant = 1, // uncommon trap has happened but activations may still exist - zombie = 2, - unloaded = 3 }; - + enum { in_use = 0, // executable nmethod + not_entrant = 1, // marked for deoptimization but activations may still exist, + // will be transformed to zombie when all activations are gone + zombie = 2, // no activations exist, nmethod is ready for purge + unloaded = 3 }; // there should be no activations, should not be called, + // will be transformed to zombie immediately jbyte _scavenge_root_state; @@ -407,8 +408,8 @@ class nmethod : public CodeBlob { address verified_entry_point() const { return _verified_entry_point; } // if klass is correct // flag accessing and manipulation - bool is_in_use() const { return _state == alive; } - bool is_alive() const { return _state == alive || _state == not_entrant; } + bool is_in_use() const { return _state == in_use; } + bool is_alive() const { return _state == in_use || _state == not_entrant; } bool is_not_entrant() const { return _state == not_entrant; } bool is_zombie() const { return _state == zombie; } bool is_unloaded() const { return _state == unloaded; } diff --git a/hotspot/src/share/vm/code/relocInfo.cpp b/hotspot/src/share/vm/code/relocInfo.cpp index 4fe6a2e4949..b5cf45e68b6 100644 --- a/hotspot/src/share/vm/code/relocInfo.cpp +++ b/hotspot/src/share/vm/code/relocInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/scopeDesc.hpp b/hotspot/src/share/vm/code/scopeDesc.hpp index 3a1921406b5..7330f6edbd6 100644 --- a/hotspot/src/share/vm/code/scopeDesc.hpp +++ b/hotspot/src/share/vm/code/scopeDesc.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 @@ -86,8 +86,6 @@ class ScopeDesc : public ResourceObj { // Tells whether sender() returns NULL bool is_top() const; - // Tells whether sd is equal to this - bool is_equal(ScopeDesc* sd) const; private: // Alternative constructor diff --git a/hotspot/src/share/vm/code/stubs.cpp b/hotspot/src/share/vm/code/stubs.cpp index a826a3550d3..9044c5f8e73 100644 --- a/hotspot/src/share/vm/code/stubs.cpp +++ b/hotspot/src/share/vm/code/stubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/code/stubs.hpp b/hotspot/src/share/vm/code/stubs.hpp index 233f43e2dae..045782f397c 100644 --- a/hotspot/src/share/vm/code/stubs.hpp +++ b/hotspot/src/share/vm/code/stubs.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/compiler/abstractCompiler.cpp b/hotspot/src/share/vm/compiler/abstractCompiler.cpp index 3f452a1b53b..0e9c3cf16ee 100644 --- a/hotspot/src/share/vm/compiler/abstractCompiler.cpp +++ b/hotspot/src/share/vm/compiler/abstractCompiler.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/compiler/abstractCompiler.hpp b/hotspot/src/share/vm/compiler/abstractCompiler.hpp index d150e8e8085..67f7c95b03d 100644 --- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp +++ b/hotspot/src/share/vm/compiler/abstractCompiler.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 @@ -40,8 +40,19 @@ class AbstractCompiler : public CHeapObj { // This thread will initialize the compiler runtime. bool should_perform_init(); + // The (closed set) of concrete compiler classes. + enum Type { + none, + c1, + c2, + shark + }; + + private: + Type _type; + public: - AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {} + AbstractCompiler(Type type) : _type(type), _compiler_state(uninitialized), _num_compiler_threads(0) {} // This function determines the compiler thread that will perform the // shutdown of the corresponding compiler runtime. @@ -54,27 +65,11 @@ class AbstractCompiler : public CHeapObj { virtual bool supports_native() { return true; } virtual bool supports_osr () { return true; } virtual bool can_compile_method(methodHandle method) { return true; } -#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)) - virtual bool is_c1 () { return false; } - virtual bool is_c2 () { return false; } - virtual bool is_shark() { return false; } -#else -#ifdef COMPILER1 - bool is_c1 () { return true; } - bool is_c2 () { return false; } - bool is_shark() { return false; } -#endif // COMPILER1 -#ifdef COMPILER2 - bool is_c1 () { return false; } - bool is_c2 () { return true; } - bool is_shark() { return false; } -#endif // COMPILER2 -#ifdef SHARK - bool is_c1 () { return false; } - bool is_c2 () { return false; } - bool is_shark() { return true; } -#endif // SHARK -#endif // TIERED + + // Compiler type queries. + bool is_c1() { return _type == c1; } + bool is_c2() { return _type == c2; } + bool is_shark() { return _type == shark; } // Customization virtual void initialize () = 0; diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index f8fa26ff8c2..a6c9117e946 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -132,9 +132,9 @@ volatile jint CompileBroker::_should_compile_new_jobs = run_compilation; // The installed compiler(s) AbstractCompiler* CompileBroker::_compilers[2]; -// These counters are used for assigning id's to each compilation -uint CompileBroker::_compilation_id = 0; -uint CompileBroker::_osr_compilation_id = 0; +// These counters are used to assign an unique ID to each compilation. +volatile jint CompileBroker::_compilation_id = 0; +volatile jint CompileBroker::_osr_compilation_id = 0; // Debugging information int CompileBroker::_last_compile_type = no_compile; @@ -1158,7 +1158,7 @@ void CompileBroker::compile_method_base(methodHandle method, // We now know that this compilation is not pending, complete, // or prohibited. Assign a compile_id to this compilation // and check to see if it is in our [Start..Stop) range. - uint compile_id = assign_compile_id(method, osr_bci); + int compile_id = assign_compile_id(method, osr_bci); if (compile_id == 0) { // The compilation falls outside the allowed range. return; @@ -1305,18 +1305,12 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, // do the compilation if (method->is_native()) { if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) { - // Acquire our lock. - int compile_id; - { - MutexLocker locker(MethodCompileQueue_lock, THREAD); - compile_id = assign_compile_id(method, standard_entry_bci); - } // To properly handle the appendix argument for out-of-line calls we are using a small trampoline that // pops off the appendix argument and jumps to the target (see gen_special_dispatch in SharedRuntime). // // Since normal compiled-to-compiled calls are not able to handle such a thing we MUST generate an adapter // in this case. If we can't generate one and use it we can not execute the out-of-line method handle calls. - (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); + AdapterHandlerLibrary::create_native_wrapper(method); } else { return NULL; } @@ -1419,27 +1413,28 @@ bool CompileBroker::compilation_is_prohibited(methodHandle method, int osr_bci, return false; } - -// ------------------------------------------------------------------ -// CompileBroker::assign_compile_id -// -// Assign a serialized id number to this compilation request. If the -// number falls out of the allowed range, return a 0. OSR -// compilations may be numbered separately from regular compilations -// if certain debugging flags are used. -uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { - assert(MethodCompileQueue_lock->owner() == Thread::current(), - "must hold the compilation queue lock"); +/** + * Generate serialized IDs for compilation requests. If certain debugging flags are used + * and the ID is not within the specified range, the method is not compiled and 0 is returned. + * The function also allows to generate separate compilation IDs for OSR compilations. + */ +int CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { +#ifdef ASSERT bool is_osr = (osr_bci != standard_entry_bci); - uint id; - if (CICountOSR && is_osr) { - id = ++_osr_compilation_id; - if ((uint)CIStartOSR <= id && id < (uint)CIStopOSR) { + int id; + if (method->is_native()) { + assert(!is_osr, "can't be osr"); + // Adapters, native wrappers and method handle intrinsics + // should be generated always. + return Atomic::add(1, &_compilation_id); + } else if (CICountOSR && is_osr) { + id = Atomic::add(1, &_osr_compilation_id); + if (CIStartOSR <= id && id < CIStopOSR) { return id; } } else { - id = ++_compilation_id; - if ((uint)CIStart <= id && id < (uint)CIStop) { + id = Atomic::add(1, &_compilation_id); + if (CIStart <= id && id < CIStop) { return id; } } @@ -1447,6 +1442,11 @@ uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { // Method was not in the appropriate compilation range. method->set_not_compilable_quietly(); return 0; +#else + // CICountOSR is a develop flag and set to 'false' by default. In a product built, + // only _compilation_id is incremented. + return Atomic::add(1, &_compilation_id); +#endif } diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index a74afb3065f..75cbcafaac0 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -246,6 +246,8 @@ class CompileBroker: AllStatic { // Compile type Information for print_last_compile() and CompilerCounters enum { no_compile, normal_compile, osr_compile, native_compile }; + static int assign_compile_id (methodHandle method, int osr_bci); + private: static bool _initialized; @@ -258,9 +260,8 @@ class CompileBroker: AllStatic { static AbstractCompiler* _compilers[2]; // These counters are used for assigning id's to each compilation - static uint _compilation_id; - static uint _osr_compilation_id; - static uint _native_compilation_id; + static volatile jint _compilation_id; + static volatile jint _osr_compilation_id; static int _last_compile_type; static int _last_compile_level; @@ -321,7 +322,6 @@ class CompileBroker: AllStatic { static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count); static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level); static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level); - static uint assign_compile_id (methodHandle method, int osr_bci); static bool is_compile_blocking (methodHandle method, int osr_bci); static void preload_classes (methodHandle method, TRAPS); diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp index 2cce602f3ed..bff35b17392 100644 --- a/hotspot/src/share/vm/compiler/compileLog.cpp +++ b/hotspot/src/share/vm/compiler/compileLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/compiler/compileLog.hpp b/hotspot/src/share/vm/compiler/compileLog.hpp index 8b740f9f2a2..d0fe07be91f 100644 --- a/hotspot/src/share/vm/compiler/compileLog.hpp +++ b/hotspot/src/share/vm/compiler/compileLog.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/compiler/compilerOracle.cpp b/hotspot/src/share/vm/compiler/compilerOracle.cpp index 8b9141269cc..cb5068dc4c6 100644 --- a/hotspot/src/share/vm/compiler/compilerOracle.cpp +++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp index 070e0321e08..8495210c384 100644 --- a/hotspot/src/share/vm/compiler/disassembler.cpp +++ b/hotspot/src/share/vm/compiler/disassembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 diff --git a/hotspot/src/share/vm/compiler/disassembler.hpp b/hotspot/src/share/vm/compiler/disassembler.hpp index c81666ec25d..639fe69c2ea 100644 --- a/hotspot/src/share/vm/compiler/disassembler.hpp +++ b/hotspot/src/share/vm/compiler/disassembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp index cfba2376ea8..501f15fb3ad 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, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp index 7215119aef5..b628cd7f1b4 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp index d26959f3d9f..378c5e66436 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp index f7730287b94..b910dd6e367 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index 74c97e8df9d..e625d3a18e6 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp index f8b0ccb90fe..29939dd86e7 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp index 5c3f01583ad..cbb59df0e77 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, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp index ed4b807fb4a..07b92d0fbe5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp index e9f6f8225af..e177fd1e6ae 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp index f0b4da8a885..2a6acd4a7ee 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @@ -27,6 +27,7 @@ #include "gc_implementation/g1/concurrentG1RefineThread.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1HotCardCache.hpp" +#include "runtime/java.hpp" ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) : _threads(NULL), _n_threads(0), @@ -62,6 +63,10 @@ ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) : for (int i = _n_threads - 1; i >= 0; i--) { ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i); assert(t != NULL, "Conc refine should have been created"); + if (t->osthread() == NULL) { + vm_shutdown_during_initialization("Could not create ConcurrentG1RefineThread"); + } + assert(t->cg1r() == this, "Conc refine thread should refer to this"); _threads[i] = t; next = t; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 282dd722228..4e458312666 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -553,6 +553,9 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) : _cmThread = new ConcurrentMarkThread(this); assert(cmThread() != NULL, "CM Thread should have been created"); assert(cmThread()->cm() != NULL, "CM Thread should refer to this cm"); + if (_cmThread->osthread() == NULL) { + vm_shutdown_during_initialization("Could not create ConcurrentMarkThread"); + } assert(CGC_lock != NULL, "Where's the CGC_lock?"); assert(_markBitMap1.covers(heap_rs), "_markBitMap1 inconsistency"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp index 7823f77e643..3f6e040bf54 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp index 8fe07693d77..c35681f959c 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 5ae273b26bd..775f6465d66 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2376,25 +2376,6 @@ size_t G1CollectedHeap::recalculate_used() const { return blk.result(); } -size_t G1CollectedHeap::unsafe_max_alloc() { - if (free_regions() > 0) return HeapRegion::GrainBytes; - // otherwise, is there space in the current allocation region? - - // We need to store the current allocation region in a local variable - // here. The problem is that this method doesn't take any locks and - // there may be other threads which overwrite the current allocation - // region field. attempt_allocation(), for example, sets it to NULL - // and this can happen *after* the NULL check here but before the call - // to free(), resulting in a SIGSEGV. Note that this doesn't appear - // to be a problem in the optimized build, since the two loads of the - // current allocation region field are optimized away. - HeapRegion* hr = _mutator_alloc_region.get(); - if (hr == NULL) { - return 0; - } - return hr->free(); -} - bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { switch (cause) { case GCCause::_gc_locker: return GCLockerInvokesConcurrent; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 69aa3255605..072013efb64 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1183,15 +1183,6 @@ public: // end fields defining the extent of the contiguous allocation region.) // But G1CollectedHeap doesn't yet support this. - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection or expansion activity. In a - // generational collector, for example, this is probably the largest - // allocation that could be supported (without expansion) in the youngest - // generation. It is "unsafe" because no locks are taken; the result - // should be treated as an approximation, not a guarantee, for use in - // heuristic resizing decisions. - virtual size_t unsafe_max_alloc(); - virtual bool is_maximal_no_gc() const { return _g1_storage.uncommitted_size() == 0; } 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 d309e609f4a..498e65f9b8d 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp index 1333f287047..eb64b87126b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp index 01bb43bef45..8bbe4ff94ca 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp index a943c9f6db3..0d82c305c24 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp index e40f6195a12..068f64f412e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index eaa8e10f38d..c7b42b5cdc4 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp index b0c3eb48a0b..f58c4f94711 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 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 96588dea042..0ee93e45b6e 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp index 8841f011e4a..aa8718e9952 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp index e39e38277c7..37f0d6562f8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp index a08e8a9801e..627c6803902 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp index 6e821f73bbc..86d5db16298 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp index 9268eb78ef4..2e4ed2dfb4a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp index 047c463d39e..dd975440033 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp index 90bf630fe36..ee9ce8b89d4 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.hpp index 950baa1d53f..e80877e2606 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp index 9d2e8182e06..829cb3cfe47 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp index eaa1f2b5509..56f215230bb 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp index 105772487c0..af5893bcc7b 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, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp index 234d5981a24..d8ee14c283d 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp index a7713b4dcfa..8dfcf1889e7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index f93f2e8991f..6a46f9fd13f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -484,10 +484,6 @@ void ParallelScavengeHeap::ensure_parsability(bool retire_tlabs) { young_gen()->eden_space()->ensure_parsability(); } -size_t ParallelScavengeHeap::unsafe_max_alloc() { - return young_gen()->eden_space()->free_in_bytes(); -} - size_t ParallelScavengeHeap::tlab_capacity(Thread* thr) const { return young_gen()->eden_space()->tlab_capacity(thr); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp index 51f40d8c62b..d4c2a1e72e7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @@ -184,8 +184,6 @@ class ParallelScavengeHeap : public CollectedHeap { void accumulate_statistics_all_tlabs(); void resize_all_tlabs(); - size_t unsafe_max_alloc(); - bool supports_tlab_allocation() const { return true; } size_t tlab_capacity(Thread* thr) const; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp index f966ccf23e2..f530945e350 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp index 7d96afbb4df..68b3de470ea 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index 820696af085..ee43825614b 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp index 2cb3b35e091..5e970eed4c4 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp index cf8f574ddfd..90fa0d5632d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 8e9dd8ddd72..8b4f0bd46f1 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -2433,20 +2433,6 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm, _gc_tracer.report_object_count_after_gc(is_alive_closure()); } -void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { - ClassLoaderData* cld = klass->class_loader_data(); - // The actual processing of the klass is done when we - // traverse the list of Klasses in the class loader data. - PSParallelCompact::follow_class_loader(cm, cld); -} - -void PSParallelCompact::adjust_klass(ParCompactionManager* cm, Klass* klass) { - ClassLoaderData* cld = klass->class_loader_data(); - // The actual processing of the klass is done when we - // traverse the list of Klasses in the class loader data. - PSParallelCompact::adjust_class_loader(cm, cld); -} - void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, ClassLoaderData* cld) { PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); @@ -2455,13 +2441,6 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); } -void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm, - ClassLoaderData* cld) { - cld->oops_do(PSParallelCompact::adjust_pointer_closure(), - PSParallelCompact::adjust_klass_closure(), - true); -} - // This should be moved to the shared markSweep code! class PSAlwaysTrueClosure: public BoolObjectClosure { public: diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index 2ba4eb45f5c..0f1b77b92f2 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -1200,13 +1200,10 @@ class PSParallelCompact : AllStatic { T* p); template static inline void adjust_pointer(T* p); - static void follow_klass(ParCompactionManager* cm, Klass* klass); - static void adjust_klass(ParCompactionManager* cm, Klass* klass); + static inline void follow_klass(ParCompactionManager* cm, Klass* klass); static void follow_class_loader(ParCompactionManager* cm, ClassLoaderData* klass); - static void adjust_class_loader(ParCompactionManager* cm, - ClassLoaderData* klass); // Compaction support. // Return true if p is in the range [beg_addr, end_addr). @@ -1380,6 +1377,11 @@ inline void PSParallelCompact::adjust_pointer(T* p) { } } +inline void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) { + oop holder = klass->klass_holder(); + PSParallelCompact::mark_and_push(cm, &holder); +} + template inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) { mark_and_push(_compaction_manager, p); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 66b23c4dbe8..8f47d582fd6 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.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 @@ -466,10 +466,12 @@ bool PSScavenge::invoke_no_policy() { } } - GCTraceTime tm("StringTable", false, false, &_gc_timer); - // Unlink any dead interned Strings and process the remaining live ones. - PSScavengeRootsClosure root_closure(promotion_manager); - StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); + { + GCTraceTime tm("StringTable", false, false, &_gc_timer); + // Unlink any dead interned Strings and process the remaining live ones. + PSScavengeRootsClosure root_closure(promotion_manager); + StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure); + } // Finally, flush the promotion_manager's labs, and deallocate its stacks. promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp index 00e466a3ea4..6470281a992 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp index 7ae1f8a0c28..24be15a4912 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp index c1f5c298794..74ac4477c96 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.cpp b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.cpp index 7cc37fd9453..1cbfb120aa4 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp index 6530d23b624..4172a95cced 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.cpp b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.cpp index 506322de521..b1ae78d3087 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp index c54e773c364..7a5fdf9ee57 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp index 5024ab9e7ab..70e657d2947 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/gcAdaptivePolicyCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp index c844a3e596d..b1563ac8686 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/isGCActiveMark.hpp b/hotspot/src/share/vm/gc_implementation/shared/isGCActiveMark.hpp index c56cbafeb2e..dc1041b28dd 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/isGCActiveMark.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/isGCActiveMark.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp index e70e3af1bc1..270d9de71bf 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index d3d758b79bd..ba7d00d68ba 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp index 5621c077c38..c79f2465ac1 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp index d50edac13ca..7e5b5a81125 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, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp index aced447c9a1..80a4a223cbd 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.cpp b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.cpp index f606e99e9a1..5a20c0dd4b9 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp index 17302d420b2..e02bc28da34 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index 1e60ed116d8..1563b9ef743 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -389,15 +389,6 @@ class CollectedHeap : public CHeapObj { // allocation from them and necessitating allocation of new TLABs. virtual void ensure_parsability(bool retire_tlabs); - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection or expansion activity. In a - // generational collector, for example, this is probably the largest - // allocation that could be supported (without expansion) in the youngest - // generation. It is "unsafe" because no locks are taken; the result - // should be treated as an approximation, not a guarantee, for use in - // heuristic resizing decisions. - virtual size_t unsafe_max_alloc() = 0; - // Section on thread-local allocation buffers (TLABs) // If the heap supports thread-local allocation buffers, it should override // the following methods: diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp index d17b82f2158..0bf322f82dd 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/gc_interface/gcCause.cpp b/hotspot/src/share/vm/gc_interface/gcCause.cpp index e7e7e43f440..2588621aa6b 100644 --- a/hotspot/src/share/vm/gc_interface/gcCause.cpp +++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp index 06f11882c95..809bab4c46d 100644 --- a/hotspot/src/share/vm/gc_interface/gcCause.hpp +++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp index 538b836f08a..16e8dabba5c 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp index 71f78840b95..0e05c34601e 100644 --- a/hotspot/src/share/vm/interpreter/cppInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/cppInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/interpreter/interpreter.hpp b/hotspot/src/share/vm/interpreter/interpreter.hpp index 1fb4ac5c8ce..cc26b378d73 100644 --- a/hotspot/src/share/vm/interpreter/interpreter.hpp +++ b/hotspot/src/share/vm/interpreter/interpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp index 573ccc1cf62..b63e03bdcf6 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp @@ -242,8 +242,20 @@ void LinkResolver::resolve_klass(KlassHandle& result, constantPoolHandle pool, i // Look up method in klasses, including static methods // Then look up local default methods -void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, TRAPS) { +void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS) { Method* result_oop = klass->uncached_lookup_method(name, signature); + + // JDK 8, JVMS 5.4.3.4: Interface method resolution should + // ignore static and non-public methods of java.lang.Object, + // like clone, finalize, registerNatives. + if (in_imethod_resolve && + result_oop != NULL && + klass->is_interface() && + (result_oop->is_static() || !result_oop->is_public()) && + result_oop->method_holder() == SystemDictionary::Object_klass()) { + result_oop = NULL; + } + if (result_oop == NULL) { Array* default_methods = InstanceKlass::cast(klass())->default_methods(); if (default_methods != NULL) { @@ -288,7 +300,7 @@ int LinkResolver::vtable_index_of_interface_method(KlassHandle klass, Symbol* signature = resolved_method->signature(); // First check in default method array - if (!resolved_method->is_abstract() && + if (!resolved_method->is_abstract() && (InstanceKlass::cast(klass())->default_methods() != NULL)) { int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature); if (index >= 0 ) { @@ -306,7 +318,11 @@ int LinkResolver::vtable_index_of_interface_method(KlassHandle klass, void LinkResolver::lookup_method_in_interfaces(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { InstanceKlass *ik = InstanceKlass::cast(klass()); - result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature)); + + // Specify 'true' in order to skip default methods when searching the + // interfaces. Function lookup_method_in_klasses() already looked for + // the method in the default methods table. + result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature, true)); } void LinkResolver::lookup_polymorphic_method(methodHandle& result, @@ -420,28 +436,18 @@ void LinkResolver::check_method_accessability(KlassHandle ref_klass, AccessFlags flags = sel_method->access_flags(); - // Special case #1: arrays always override "clone". JVMS 2.15. + // Special case: arrays always override "clone". JVMS 2.15. // If the resolved klass is an array class, and the declaring class // is java.lang.Object and the method is "clone", set the flags // to public. - // Special case #2: If the resolved klass is an interface, and - // the declaring class is java.lang.Object, and the method is - // "clone" or "finalize", set the flags to public. If the - // resolved interface does not contain "clone" or "finalize" - // methods, the method/interface method resolution looks to - // the interface's super class, java.lang.Object. With JDK 8 - // interface accessability check requirement, special casing - // this scenario is necessary to avoid an IAE. // - // We'll check for each method name first and then java.lang.Object - // to best short-circuit out of these tests. - if (((sel_method->name() == vmSymbols::clone_name() && - (resolved_klass->oop_is_array() || resolved_klass->is_interface())) || - (sel_method->name() == vmSymbols::finalize_method_name() && - resolved_klass->is_interface())) && - sel_klass() == SystemDictionary::Object_klass()) { + // We'll check for the method name first, as that's most likely + // to be false (so we'll short-circuit out of these tests). + if (sel_method->name() == vmSymbols::clone_name() && + sel_klass() == SystemDictionary::Object_klass() && + resolved_klass->oop_is_array()) { // We need to change "protected" to "public". - assert(flags.is_protected(), "clone or finalize not protected?"); + assert(flags.is_protected(), "clone not protected?"); jint new_flags = flags.as_int(); new_flags = new_flags & (~JVM_ACC_PROTECTED); new_flags = new_flags | JVM_ACC_PUBLIC; @@ -531,7 +537,7 @@ void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle res } // 2. lookup method in resolved klass and its super klasses - lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, true, CHECK); + lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, true, false, CHECK); if (resolved_method.is_null()) { // not found in the class hierarchy // 3. lookup method in all the interfaces implemented by the resolved klass @@ -618,7 +624,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method, bool check_access, bool nostatics, TRAPS) { - // check if klass is interface + // check if klass is interface if (!resolved_klass->is_interface()) { ResourceMark rm(THREAD); char buf[200]; @@ -628,7 +634,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method, // lookup method in this interface or its super, java.lang.Object // JDK8: also look for static methods - lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, false, CHECK); + lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, false, true, CHECK); if (resolved_method.is_null()) { // lookup method in all the super-interfaces @@ -943,8 +949,17 @@ void LinkResolver::linktime_resolve_special_method(methodHandle& resolved_method Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ? current_klass() : InstanceKlass::cast(current_klass())->host_klass(); + // As of the fix for 4486457 we disable verification for all of the + // dynamically-generated bytecodes associated with the 1.4 + // reflection implementation, not just those associated with + // sun/reflect/SerializationConstructorAccessor. + bool is_reflect = JDK_Version::is_gte_jdk14x_version() && + UseNewReflection && + klass_to_check->is_subclass_of( + SystemDictionary::reflect_MagicAccessorImpl_klass()); - if (!InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) { + if (!is_reflect && + !InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) { ResourceMark rm(THREAD); char buf[200]; jio_snprintf(buf, sizeof(buf), @@ -1276,8 +1291,11 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand resolved_klass()->external_name()); THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); } + // do lookup based on receiver klass methodHandle sel_method; + // This search must match the linktime preparation search for itable initialization + // to correctly enforce loader constraints for interface method inheritance lookup_instance_method_in_klasses(sel_method, recv_klass, resolved_method->name(), resolved_method->signature(), CHECK); diff --git a/hotspot/src/share/vm/interpreter/linkResolver.hpp b/hotspot/src/share/vm/interpreter/linkResolver.hpp index 4b13de8789f..f598380591b 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.hpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp @@ -124,7 +124,7 @@ class LinkResolver: AllStatic { friend class klassItable; private: - static void lookup_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, TRAPS); + static void lookup_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS); static void lookup_instance_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS); static void lookup_method_in_interfaces (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS); static void lookup_polymorphic_method (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, diff --git a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp index 838e2e08473..48e0e217091 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp index a80caa96409..ee1b0f5acc5 100644 --- a/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp +++ b/hotspot/src/share/vm/interpreter/templateInterpreterGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp index 11c875ef32d..d636465a29d 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.hpp +++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index 36c0d06c3fd..98410227a86 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -71,9 +71,8 @@ bool MetaspaceObj::is_shared() const { return MetaspaceShared::is_in_shared_space(this); } - bool MetaspaceObj::is_metaspace_object() const { - return Metaspace::contains((void*)this); + return ClassLoaderDataGraph::contains((void*)this); } void MetaspaceObj::print_address_on(outputStream* st) const { @@ -140,7 +139,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, "address should be aligned to 4 bytes at least"); + assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " PTR_FORMAT, res)); assert(type <= allocation_mask, "incorrect allocation type"); ResourceObj* resobj = (ResourceObj *)res; resobj->_allocation_t[0] = ~(allocation + type); diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp index 739753311c5..590b74f5ddf 100644 --- a/hotspot/src/share/vm/memory/allocation.hpp +++ b/hotspot/src/share/vm/memory/allocation.hpp @@ -264,7 +264,7 @@ class ClassLoaderData; class MetaspaceObj { public: - bool is_metaspace_object() const; // more specific test but slower + bool is_metaspace_object() const; bool is_shared() const; void print_address_on(outputStream* st) const; // nonvirtual address printing diff --git a/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp b/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp index 460a4ea29e1..23d7fe0ae24 100644 --- a/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp +++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.cpp b/hotspot/src/share/vm/memory/blockOffsetTable.cpp index 841794a0164..c0b35cdde0f 100644 --- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp +++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index f5fdb4427ce..51c672e4e7c 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -667,9 +667,6 @@ void DefNewGeneration::collect(bool full, // for full GC's. AdaptiveSizePolicy* size_policy = gch->gen_policy()->size_policy(); size_policy->reset_gc_overhead_limit_count(); - if (PrintGC && !PrintGCDetails) { - gch->print_heap_change(gch_prev_used); - } assert(!gch->incremental_collection_failed(), "Should be clear"); } else { assert(_promo_failure_scan_stack.is_empty(), "post condition"); @@ -695,6 +692,9 @@ void DefNewGeneration::collect(bool full, // Reset the PromotionFailureALot counters. NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();) } + if (PrintGC && !PrintGCDetails) { + gch->print_heap_change(gch_prev_used); + } // set new iteration safe limit for the survivor spaces from()->set_concurrent_iteration_safe_limit(from()->top()); to()->set_concurrent_iteration_safe_limit(to()->top()); diff --git a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp index 7cb2b17b57b..915ec206395 100644 --- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp +++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/memory/freeList.cpp b/hotspot/src/share/vm/memory/freeList.cpp index 78785e8809f..1d521885925 100644 --- a/hotspot/src/share/vm/memory/freeList.cpp +++ b/hotspot/src/share/vm/memory/freeList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/freeList.hpp b/hotspot/src/share/vm/memory/freeList.hpp index e69c8a32f0e..e971471f9c7 100644 --- a/hotspot/src/share/vm/memory/freeList.hpp +++ b/hotspot/src/share/vm/memory/freeList.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/gcLocker.cpp b/hotspot/src/share/vm/memory/gcLocker.cpp index 1b0c94ee171..09fb73bb035 100644 --- a/hotspot/src/share/vm/memory/gcLocker.cpp +++ b/hotspot/src/share/vm/memory/gcLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/gcLocker.hpp b/hotspot/src/share/vm/memory/gcLocker.hpp index 45b8a8f89e7..60bebdf0fa4 100644 --- a/hotspot/src/share/vm/memory/gcLocker.hpp +++ b/hotspot/src/share/vm/memory/gcLocker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index aa6f24bd23e..49c5965a89b 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -673,10 +673,6 @@ HeapWord** GenCollectedHeap::end_addr() const { return _gens[0]->end_addr(); } -size_t GenCollectedHeap::unsafe_max_alloc() { - return _gens[0]->unsafe_max_alloc_nogc(); -} - // public collection interfaces void GenCollectedHeap::collect(GCCause::Cause cause) { diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index 5cd8a71280a..b80fd718bd8 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -166,14 +166,6 @@ public: HeapWord** top_addr() const; HeapWord** end_addr() const; - // Return an estimate of the maximum allocation that could be performed - // without triggering any collection activity. In a generational - // collector, for example, this is probably the largest allocation that - // could be supported in the youngest generation. It is "unsafe" because - // no locks are taken; the result should be treated as an approximation, - // not a guarantee. - size_t unsafe_max_alloc(); - // Does this heap support heap inspection? (+PrintClassHistogram) virtual bool supports_heap_inspection() const { return true; } diff --git a/hotspot/src/share/vm/memory/genRemSet.cpp b/hotspot/src/share/vm/memory/genRemSet.cpp index c496deafc03..bb3149f5a85 100644 --- a/hotspot/src/share/vm/memory/genRemSet.cpp +++ b/hotspot/src/share/vm/memory/genRemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/genRemSet.hpp b/hotspot/src/share/vm/memory/genRemSet.hpp index 44a43540769..a275320c8da 100644 --- a/hotspot/src/share/vm/memory/genRemSet.hpp +++ b/hotspot/src/share/vm/memory/genRemSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp index 290cce583a0..e3bceb4446c 100644 --- a/hotspot/src/share/vm/memory/generation.hpp +++ b/hotspot/src/share/vm/memory/generation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/generationSpec.cpp b/hotspot/src/share/vm/memory/generationSpec.cpp index d97a56fbbcc..128387cc952 100644 --- a/hotspot/src/share/vm/memory/generationSpec.cpp +++ b/hotspot/src/share/vm/memory/generationSpec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/heap.hpp b/hotspot/src/share/vm/memory/heap.hpp index 725592e67be..29e76d7dc62 100644 --- a/hotspot/src/share/vm/memory/heap.hpp +++ b/hotspot/src/share/vm/memory/heap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/iterator.cpp b/hotspot/src/share/vm/memory/iterator.cpp index 545ab921363..f69eb4ed75d 100644 --- a/hotspot/src/share/vm/memory/iterator.cpp +++ b/hotspot/src/share/vm/memory/iterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/iterator.hpp b/hotspot/src/share/vm/memory/iterator.hpp index e590a3e9be2..dd98234d31e 100644 --- a/hotspot/src/share/vm/memory/iterator.hpp +++ b/hotspot/src/share/vm/memory/iterator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/metachunk.hpp b/hotspot/src/share/vm/memory/metachunk.hpp index 3bd4d15bca8..e873dc6a32c 100644 --- a/hotspot/src/share/vm/memory/metachunk.hpp +++ b/hotspot/src/share/vm/memory/metachunk.hpp @@ -143,6 +143,8 @@ class Metachunk : public Metabase { void set_is_tagged_free(bool v) { _is_tagged_free = v; } #endif + bool contains(const void* ptr) { return bottom() <= ptr && ptr < _top; } + NOT_PRODUCT(void mangle();) void print_on(outputStream* st) const; diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 826dde3838c..5a7e4ec2fb1 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -287,7 +287,7 @@ class VirtualSpaceNode : public CHeapObj { VirtualSpace* virtual_space() const { return (VirtualSpace*) &_virtual_space; } // Returns true if "word_size" is available in the VirtualSpace - bool is_available(size_t word_size) { return _top + word_size <= end(); } + bool is_available(size_t word_size) { return word_size <= pointer_delta(end(), _top, sizeof(MetaWord)); } MetaWord* top() const { return _top; } void inc_top(size_t word_size) { _top += word_size; } @@ -513,8 +513,6 @@ class VirtualSpaceList : public CHeapObj { // Unlink empty VirtualSpaceNodes and free it. void purge(ChunkManager* chunk_manager); - bool contains(const void *ptr); - void print_on(outputStream* st) const; class VirtualSpaceListIterator : public StackObj { @@ -558,7 +556,7 @@ class SpaceManager : public CHeapObj { private: - // protects allocations and contains. + // protects allocations Mutex* const _lock; // Type of metadata allocated. @@ -595,7 +593,11 @@ class SpaceManager : public CHeapObj { private: // Accessors Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; } - void set_chunks_in_use(ChunkIndex index, Metachunk* v) { _chunks_in_use[index] = v; } + void set_chunks_in_use(ChunkIndex index, Metachunk* v) { + // ensure lock-free iteration sees fully initialized node + OrderAccess::storestore(); + _chunks_in_use[index] = v; + } BlockFreelist* block_freelists() const { return (BlockFreelist*) &_block_freelists; @@ -708,6 +710,8 @@ class SpaceManager : public CHeapObj { void print_on(outputStream* st) const; void locked_print_chunks_in_use_on(outputStream* st) const; + bool contains(const void *ptr); + void verify(); void verify_chunk_size(Metachunk* chunk); NOT_PRODUCT(void mangle_freed_chunks();) @@ -1159,8 +1163,6 @@ bool VirtualSpaceList::create_new_virtual_space(size_t vs_word_size) { } else { assert(new_entry->reserved_words() == vs_word_size, "Reserved memory size differs from requested memory size"); - // ensure lock-free iteration sees fully initialized node - OrderAccess::storestore(); link_vs(new_entry); return true; } @@ -1287,19 +1289,6 @@ void VirtualSpaceList::print_on(outputStream* st) const { } } -bool VirtualSpaceList::contains(const void *ptr) { - VirtualSpaceNode* list = virtual_space_list(); - VirtualSpaceListIterator iter(list); - while (iter.repeat()) { - VirtualSpaceNode* node = iter.get_next(); - if (node->reserved()->contains(ptr)) { - return true; - } - } - return false; -} - - // MetaspaceGC methods // VM_CollectForMetadataAllocation is the vm operation used to GC. @@ -2392,6 +2381,21 @@ MetaWord* SpaceManager::allocate_work(size_t word_size) { return result; } +// This function looks at the chunks in the metaspace without locking. +// The chunks are added with store ordering and not deleted except for at +// unloading time. +bool SpaceManager::contains(const void *ptr) { + for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) + { + Metachunk* curr = chunks_in_use(i); + while (curr != NULL) { + if (curr->contains(ptr)) return true; + curr = curr->next(); + } + } + return false; +} + void SpaceManager::verify() { // If there are blocks in the dictionary, then // verfication of chunks does not work since @@ -3463,17 +3467,12 @@ void Metaspace::print_on(outputStream* out) const { } } -bool Metaspace::contains(const void * ptr) { - if (MetaspaceShared::is_in_shared_space(ptr)) { - return true; +bool Metaspace::contains(const void* ptr) { + if (vsm()->contains(ptr)) return true; + if (using_class_space()) { + return class_vsm()->contains(ptr); } - // This is checked while unlocked. As long as the virtualspaces are added - // at the end, the pointer will be in one of them. The virtual spaces - // aren't deleted presently. When they are, some sort of locking might - // be needed. Note, locking this can cause inversion problems with the - // caller in MetaspaceObj::is_metadata() function. - return space_list()->contains(ptr) || - (using_class_space() && class_space_list()->contains(ptr)); + return false; } void Metaspace::verify() { @@ -3641,10 +3640,82 @@ class TestVirtualSpaceNodeTest { } } + +#define assert_is_available_positive(word_size) \ + assert(vsn.is_available(word_size), \ + err_msg(#word_size ": " PTR_FORMAT " bytes were not available in " \ + "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ + (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end())); + +#define assert_is_available_negative(word_size) \ + assert(!vsn.is_available(word_size), \ + err_msg(#word_size ": " PTR_FORMAT " bytes should not be available in " \ + "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ + (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end())); + + static void test_is_available_positive() { + // Reserve some memory. + VirtualSpaceNode vsn(os::vm_allocation_granularity()); + assert(vsn.initialize(), "Failed to setup VirtualSpaceNode"); + + // Commit some memory. + size_t commit_word_size = os::vm_allocation_granularity() / BytesPerWord; + bool expanded = vsn.expand_by(commit_word_size, commit_word_size); + assert(expanded, "Failed to commit"); + + // Check that is_available accepts the committed size. + assert_is_available_positive(commit_word_size); + + // Check that is_available accepts half the committed size. + size_t expand_word_size = commit_word_size / 2; + assert_is_available_positive(expand_word_size); + } + + static void test_is_available_negative() { + // Reserve some memory. + VirtualSpaceNode vsn(os::vm_allocation_granularity()); + assert(vsn.initialize(), "Failed to setup VirtualSpaceNode"); + + // Commit some memory. + size_t commit_word_size = os::vm_allocation_granularity() / BytesPerWord; + bool expanded = vsn.expand_by(commit_word_size, commit_word_size); + assert(expanded, "Failed to commit"); + + // Check that is_available doesn't accept a too large size. + size_t two_times_commit_word_size = commit_word_size * 2; + assert_is_available_negative(two_times_commit_word_size); + } + + static void test_is_available_overflow() { + // Reserve some memory. + VirtualSpaceNode vsn(os::vm_allocation_granularity()); + assert(vsn.initialize(), "Failed to setup VirtualSpaceNode"); + + // Commit some memory. + size_t commit_word_size = os::vm_allocation_granularity() / BytesPerWord; + bool expanded = vsn.expand_by(commit_word_size, commit_word_size); + assert(expanded, "Failed to commit"); + + // Calculate a size that will overflow the virtual space size. + void* virtual_space_max = (void*)(uintptr_t)-1; + size_t bottom_to_max = pointer_delta(virtual_space_max, vsn.bottom(), 1); + size_t overflow_size = bottom_to_max + BytesPerWord; + size_t overflow_word_size = overflow_size / BytesPerWord; + + // Check that is_available can handle the overflow. + assert_is_available_negative(overflow_word_size); + } + + static void test_is_available() { + TestVirtualSpaceNodeTest::test_is_available_positive(); + TestVirtualSpaceNodeTest::test_is_available_negative(); + TestVirtualSpaceNodeTest::test_is_available_overflow(); + } }; void TestVirtualSpaceNode_test() { TestVirtualSpaceNodeTest::test(); + TestVirtualSpaceNodeTest::test_is_available(); } #endif diff --git a/hotspot/src/share/vm/memory/metaspace.hpp b/hotspot/src/share/vm/memory/metaspace.hpp index c22d2170761..96427cb9833 100644 --- a/hotspot/src/share/vm/memory/metaspace.hpp +++ b/hotspot/src/share/vm/memory/metaspace.hpp @@ -225,7 +225,7 @@ class Metaspace : public CHeapObj { MetaWord* expand_and_allocate(size_t size, MetadataType mdtype); - static bool contains(const void *ptr); + bool contains(const void* ptr); void dump(outputStream* const out) const; // Free empty virtualspaces diff --git a/hotspot/src/share/vm/memory/metaspaceCounters.cpp b/hotspot/src/share/vm/memory/metaspaceCounters.cpp index 60e26b8c714..3ad462d081d 100644 --- a/hotspot/src/share/vm/memory/metaspaceCounters.cpp +++ b/hotspot/src/share/vm/memory/metaspaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/memory/metaspaceCounters.hpp b/hotspot/src/share/vm/memory/metaspaceCounters.hpp index 0fa991291a1..4db551a1e34 100644 --- a/hotspot/src/share/vm/memory/metaspaceCounters.hpp +++ b/hotspot/src/share/vm/memory/metaspaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index cd810c036d4..f5d9e05f0cf 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 7eb462ecccc..8f844df81f1 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index eb1e209a850..04efc7da593 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp index 2aed587f054..24986b95089 100644 --- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp +++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp index ac1e9316409..a18d6813e2f 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp index e6e9b79873c..94a4330aca1 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/oops/arrayKlass.cpp b/hotspot/src/share/vm/oops/arrayKlass.cpp index 6e04c3ac145..9e40206c253 100644 --- a/hotspot/src/share/vm/oops/arrayKlass.cpp +++ b/hotspot/src/share/vm/oops/arrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/arrayOop.hpp b/hotspot/src/share/vm/oops/arrayOop.hpp index 0e5ceffe35a..0cc8f2e448d 100644 --- a/hotspot/src/share/vm/oops/arrayOop.hpp +++ b/hotspot/src/share/vm/oops/arrayOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/compiledICHolder.cpp b/hotspot/src/share/vm/oops/compiledICHolder.cpp index 2b2cd2ae646..72268079296 100644 --- a/hotspot/src/share/vm/oops/compiledICHolder.cpp +++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/oops/fieldInfo.hpp b/hotspot/src/share/vm/oops/fieldInfo.hpp index 6763c42d127..40a192bdcc0 100644 --- a/hotspot/src/share/vm/oops/fieldInfo.hpp +++ b/hotspot/src/share/vm/oops/fieldInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/oops/generateOopMap.cpp b/hotspot/src/share/vm/oops/generateOopMap.cpp index 9a9dc23d4e8..2207e8c814e 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.cpp +++ b/hotspot/src/share/vm/oops/generateOopMap.cpp @@ -1863,11 +1863,8 @@ void GenerateOopMap::do_ldc(int bci) { constantTag tag = cp->tag_at(ldc.pool_index()); // idx is index in resolved_references BasicType bt = ldc.result_type(); CellTypeState cts; - if (tag.is_klass() || - tag.is_unresolved_klass() || - tag.is_string() || - tag.is_method_handle() || - tag.is_method_type()) { + if (tag.basic_type() == T_OBJECT) { + assert(!tag.is_string_index() && !tag.is_klass_index(), "Unexpected index tag"); assert(bt == T_OBJECT, "Guard is incorrect"); cts = CellTypeState::make_line_ref(bci); } else { diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp index 507206fc854..a92167a9a7d 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -150,10 +150,6 @@ void InstanceClassLoaderKlass::oop_push_contents(PSPromotionManager* pm, oop obj int InstanceClassLoaderKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { InstanceKlass::oop_update_pointers(cm, obj); - ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); - if (loader_data != NULL) { - PSParallelCompact::adjust_class_loader(cm, loader_data); - } return size_helper(); } #endif // INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp index d93f2a5c32a..309ebf96c19 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 77be5307db6..a6ca58c42c1 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -1498,13 +1498,18 @@ int InstanceKlass::find_method_by_name( return -1; } -// lookup_method searches both the local methods array and all superclasses methods arrays +// uncached_lookup_method searches both the local class methods array and all +// superclasses methods arrays, skipping any overpass methods in superclasses. Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { Klass* klass = const_cast(this); + bool dont_ignore_overpasses = true; // For the class being searched, find its overpasses. while (klass != NULL) { Method* method = InstanceKlass::cast(klass)->find_method(name, signature); - if (method != NULL) return method; + if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) { + return method; + } klass = InstanceKlass::cast(klass)->super(); + dont_ignore_overpasses = false; // Ignore overpass methods in all superclasses. } return NULL; } @@ -1519,7 +1524,7 @@ Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name, } // Look up interfaces if (m == NULL) { - m = lookup_method_in_all_interfaces(name, signature); + m = lookup_method_in_all_interfaces(name, signature, false); } return m; } @@ -1528,14 +1533,16 @@ Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name, // Do NOT return private or static methods, new in JDK8 which are not externally visible // They should only be found in the initial InterfaceMethodRef Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, - Symbol* signature) const { + Symbol* signature, + bool skip_default_methods) const { Array* all_ifs = transitive_interfaces(); int num_ifs = all_ifs->length(); InstanceKlass *ik = NULL; for (int i = 0; i < num_ifs; i++) { ik = InstanceKlass::cast(all_ifs->at(i)); Method* m = ik->lookup_method(name, signature); - if (m != NULL && m->is_public() && !m->is_static()) { + if (m != NULL && m->is_public() && !m->is_static() && + (!skip_default_methods || !m->is_default_method())) { return m; } } @@ -2199,7 +2206,6 @@ int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { obj, \ PSParallelCompact::adjust_pointer(p), \ assert_is_in) - obj->update_header(cm); return size; } diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 84cc0046a95..2b7a73a3189 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -525,7 +525,8 @@ class InstanceKlass: public Klass { // lookup a method in all the interfaces that this class implements // (returns NULL if not found) - Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature) const; + Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, bool skip_default_methods) const; + // lookup a method in local defaults then in all interfaces // (returns NULL if not found) Method* lookup_method_in_ordered_interfaces(Symbol* name, Symbol* signature) const; diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp index 825633247d1..70c2ca19132 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -155,8 +155,13 @@ void InstanceMirrorKlass::oop_follow_contents(oop obj) { // Follow the klass field in the mirror. Klass* klass = java_lang_Class::as_Klass(obj); if (klass != NULL) { - // For anonymous classes we need to handle the class loader data, - // otherwise it won't be claimed and can be unloaded. + // An anonymous class doesn't have its own class loader, so the call + // to follow_klass will mark and push its java mirror instead of the + // class loader. When handling the java mirror for an anonymous class + // we need to make sure its class loader data is claimed, this is done + // by calling follow_class_loader explicitly. For non-anonymous classes + // the call to follow_class_loader is made when the class loader itself + // is handled. if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { MarkSweep::follow_class_loader(klass->class_loader_data()); } else { @@ -183,7 +188,18 @@ void InstanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm, // Follow the klass field in the mirror. Klass* klass = java_lang_Class::as_Klass(obj); if (klass != NULL) { - PSParallelCompact::follow_klass(cm, klass); + // An anonymous class doesn't have its own class loader, so the call + // to follow_klass will mark and push its java mirror instead of the + // class loader. When handling the java mirror for an anonymous class + // we need to make sure its class loader data is claimed, this is done + // by calling follow_class_loader explicitly. For non-anonymous classes + // the call to follow_class_loader is made when the class loader itself + // is handled. + if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { + PSParallelCompact::follow_class_loader(cm, klass->class_loader_data()); + } else { + PSParallelCompact::follow_klass(cm, klass); + } } else { // If klass is NULL then this a mirror for a primitive type. // We don't have to follow them, since they are handled as strong @@ -332,17 +348,6 @@ int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) int size = oop_size(obj); InstanceKlass::oop_update_pointers(cm, obj); - // Follow the klass field in the mirror. - Klass* klass = java_lang_Class::as_Klass(obj); - if (klass != NULL) { - PSParallelCompact::adjust_klass(cm, klass); - } else { - // If klass is NULL then this a mirror for a primitive type. - // We don't have to follow them, since they are handled as strong - // roots in Universe::oops_do. - assert(java_lang_Class::is_primitive(obj), "Sanity check"); - } - InstanceMirrorKlass_OOP_ITERATE( \ start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\ PSParallelCompact::adjust_pointer(p), \ diff --git a/hotspot/src/share/vm/oops/instanceOop.hpp b/hotspot/src/share/vm/oops/instanceOop.hpp index bdac1992e6f..5186aa3b817 100644 --- a/hotspot/src/share/vm/oops/instanceOop.hpp +++ b/hotspot/src/share/vm/oops/instanceOop.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.hpp b/hotspot/src/share/vm/oops/instanceRefKlass.hpp index d8771608f73..3140977b471 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 22b570bbff3..bf5dae0606d 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -376,8 +376,6 @@ void Klass::append_to_sibling_list() { } bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { - assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); - #ifdef ASSERT // The class is alive iff the class loader is alive. oop loader = class_loader(); diff --git a/hotspot/src/share/vm/oops/klassPS.hpp b/hotspot/src/share/vm/oops/klassPS.hpp index 5fb17b6e801..a92f8738a78 100644 --- a/hotspot/src/share/vm/oops/klassPS.hpp +++ b/hotspot/src/share/vm/oops/klassPS.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp index 509c7885360..a7fc062b71e 100644 --- a/hotspot/src/share/vm/oops/klassVtable.cpp +++ b/hotspot/src/share/vm/oops/klassVtable.cpp @@ -622,7 +622,7 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method, // this check for all access permissions. InstanceKlass *sk = InstanceKlass::cast(super); if (sk->has_miranda_methods()) { - if (sk->lookup_method_in_all_interfaces(name, signature) != NULL) { + if (sk->lookup_method_in_all_interfaces(name, signature, false) != NULL) { return false; // found a matching miranda; we do not need a new entry } } @@ -743,7 +743,7 @@ void klassVtable::add_new_mirandas_to_lists( if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all? InstanceKlass *sk = InstanceKlass::cast(super); // check if it is a duplicate of a super's miranda - if (sk->lookup_method_in_all_interfaces(im->name(), im->signature()) == NULL) { + if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), false) == NULL) { new_mirandas->append(im); } if (all_mirandas != NULL) { @@ -1085,6 +1085,8 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass Method* m = methods->at(i); methodHandle target; if (m->has_itable_index()) { + // This search must match the runtime resolution, i.e. selection search for invokeinterface + // to correctly enforce loader constraints for interface method inheritance LinkResolver::lookup_instance_method_in_klasses(target, _klass, m->name(), m->signature(), CHECK); } if (target == NULL || !target->is_public() || target->is_abstract()) { diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 94c990a728e..7294ebe9adb 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -587,7 +587,6 @@ int ObjArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { assert (obj->is_objArray(), "obj must be obj array"); objArrayOop a = objArrayOop(obj); int size = a->object_size(); - a->update_header(cm); ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) return size; } diff --git a/hotspot/src/share/vm/oops/objArrayKlass.hpp b/hotspot/src/share/vm/oops/objArrayKlass.hpp index d56a3de846d..af06fd42084 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp b/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp index 23e809a7e0f..e082df55ab4 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/oop.hpp b/hotspot/src/share/vm/oops/oop.hpp index 66a62eaab23..350c0fc6131 100644 --- a/hotspot/src/share/vm/oops/oop.hpp +++ b/hotspot/src/share/vm/oops/oop.hpp @@ -328,11 +328,6 @@ class oopDesc { // return the size of this oop. This is used by the MarkSweep collector. int adjust_pointers(); -#if INCLUDE_ALL_GCS - // Parallel old - void update_header(ParCompactionManager* cm); -#endif // INCLUDE_ALL_GCS - // mark-sweep support void follow_body(int begin, int end); diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp index d8e40477f79..596bbc6d123 100644 --- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -80,8 +80,4 @@ inline oop oopDesc::forward_to_atomic(oop p) { return forwardee(); } -inline void oopDesc::update_header(ParCompactionManager* cm) { - PSParallelCompact::adjust_klass(cm, klass()); -} - #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP diff --git a/hotspot/src/share/vm/oops/oop.psgc.inline.hpp b/hotspot/src/share/vm/oops/oop.psgc.inline.hpp index ea184f36339..b959ad531be 100644 --- a/hotspot/src/share/vm/oops/oop.psgc.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.psgc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp index 56863a02469..8d9c6728cf8 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.hpp b/hotspot/src/share/vm/oops/typeArrayKlass.hpp index f8bf2ac74c0..cf363fc76c2 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index fade19bdb6b..f25e5480e43 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp index e1574691849..dbb3cfb5039 100644 --- a/hotspot/src/share/vm/opto/block.hpp +++ b/hotspot/src/share/vm/opto/block.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/buildOopMap.cpp b/hotspot/src/share/vm/opto/buildOopMap.cpp index e63be38ed11..9f2dd674e2f 100644 --- a/hotspot/src/share/vm/opto/buildOopMap.cpp +++ b/hotspot/src/share/vm/opto/buildOopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 1e875c42c50..4b3f39f0893 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -50,7 +50,10 @@ InlineTree::InlineTree(Compile* c, _subtrees(c->comp_arena(), 2, 0, NULL), _msg(NULL) { - NOT_PRODUCT(_count_inlines = 0;) +#ifndef PRODUCT + _count_inlines = 0; + _forced_inline = false; +#endif if (_caller_jvms != NULL) { // Keep a private copy of the caller_jvms: _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms()); @@ -81,7 +84,10 @@ InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvm _count_inline_bcs(method()->code_size()), _msg(NULL) { - NOT_PRODUCT(_count_inlines = 0;) +#ifndef PRODUCT + _count_inlines = 0; + _forced_inline = false; +#endif assert(!UseOldInlining, "do not use for old stuff"); } @@ -128,9 +134,19 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method, tty->print_cr("Inlined method is hot: "); } set_msg("force inline by CompilerOracle"); + _forced_inline = true; return true; } +#ifndef PRODUCT + int inline_depth = inline_level()+1; + if (ciReplay::should_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { + set_msg("force inline by ciReplay"); + _forced_inline = true; + return true; + } +#endif + int size = callee_method->code_size_for_inlining(); // Check for too many throws (and not too huge) @@ -264,6 +280,18 @@ bool InlineTree::should_not_inline(ciMethod *callee_method, } #ifndef PRODUCT + int caller_bci = jvms->bci(); + int inline_depth = inline_level()+1; + if (ciReplay::should_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { + set_msg("force inline by ciReplay"); + return false; + } + + if (ciReplay::should_not_inline(C->replay_inline_data(), callee_method, caller_bci, inline_depth)) { + set_msg("disallowed by ciReplay"); + return true; + } + if (ciReplay::should_not_inline(callee_method)) { set_msg("disallowed by ciReplay"); return true; @@ -343,6 +371,7 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, } } + _forced_inline = false; // Reset if (!should_inline(callee_method, caller_method, caller_bci, profile, wci_result)) { return false; @@ -373,10 +402,10 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, if ((!UseInterpreter || CompileTheWorld) && is_init_with_ea(callee_method, caller_method, C)) { - // Escape Analysis stress testing when running Xcomp or CTW: // inline constructors even if they are not reached. - + } else if (forced_inline()) { + // Inlining was forced by CompilerOracle or ciReplay } else if (profile.count() == 0) { // don't inline unreached call sites set_msg("call site not reached"); @@ -700,12 +729,28 @@ InlineTree* InlineTree::find_subtree_from_root(InlineTree* root, JVMState* jvms, return iltp; } +// Count number of nodes in this subtree +int InlineTree::count() const { + int result = 1; + for (int i = 0 ; i < _subtrees.length(); i++) { + result += _subtrees.at(i)->count(); + } + return result; +} + +void InlineTree::dump_replay_data(outputStream* out) { + out->print(" %d %d ", inline_level(), caller_bci()); + method()->dump_name_as_ascii(out); + for (int i = 0 ; i < _subtrees.length(); i++) { + _subtrees.at(i)->dump_replay_data(out); + } +} #ifndef PRODUCT void InlineTree::print_impl(outputStream* st, int indent) const { for (int i = 0; i < indent; i++) st->print(" "); - st->print(" @ %d ", caller_bci()); + st->print(" @ %d", caller_bci()); method()->print_short_name(st); st->cr(); diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp index 91653bd3ce3..7fa7918263e 100644 --- a/hotspot/src/share/vm/opto/c2compiler.cpp +++ b/hotspot/src/share/vm/opto/c2compiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/opto/c2compiler.hpp b/hotspot/src/share/vm/opto/c2compiler.hpp index 48ccc1b5105..0a6b519e2e3 100644 --- a/hotspot/src/share/vm/opto/c2compiler.hpp +++ b/hotspot/src/share/vm/opto/c2compiler.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 @@ -32,13 +32,11 @@ class C2Compiler : public AbstractCompiler { static bool init_c2_runtime(); public: + C2Compiler() : AbstractCompiler(c2) {} + // Name const char *name() { return "C2"; } -#ifdef TIERED - virtual bool is_c2() { return true; }; -#endif // TIERED - void initialize(); // Compilation entry point for methods diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp index adc27ac02e4..6e9c98d3436 100644 --- a/hotspot/src/share/vm/opto/callGenerator.cpp +++ b/hotspot/src/share/vm/opto/callGenerator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index 594b650decb..3c07fc9a62a 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 492bf384f2f..47fa4ba6b5b 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -1682,9 +1682,21 @@ Node *PhaseChaitin::find_base_for_derived( Node **derived_base_map, Node *derive // (where top() node is placed). base->init_req(0, _cfg.get_root_node()); Block *startb = _cfg.get_block_for_node(C->top()); - startb->insert_node(base, startb->find_node(C->top())); + uint node_pos = startb->find_node(C->top()); + startb->insert_node(base, node_pos); _cfg.map_node_to_block(base, startb); assert(_lrg_map.live_range_id(base) == 0, "should not have LRG yet"); + + // The loadConP0 might have projection nodes depending on architecture + // Add the projection nodes to the CFG + for (DUIterator_Fast imax, i = base->fast_outs(imax); i < imax; i++) { + Node* use = base->fast_out(i); + if (use->is_MachProj()) { + startb->insert_node(use, ++node_pos); + _cfg.map_node_to_block(use, startb); + new_lrg(use, maxlrg++); + } + } } if (_lrg_map.live_range_id(base) == 0) { new_lrg(base, maxlrg++); diff --git a/hotspot/src/share/vm/opto/chaitin.hpp b/hotspot/src/share/vm/opto/chaitin.hpp index da98d16e29c..b188cc9bbf8 100644 --- a/hotspot/src/share/vm/opto/chaitin.hpp +++ b/hotspot/src/share/vm/opto/chaitin.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/classes.cpp b/hotspot/src/share/vm/opto/classes.cpp index 78529511f31..dadc72726e3 100644 --- a/hotspot/src/share/vm/opto/classes.cpp +++ b/hotspot/src/share/vm/opto/classes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/classes.hpp b/hotspot/src/share/vm/opto/classes.hpp index 002d2db636d..7390c915da9 100644 --- a/hotspot/src/share/vm/opto/classes.hpp +++ b/hotspot/src/share/vm/opto/classes.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/coalesce.hpp b/hotspot/src/share/vm/opto/coalesce.hpp index 3a361b25f11..41d4d8fe3e2 100644 --- a/hotspot/src/share/vm/opto/coalesce.hpp +++ b/hotspot/src/share/vm/opto/coalesce.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 99d3cec271b..ba8debaaeea 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" +#include "ci/ciReplay.hpp" #include "classfile/systemDictionary.hpp" #include "code/exceptionHandlerTable.hpp" #include "code/nmethod.hpp" @@ -647,6 +648,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr _printer(IdealGraphPrinter::printer()), #endif _congraph(NULL), + _replay_inline_data(NULL), _late_inlines(comp_arena(), 2, 0, NULL), _string_late_inlines(comp_arena(), 2, 0, NULL), _boxing_late_inlines(comp_arena(), 2, 0, NULL), @@ -680,6 +682,10 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr } set_print_assembly(print_opto_assembly); set_parsed_irreducible_loop(false); + + if (method()->has_option("ReplayInline")) { + _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level()); + } #endif set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); @@ -849,6 +855,15 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr #endif NOT_PRODUCT( verify_barriers(); ) + + // Dump compilation data to replay it. + if (method()->has_option("DumpReplay")) { + env()->dump_replay_data(_compile_id); + } + if (method()->has_option("DumpInline") && (ilt() != NULL)) { + env()->dump_inline_data(_compile_id); + } + // Now that we know the size of all the monitors we can add a fixed slot // for the original deopt pc. @@ -938,6 +953,7 @@ Compile::Compile( ciEnv* ci_env, _dead_node_list(comp_arena()), _dead_node_count(0), _congraph(NULL), + _replay_inline_data(NULL), _number_of_mh_late_inlines(0), _inlining_progress(false), _inlining_incrementally(false), @@ -3757,6 +3773,16 @@ void Compile::dump_inlining() { } } +// Dump inlining replay data to the stream. +// Don't change thread state and acquire any locks. +void Compile::dump_inline_data(outputStream* out) { + InlineTree* inl_tree = ilt(); + if (inl_tree != NULL) { + out->print(" inline %d", inl_tree->count()); + inl_tree->dump_replay_data(out); + } +} + int Compile::cmp_expensive_nodes(Node* n1, Node* n2) { if (n1->Opcode() < n2->Opcode()) return -1; else if (n1->Opcode() > n2->Opcode()) return 1; diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index d248d9d6c23..88581238b1e 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -431,6 +431,8 @@ class Compile : public Phase { // Are we within a PreserveJVMState block? int _preserve_jvm_state; + void* _replay_inline_data; // Pointer to data loaded from file + public: outputStream* print_inlining_stream() const { @@ -465,6 +467,11 @@ class Compile : public Phase { print_inlining_stream()->print(ss.as_string()); } + void* replay_inline_data() const { return _replay_inline_data; } + + // Dump inlining replay data to the stream. + void dump_inline_data(outputStream* out); + private: // Matching, CFG layout, allocation, code generation PhaseCFG* _cfg; // Results of CFG finding diff --git a/hotspot/src/share/vm/opto/connode.cpp b/hotspot/src/share/vm/opto/connode.cpp index b59025ad4f3..948ff7b4632 100644 --- a/hotspot/src/share/vm/opto/connode.cpp +++ b/hotspot/src/share/vm/opto/connode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index 6768968bebd..223f7da3655 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/domgraph.cpp b/hotspot/src/share/vm/opto/domgraph.cpp index 5e1886c24f0..a7fa0532763 100644 --- a/hotspot/src/share/vm/opto/domgraph.cpp +++ b/hotspot/src/share/vm/opto/domgraph.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index 50afded6a92..028aa2467f2 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -1579,9 +1579,20 @@ void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { jobj->set_scalar_replaceable(false); return; } + // 2. An object is not scalar replaceable if the field into which it is + // stored has multiple bases one of which is null. + if (field->base_count() > 1) { + for (BaseIterator i(field); i.has_next(); i.next()) { + PointsToNode* base = i.get(); + if (base == null_obj) { + jobj->set_scalar_replaceable(false); + return; + } + } + } } assert(use->is_Field() || use->is_LocalVar(), "sanity"); - // 2. An object is not scalar replaceable if it is merged with other objects. + // 3. An object is not scalar replaceable if it is merged with other objects. for (EdgeIterator j(use); j.has_next(); j.next()) { PointsToNode* ptn = j.get(); if (ptn->is_JavaObject() && ptn != jobj) { @@ -1600,13 +1611,13 @@ void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { FieldNode* field = j.get()->as_Field(); int offset = field->as_Field()->offset(); - // 3. An object is not scalar replaceable if it has a field with unknown + // 4. An object is not scalar replaceable if it has a field with unknown // offset (array's element is accessed in loop). if (offset == Type::OffsetBot) { jobj->set_scalar_replaceable(false); return; } - // 4. Currently an object is not scalar replaceable if a LoadStore node + // 5. Currently an object is not scalar replaceable if a LoadStore node // access its field since the field value is unknown after it. // Node* n = field->ideal_node(); @@ -1617,7 +1628,7 @@ void ConnectionGraph::adjust_scalar_replaceable_state(JavaObjectNode* jobj) { } } - // 5. Or the address may point to more then one object. This may produce + // 6. Or the address may point to more then one object. This may produce // the false positive result (set not scalar replaceable) // since the flow-insensitive escape analysis can't separate // the case when stores overwrite the field's value from the case diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index db60d4d1e60..6d7164347b4 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/generateOptoStub.cpp b/hotspot/src/share/vm/opto/generateOptoStub.cpp index 9b64d1f10e2..6721c9dcda2 100644 --- a/hotspot/src/share/vm/opto/generateOptoStub.cpp +++ b/hotspot/src/share/vm/opto/generateOptoStub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 8c5e05c3ac7..c30cdc12c82 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index 75e01784e4c..cfd943698c4 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/opto/idealKit.cpp b/hotspot/src/share/vm/opto/idealKit.cpp index 90eff2bb5d7..504af59e05a 100644 --- a/hotspot/src/share/vm/opto/idealKit.cpp +++ b/hotspot/src/share/vm/opto/idealKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/opto/idealKit.hpp b/hotspot/src/share/vm/opto/idealKit.hpp index 16833c0cbfe..132a310d5d4 100644 --- a/hotspot/src/share/vm/opto/idealKit.hpp +++ b/hotspot/src/share/vm/opto/idealKit.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp index 89ed5b33102..52a6cecce90 100644 --- a/hotspot/src/share/vm/opto/ifg.cpp +++ b/hotspot/src/share/vm/opto/ifg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp index 029a9f64adc..6e61a1f98bc 100644 --- a/hotspot/src/share/vm/opto/ifnode.cpp +++ b/hotspot/src/share/vm/opto/ifnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index c497abdb578..bdf076aa341 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/live.cpp b/hotspot/src/share/vm/opto/live.cpp index 02bbb1b97ab..787f5ab88c3 100644 --- a/hotspot/src/share/vm/opto/live.cpp +++ b/hotspot/src/share/vm/opto/live.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/live.hpp b/hotspot/src/share/vm/opto/live.hpp index e449bb3f3a6..343c5c6f727 100644 --- a/hotspot/src/share/vm/opto/live.hpp +++ b/hotspot/src/share/vm/opto/live.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp index 411226acffa..2fbfba0f48c 100644 --- a/hotspot/src/share/vm/opto/loopPredicate.cpp +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 75f35b7d896..af31a9ce1fb 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 6d4933893bb..59915ffed6f 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index a7bf3ad28e8..ba19f7493cc 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 06bf9e608c0..325b014ea08 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/opto/macro.hpp b/hotspot/src/share/vm/opto/macro.hpp index 7a72316dfc8..5e2e97c7e3c 100644 --- a/hotspot/src/share/vm/opto/macro.hpp +++ b/hotspot/src/share/vm/opto/macro.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index 1131d09f1d5..f840d0c6edc 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 49694b6e92e..14d347b8e69 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -2071,6 +2071,11 @@ const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const { if (t != NULL) { // constant oop => constant klass if (offset == java_lang_Class::array_klass_offset_in_bytes()) { + if (t->is_void()) { + // We cannot create a void array. Since void is a primitive type return null + // klass. Users of this result need to do a null check on the returned klass. + return TypePtr::NULL_PTR; + } return TypeKlassPtr::make(ciArrayKlass::make(t)); } if (!t->is_klass()) { diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index 88a05ad134d..3a35be5dba3 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/multnode.cpp b/hotspot/src/share/vm/opto/multnode.cpp index bb3357abcf0..106a0086c63 100644 --- a/hotspot/src/share/vm/opto/multnode.cpp +++ b/hotspot/src/share/vm/opto/multnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/multnode.hpp b/hotspot/src/share/vm/opto/multnode.hpp index e3866c8b9a1..6a0aea721b8 100644 --- a/hotspot/src/share/vm/opto/multnode.hpp +++ b/hotspot/src/share/vm/opto/multnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 1df5eb51a8c..06e74b6d0f2 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/optoreg.hpp b/hotspot/src/share/vm/opto/optoreg.hpp index a21311b9c6d..0d45c7a50ab 100644 --- a/hotspot/src/share/vm/opto/optoreg.hpp +++ b/hotspot/src/share/vm/opto/optoreg.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index 6232c41f0b1..f362669b5ec 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/output.hpp b/hotspot/src/share/vm/opto/output.hpp index 5fb68c6828a..6758d180689 100644 --- a/hotspot/src/share/vm/opto/output.hpp +++ b/hotspot/src/share/vm/opto/output.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/parse.hpp b/hotspot/src/share/vm/opto/parse.hpp index f60e6a540ea..6da027ee65f 100644 --- a/hotspot/src/share/vm/opto/parse.hpp +++ b/hotspot/src/share/vm/opto/parse.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -141,6 +141,13 @@ public: GrowableArray subtrees() { return _subtrees; } void print_value_on(outputStream* st) const PRODUCT_RETURN; + + bool _forced_inline; // Inlining was forced by CompilerOracle or ciReplay + bool forced_inline() const { return _forced_inline; } + // Count number of nodes in this subtree + int count() const; + // Dump inlining replay data to the stream. + void dump_replay_data(outputStream* out); }; diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index 808f64d2d9a..de7188ff871 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index 74119ef9f51..75746213087 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/phase.cpp b/hotspot/src/share/vm/opto/phase.cpp index 5359301575d..24fdb45ca7c 100644 --- a/hotspot/src/share/vm/opto/phase.cpp +++ b/hotspot/src/share/vm/opto/phase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/phase.hpp b/hotspot/src/share/vm/opto/phase.hpp index 582a126db36..1bc68a130f5 100644 --- a/hotspot/src/share/vm/opto/phase.hpp +++ b/hotspot/src/share/vm/opto/phase.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp index 15b9b778883..3e6ab4eafff 100644 --- a/hotspot/src/share/vm/opto/phaseX.cpp +++ b/hotspot/src/share/vm/opto/phaseX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/phaseX.hpp b/hotspot/src/share/vm/opto/phaseX.hpp index 7f39e538154..d03d47d95bc 100644 --- a/hotspot/src/share/vm/opto/phaseX.hpp +++ b/hotspot/src/share/vm/opto/phaseX.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/postaloc.cpp b/hotspot/src/share/vm/opto/postaloc.cpp index 2ad809d1a58..86078979af1 100644 --- a/hotspot/src/share/vm/opto/postaloc.cpp +++ b/hotspot/src/share/vm/opto/postaloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/opto/reg_split.cpp b/hotspot/src/share/vm/opto/reg_split.cpp index 842048f46f5..cfcecadd338 100644 --- a/hotspot/src/share/vm/opto/reg_split.cpp +++ b/hotspot/src/share/vm/opto/reg_split.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/regalloc.cpp b/hotspot/src/share/vm/opto/regalloc.cpp index 7ac02165662..a4844367e43 100644 --- a/hotspot/src/share/vm/opto/regalloc.cpp +++ b/hotspot/src/share/vm/opto/regalloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/regalloc.hpp b/hotspot/src/share/vm/opto/regalloc.hpp index 9bea94be5de..3aea8194783 100644 --- a/hotspot/src/share/vm/opto/regalloc.hpp +++ b/hotspot/src/share/vm/opto/regalloc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 4e2c8b7aef6..fcbead264af 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp index 47eb5c65c05..56ee308d982 100644 --- a/hotspot/src/share/vm/opto/subnode.hpp +++ b/hotspot/src/share/vm/opto/subnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp index 90f24189fe4..96c81bd999c 100644 --- a/hotspot/src/share/vm/opto/superword.cpp +++ b/hotspot/src/share/vm/opto/superword.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/opto/superword.hpp b/hotspot/src/share/vm/opto/superword.hpp index 050d7588c3d..5081586474d 100644 --- a/hotspot/src/share/vm/opto/superword.hpp +++ b/hotspot/src/share/vm/opto/superword.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 3f628195f78..83806a3235b 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -3812,17 +3812,17 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const { tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable); } } else // Non integral arrays. - // Must fall to bottom if exact klasses in upper lattice - // are not equal or super klass is exact. - if ( above_centerline(ptr) && klass() != tap->klass() && - // meet with top[] and bottom[] are processed further down: - tap ->_klass != NULL && this->_klass != NULL && - // both are exact and not equal: - ((tap ->_klass_is_exact && this->_klass_is_exact) || - // 'tap' is exact and super or unrelated: - (tap ->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) || - // 'this' is exact and super or unrelated: - (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) { + // Must fall to bottom if exact klasses in upper lattice + // are not equal or super klass is exact. + if ((above_centerline(ptr) || ptr == Constant) && klass() != tap->klass() && + // meet with top[] and bottom[] are processed further down: + tap->_klass != NULL && this->_klass != NULL && + // both are exact and not equal: + ((tap->_klass_is_exact && this->_klass_is_exact) || + // 'tap' is exact and super or unrelated: + (tap->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) || + // 'this' is exact and super or unrelated: + (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) { tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable); return make(NotNull, NULL, tary, lazy_klass, false, off, InstanceBot); } diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index d4be22e6cd0..4026c0eb29f 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * 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 diff --git a/hotspot/src/share/vm/prims/forte.cpp b/hotspot/src/share/vm/prims/forte.cpp index 4b1fbebc137..ae09d1161d2 100644 --- a/hotspot/src/share/vm/prims/forte.cpp +++ b/hotspot/src/share/vm/prims/forte.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -613,7 +613,7 @@ void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { #ifdef __APPLE__ // XXXDARWIN: Link errors occur even when __attribute__((weak_import)) // is added -#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) +#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0) #else void collector_func_load(char* name, void* null_argument_1, diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index ab24446baf1..449ed679847 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -1804,34 +1804,34 @@ JNI_END // the runtime type of subword integral basic types is integer DEFINE_CALLMETHODV(jboolean, Boolean, T_BOOLEAN - , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBOOLEANMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBOOLEANMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jbyte, Byte, T_BYTE - , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBYTEMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBYTEMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jchar, Char, T_CHAR - , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLCHARMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLCHARMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jshort, Short, T_SHORT - , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLSHORTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLSHORTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jobject, Object, T_OBJECT - , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLOBJECTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLOBJECTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jint, Int, T_INT, - HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref)) + HOTSPOT_JNI_CALLINTMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLINTMETHODV_RETURN(_ret_ref)) DEFINE_CALLMETHODV(jlong, Long, T_LONG - , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLLONGMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLLONGMETHODV_RETURN(_ret_ref)) // Float and double probes don't return value because dtrace doesn't currently support it DEFINE_CALLMETHODV(jfloat, Float, T_FLOAT - , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLFLOATMETHOD_RETURN()) + , HOTSPOT_JNI_CALLFLOATMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLFLOATMETHODV_RETURN()) DEFINE_CALLMETHODV(jdouble, Double, T_DOUBLE - , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN()) + , HOTSPOT_JNI_CALLDOUBLEMETHODV_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLDOUBLEMETHODV_RETURN()) #define DEFINE_CALLMETHODA(ResultType, Result, Tag \ , EntryProbe, ReturnProbe) \ @@ -1856,34 +1856,34 @@ JNI_END // the runtime type of subword integral basic types is integer DEFINE_CALLMETHODA(jboolean, Boolean, T_BOOLEAN - , HOTSPOT_JNI_CALLBOOLEANMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBOOLEANMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBOOLEANMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBOOLEANMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jbyte, Byte, T_BYTE - , HOTSPOT_JNI_CALLBYTEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLBYTEMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLBYTEMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLBYTEMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jchar, Char, T_CHAR - , HOTSPOT_JNI_CALLCHARMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLCHARMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLCHARMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLCHARMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jshort, Short, T_SHORT - , HOTSPOT_JNI_CALLSHORTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLSHORTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLSHORTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLSHORTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jobject, Object, T_OBJECT - , HOTSPOT_JNI_CALLOBJECTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLOBJECTMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLOBJECTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLOBJECTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jint, Int, T_INT, - HOTSPOT_JNI_CALLINTMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLINTMETHOD_RETURN(_ret_ref)) + HOTSPOT_JNI_CALLINTMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLINTMETHODA_RETURN(_ret_ref)) DEFINE_CALLMETHODA(jlong, Long, T_LONG - , HOTSPOT_JNI_CALLLONGMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLLONGMETHOD_RETURN(_ret_ref)) + , HOTSPOT_JNI_CALLLONGMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLLONGMETHODA_RETURN(_ret_ref)) // Float and double probes don't return value because dtrace doesn't currently support it DEFINE_CALLMETHODA(jfloat, Float, T_FLOAT - , HOTSPOT_JNI_CALLFLOATMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLFLOATMETHOD_RETURN()) + , HOTSPOT_JNI_CALLFLOATMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLFLOATMETHODA_RETURN()) DEFINE_CALLMETHODA(jdouble, Double, T_DOUBLE - , HOTSPOT_JNI_CALLDOUBLEMETHOD_ENTRY(env, obj, (uintptr_t)methodID), - HOTSPOT_JNI_CALLDOUBLEMETHOD_RETURN()) + , HOTSPOT_JNI_CALLDOUBLEMETHODA_ENTRY(env, obj, (uintptr_t)methodID), + HOTSPOT_JNI_CALLDOUBLEMETHODA_RETURN()) DT_VOID_RETURN_MARK_DECL(CallVoidMethod, HOTSPOT_JNI_CALLVOIDMETHOD_RETURN()); DT_VOID_RETURN_MARK_DECL(CallVoidMethodV, HOTSPOT_JNI_CALLVOIDMETHODV_RETURN()); @@ -3145,7 +3145,7 @@ JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID JNI_END DEFINE_SETSTATICFIELD(jboolean, bool, Boolean, 'Z', z - , HOTSPOT_JNI_SETBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value), + , HOTSPOT_JNI_SETSTATICBOOLEANFIELD_ENTRY(env, clazz, (uintptr_t)fieldID, value), HOTSPOT_JNI_SETBOOLEANFIELD_RETURN()) DEFINE_SETSTATICFIELD(jbyte, byte, Byte, 'B', b , HOTSPOT_JNI_SETSTATICBYTEFIELD_ENTRY(env, clazz, (uintptr_t) fieldID, value), diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index b829d14dd23..4313b4bf0ac 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index a757e194827..1059783eb05 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -3971,40 +3971,6 @@ jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Ha } -// Internal SQE debugging support /////////////////////////////////////////////////////////// - -#ifndef PRODUCT - -extern "C" { - JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get); - JNIEXPORT jboolean JNICALL JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get); - JNIEXPORT void JNICALL JVM_VMBreakPoint(JNIEnv *env, jobject obj); -} - -JVM_LEAF(jboolean, JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get)) - JVMWrapper("JVM_AccessBoolVMFlag"); - return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, Flag::INTERNAL); -JVM_END - -JVM_LEAF(jboolean, JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get)) - JVMWrapper("JVM_AccessVMIntFlag"); - intx v; - jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, Flag::INTERNAL); - *value = (jint)v; - return result; -JVM_END - - -JVM_ENTRY(void, JVM_VMBreakPoint(JNIEnv *env, jobject obj)) - JVMWrapper("JVM_VMBreakPoint"); - oop the_obj = JNIHandles::resolve(obj); - BREAKPOINT; -JVM_END - - -#endif - - // Method /////////////////////////////////////////////////////////////////////////////////////////// JVM_ENTRY(jobject, JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0)) diff --git a/hotspot/src/share/vm/prims/jvm_misc.hpp b/hotspot/src/share/vm/prims/jvm_misc.hpp index 266ed8690db..39b2d7199d4 100644 --- a/hotspot/src/share/vm/prims/jvm_misc.hpp +++ b/hotspot/src/share/vm/prims/jvm_misc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp index c931e3f8e78..95129c06b9a 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp index d9d475b11ad..4170cf9155d 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 diff --git a/hotspot/src/share/vm/prims/jvmtiEnter.xsl b/hotspot/src/share/vm/prims/jvmtiEnter.xsl index f31bd5143b7..ff609eee2f9 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl +++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl @@ -1,6 +1,6 @@ - - - -' - -# -# UDiffs need a slightly different CSS rule for 'new' items (we don't -# want them to be bolded as we do in cdiffs or sdiffs). -# -UDIFFCSS=' - -' - -# -# input_cmd | html_quote | output_cmd -# or -# html_quote filename | output_cmd -# -# Make a piece of source code safe for display in an HTML
 block.
-#
-html_quote()
-{
-	sed -e "s/&/\&/g" -e "s/&#\([x]*[0-9A-Fa-f]\{2,5\}\);/\&#\1;/g" -e "s//\>/g" "$@" | expand
-}
-
-#
-# input_cmd | html_quote | output_cmd
-# or
-# html_dequote filename | output_cmd
-#
-# Replace HTML entities with literals
-#
-html_dequote()
-{
-	sed -e "s/"/\"/g" -e "s/'/\'/g" -e "s/&/\&/g" -e "s/</<'/g" -e "s/>/>/g" "$@" | expand
-}
-
-#
-# input_cmd | bug2url | output_cmd
-#
-# Scan for bugids and insert  links to the relevent bug database.
-#
-bug2url()
-{
-	sed -e 's|[0-9]\{5,\}|&|g'
-}
-
-#
-# strip_unchanged  | output_cmd
-#
-# Removes chunks of sdiff documents that have not changed. This makes it
-# easier for a code reviewer to find the bits that have changed.
-#
-# Deleted lines of text are replaced by a horizontal rule. Some
-# identical lines are retained before and after the changed lines to
-# provide some context.  The number of these lines is controlled by the
-# variable C in the $AWK script below.
-#
-# The script detects changed lines as any line that has a "
"
-				inx = c % C
-				c = C
-			}
-
-			for (i = 0; i < c; i++)
-				print ln[(inx + i) % C]
-		}
-		c = 0;
-		print
-		next
-	}
-	{	if (c >= C) {
-			ln[c % C] = $0
-			c++;
-			next;
-		}
-		c++;
-		print
-	}
-	END	{ if (c > (C * 2)) print "\n

" } - - ' $1 -} - -# -# sdiff_to_html -# -# This function takes two files as arguments, obtains their diff, and -# processes the diff output to present the files as an HTML document with -# the files displayed side-by-side, differences shown in color. It also -# takes a delta comment, rendered as an HTML snippet, as the third -# argument. The function takes two files as arguments, then the name of -# file, the path, and the comment. The HTML will be delivered on stdout, -# e.g. -# -# $ sdiff_to_html old/usr/src/tools/scripts/webrev.sh \ -# new/usr/src/tools/scripts/webrev.sh \ -# webrev.sh usr/src/tools/scripts \ -# ' -# JDK-1234567 my bugid' > .html -# -# framed_sdiff() is then called which creates $2.frames.html -# in the webrev tree. -# -# FYI: This function is rather unusual in its use of awk. The initial -# diff run produces conventional diff output showing changed lines mixed -# with editing codes. The changed lines are ignored - we're interested in -# the editing codes, e.g. -# -# 8c8 -# 57a61 -# 63c66,76 -# 68,93d80 -# 106d90 -# 108,110d91 -# -# These editing codes are parsed by the awk script and used to generate -# another awk script that generates HTML, e.g the above lines would turn -# into something like this: -# -# BEGIN { printf "
\n" }
-#      function sp(n) {for (i=0;i%4d %s \n", n, NR, $0}
-#      NR==8           {wl("#7A7ADD");next}
-#      NR==54          {wl("#7A7ADD");sp(3);next}
-#      NR==56          {wl("#7A7ADD");next}
-#      NR==57          {wl("black");printf "\n"; next}
-#        :               :
-#
-#  This script is then run on the original source file to generate the
-#  HTML that corresponds to the source file.
-#
-#  The two HTML files are then combined into a single piece of HTML that
-#  uses an HTML table construct to present the files side by side.  You'll
-#  notice that the changes are color-coded:
-#
-#   black     - unchanged lines
-#   blue      - changed lines
-#   bold blue - new lines
-#   brown     - deleted lines
-#
-#  Blank lines are inserted in each file to keep unchanged lines in sync
-#  (side-by-side).  This format is familiar to users of sdiff(1) or
-#  Teamware's filemerge tool.
-#
-sdiff_to_html()
-{
-	diff -b $1 $2 > /tmp/$$.diffs
-
-	TNAME=$3
-	TPATH=$4
-	COMMENT=$5
-
-	#
-	#  Now we have the diffs, generate the HTML for the old file.
-	#
-	$AWK '
-	BEGIN	{
-		printf "function sp(n) {for (i=0;i%%4d %%s\\n\", NR, $0}\n"
-		printf "function changed() "
-		printf "{printf \"%%4d %%s\\n\", NR, $0}\n"
-		printf "function bl() {printf \"%%4d %%s\\n\", NR, $0}\n"
-}
-	/^/	{next}
-	/^---/	{next}
-
-	{
-	split($1, a, /[cad]/) ;
-	if (index($1, "a")) {
-		if (a[1] == 0) {
-			n = split(a[2], r, /,/);
-			if (n == 1)
-				printf "BEGIN\t\t{sp(1)}\n"
-			else
-				printf "BEGIN\t\t{sp(%d)}\n",\
-				(r[2] - r[1]) + 1
-			next
-		}
-
-		printf "NR==%s\t\t{", a[1]
-		n = split(a[2], r, /,/);
-		s = r[1];
-		if (n == 1)
-			printf "bl();printf \"\\n\"; next}\n"
-		else {
-			n = r[2] - r[1]
-			printf "bl();sp(%d);next}\n",\
-			(r[2] - r[1]) + 1
-		}
-		next
-	}
-	if (index($1, "d")) {
-		n = split(a[1], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		if (n == 1)
-			printf "NR==%s\t\t{removed(); next}\n" , n1
-		else
-			printf "NR==%s,NR==%s\t{removed(); next}\n" , n1, n2
-		next
-	}
-	if (index($1, "c")) {
-		n = split(a[1], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		final = n2
-		d1 = 0
-		if (n == 1)
-			printf "NR==%s\t\t{changed();" , n1
-		else {
-			d1 = n2 - n1
-			printf "NR==%s,NR==%s\t{changed();" , n1, n2
-		}
-		m = split(a[2], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		if (m > 1) {
-			d2  = n2 - n1
-			if (d2 > d1) {
-				if (n > 1) printf "if (NR==%d)", final
-				printf "sp(%d);", d2 - d1
-			}
-		}
-		printf "next}\n" ;
-
-		next
-	}
-	}
-
-	END	{ printf "{printf \"%%4d %%s\\n\", NR, $0 }\n" }
-	' /tmp/$$.diffs > /tmp/$$.file1
-
-	#
-	#  Now generate the HTML for the new file
-	#
-	$AWK '
-	BEGIN	{
-		printf "function sp(n) {for (i=0;i%%4d %%s\\n\", NR, $0}\n"
-		printf "function changed() "
-		printf "{printf \"%%4d %%s\\n\", NR, $0}\n"
-		printf "function bl() {printf \"%%4d %%s\\n\", NR, $0}\n"
-	}
-
-	/^/	{next}
-	/^---/	{next}
-
-	{
-	split($1, a, /[cad]/) ;
-	if (index($1, "d")) {
-		if (a[2] == 0) {
-			n = split(a[1], r, /,/);
-			if (n == 1)
-				printf "BEGIN\t\t{sp(1)}\n"
-			else
-				printf "BEGIN\t\t{sp(%d)}\n",\
-				(r[2] - r[1]) + 1
-			next
-		}
-
-		printf "NR==%s\t\t{", a[2]
-		n = split(a[1], r, /,/);
-		s = r[1];
-		if (n == 1)
-			printf "bl();printf \"\\n\"; next}\n"
-		else {
-			n = r[2] - r[1]
-			printf "bl();sp(%d);next}\n",\
-			(r[2] - r[1]) + 1
-		}
-		next
-	}
-	if (index($1, "a")) {
-		n = split(a[2], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		if (n == 1)
-			printf "NR==%s\t\t{new() ; next}\n" , n1
-		else
-			printf "NR==%s,NR==%s\t{new() ; next}\n" , n1, n2
-		next
-	}
-	if (index($1, "c")) {
-		n = split(a[2], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		final = n2
-		d2 = 0;
-		if (n == 1) {
-			final = n1
-			printf "NR==%s\t\t{changed();" , n1
-		} else {
-			d2 = n2 - n1
-			printf "NR==%s,NR==%s\t{changed();" , n1, n2
-		}
-		m = split(a[1], r, /,/);
-		n1 = r[1]
-		n2 = r[2]
-		if (m > 1) {
-			d1  = n2 - n1
-			if (d1 > d2) {
-				if (n > 1) printf "if (NR==%d)", final
-				printf "sp(%d);", d1 - d2
-			}
-		}
-		printf "next}\n" ;
-		next
-	}
-	}
-	END	{ printf "{printf \"%%4d %%s\\n\", NR, $0 }\n" }
-	' /tmp/$$.diffs > /tmp/$$.file2
-
-	#
-	# Post-process the HTML files by running them back through $AWK
-	#
-	html_quote < $1 | $AWK -f /tmp/$$.file1 > /tmp/$$.file1.html
-
-	html_quote < $2 | $AWK -f /tmp/$$.file2 > /tmp/$$.file2.html
-
-	#
-	# Now combine into a valid HTML file and side-by-side into a table
-	#
-	print "$HTML$STDHEAD"
-	print "$WNAME Sdiff $TPATH "
-	print ""
-	print "

$TPATH/$TNAME

" - print "Print this page" - print "
$COMMENT
\n" - print "" - print "" - print "
"
-
-	strip_unchanged /tmp/$$.file1.html
-
-	print "
"
-
-	strip_unchanged /tmp/$$.file2.html
-
-	print "
" - print "" - - framed_sdiff $TNAME $TPATH /tmp/$$.file1.html /tmp/$$.file2.html \ - "$COMMENT" -} - - -# -# framed_sdiff -# -# Expects lefthand and righthand side html files created by sdiff_to_html. -# We use insert_anchors() to augment those with HTML navigation anchors, -# and then emit the main frame. Content is placed into: -# -# $WDIR/DIR/$TNAME.lhs.html -# $WDIR/DIR/$TNAME.rhs.html -# $WDIR/DIR/$TNAME.frames.html -# -# NOTE: We rely on standard usage of $WDIR and $DIR. -# -function framed_sdiff -{ - typeset TNAME=$1 - typeset TPATH=$2 - typeset lhsfile=$3 - typeset rhsfile=$4 - typeset comments=$5 - typeset RTOP - - # Enable html files to access WDIR via a relative path. - RTOP=$(relative_dir $TPATH $WDIR) - - # Make the rhs/lhs files and output the frameset file. - print "$HTML$STDHEAD" > $WDIR/$DIR/$TNAME.lhs.html - - cat >> $WDIR/$DIR/$TNAME.lhs.html <<-EOF - - - - -
$comments

- EOF - - cp $WDIR/$DIR/$TNAME.lhs.html $WDIR/$DIR/$TNAME.rhs.html - - insert_anchors $lhsfile >> $WDIR/$DIR/$TNAME.lhs.html - insert_anchors $rhsfile >> $WDIR/$DIR/$TNAME.rhs.html - - close='' - - print $close >> $WDIR/$DIR/$TNAME.lhs.html - print $close >> $WDIR/$DIR/$TNAME.rhs.html - - print "$FRAMEHTML$STDHEAD" > $WDIR/$DIR/$TNAME.frames.html - print "$WNAME Framed-Sdiff " \ - "$TPATH/$TNAME " >> $WDIR/$DIR/$TNAME.frames.html - cat >> $WDIR/$DIR/$TNAME.frames.html <<-EOF - - - - - - - - <body id="SUNWwebrev"> - Alas 'frames' webrev requires that your browser supports frames - and has the feature enabled. - </body> - - - - EOF -} - - -# -# fix_postscript -# -# Merge codereview output files to a single conforming postscript file, by: -# - removing all extraneous headers/trailers -# - making the page numbers right -# - removing pages devoid of contents which confuse some -# postscript readers. -# -# From Casper. -# -function fix_postscript -{ - infile=$1 - - cat > /tmp/$$.crmerge.pl << \EOF - - print scalar(<>); # %!PS-Adobe--- - print "%%Orientation: Landscape\n"; - - $pno = 0; - $doprint = 1; - - $page = ""; - - while (<>) { - next if (/^%%Pages:\s*\d+/); - - if (/^%%Page:/) { - if ($pno == 0 || $page =~ /\)S/) { - # Header or single page containing text - print "%%Page: ? $pno\n" if ($pno > 0); - print $page; - $pno++; - } else { - # Empty page, skip it. - } - $page = ""; - $doprint = 1; - next; - } - - # Skip from %%Trailer of one document to Endprolog - # %%Page of the next - $doprint = 0 if (/^%%Trailer/); - $page .= $_ if ($doprint); - } - - if ($page =~ /\)S/) { - print "%%Page: ? $pno\n"; - print $page; - } else { - $pno--; - } - print "%%Trailer\n%%Pages: $pno\n"; -EOF - - $PERL /tmp/$$.crmerge.pl < $infile -} - - -# -# input_cmd | insert_anchors | output_cmd -# -# Flag blocks of difference with sequentially numbered invisible -# anchors. These are used to drive the frames version of the -# sdiffs output. -# -# NOTE: Anchor zero flags the top of the file irrespective of changes, -# an additional anchor is also appended to flag the bottom. -# -# The script detects changed lines as any line that has a "", anc, anc++; - } - - BEGIN { - anc=1; - inblock=1; - printf "
\n";
-	}
-	NF == 0 || /^";
-		printf "--- EOF ---"
-        	for(i=0;i<8;i++) printf "\n\n\n\n\n\n\n\n\n\n";
-		printf "
" - printf "
"; - printf "", - anc - 1; - printf "
"; - } - ' $1 -} - - -# -# relative_dir -# -# Print a relative return path from $1 to $2. For example if -# $1=/tmp/myreview/raw_files/usr/src/tools/scripts and $2=/tmp/myreview, -# this function would print "../../../../". -# -# In the event that $1 is not in $2 a warning is printed to stderr, -# and $2 is returned-- the result of this is that the resulting webrev -# is not relocatable. -# -function relative_dir -{ - d1=$1 - d2=$2 - if [[ "$d1" == "." ]]; then - print "." - else - typeset cur="${d1##$d2?(/)}" - typeset ret="" - if [[ $d2 == $cur ]]; then # Should never happen. - # Should never happen. - print -u2 "\nWARNING: relative_dir: \"$1\" not relative " - print -u2 "to \"$2\". Check input paths. Framed webrev " - print -u2 "will not be relocatable!" - print $2 - return - fi - - while [[ -n ${cur} ]]; - do - cur=${cur%%*(/)*([!/])} - if [[ -z $ret ]]; then - ret=".." - else - ret="../$ret" - fi - done - print $ret - fi -} - - -# -# frame_nav_js -# -# Emit javascript for frame navigation -# -function frame_nav_js -{ -cat << \EOF -var myInt; -var scrolling=0; -var sfactor = 3; -var scount=10; - -function scrollByPix() { - if (scount<=0) { - sfactor*=1.2; - scount=10; - } - parent.lhs.scrollBy(0,sfactor); - parent.rhs.scrollBy(0,sfactor); - scount--; -} - -function scrollToAnc(num) { - - // Update the value of the anchor in the form which we use as - // storage for this value. setAncValue() will take care of - // correcting for overflow and underflow of the value and return - // us the new value. - num = setAncValue(num); - - // Set location and scroll back a little to expose previous - // lines. - // - // Note that this could be improved: it is possible although - // complex to compute the x and y position of an anchor, and to - // scroll to that location directly. - // - parent.lhs.location.replace(parent.lhs.location.pathname + "#" + num); - parent.rhs.location.replace(parent.rhs.location.pathname + "#" + num); - - parent.lhs.scrollBy(0,-30); - parent.rhs.scrollBy(0,-30); -} - -function getAncValue() -{ - return (parseInt(parent.nav.document.diff.real.value)); -} - -function setAncValue(val) -{ - if (val <= 0) { - val = 0; - parent.nav.document.diff.real.value = val; - parent.nav.document.diff.display.value = "BOF"; - return (val); - } - - // - // The way we compute the max anchor value is to stash it - // inline in the left and right hand side pages-- it's the same - // on each side, so we pluck from the left. - // - maxval = parent.lhs.document.eof.value.value; - if (val < maxval) { - parent.nav.document.diff.real.value = val; - parent.nav.document.diff.display.value = val.toString(); - return (val); - } - - // this must be: val >= maxval - val = maxval; - parent.nav.document.diff.real.value = val; - parent.nav.document.diff.display.value = "EOF"; - return (val); -} - -function stopScroll() { - if (scrolling==1) { - clearInterval(myInt); - scrolling=0; - } -} - -function startScroll() { - stopScroll(); - scrolling=1; - myInt=setInterval("scrollByPix()",10); -} - -function handlePress(b) { - - switch (b) { - case 1 : - scrollToAnc(-1); - break; - case 2 : - scrollToAnc(getAncValue() - 1); - break; - case 3 : - sfactor=-3; - startScroll(); - break; - case 4 : - sfactor=3; - startScroll(); - break; - case 5 : - scrollToAnc(getAncValue() + 1); - break; - case 6 : - scrollToAnc(999999); - break; - } -} - -function handleRelease(b) { - stopScroll(); -} - -function keypress(ev) { - var keynum; - var keychar; - - if (window.event) { // IE - keynum = ev.keyCode; - } else if (ev.which) { // non-IE - keynum = ev.which; - } - - keychar = String.fromCharCode(keynum); - - if (keychar == "k") { - handlePress(2); - return (0); - } else if (keychar == "j" || keychar == " ") { - handlePress(5); - return (0); - } - return (1); -} - -function ValidateDiffNum(){ - val = parent.nav.document.diff.display.value; - if (val == "EOF") { - scrollToAnc(999999); - return; - } - - if (val == "BOF") { - scrollToAnc(0); - return; - } - - i=parseInt(val); - if (isNaN(i)) { - parent.nav.document.diff.display.value = getAncValue(); - } else { - scrollToAnc(i); - } - return false; -} - -EOF -} - -# -# frame_navigation -# -# Output anchor navigation file for framed sdiffs. -# -function frame_navigation -{ - print "$HTML$STDHEAD" - - cat << \EOF -Anchor Navigation - - - - -EOF - - print "" - - cat << \EOF - - - - - - - - - -
Diff navigation: - Use 'j' and 'k' for next and previous diffs; or use buttons - at right -
- - - - - - - - - - - -
- BOF - Scroll Up - Prev Diff -
- EOF - Scroll Down - Next Diff
-
-
-
- - -
-
- - -EOF -} - - - -# -# diff_to_html { U | C } -# -# Processes the output of diff to produce an HTML file representing either -# context or unified diffs. -# -diff_to_html() -{ - TNAME=$1 - TPATH=$2 - DIFFTYPE=$3 - COMMENT=$4 - - print "$HTML$STDHEAD" - print "$WNAME ${DIFFTYPE}diff $TPATH" - - if [[ $DIFFTYPE == "U" ]]; then - print "$UDIFFCSS" - fi - - cat <<-EOF - - -

$TPATH

- Print this page -
$COMMENT
-
-EOF
-
-	html_quote | $AWK '
-	/^--- new/	{ next }
-	/^\+\+\+ new/	{ next }
-	/^--- old/	{ next }
-	/^\*\*\* old/	{ next }
-	/^\*\*\*\*/	{ next }
-	/^-------/	{ printf "

%s

\n", $0; next } - /^\@\@.*\@\@$/ { printf "

\n";
-			  printf "%s\n", $0;
-			  next}
-
-	/^\*\*\*/	{ printf "
%s\n", $0; - next} - /^---/ { printf "%s\n", $0; - next} - /^\+/ {printf "%s\n", $0; next} - /^!/ {printf "%s\n", $0; next} - /^-/ {printf "%s\n", $0; next} - {printf "%s\n", $0; next} - ' - - print "
\n" -} - - -# -# source_to_html { new | old } -# -# Process a plain vanilla source file to transform it into an HTML file. -# -source_to_html() -{ - WHICH=$1 - TNAME=$2 - - print "$HTML$STDHEAD" - print "$WHICH $TNAME" - print "" - print "
"
-	html_quote | $AWK '{line += 1 ; printf "%4d %s\n", line, $0 }'
-	print "
" -} - -comments_from_mercurial() -{ - fmt=$1 - pfile=$PWS/$2 - cfile=$CWS/$3 - - logdir=`dirname $cfile` - logf=`basename $cfile` - if [ -d $logdir ]; then - ( cd $logdir; - active=`hg status $logf 2>/dev/null` - # If the output from 'hg status' is not empty, it means the file - # hasn't been committed, so don't fetch comments. - if [[ -z $active ]] ; then - if [[ -n $ALL_CREV ]]; then - rev_opt= - for rev in $ALL_CREV; do - rev_opt="$rev_opt --rev $rev" - done - comm=`hg log $rev_opt --follow --template 'rev {rev} : {desc}\n' $logf` - elif [[ -n $FIRST_CREV ]]; then - comm=`hg log --rev $FIRST_CREV:tip --follow --template 'rev {rev} : {desc}\n' $logf` - else - comm=`hg log -l1 --follow --template 'rev {rev} : {desc}\n' $logf` - fi - else - comm="" - fi - if [[ $fmt == "text" ]]; then - print "$comm" - return - fi - - print "$comm" | html_quote | bug2url - ) - fi -} - - -# -# getcomments {text|html} filepath parentpath -# -# Fetch the comments depending on what SCM mode we're in. -# -getcomments() -{ - typeset fmt=$1 - typeset p=$2 - typeset pp=$3 - - comments_from_mercurial $fmt $pp $p -} - -# -# printCI -# -# Print out Code Inspection figures similar to sccs-prt(1) format. -# -function printCI -{ - integer tot=$1 ins=$2 del=$3 mod=$4 unc=$5 - typeset str - if (( tot == 1 )); then - str="line" - else - str="lines" - fi - printf '%d %s changed: %d ins; %d del; %d mod; %d unchg' \ - $tot $str $ins $del $mod $unc -} - - -# -# difflines -# -# Calculate and emit number of added, removed, modified and unchanged lines, -# and total lines changed, the sum of added + removed + modified. -# -function difflines -{ - integer tot mod del ins unc err - typeset filename - - eval $( diff -e $1 $2 | $AWK ' - # Change range of lines: N,Nc - /^[0-9]*,[0-9]*c$/ { - n=split(substr($1,1,length($1)-1), counts, ","); - if (n != 2) { - error=2 - exit; - } - # - # 3,5c means lines 3 , 4 and 5 are changed, a total of 3 lines. - # following would be 5 - 3 = 2! Hence +1 for correction. - # - r=(counts[2]-counts[1])+1; - - # - # Now count replacement lines: each represents a change instead - # of a delete, so increment c and decrement r. - # - while (getline != /^\.$/) { - c++; - r--; - } - # - # If there were more replacement lines than original lines, - # then r will be negative; in this case there are no deletions, - # but there are r changes that should be counted as adds, and - # since r is negative, subtract it from a and add it to c. - # - if (r < 0) { - a-=r; - c+=r; - } - - # - # If there were more original lines than replacement lines, then - # r will be positive; in this case, increment d by that much. - # - if (r > 0) { - d+=r; - } - next; - } - - # Change lines: Nc - /^[0-9].*c$/ { - # The first line is a replacement; any more are additions. - if (getline != /^\.$/) { - c++; - while (getline != /^\.$/) a++; - } - next; - } - - # Add lines: both Na and N,Na - /^[0-9].*a$/ { - while (getline != /^\.$/) a++; - next; - } - - # Delete range of lines: N,Nd - /^[0-9]*,[0-9]*d$/ { - n=split(substr($1,1,length($1)-1), counts, ","); - if (n != 2) { - error=2 - exit; - } - # - # 3,5d means lines 3 , 4 and 5 are deleted, a total of 3 lines. - # following would be 5 - 3 = 2! Hence +1 for correction. - # - r=(counts[2]-counts[1])+1; - d+=r; - next; - } - - # Delete line: Nd. For example 10d says line 10 is deleted. - /^[0-9]*d$/ {d++; next} - - # Should not get here! - { - error=1; - exit; - } - - # Finish off - print results - END { - printf("tot=%d;mod=%d;del=%d;ins=%d;err=%d\n", - (c+d+a), c, d, a, error); - }' ) - - # End of $AWK, Check to see if any trouble occurred. - if (( $? > 0 || err > 0 )); then - print "Unexpected Error occurred reading" \ - "\`diff -e $1 $2\`: \$?=$?, err=" $err - return - fi - - # Accumulate totals - (( TOTL += tot )) - (( TMOD += mod )) - (( TDEL += del )) - (( TINS += ins )) - # Calculate unchanged lines - unc=`wc -l < $1` - if (( unc > 0 )); then - (( unc -= del + mod )) - (( TUNC += unc )) - fi - # print summary - print "\c" - printCI $tot $ins $del $mod $unc - print "" -} - -function outgoing_from_mercurial_forest -{ - hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK ' - BEGIN {ntree=0} - /^comparing/ {next} - /^no changes/ {next} - /^searching/ {next} - /^\[.*\]$/ {tree=substr($1,2,length($1)-2); - trees[ntree++] = tree; - revs[tree]=-1; - next} - /^rev:/ {rev=$2+0; - if (revs[tree] == -1 || rev < revs[tree]) - { revs[tree] = rev; }; - next;} - END {for (tree in trees) - { rev=revs[trees[tree]]; - if (rev > 0) - {printf("%s %d\n",trees[tree],rev-1)} - }}' | while read LINE - do - set - $LINE - TREE=$1 - REV=$2 - A=`hg -R $CWS/$TREE log --rev $REV --template '{node}'` - FSTAT_OPT="--rev $A" - print "Revision: $A $REV" >> $FLIST - treestatus $TREE - done -} - -function flist_from_mercurial_forest -{ - rm -f $FLIST - if [ -z "$Nflag" ]; then - print " File list from hg foutgoing $PWS ..." - outgoing_from_mercurial_forest - HG_LIST_FROM_COMMIT=1 - fi - if [ ! -f $FLIST ]; then - # hg commit hasn't been run see what is lying around - print "\n No outgoing, perhaps you haven't commited." - print " File list from hg fstatus -mard ...\c" - FSTAT_OPT= - fstatus - HG_LIST_FROM_COMMIT= - fi - print " Done." -} - -# -# Used when dealing with the result of 'hg foutgoing' -# When now go down the tree and generate the change list -# -function treestatus -{ - TREE=$1 - HGCMD="hg -R $CWS/$TREE status $FSTAT_OPT" - - $HGCMD -mdn 2>/dev/null | $FILTER | while read F - do - echo $TREE/$F - done >> $FLIST - - # Then all the added files - # But some of these could have been "moved" or renamed ones or copied ones - # so let's make sure we get the proper info - # hg status -aC will produce something like: - # A subdir/File3 - # A subdir/File4 - # File4 - # A subdir/File5 - # The first and last are simple addition while the middle one - # is a move/rename or a copy. We can't distinguish from a rename vs a copy - # without also getting the status of removed files. The middle case above - # is a rename if File4 is also shown a being removed. If File4 is not a - # removed file, then the middle case is a copy from File4 to subdir/File4 - # FIXME - we're not distinguishing copy from rename - $HGCMD -aC | $FILTER | while read LINE; do - ldone="" - while [ -z "$ldone" ]; do - ldone="1" - set - $LINE - if [ $# -eq 2 -a "$1" == "A" ]; then - AFILE=$2 - if read LINE2; then - set - $LINE2 - if [ $# -eq 1 ]; then - echo $TREE/$AFILE $TREE/$1 >>$FLIST - elif [ $# -eq 2 ]; then - echo $TREE/$AFILE >>$FLIST - LINE=$LINE2 - ldone="" - fi - else - echo $TREE/$AFILE >>$FLIST - fi - fi - done - done - $HGCMD -rn | $FILTER | while read RFILE; do - grep "$TREE/$RFILE" $FLIST >/dev/null - if [ $? -eq 1 ]; then - echo $TREE/$RFILE >>$FLIST - fi - done -} - -function fstatus -{ - # - # forest extension is still being changed. For instance the output - # of fstatus used to no prepend the tree path to filenames, but - # this has changed recently. AWK code below does try to handle both - # cases - # - hg fstatus -mdn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK ' - /^\[.*\]$/ {tree=substr($1,2,length($1)-2); next} - $1 != "" {n=index($1,tree); - if (n == 0) - { printf("%s/%s\n",tree,$1)} - else - { printf("%s\n",$1)}}' >> $FLIST - - # - # There is a bug in the output of fstatus -aC on recent versions: it - # inserts a space between the name of the tree and the filename of the - # old file. e.g.: - # - # $ hg fstatus -aC - # [.] - # - # [MyWS] - # A MyWS/subdir/File2 - # MyWS/ File2 - # - # [MyWS2] - # - - hg fstatus -aC $FSTAT_OPT 2>/dev/null | $FILTER | $AWK ' - /^\[.*\]$/ {tree=substr($1,2,length($1)-2); next} - /^A .*/ {n=index($2,tree); - if (n == 0) - { printf("A %s/%s\n",tree,$2)} - else - { printf("A %s\n",$2)}; - next} - /^ / {n=index($1,tree); - if (n == 0) - { printf("%s/%s\n",tree,$1)} - else - { if (NF == 2) - printf("%s/%s\n",tree,$2) - else - printf("%s\n",$1) - }; - next} - ' | while read LINE; do - ldone="" - while [ -z "$ldone" ]; do - ldone="1" - set - $LINE - if [ $# -eq 2 -a "$1" == "A" ]; then - AFILE=$2 - if read LINE2; then - set - $LINE2 - if [ $# -eq 1 ]; then - echo $AFILE $1 >>$FLIST - elif [ $# -eq 2 ]; then - echo $AFILE >>$FLIST - LINE=$LINE2 - ldone="" - fi - else - echo $AFILE >>$FLIST - fi - fi - done - done - hg fstatus -rn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK ' - /^\[.*\]$/ {tree=substr($1,2,length($1)-2); next} - $1 != "" {n=index($1,tree); - if (n == 0) - { printf("%s/%s\n",tree,$1)} - else - { printf("%s\n",$1)}}' | while read RFILE; do - grep "$RFILE" $FLIST >/dev/null - if [ $? -eq 1 ]; then - echo $RFILE >>$FLIST - fi - done -} - -# -# flist_from_mercurial $PWS -# -# Only local file based repositories are supported at present -# since even though we can determine the list from the parent finding -# the changes is harder. -# -# We first look for any outgoing files, this is for when the user has -# run hg commit. If we don't find any then we look with hg status. -# -# We need at least one of default-push or default paths set in .hg/hgrc -# If neither are set we don't know who to compare with. - -function flist_from_mercurial -{ -# if [ "${PWS##ssh://}" != "$PWS" -o \ -# "${PWS##http://}" != "$PWS" -o \ -# "${PWS##https://}" != "$PWS" ]; then -# print "Remote Mercurial repositories not currently supported." -# print "Set default and/or default-push to a local repository" -# exit -# fi - if [[ -n $forestflag ]]; then - HG_LIST_FROM_COMMIT= - flist_from_mercurial_forest - else - STATUS_REV= - if [[ -n $rflag ]]; then - STATUS_REV="--rev $PARENT_REV" - elif [[ -n $OUTREV ]]; then - STATUS_REV="--rev $OUTREV" - else - # hg commit hasn't been run see what is lying around - print "\n No outgoing, perhaps you haven't commited." - fi - # First let's list all the modified or deleted files - - hg status $STATUS_REV -mdn | $FILTER > $FLIST - - # Then all the added files - # But some of these could have been "moved" or renamed ones - # so let's make sure we get the proper info - # hg status -aC will produce something like: - # A subdir/File3 - # A subdir/File4 - # File4 - # A subdir/File5 - # The first and last are simple addition while the middle one - # is a move/rename or a copy. We can't distinguish from a rename vs a copy - # without also getting the status of removed files. The middle case above - # is a rename if File4 is also shown a being removed. If File4 is not a - # removed file, then the middle case is a copy from File4 to subdir/File4 - # FIXME - we're not distinguishing copy from rename - - hg status $STATUS_REV -aC | $FILTER >$FLIST.temp - while read LINE; do - ldone="" - while [ -z "$ldone" ]; do - ldone="1" - set - $LINE - if [ $# -eq 2 -a "$1" == "A" ]; then - AFILE=$2 - if read LINE2; then - set - $LINE2 - if [ $# -eq 1 ]; then - echo $AFILE $1 >>$FLIST - elif [ $# -eq 2 ]; then - echo $AFILE >>$FLIST - LINE=$LINE2 - ldone="" - fi - else - echo $AFILE >>$FLIST - fi - fi - done - done < $FLIST.temp - hg status $STATUS_REV -rn | $FILTER > $FLIST.temp - while read RFILE; do - grep "$RFILE" $FLIST >/dev/null - if [ $? -eq 1 ]; then - echo $RFILE >>$FLIST - fi - done < $FLIST.temp - rm -f $FLIST.temp - fi -} - -function env_from_flist -{ - [[ -r $FLIST ]] || return - - # - # Use "eval" to set env variables that are listed in the file - # list. Then copy those into our local versions of those - # variables if they have not been set already. - # - eval `sed -e "s/#.*$//" $FLIST | grep = ` - - [[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS - - # - # Check to see if CODEMGR_PARENT is set in the flist file. - # - [[ -z $codemgr_parent && -n $CODEMGR_PARENT ]] && \ - codemgr_parent=$CODEMGR_PARENT -} - -# -# detect_scm -# -# We dynamically test the SCM type; this allows future extensions to -# new SCM types -# -function detect_scm -{ - if hg root >/dev/null ; then - print "mercurial" - else - print "unknown" - fi -} - -function look_for_prog -{ - typeset path - typeset ppath - typeset progname=$1 - - DEVTOOLS= - OS=`uname` - if [[ "$OS" == "SunOS" ]]; then - DEVTOOLS="/java/devtools/`uname -p`/bin" - elif [[ "$OS" == "Linux" ]]; then - DEVTOOLS="/java/devtools/linux/bin" - fi - - ppath=$PATH - ppath=$ppath:/usr/sfw/bin:/usr/bin:/usr/sbin - ppath=$ppath:/opt/teamware/bin:/opt/onbld/bin - ppath=$ppath:/opt/onbld/bin/`uname -p` - ppath=$ppath:/java/devtools/share/bin:$DEVTOOLS - - PATH=$ppath prog=`whence $progname` - if [[ -n $prog ]]; then - print $prog - fi -} - -# -# Find the parent for $1 -# -function find_outrev -{ - crev=$1 - prev=`hg log -r $crev --template '{parents}\n'` - if [[ -z "$prev" ]] - then - # No specific parent means previous changeset is parent - prev=`expr $crev - 1` - else - # Format is either of the following two: - # 546:7df6fcf1183b - # 548:16f1915bb5cd 547:ffaa4e775815 - prev=`echo $prev | sed -e 's/\([0-9]*\):.*/\1/'` - fi - print $prev -} - -function extract_ssh_infos -{ - CMD=$1 - if expr "$CMD" : 'ssh://[^/]*@' >/dev/null; then - ssh_user=`echo $CMD | sed -e 's/ssh:\/\/\(.*\)@.*/\1/'` - ssh_host=`echo $CMD | sed -e 's/ssh:\/\/.*@\([^/]*\)\/.*/\1/'` - ssh_dir=`echo $CMD | sed -e 's/ssh:\/\/.*@[^/]*\/\(.*\)/\1/'` - else - ssh_user= - ssh_host=`echo $CMD | sed -e 's/ssh:\/\/\([^/]*\)\/.*/\1/'` - ssh_dir=`echo $CMD | sed -e 's/ssh:\/\/[^/]*\/\(.*\)/\1/'` - fi - -} - -function build_old_new_mercurial -{ - olddir=$1 - newdir=$2 - DIR=$3 - F=$4 - # - # new version of the file. - # - rm -rf $newdir/$DIR/$F - if [ -f $F ]; then - cp $F $newdir/$DIR/$F - fi - - # - # Old version of the file. - # - rm -rf $olddir/$DIR/$F - - if [ -n "$PWS" ]; then - if expr "$PWS" : 'ssh://' >/dev/null - then - extract_ssh_infos $PWS - if [ -n "$ssh_user" ]; then - parent="ssh -l $ssh_user $ssh_host hg -R $ssh_dir --cwd $ssh_dir" - else - parent="ssh $ssh_host hg -R $ssh_dir --cwd $ssh_dir" - fi - else - parent="hg -R $PWS --cwd $PWS" - fi - else - parent="" - fi - - if [ -z "$rename" ]; then - if [ -n "$rflag" ]; then - parentrev=$PARENT_REV - elif [ "$HG_LIST_FROM_COMMIT" -eq 1 ]; then - parentrev=$OUTREV - else - if [[ -n $HG_BRANCH ]]; then - parentrev=$HG_BRANCH - else - parentrev="tip" - fi - fi - - if [ -n "$parentrev" ]; then - if [ -z "$parent" ]; then - hg cat --rev $parentrev --output $olddir/$DIR/$F $F 2>/dev/null - else - # when specifying a workspace we have to provide - # the full path - $parent cat --rev $parentrev --output $olddir/$DIR/$F $DIR/$F 2>/dev/null - fi - fi - else - # It's a rename (or a move), or a copy, so let's make sure we move - # to the right directory first, then restore it once done - current_dir=`pwd` - hg_root=`hg root` - cd $CWS - if [ -n "$rflag" ]; then - parentrev=$PARENT_REV - elif [ "$HG_LIST_FROM_COMMIT" -eq 1 ]; then - parentrev=$OUTREV - fi - if [ -z "$parentrev" ]; then - parentrev=`hg log -l1 $PDIR/$PF | $AWK -F: '/changeset/ {print $2}'` - fi - if [ -n "$parentrev" ]; then - mkdir -p $olddir/$PDIR - if [ -z "$parent" ]; then - hg cat -R $hg_root --rev $parentrev --output $olddir/$PDIR/$PF $PDIR/$PF 2>/dev/null - else - $parent cat --rev $parentrev --output $olddir/$PDIR/$PF $PDIR/$PF 2>/dev/null - fi - fi - cd $current_dir - fi -} - -function build_old_new -{ - if [[ $SCM_MODE == "mercurial" ]]; then - build_old_new_mercurial $@ - fi -} - - -# -# Usage message. -# -function usage -{ - print "Usage:\twebrev [options] - webrev [options] ( | - ) - -Options: - -v: Print the version of this tool. - -b: Do not ignore changes in the amount of white space. - -c : Include link to CR (aka bugid) in the main page. - -i : Include in the index.html file. - -o : Output webrev to specified directory. - -p : Use specified parent wkspc or basis for comparison - -u : Use that username instead of 'guessing' one. - -m: Forces the use of Mercurial - -Mercurial only options: - -r rev: Compare against a specified revision - -N: Skip 'hg outgoing', use only 'hg status' - -f: Use the forest extension - -Arguments: - : Optional file containing list of files to include in webrev - -: read list of files to include in webrev from standard input - -Environment: - WDIR: Control the output directory. - WEBREV_BUGURL: Control the URL prefix for bugids. - -" - - exit 2 -} - -# -# -# Main program starts here -# -# -LANG="C" -LC_ALL="C" -export LANG LC_ALL -trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15 - -set +o noclobber - -[[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff` -[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview` -[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf` -[[ -z $PERL ]] && PERL=`look_for_prog perl` -[[ -z $SCCS ]] && SCCS=`look_for_prog sccs` -[[ -z $AWK ]] && AWK=`look_for_prog nawk` -[[ -z $AWK ]] && AWK=`look_for_prog gawk` -[[ -z $AWK ]] && AWK=`look_for_prog awk` -[[ -z $JAR ]] && JAR=`look_for_prog jar` -[[ -z $ZIP ]] && ZIP=`look_for_prog zip` -[[ -z $GETENT ]] && GETENT=`look_for_prog getent` -[[ -z $WGET ]] && WGET=`look_for_prog wget` - -if uname | grep CYGWIN >/dev/null -then - ISWIN=1 - # Under windows mercurial outputs '\' instead of '/' - FILTER="tr '\\\\' '/'" -else - FILTER="cat" -fi - -if [[ ! -x $PERL ]]; then - print -u2 "Error: No perl interpreter found. Exiting." - exit 1 -fi - -# -# These aren't fatal, but we want to note them to the user. -# -# [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found." -# [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found." -# [[ ! -x $WDIFF ]] && print -u2 "WARNING: wdiff not found." - -# Declare global total counters. -integer TOTL TINS TDEL TMOD TUNC - -flist_mode= -flist_file= -bflag= -iflag= -oflag= -pflag= -uflag= -Oflag= -rflag= -Nflag= -forestflag= -while getopts "c:i:o:p:r:u:mONvfb" opt -do - case $opt in - b) bflag=1;; - - i) iflag=1 - INCLUDE_FILE=$OPTARG;; - - o) oflag=1 - WDIR=$OPTARG;; - - p) pflag=1 - codemgr_parent=$OPTARG;; - - u) uflag=1 - username=$OPTARG;; - - c) if [[ -z $CRID ]]; then - CRID=$OPTARG - else - CRID="$CRID $OPTARG" - fi;; - - m) SCM_MODE="mercurial";; - - O) Oflag=1;; # ignored (bugs are now all visible at bugs.openjdk.java.net) - - N) Nflag=1;; - - f) forestflag=1;; - - r) rflag=1 - PARENT_REV=$OPTARG;; - - v) print "$0 version: $WEBREV_UPDATED";; - - - ?) usage;; - esac -done - -FLIST=/tmp/$$.flist -HG_LIST_FROM_COMMIT= - -if [[ -n $forestflag && -n $rflag ]]; then - print "The -r flag is incompatible with the use of forests" - exit 2 -fi - -# -# If this manually set as the parent, and it appears to be an earlier webrev, -# then note that fact and set the parent to the raw_files/new subdirectory. -# -if [[ -n $pflag && -d $codemgr_parent/raw_files/new ]]; then - parent_webrev="$codemgr_parent" - codemgr_parent="$codemgr_parent/raw_files/new" -fi - -shift $(($OPTIND - 1)) - -if [[ $1 == "-" ]]; then - cat > $FLIST - flist_mode="stdin" - flist_done=1 - shift -elif [[ -n $1 ]]; then - if [[ ! -r $1 ]]; then - print -u2 "$1: no such file or not readable" - usage - fi - cat $1 > $FLIST - flist_mode="file" - flist_file=$1 - flist_done=1 - shift -else - flist_mode="auto" -fi - -# -# Before we go on to further consider -l and -w, work out which SCM we think -# is in use. -# -if [[ -z $SCM_MODE ]]; then - SCM_MODE=`detect_scm $FLIST` -fi -if [[ $SCM_MODE == "unknown" ]]; then - print -u2 "Unable to determine SCM type currently in use." - print -u2 "For mercurial: webrev runs 'hg root'." - exit 1 -fi - -print -u2 " SCM detected: $SCM_MODE" - - -if [[ $SCM_MODE == "mercurial" ]]; then - # - # determine Workspace and parent workspace paths - # - CWS=`hg root | $FILTER` - if [[ -n $pflag && -z "$PWS" ]]; then - OUTPWS=$codemgr_parent - # Let's try to expand it if it's an alias defined in [paths] - tmp=`hg path $OUTPWS 2>/dev/null | $FILTER` - if [[ -n $tmp ]]; then - OUTPWS="$tmp" - fi - if [[ -n $rflag ]]; then - if expr "$codemgr_parent" : 'ssh://.*' >/dev/null; then - PWS=$codemgr_parent - else - PWS=`hg -R "$codemgr_parent" root 2>/dev/null | $FILTER` - fi - fi - fi - # - # OUTPWS is the parent repository to use when using 'hg outgoing' - # - if [[ -z $Nflag ]]; then - if [[ -n $forestflag ]]; then - # - # for forest we have to rely on properly set default and - # default-push because they can be different from the top one. - # unless of course it was explicitly specified with -p - if [[ -z $pflag ]]; then - OUTPWS= - fi - else - # - # Unfortunately mercurial is bugged and doesn't handle - # aliases correctly in 'hg path default' - # So let's do it ourselves. Sigh... - if [[ -z "$OUTPWS" ]]; then - OUTPWS=`grep default-push $CWS/.hg/hgrc | $AWK '{print $3}' | $FILTER` - fi - # Still empty, means no default-push - if [[ -z "$OUTPWS" ]]; then - OUTPWS=`grep 'default =' $CWS/.hg/hgrc | $AWK '{print $3}' | $FILTER` - fi - # Let's try to expand it if it's an alias defined in [paths] - tmp=`hg path $OUTPWS 2>/dev/null | $FILTER` - if [[ -n $tmp ]]; then - OUTPWS="$tmp" - fi - fi - fi - # - # OUTPWS may contain username:password, let's make sure we remove the - # sensitive information before we print out anything in the HTML - # - OUTPWS2=$OUTPWS - if [[ -n $OUTPWS ]]; then - if [[ `expr "$OUTPWS" : '.*://[^/]*@.*'` -gt 0 ]]; then - # Remove everything between '://' and '@' - OUTPWS2=`echo $OUTPWS | sed -e 's/\(.*:\/\/\).*@\(.*\)/\1\2/'` - fi - fi - - if [[ -z $HG_BRANCH ]]; then - HG_BRANCH=`hg branch` - if [ "$HG_BRANCH" == "default" ]; then - # - # 'default' means no particular branch, so let's cancel that - # - HG_BRANCH= - fi - fi - - if [[ -z $forestflag ]]; then - if [[ -z $Nflag ]]; then - # - # If no "-N", always do "hg outgoing" against parent - # repository to determine list of outgoing revisions. - # - ALL_CREV=`hg outgoing -q --template '{rev}\n' $OUTPWS | sort -n` - if [[ -n $ALL_CREV ]]; then - FIRST_CREV=`echo "$ALL_CREV" | head -1` - # - # If no "-r", choose revision to compare against by - # finding the latest revision not in the outgoing list. - # - if [[ -z $rflag ]]; then - OUTREV=`find_outrev "$FIRST_CREV"` - if [[ -n $OUTREV ]]; then - HG_LIST_FROM_COMMIT=1 - fi - fi - fi - elif [[ -n $rflag ]]; then - # - # If skipping "hg outgoing" but still comparing against a - # specific revision (not the tip), set revision for comment - # accumulation. - # - FIRST_CREV=`hg log --rev $PARENT_REV --template '{rev}'` - FIRST_CREV=`expr $FIRST_CREV + 1` - fi - fi - #Let's check if a merge is needed, if so, issue a warning - PREV=`hg parent | grep '^tag:.*tip$'` - if [[ -z $PREV ]]; then - print "WARNING: parent rev is not tip. Maybe an update or merge is needed" - fi -fi - -if [[ $flist_mode == "stdin" ]]; then - print -u2 " File list from: standard input" -elif [[ $flist_mode == "file" ]]; then - print -u2 " File list from: $flist_file" -fi - -if [[ $# -gt 0 ]]; then - print -u2 "WARNING: unused arguments: $*" -fi - -if [[ $SCM_MODE == "mercurial" ]]; then - if [[ -z $flist_done ]]; then - flist_from_mercurial $PWS - fi -fi - -# -# If the user didn't specify a -i option, check to see if there is a -# webrev-info file in the workspace directory. -# -if [[ -z $iflag && -r "$CWS/webrev-info" ]]; then - iflag=1 - INCLUDE_FILE="$CWS/webrev-info" -fi - -if [[ -n $iflag ]]; then - if [[ ! -r $INCLUDE_FILE ]]; then - print -u2 "include file '$INCLUDE_FILE' does not exist or is" \ - "not readable." - exit 1 - else - # - # $INCLUDE_FILE may be a relative path, and the script alters - # PWD, so we just stash a copy in /tmp. - # - cp $INCLUDE_FILE /tmp/$$.include - fi -fi - -# -# Output directory. -# -if [[ -z $WDIR ]]; then - WDIR=$CWS/webrev -else - # If the output directory doesn't end with '/webrev' or '/webrev/' - # then add '/webrev'. This is for backward compatibility - if ! expr $WDIR : '.*/webrev/\?$' >/dev/null - then - WDIR=$WDIR/webrev - fi -fi -# WDIR=${WDIR:-$CWS/webrev} - -# -# Name of the webrev, derived from the workspace name; in the -# future this could potentially be an option. -# -# Let's keep what's after the last '/' -WNAME=${CWS##*/} - -# -# If WDIR doesn't start with '/' or 'x:' prepend the current dir -# -if [ ${WDIR%%/*} ]; then - if [[ -n $ISWIN ]]; then - if [ ${WDIR%%[A-Za-z]:*} ]; then - WDIR=$PWD/$WDIR - fi - else - WDIR=$PWD/$WDIR - fi -fi - -if [[ ! -d $WDIR ]]; then - mkdir -p $WDIR - [[ $? != 0 ]] && exit 1 -fi - -# -# Summarize what we're going to do. -# -print " Workspace: $CWS" -if [[ -n $parent_webrev ]]; then - print "Compare against: webrev at $parent_webrev" -elif [[ -n $OUTPWS2 ]]; then - print "Compare against: $OUTPWS2" -fi -if [[ -n $HG_BRANCH ]]; then - print " Branch: $HG_BRANCH" -fi -if [[ -n $rflag ]]; then - print "Compare against version: $PARENT_REV" -fi -[[ -n $INCLUDE_FILE ]] && print " Including: $INCLUDE_FILE" -print " Output to: $WDIR" - -# -# Save the file list in the webrev dir -# -[[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list - -# -# Bug IDs will be replaced by a URL. Order of precedence -# is: default location, $WEBREV_BUGURL -# -BUGURL='https://bugs.openjdk.java.net/browse/' -[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL" -IDPREFIX='JDK-' - - -rm -f $WDIR/$WNAME.patch -rm -f $WDIR/$WNAME.changeset -rm -f $WDIR/$WNAME.ps -rm -f $WDIR/$WNAME.pdf - -touch $WDIR/$WNAME.patch - -print " Output Files:" - -# -# Clean up the file list: Remove comments, blank lines and env variables. -# -sed -e "s/#.*$//" -e "/=/d" -e "/^[ ]*$/d" $FLIST > /tmp/$$.flist.clean -FLIST=/tmp/$$.flist.clean - -# -# Clean up residual raw files -# -if [ -d $WDIR/raw_files ]; then - rm -rf $WDIR/raw_files 2>/dev/null -fi - -# -# Should we ignore changes in white spaces when generating diffs? -# -if [[ -n $bflag ]]; then - DIFFOPTS="-t" -else - DIFFOPTS="-bt" -fi -# -# First pass through the files: generate the per-file webrev HTML-files. -# -while read LINE -do - set - $LINE - P=$1 - - if [[ $1 == "Revision:" ]]; then - OUTREV=$2 - continue - fi - # - # Normally, each line in the file list is just a pathname of a - # file that has been modified or created in the child. A file - # that is renamed in the child workspace has two names on the - # line: new name followed by the old name. - # - oldname="" - oldpath="" - rename= - if [[ $# -eq 2 ]]; then - PP=$2 # old filename - oldname=" (was $PP)" - oldpath="$PP" - rename=1 - PDIR=${PP%/*} - if [[ $PDIR == $PP ]]; then - PDIR="." # File at root of workspace - fi - - PF=${PP##*/} - - DIR=${P%/*} - if [[ $DIR == $P ]]; then - DIR="." # File at root of workspace - fi - - F=${P##*/} - else - DIR=${P%/*} - if [[ "$DIR" == "$P" ]]; then - DIR="." # File at root of workspace - fi - - F=${P##*/} - - PP=$P - PDIR=$DIR - PF=$F - fi - - # Make the webrev directory if necessary as it may have been - # removed because it was empty - if [ ! -d $CWS/$DIR ]; then - mkdir -p $CWS/$DIR - fi - - COMM=`getcomments html $P $PP` - - print "\t$P$oldname\n\t\t\c" - - # Make the webrev mirror directory if necessary - mkdir -p $WDIR/$DIR - - # cd to the directory so the names are short - cd $CWS/$DIR - - # - # We stash old and new files into parallel directories in /tmp - # and do our diffs there. This makes it possible to generate - # clean looking diffs which don't have absolute paths present. - # - olddir=$WDIR/raw_files/old - newdir=$WDIR/raw_files/new - mkdir -p $olddir - mkdir -p $newdir - mkdir -p $olddir/$PDIR - mkdir -p $newdir/$DIR - - build_old_new $olddir $newdir $DIR $F - - if [[ ! -f $F && ! -f $olddir/$DIR/$F ]]; then - print "*** Error: file not in parent or child" - continue - fi - - cd $WDIR/raw_files - ofile=old/$PDIR/$PF - nfile=new/$DIR/$F - - mv_but_nodiff= - cmp $ofile $nfile > /dev/null 2>&1 - if [[ $? == 0 && $rename == 1 ]]; then - mv_but_nodiff=1 - fi - - # - # Cleaning up - # - rm -f $WDIR/$DIR/$F.cdiff.html - rm -f $WDIR/$DIR/$F.udiff.html - rm -f $WDIR/$DIR/$F.wdiff.html - rm -f $WDIR/$DIR/$F.sdiff.html - rm -f $WDIR/$DIR/$F-.html - rm -f $WDIR/$DIR/$F.html - - its_a_jar= - if expr $F : '.*\.jar' \| $F : '.*\.zip' >/dev/null; then - its_a_jar=1 - # It's a JAR or ZIP file, let's do it differently - if [[ -z $JAR ]]; then - print "No access to jar, so can't produce diffs for jar or zip files" - else - if [ -f $ofile ]; then - $JAR -tvf $ofile >"$ofile".lst - fi - if [ -f $nfile ]; then - $JAR -tvf $nfile >"$nfile".lst - fi - - if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then - - ${CDIFFCMD:-diff -bt -C 5} $ofile.lst $nfile.lst > $WDIR/$DIR/$F.cdiff - diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \ - > $WDIR/$DIR/$F.cdiff.html - print " cdiffs\c" - - ${UDIFFCMD:-diff -bt -U 5} $ofile.lst $nfile.lst > $WDIR/$DIR/$F.udiff - diff_to_html $F $DIR/$F "U" "$COMM" < $WDIR/$DIR/$F.udiff \ - > $WDIR/$DIR/$F.udiff.html - - print " udiffs\c" - - if [[ -x $WDIFF ]]; then - $WDIFF -c "$COMM" \ - -t "$WNAME Wdiff $DIR/$F" $ofile.lst $nfile.lst > \ - $WDIR/$DIR/$F.wdiff.html 2>/dev/null - if [[ $? -eq 0 ]]; then - print " wdiffs\c" - else - print " wdiffs[fail]\c" - fi - fi - - sdiff_to_html $ofile $nfile $F $DIR "$COMM" \ - > $WDIR/$DIR/$F.sdiff.html - print " sdiffs\c" - - print " frames\c" - - rm -f $WDIR/$DIR/$F.cdiff $WDIR/$DIR/$F.udiff - - difflines $ofile.lst $nfile.lst > $WDIR/$DIR/$F.count - - elif [[ -f $ofile && -f $nfile && -n $mv_but_nodiff ]]; then - # renamed file: may also have differences - difflines $ofile.lst $nfile.lst > $WDIR/$DIR/$F.count - elif [[ -f $nfile ]]; then - # new file: count added lines - difflines /dev/null $nfile.lst > $WDIR/$DIR/$F.count - elif [[ -f $ofile ]]; then - # old file: count deleted lines - difflines $ofile.lst /dev/null > $WDIR/$DIR/$F.count - fi - fi - else - - # - # If we have old and new versions of the file then run the - # appropriate diffs. This is complicated by a couple of factors: - # - # - renames must be handled specially: we emit a 'remove' - # diff and an 'add' diff - # - new files and deleted files must be handled specially - # - Solaris patch(1m) can't cope with file creation - # (and hence renames) as of this writing. - # - To make matters worse, gnu patch doesn't interpret the - # output of Solaris diff properly when it comes to - # adds and deletes. We need to do some "cleansing" - # transformations: - # [to add a file] @@ -1,0 +X,Y @@ --> @@ -0,0 +X,Y @@ - # [to del a file] @@ -X,Y +1,0 @@ --> @@ -X,Y +0,0 @@ - # - cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'" - cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'" - - if [[ ! "$HG_LIST_FROM_COMMIT" -eq 1 || ! $flist_mode == "auto" ]]; - then - # Only need to generate a patch file here if there are no commits in outgoing - # or if we've specified a file list - rm -f $WDIR/$DIR/$F.patch - if [[ -z $rename ]]; then - if [ ! -f $ofile ]; then - diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ - > $WDIR/$DIR/$F.patch - elif [ ! -f $nfile ]; then - diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ - > $WDIR/$DIR/$F.patch - else - diff -u $ofile $nfile > $WDIR/$DIR/$F.patch - fi - else - diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \ - > $WDIR/$DIR/$F.patch - - diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \ - >> $WDIR/$DIR/$F.patch - - fi - - - # - # Tack the patch we just made onto the accumulated patch for the - # whole wad. - # - cat $WDIR/$DIR/$F.patch >> $WDIR/$WNAME.patch - fi - - print " patch\c" - - if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then - - ${CDIFFCMD:-diff -bt -C 5} $ofile $nfile > $WDIR/$DIR/$F.cdiff - diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \ - > $WDIR/$DIR/$F.cdiff.html - print " cdiffs\c" - - ${UDIFFCMD:-diff -bt -U 5} $ofile $nfile > $WDIR/$DIR/$F.udiff - diff_to_html $F $DIR/$F "U" "$COMM" < $WDIR/$DIR/$F.udiff \ - > $WDIR/$DIR/$F.udiff.html - - print " udiffs\c" - - if [[ -x $WDIFF ]]; then - $WDIFF -c "$COMM" \ - -t "$WNAME Wdiff $DIR/$F" $ofile $nfile > \ - $WDIR/$DIR/$F.wdiff.html 2>/dev/null - if [[ $? -eq 0 ]]; then - print " wdiffs\c" - else - print " wdiffs[fail]\c" - fi - fi - - sdiff_to_html $ofile $nfile $F $DIR "$COMM" \ - > $WDIR/$DIR/$F.sdiff.html - print " sdiffs\c" - - print " frames\c" - - rm -f $WDIR/$DIR/$F.cdiff $WDIR/$DIR/$F.udiff - - difflines $ofile $nfile > $WDIR/$DIR/$F.count - - elif [[ -f $ofile && -f $nfile && -n $mv_but_nodiff ]]; then - # renamed file: may also have differences - difflines $ofile $nfile > $WDIR/$DIR/$F.count - elif [[ -f $nfile ]]; then - # new file: count added lines - difflines /dev/null $nfile > $WDIR/$DIR/$F.count - elif [[ -f $ofile ]]; then - # old file: count deleted lines - difflines $ofile /dev/null > $WDIR/$DIR/$F.count - fi - fi - # - # Now we generate the postscript for this file. We generate diffs - # only in the event that there is delta, or the file is new (it seems - # tree-killing to print out the contents of deleted files). - # - if [[ -f $nfile ]]; then - ocr=$ofile - [[ ! -f $ofile ]] && ocr=/dev/null - - if [[ -z $mv_but_nodiff ]]; then - textcomm=`getcomments text $P $PP` - if [[ -x $CODEREVIEW ]]; then - $CODEREVIEW -y "$textcomm" \ - -e $ocr $nfile \ - > /tmp/$$.psfile 2>/dev/null && - cat /tmp/$$.psfile >> $WDIR/$WNAME.ps - if [[ $? -eq 0 ]]; then - print " ps\c" - else - print " ps[fail]\c" - fi - fi - fi - fi - - if [[ -f $ofile && -z $mv_but_nodiff ]]; then - if [[ -n $its_a_jar ]]; then - source_to_html Old $P < $ofile.lst > $WDIR/$DIR/$F-.html - else - source_to_html Old $P < $ofile > $WDIR/$DIR/$F-.html - fi - print " old\c" - fi - - if [[ -f $nfile ]]; then - if [[ -n $its_a_jar ]]; then - source_to_html New $P < $nfile.lst > $WDIR/$DIR/$F.html - else - source_to_html New $P < $nfile > $WDIR/$DIR/$F.html - fi - print " new\c" - fi - - print -done < $FLIST - -# Create the new style mercurial patch here using hg export -r [all-revs] -g -o $CHANGESETPATH -if [[ $SCM_MODE == "mercurial" ]]; then - if [[ "$HG_LIST_FROM_COMMIT" -eq 1 && $flist_mode == "auto" ]]; then - EXPORTCHANGESET="$WNAME.changeset" - CHANGESETPATH=${WDIR}/${EXPORTCHANGESET} - rm -f $CHANGESETPATH - touch $CHANGESETPATH - if [[ -n $ALL_CREV ]]; then - rev_opt= - for rev in $ALL_CREV; do - rev_opt="$rev_opt --rev $rev" - done - elif [[ -n $FIRST_CREV ]]; then - rev_opt="--rev $FIRST_CREV" - fi - - if [[ -n $rev_opt ]]; then - (cd $CWS;hg export -g $rev_opt -o $CHANGESETPATH) - echo "Created changeset: $CHANGESETPATH" 1>&2 - # Use it in place of the jdk.patch created above - rm -f $WDIR/$WNAME.patch - fi - set +x - fi -fi - -frame_nav_js > $WDIR/ancnav.js -frame_navigation > $WDIR/ancnav.html - -if [[ -f $WDIR/$WNAME.ps && -x $CODEREVIEW && -x $PS2PDF ]]; then - print " Generating PDF: \c" - fix_postscript $WDIR/$WNAME.ps | $PS2PDF - > $WDIR/$WNAME.pdf - print "Done." -fi - -# Now build the index.html file that contains -# links to the source files and their diffs. - -cd $CWS - -# Save total changed lines for Code Inspection. -print "$TOTL" > $WDIR/TotalChangedLines - -print " index.html: \c" -INDEXFILE=$WDIR/index.html -exec 3<&1 # duplicate stdout to FD3. -exec 1<&- # Close stdout. -exec > $INDEXFILE # Open stdout to index file. - -print "$HTML" -print "" -print "$STDHEAD" -print "$WNAME" -print "" -print "" -print "
" -print "

Code Review for $WNAME

" - -print "" - -if [[ -z $uflag ]]; then - if [[ $SCM_MODE == "mercurial" ]]; then - # - # Let's try to extract the user name from the .hgrc file - # - username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'` - fi - - if [[ -z $username ]]; then - # - # Figure out the username and gcos name. To maintain compatibility - # with passwd(4), we must support '&' substitutions. - # - username=`id | cut -d '(' -f 2 | cut -d ')' -f 1` - if [[ -x $GETENT ]]; then - realname=`$GETENT passwd $username | cut -d':' -f 5 | cut -d ',' -f 1` - fi - userupper=`print "$username" | sed 's/\<./\u&/g'` - realname=`print $realname | sed s/\&/$userupper/` - fi -fi - -date="on `date`" - -if [[ -n "$username" && -n "$realname" ]]; then - print "" - print "" -elif [[ -n "$username" ]]; then - print "" -fi - -print "" -if [[ -n $parent_webrev ]]; then - print "" -if [[ -n $rflag ]]; then - print "" -elif [[ -n $OUTREV ]]; then - if [[ -z $forestflag ]]; then - print "" - fi -fi -if [[ -n $HG_BRANCH ]]; then - print "" -fi - -print "" - -if [[ -f $WDIR/$WNAME.patch ]]; then - print "" -elif [[ -f $CHANGESETPATH ]]; then - print "" -fi - -if [[ -f $WDIR/$WNAME.pdf ]]; then - print "" -fi - -if [[ -n "$iflag" ]]; then - print "" -fi -# Add links to referenced CRs, if any -# URL has a like: -# <title>[#JDK-8024688] b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair - Java Bug System -# we format this to: -# JDK-8024688: b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair -if [[ -n $CRID ]]; then - for id in $CRID - do - #add "JDK-" to raw bug id for openjdk.java.net links. - id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'` - - print "
Prepared by:$realname ($username) $date
Prepared by:$username $date
Workspace:$CWS
Compare against:" - print "webrev at $parent_webrev" -else - if [[ -n $OUTPWS2 ]]; then - print "
Compare against:" - print "$OUTPWS2" - fi -fi -print "
Compare against version:$PARENT_REV
Compare against version:$OUTREV
Branch:$HG_BRANCH
Summary of changes:" -printCI $TOTL $TINS $TDEL $TMOD $TUNC -print "
Patch of changes:" - print "$WNAME.patch
Changeset:" - print "$EXPORTCHANGESET
Printable review:" - print "$WNAME.pdf
Author comments:
" - cat /tmp/$$.include - print "
Bug id:" - url="${BUGURL}${id}" - - if [[ -n $WGET ]]; then - msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '' | sed 's/<title>\[#\(.*\)\] \(.*\) - Java Bug System<\/title>/\1 : \2/' | html_dequote | html_quote` - fi - if [[ -z $msg ]]; then - msg="${id}" - fi - - print "<a href=\"$url\">$msg</a>" - - print "</td></tr>" - done -fi -print "<tr><th>Legend:</th><td>" -print "<b>Modified file</b><br><font color=red><b>Deleted file</b></font><br><font color=green><b>New file</b></font></td></tr>" -print "</table>" -print "</div>" - -# -# Second pass through the files: generate the rest of the index file -# -while read LINE -do - set - $LINE - if [[ $1 == "Revision:" ]]; then - FIRST_CREV=`expr $3 + 1` - continue - fi - P=$1 - - if [[ $# == 2 ]]; then - PP=$2 - oldname=" <i>(was $PP)</i>" - - else - PP=$P - oldname="" - fi - - DIR=${P%/*} - if [[ $DIR == $P ]]; then - DIR="." # File at root of workspace - fi - - # Avoid processing the same file twice. - # It's possible for renamed files to - # appear twice in the file list - - F=$WDIR/$P - - print "<p><code>" - - # If there's a diffs file, make diffs links - - NODIFFS= - if [[ -f $F.cdiff.html ]]; then - print "<a href=\"$P.cdiff.html\">Cdiffs</a>" - print "<a href=\"$P.udiff.html\">Udiffs</a>" - - if [[ -f $F.wdiff.html && -x $WDIFF ]]; then - print "<a href=\"$P.wdiff.html\">Wdiffs</a>" - fi - - print "<a href=\"$P.sdiff.html\">Sdiffs</a>" - - print "<a href=\"$P.frames.html\">Frames</a>" - else - NODIFFS=1 - print " ------ ------ ------" - - if [[ -x $WDIFF ]]; then - print " ------" - fi - - print " ------" - fi - - # If there's an old file, make the link - - NOOLD= - if [[ -f $F-.html ]]; then - print "<a href=\"$P-.html\">Old</a>" - else - NOOLD=1 - print " ---" - fi - - # If there's an new file, make the link - - NONEW= - if [[ -f $F.html ]]; then - print "<a href=\"$P.html\">New</a>" - else - NONEW=1 - print " ---" - fi - - if [[ -f $F.patch ]]; then - print "<a href=\"$P.patch\">Patch</a>" - else - print " -----" - fi - - if [[ -f $WDIR/raw_files/new/$P ]]; then - print "<a href=\"raw_files/new/$P\">Raw</a>" - else - print " ---" - fi - print "</code>" - if [[ -n $NODIFFS && -z $oldname ]]; then - if [[ -n $NOOLD ]]; then - print "<font color=green><b>$P</b></font>" - elif [[ -n $NONEW ]]; then - print "<font color=red><b>$P</b></font>" - fi - else - print "<b>$P</b> $oldname" - fi - - print "</p><blockquote>\c" - # Insert delta comments if any - comments=`getcomments html $P $PP` - if [ -n "$comments" ]; then - print "<pre>$comments</pre>" - fi - - # Add additional comments comment - - print "<!-- Add comments to explain changes in $P here -->" - - # Add count of changes. - - if [[ -f $F.count ]]; then - cat $F.count - rm $F.count - fi - print "</blockquote>" -done < $FLIST - -print -print -print "<hr />" -print "<p style=\"font-size: small\">" -print "This code review page was prepared using <b>$0</b>" -print "(vers $WEBREV_UPDATED)." -print "</body>" -print "</html>" - -if [[ -n $ZIP ]]; then - # Let's generate a zip file for convenience - cd $WDIR/.. - if [ -f webrev.zip ]; then - rm webrev.zip - fi - $ZIP -r webrev webrev >/dev/null 2>&1 -fi - -exec 1<&- # Close FD 1. -exec 1<&3 # dup FD 3 to restore stdout. -exec 3<&- # close FD 3. - -print "Done." -print "Output to: $WDIR" diff --git a/nashorn/.hgtags b/nashorn/.hgtags index 0c34bd5d62c..3d90b565999 100644 --- a/nashorn/.hgtags +++ b/nashorn/.hgtags @@ -230,4 +230,8 @@ f0d3ac2474ee755b1180ec71bcdfa190845b17eb jdk8-b115 8d014b039b44c23fa520ce20c2c27f7aa91441e9 jdk8-b118 c3343930c73c58a22c1d58719bb988aeb25a871f jdk8-b119 55cbc2d00c93f82513ce33819d41dc67e71aaefd jdk8-b120 +32631eed0fad2b31346eb41b29a50227bd29e2ec jdk8-b121 +9d112a0e7df737f3b1fa2a021d5bb350ed56c1b7 jdk8-b122 +688f4167f92188482b0d80e315c72f726c6d5ff6 jdk8-b123 32631eed0fad2b31346eb41b29a50227bd29e2ec jdk9-b00 +65347535840f045f2cd4341d7466c51009b1b06f jdk9-b01 diff --git a/nashorn/bin/jjs b/nashorn/bin/jjs deleted file mode 100644 index f89a07c2c9a..00000000000 --- a/nashorn/bin/jjs +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/java -server -XX:+TieredCompilation -Xms2G -Xmx2G -esa -ea -Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -XX:+HeapDumpOnOutOfMemoryError -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.debug=true jdk.nashorn.tools.Shell $* diff --git a/nashorn/bin/jjs.bat b/nashorn/bin/jjs.bat deleted file mode 100644 index 3c1c1595c47..00000000000 --- a/nashorn/bin/jjs.bat +++ /dev/null @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false jdk.nashorn.tools.Shell diff --git a/nashorn/bin/jjssecure b/nashorn/bin/jjssecure deleted file mode 100644 index db6bdfc4178..00000000000 --- a/nashorn/bin/jjssecure +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=`dirname $0`/../make/java.security.override -Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=true -Dnashorn.home=`dirname $0`/.. -Djava.security.manager jdk.nashorn.tools.Shell $* diff --git a/nashorn/bin/jjssecure.bat b/nashorn/bin/jjssecure.bat deleted file mode 100644 index f8da10aaaf6..00000000000 --- a/nashorn/bin/jjssecure.bat +++ /dev/null @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.security.properties=%~dp0\..\make\java.security.override -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.home=%~dp0\.. -Djava.security.manager jdk.nashorn.tools.Shell diff --git a/nashorn/bin/nashorn b/nashorn/bin/nashorn deleted file mode 100644 index da22be1fb01..00000000000 --- a/nashorn/bin/nashorn +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $* diff --git a/nashorn/bin/nashorn.bat b/nashorn/bin/nashorn.bat deleted file mode 100644 index 2961ac699a4..00000000000 --- a/nashorn/bin/nashorn.bat +++ /dev/null @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn diff --git a/nashorn/bin/nashornsecure b/nashorn/bin/nashornsecure deleted file mode 100644 index 77c7c52933a..00000000000 --- a/nashorn/bin/nashornsecure +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# 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. 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. -# - -[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1; - -$JAVA_HOME/bin/jrunscript -J-Djava.security.properties=`dirname $0`/../make/java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=`dirname $0`/../dist:$JAVA_HOME/jre/lib/ext -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $* diff --git a/nashorn/bin/nashornsecure.bat b/nashorn/bin/nashornsecure.bat deleted file mode 100644 index 5a4eca63c64..00000000000 --- a/nashorn/bin/nashornsecure.bat +++ /dev/null @@ -1,27 +0,0 @@ -rem -rem Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. -rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -rem -rem This code is free software; you can redistribute it and/or modify it -rem under the terms of the GNU General Public License version 2 only, as -rem published by the Free Software Foundation. Oracle designates this -rem particular file as subject to the "Classpath" exception as provided -rem by Oracle in the LICENSE file that accompanied this code. -rem -rem This code is distributed in the hope that it will be useful, but WITHOUT -rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -rem version 2 for more details (a copy is included in the LICENSE file that -rem accompanied this code). -rem -rem You should have received a copy of the GNU General Public License version -rem 2 along with this work; if not, write to the Free Software Foundation, -rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -rem -rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -rem or visit www.oracle.com if you need additional information or have any -rem questions. -rem -@echo off - -jrunscript -J-Djava.security.properties=%~dp0\..\make\java.security.override -J-Djava.security.manager -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java index 3fdd7c686bb..c43bdf52512 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java @@ -279,10 +279,6 @@ public final class MemberInfo implements Cloneable { } } } else if (kind == Kind.FUNCTION) { - final Type returnType = Type.getReturnType(javaDesc); - if (! returnType.toString().equals(OBJECT_DESC)) { - error("return value should be of Object type, found" + returnType); - } final Type[] argTypes = Type.getArgumentTypes(javaDesc); if (argTypes.length < 1) { error("function methods should have at least 1 arg"); diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java index 475d7328c69..479d1d31f21 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java @@ -349,19 +349,19 @@ public class MethodGenerator extends MethodVisitor { // invokes, field get/sets void invokeInterface(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc); + super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc, true); } void invokeVirtual(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc); + super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc, false); } void invokeSpecial(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKESPECIAL, owner, method, desc); + super.visitMethodInsn(INVOKESPECIAL, owner, method, desc, false); } void invokeStatic(final String owner, final String method, final String desc) { - super.visitMethodInsn(INVOKESTATIC, owner, method, desc); + super.visitMethodInsn(INVOKESTATIC, owner, method, desc, false); } void putStatic(final String owner, final String field, final String desc) { @@ -413,7 +413,7 @@ public class MethodGenerator extends MethodVisitor { super.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", - "(Ljava/lang/String;)V"); + "(Ljava/lang/String;)V", false); } // print the object on the top of the stack @@ -426,6 +426,6 @@ public class MethodGenerator extends MethodVisitor { super.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", - "(Ljava/lang/Object;)V"); + "(Ljava/lang/Object;)V", false); } } diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java index 72250de79bc..0ec233ae8c8 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java @@ -146,16 +146,16 @@ public class ScriptClassInstrumentor extends ClassVisitor { // call $clinit$ just before return from <clinit> if (isStaticInit && opcode == RETURN) { super.visitMethodInsn(INVOKESTATIC, scriptClassInfo.getJavaName(), - $CLINIT$, DEFAULT_INIT_DESC); + $CLINIT$, DEFAULT_INIT_DESC, false); } super.visitInsn(opcode); } @Override - public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { + public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) { if (isConstructor && opcode == INVOKESPECIAL && INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) { - super.visitMethodInsn(opcode, owner, name, desc); + super.visitMethodInsn(opcode, owner, name, desc, false); if (memberCount > 0) { // initialize @Property fields if needed @@ -166,7 +166,7 @@ public class ScriptClassInstrumentor extends ClassVisitor { super.visitTypeInsn(NEW, clazz); super.visitInsn(DUP); super.visitMethodInsn(INVOKESPECIAL, clazz, - INIT, DEFAULT_INIT_DESC); + INIT, DEFAULT_INIT_DESC, false); super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(), memInfo.getJavaName(), memInfo.getJavaDesc()); } @@ -180,7 +180,7 @@ public class ScriptClassInstrumentor extends ClassVisitor { } } } else { - super.visitMethodInsn(opcode, owner, name, desc); + super.visitMethodInsn(opcode, owner, name, desc, itf); } } diff --git a/nashorn/make/build-benchmark.xml b/nashorn/make/build-benchmark.xml index 8f2296b028e..8225df1cf0c 100644 --- a/nashorn/make/build-benchmark.xml +++ b/nashorn/make/build-benchmark.xml @@ -239,7 +239,7 @@ </antcall> </target> - <target name="octane-regexp-octane-v8" depends="jar"> + <target name="octane-regexp-v8" depends="jar"> <antcall target="run-octane-v8"> <param name="octane-tests" value="regexp"/> </antcall> @@ -291,17 +291,56 @@ </antcall> </target> + <!-- splay --> + <target name="octane-typescript" depends="jar"> + <antcall target="run-octane"> + <param name="octane-tests" value="typescript"/> + </antcall> + </target> + + <target name="octane-typescript-v8" depends="jar"> + <antcall target="run-octane-v8"> + <param name="octane-typescript" value="typescript"/> + </antcall> + </target> + + <target name="octane-typescript-rhino" depends="jar"> + <antcall target="run-octane-rhino"> + <param name="octane-tests" value="typescript"/> + </antcall> + </target> + + <!-- zlib --> + <target name="octane-zlib" depends="jar"> + <antcall target="run-octane"> + <param name="octane-tests" value="zlib"/> + </antcall> + </target> + + <target name="octane-zlib-v8" depends="jar"> + <antcall target="run-octane-v8"> + <param name="octane-typescript" value="zlib"/> + </antcall> + </target> + + <target name="octane-zlib-rhino" depends="jar"> + <antcall target="run-octane-rhino"> + <param name="octane-tests" value="zlib"/> + </antcall> + </target> + <!-- run octane benchmarks in a single process --> <target name="octane-single-process" depends="octane-init"> <antcall target="run-octane"/> </target> - <!-- mandreel excluded due to OOM --> + <!-- zlib excluded due to missing implementation of 'read' --> <target name="octane-separate-process" depends= "octane-box2d, octane-code-load, octane-crypto, octane-deltablue, octane-earley-boyer, octane-gbemu, - octane-navier-stokes, octane-pdfjs, octane-raytrace, - octane-regexp, octane-richards, octane-splay"/> + octane-mandreel, octane-navier-stokes, octane-pdfjs, + octane-raytrace, octane-regexp, octane-richards, + octane-splay, octane-typescript"/> <target name="--single-process" unless="${octane-test-sys-prop.separate.process}"> <antcall target="octane-single-process"/> @@ -330,6 +369,9 @@ dir="."> <jvmarg line="${ext.class.path}"/> <jvmarg line="${run.test.jvmargs.octane} -Xms${run.test.xms} -Xmx${run.test.xmx}"/> + <syspropertyset> + <propertyref prefix="nashorn."/> + </syspropertyset> <arg value="${octane-test-sys-prop.test.js.framework}"/> <arg value="--"/> <arg value="${octane-tests}"/> diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index 7d1f42aea0c..93342248de5 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -66,13 +66,16 @@ <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt"> <istrue value="${make.code.coverage}" /> </condition> + + <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else=""> + <istrue value="${jfr}"/> + </condition> </target> <target name="init" depends="init-conditions, init-cc"> - <!-- extends jvm args --> - <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs}"/> - <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs}" /> + <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/> + <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/> <echo message="run.test.jvmargs=${run.test.jvmargs}"/> <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/> @@ -301,6 +304,10 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { permission java.lang.RuntimePermission "nashorn.JavaReflection"; }; +grant codeBase "file:/${basedir}/test/script/markdown.js" { + permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read"; +}; + </echo> <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators --> @@ -316,6 +323,7 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/> <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/> <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/> + <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/> </target> <target name="check-testng" unless="testng.available"> @@ -338,6 +346,9 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <propertyset> + <propertyref prefix="nashorn."/> + </propertyset> <propertyset> <propertyref prefix="test-sys-prop."/> <mapper from="test-sys-prop.*" to="*" type="glob"/> @@ -393,6 +404,25 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { </testng> </target> + <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> + <fileset id="test.classes" dir="${build.test.classes.dir}"> + <include name="**/framework/*Test.class"/> + </fileset> + + <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" + verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> + <jvmarg line="${ext.class.path}"/> + <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <propertyset> + <propertyref prefix="testmarkdown-test-sys-prop."/> + <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/> + </propertyset> + <classpath> + <pathelement path="${run.test.classpath}"/> + </classpath> + </testng> + </target> + <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> <fileset id="test.classes" dir="${build.test.classes.dir}"> <include name="**/framework/*Test.class"/> @@ -402,6 +432,9 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> <jvmarg line="${ext.class.path}"/> <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> + <propertyset> + <propertyref prefix="nashorn."/> + </propertyset> <propertyset> <propertyref prefix="test262-test-sys-prop."/> <mapper from="test262-test-sys-prop.*" to="*" type="glob"/> @@ -537,6 +570,11 @@ grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { <mkdir dir="${test.external.dir}/yui"/> <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> + + <!-- showdown --> + <mkdir dir="${test.external.dir}/showdown"/> + <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> + <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> </target> diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties index c3ffca4ec68..ad36744836b 100644 --- a/nashorn/make/project.properties +++ b/nashorn/make/project.properties @@ -71,6 +71,9 @@ fxshell.classes.dir = ${build.dir}/fxshell/classes fxshell.dir = tools/fxshell fxshell.jar = ${dist.dir}/nashornfx.jar +# configuration for java flight recorder +run.test.jvmargs.jfr=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128 + # jars refererred file.reference.testng.jar=test/lib/testng.jar @@ -119,6 +122,7 @@ test.external.dir=test/script/external test262.dir=${test.external.dir}/test262 test262.suite.dir=${test262.dir}/test/suite testjfx.dir=${test.script.dir}/jfx +testmarkdown.dir=${test.script.dir}/markdown test-sys-prop.test.dir=${test.dir} test-sys-prop.test.js.roots=${test.basic.dir} ${test.error.dir} ${test.sandbox.dir} ${test.trusted.dir} @@ -209,6 +213,16 @@ test262-test-sys-prop.test.js.framework=\ ${test262.dir}/test/harness/framework.js \ ${test262.dir}/test/harness/sta.js +# testmarkdown test root +testmarkdown-test-sys-prop.test.js.roots=${testmarkdown.dir} + +# execute testmarkdown tests in shared nashorn context or not? +testmarkdown-test-sys-prop.test.js.shared.context=false + +# framework root for markdown script tests +testmarkdown-test-sys-prop.test.js.framework=\ + ${test.script.dir}${file.separator}markdown.js + # testjfx test root testjfx-test-sys-prop.test.js.roots=${testjfx.dir} diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java index d5ec5bb4a60..a5f8c24a2e6 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import jdk.nashorn.internal.codegen.CompilerConstants; import jdk.nashorn.internal.runtime.ECMAErrors; +import jdk.nashorn.internal.runtime.ScriptObject; /** * This is base exception for all Nashorn exceptions. These originate from @@ -44,11 +45,13 @@ import jdk.nashorn.internal.runtime.ECMAErrors; @SuppressWarnings("serial") public abstract class NashornException extends RuntimeException { // script file name - private final String fileName; + private String fileName; // script line number - private final int line; + private int line; // script column number - private final int column; + private int column; + // underlying ECMA error object - lazily initialized + private Object ecmaError; /** script source name used for "engine.js" */ public static final String ENGINE_SCRIPT_SOURCE_NAME = "nashorn:engine/resources/engine.js"; @@ -121,6 +124,15 @@ public abstract class NashornException extends RuntimeException { return fileName; } + /** + * Set the source file name for this {@code NashornException} + * + * @param fileName the file name + */ + public final void setFileName(final String fileName) { + this.fileName = fileName; + } + /** * Get the line number for this {@code NashornException} * @@ -130,15 +142,33 @@ public abstract class NashornException extends RuntimeException { return line; } + /** + * Set the line number for this {@code NashornException} + * + * @param line the line number + */ + public final void setLineNumber(final int line) { + this.line = line; + } + /** * Get the column for this {@code NashornException} * - * @return the column + * @return the column number */ public final int getColumnNumber() { return column; } + /** + * Set the column for this {@code NashornException} + * + * @param column the column number + */ + public final void setColumnNumber(final int column) { + this.column = column; + } + /** * Returns array javascript stack frames from the given exception object. * @@ -155,6 +185,11 @@ public abstract class NashornException extends RuntimeException { if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) { methodName = "<program>"; } + + if (methodName.contains(CompilerConstants.ANON_FUNCTION_PREFIX.symbolName())) { + methodName = "<anonymous>"; + } + filtered.add(new StackTraceElement(className, methodName, st.getFileName(), st.getLineNumber())); } @@ -188,4 +223,43 @@ public abstract class NashornException extends RuntimeException { } return buf.toString(); } + + protected Object getThrown() { + return null; + } + + protected NashornException initEcmaError(final ScriptObject global) { + if (ecmaError != null) { + return this; // initialized already! + } + + final Object thrown = getThrown(); + if (thrown instanceof ScriptObject) { + setEcmaError(ScriptObjectMirror.wrap(thrown, global)); + } else { + setEcmaError(thrown); + } + + return this; + } + + /** + * Return the underlying ECMA error object, if available. + * + * @return underlying ECMA Error object's mirror or whatever was thrown + * from script such as a String, Number or a Boolean. + */ + public Object getEcmaError() { + return ecmaError; + } + + /** + * Return the underlying ECMA error object, if available. + * + * @param ecmaError underlying ECMA Error object's mirror or whatever was thrown + * from script such as a String, Number or a Boolean. + */ + public void setEcmaError(final Object ecmaError) { + this.ecmaError = ecmaError; + } } diff --git a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java index d0fb0c31832..8028cce229e 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java @@ -476,16 +476,19 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException { name.getClass(); // null check + ScriptObject invokeGlobal = null; ScriptObjectMirror selfMirror = null; if (selfObject instanceof ScriptObjectMirror) { selfMirror = (ScriptObjectMirror)selfObject; if (! isOfContext(selfMirror.getHomeGlobal(), nashornContext)) { throw new IllegalArgumentException(getMessage("script.object.from.another.engine")); } + invokeGlobal = selfMirror.getHomeGlobal(); } else if (selfObject instanceof ScriptObject) { // invokeMethod called from script code - in which case we may get 'naked' ScriptObject // Wrap it with oldGlobal to make a ScriptObjectMirror for the same. final ScriptObject oldGlobal = Context.getGlobal(); + invokeGlobal = oldGlobal; if (oldGlobal == null) { throw new IllegalArgumentException(getMessage("no.current.nashorn.global")); } @@ -498,6 +501,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } else if (selfObject == null) { // selfObject is null => global function call final ScriptObject ctxtGlobal = getNashornGlobalFrom(context); + invokeGlobal = ctxtGlobal; selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(ctxtGlobal, ctxtGlobal); } @@ -509,7 +513,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C if (cause instanceof NoSuchMethodException) { throw (NoSuchMethodException)cause; } - throwAsScriptException(e); + throwAsScriptException(e, invokeGlobal); throw new AssertionError("should not reach here"); } } @@ -543,7 +547,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal)); } catch (final Exception e) { - throwAsScriptException(e); + throwAsScriptException(e, ctxtGlobal); throw new AssertionError("should not reach here"); } finally { if (globalChanged) { @@ -552,7 +556,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C } } - private static void throwAsScriptException(final Exception e) throws ScriptException { + private static void throwAsScriptException(final Exception e, final ScriptObject global) throws ScriptException { if (e instanceof ScriptException) { throw (ScriptException)e; } else if (e instanceof NashornException) { @@ -560,6 +564,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C final ScriptException se = new ScriptException( ne.getMessage(), ne.getFileName(), ne.getLineNumber(), ne.getColumnNumber()); + ne.initEcmaError(global); se.initCause(e); throw se; } else if (e instanceof RuntimeException) { @@ -605,7 +610,7 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C return nashornContext.compileScript(source, newGlobal); } catch (final Exception e) { - throwAsScriptException(e); + throwAsScriptException(e, newGlobal); throw new AssertionError("should not reach here"); } finally { if (globalChanged) { @@ -621,6 +626,11 @@ public final class NashornScriptEngine extends AbstractScriptEngine implements C continue; } + // skip check for default methods - non-abstract, interface methods + if (! Modifier.isAbstract(method.getModifiers())) { + continue; + } + Object obj = sobj.get(method.getName()); if (! (obj instanceof ScriptFunction)) { return false; diff --git a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java index 911f1663cb6..01f72c0008f 100644 --- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java +++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java @@ -108,6 +108,8 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin } throw new RuntimeException("not a function: " + toString()); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -135,6 +137,8 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin } throw new RuntimeException("not a constructor: " + toString()); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -182,6 +186,8 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin } throw new NoSuchMethodException("No such function " + functionName); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { @@ -717,6 +723,8 @@ public final class ScriptObjectMirror extends AbstractJSObject implements Bindin } try { return callable.call(); + } catch (final NashornException ne) { + throw ne.initEcmaError(global); } catch (final RuntimeException e) { throw e; } catch (final Exception e) { diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java index f1ced8ada06..177cfef4e4b 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java @@ -766,7 +766,7 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> { symbol.setType(Type.OBJECT); } - returnType = Type.widest(returnTypes.pop(), symbol.getSymbolType()); + returnType = widestReturnType(returnTypes.pop(), symbol.getSymbolType()); } else { returnType = Type.OBJECT; //undefined } @@ -1433,10 +1433,30 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> { ensureTypeNotUnknown(trueExpr); ensureTypeNotUnknown(falseExpr); - final Type type = Type.widest(trueExpr.getType(), falseExpr.getType()); + final Type type = widestReturnType(trueExpr.getType(), falseExpr.getType()); return end(ensureSymbol(type, ternaryNode)); } + /** + * When doing widening for return types of a function or a ternary operator, it is not valid to widen a boolean to + * anything other than Object. Also, widening a numeric type to an object type must widen to Object proper and not + * any more specific subclass (e.g. widest of int/long/double and String is Object). + * @param t1 type 1 + * @param t2 type 2 + * @return wider of t1 and t2, except if one is boolean and the other is neither boolean nor unknown, or if one is + * numeric and the other is neither numeric nor unknown in which case {@code Type.OBJECT} is returned. + */ + private static Type widestReturnType(final Type t1, final Type t2) { + if (t1.isUnknown()) { + return t2; + } else if (t2.isUnknown()) { + return t1; + } else if (t1.isBoolean() != t2.isBoolean() || t1.isNumeric() != t2.isNumeric()) { + return Type.OBJECT; + } + return Type.widest(t1, t2); + } + private void initCompileConstant(final CompilerConstants cc, final Block block, final int flags) { final Class<?> type = cc.type(); // Must not call this method for constants with no explicit types; use the one with (..., Type) signature instead. diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java index c3b1dbe2656..6ad92829bfe 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java @@ -2023,8 +2023,6 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex return false; } - method._new(ECMAException.class).dup(); - final Source source = lc.getCurrentFunction().getSource(); final Expression expression = throwNode.getExpression(); @@ -2037,7 +2035,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex method.load(source.getName()); method.load(line); method.load(column); - method.invoke(ECMAException.THROW_INIT); + method.invoke(ECMAException.CREATE); method.athrow(); diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java b/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java index d27bdd953ec..dcf1b1ba5cd 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java @@ -158,7 +158,7 @@ final class CodeGeneratorLexicalContext extends LexicalContext { if (scopeCalls.containsKey(scopeCall)) { return scopeCalls.get(scopeCall); } - scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName("scopeCall")); + scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName(":scopeCall")); scopeCalls.put(scopeCall, scopeCall); return scopeCall; } @@ -177,7 +177,7 @@ final class CodeGeneratorLexicalContext extends LexicalContext { if (scopeCalls.containsKey(scopeCall)) { return scopeCalls.get(scopeCall); } - scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName("scopeCall")); + scopeCall.setClassAndName(unit, getCurrentFunction().uniqueName(":scopeCall")); scopeCalls.put(scopeCall, scopeCall); return scopeCall; } diff --git a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java index 24173c3e710..b53b8fdf423 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java @@ -85,6 +85,8 @@ public final class Compiler { private Source source; + private String sourceName; + private final Map<String, byte[]> bytecode; private final Set<CompileUnit> compileUnits; @@ -267,6 +269,7 @@ public final class Compiler { append('$'). append(safeSourceName(functionNode.getSource())); this.source = functionNode.getSource(); + this.sourceName = functionNode.getSourceName(); this.scriptName = sb.toString(); } @@ -573,7 +576,7 @@ public final class Compiler { } private CompileUnit initCompileUnit(final String unitClassName, final long initialWeight) { - final ClassEmitter classEmitter = new ClassEmitter(env, source.getName(), unitClassName, strict); + final ClassEmitter classEmitter = new ClassEmitter(env, sourceName, unitClassName, strict); final CompileUnit compileUnit = new CompileUnit(unitClassName, classEmitter, initialWeight); classEmitter.begin(); diff --git a/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java b/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java index fb347c75afb..16f08b82e17 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilerConstants.java @@ -41,6 +41,7 @@ import jdk.nashorn.internal.runtime.Source; */ public enum CompilerConstants { + /** the __FILE__ variable */ __FILE__, @@ -75,7 +76,7 @@ public enum CompilerConstants { DEFAULT_SCRIPT_NAME("Script"), /** function prefix for anonymous functions */ - FUNCTION_PREFIX("function$"), + ANON_FUNCTION_PREFIX("L:"), /** method name for Java method that is script entry point */ RUN_SCRIPT("runScript"), @@ -149,26 +150,31 @@ public enum CompilerConstants { ALLOCATE("allocate"), /** prefix for split methods, @see Splitter */ - SPLIT_PREFIX("$split"), + SPLIT_PREFIX(":split"), /** prefix for split array method and slot */ - SPLIT_ARRAY_ARG("split_array", 3), + SPLIT_ARRAY_ARG(":split_array", 3), /** get string from constant pool */ - GET_STRING("$getString"), + GET_STRING(":getString"), /** get map */ - GET_MAP("$getMap"), + GET_MAP(":getMap"), /** get map */ - SET_MAP("$setMap"), + SET_MAP(":setMap"), /** get array prefix */ - GET_ARRAY_PREFIX("$get"), + GET_ARRAY_PREFIX(":get"), /** get array suffix */ GET_ARRAY_SUFFIX("$array"); + /** + * Prefix used for internal methods generated in script clases. + */ + public static final String INTERNAL_METHOD_PREFIX = ":"; + private final String symbolName; private final Class<?> type; private final int slot; diff --git a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java index 9b6d12aae88..91129ece26a 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java @@ -1130,7 +1130,11 @@ public class MethodEmitter implements Emitter { popType(Type.OBJECT); } - method.visitMethodInsn(opcode, className, methodName, methodDescriptor); + if (opcode == INVOKEINTERFACE) { + method.visitMethodInsn(opcode, className, methodName, methodDescriptor, true); + } else { + method.visitMethodInsn(opcode, className, methodName, methodDescriptor, false); + } if (returnType != null) { pushType(returnType); diff --git a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java index e7c789535d7..4799c264196 100644 --- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java +++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java @@ -261,7 +261,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps { } static void invokeStatic(final MethodVisitor method, final Call call) { - method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor()); + method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor(), false); } /** diff --git a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java index b0998ae1911..1437eb40384 100644 --- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java +++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import jdk.nashorn.internal.codegen.CompileUnit; import jdk.nashorn.internal.codegen.Compiler; @@ -138,6 +139,9 @@ public final class FunctionNode extends LexicalContextExpression implements Flag /** Function flags. */ private final int flags; + /** //@ sourceURL or //# sourceURL for program function nodes */ + private final String sourceURL; + private final int lineNumber; /** Is anonymous function flag. */ @@ -223,6 +227,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag * @param parameters parameter list * @param kind kind of function as in {@link FunctionNode.Kind} * @param flags initial flags + * @param sourceURL sourceURL specified in script (optional) */ public FunctionNode( final Source source, @@ -235,7 +240,8 @@ public final class FunctionNode extends LexicalContextExpression implements Flag final String name, final List<IdentNode> parameters, final FunctionNode.Kind kind, - final int flags) { + final int flags, + final String sourceURL) { super(token, finish); this.source = source; @@ -250,6 +256,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag this.compilationState = EnumSet.of(CompilationState.INITIALIZED); this.declaredSymbols = new HashSet<>(); this.flags = flags; + this.sourceURL = sourceURL; this.compileUnit = null; this.body = null; this.snapshot = null; @@ -260,6 +267,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag final FunctionNode functionNode, final long lastToken, final int flags, + final String sourceURL, final String name, final Type returnType, final CompileUnit compileUnit, @@ -271,6 +279,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag super(functionNode); this.lineNumber = functionNode.lineNumber; this.flags = flags; + this.sourceURL = sourceURL; this.name = name; this.returnType = returnType; this.compileUnit = compileUnit; @@ -307,6 +316,38 @@ public final class FunctionNode extends LexicalContextExpression implements Flag return source; } + /** + * get source name - sourceURL or name derived from Source. + * + * @return name for the script source + */ + public String getSourceName() { + return (sourceURL != null)? sourceURL : source.getName(); + } + + /** + * get the sourceURL + * @return the sourceURL + */ + public String getSourceURL() { + return sourceURL; + } + + /** + * Set the sourceURL + * + * @param lc lexical context + * @param newSourceURL source url string to set + * @return function node or a new one if state was changed + */ + public FunctionNode setSourceURL(final LexicalContext lc, final String newSourceURL) { + if (Objects.equals(sourceURL, newSourceURL)) { + return this; + } + + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, newSourceURL, name, returnType, compileUnit, compilationState, body, parameters, null, hints)); + } + /** * Returns the line number. * @return the line number. @@ -335,7 +376,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.snapshot == null) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, null, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, null, hints)); } /** @@ -351,7 +392,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (isProgram() || parameters.isEmpty()) { return this; //never specialize anything that won't be recompiled } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, this, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, this, hints)); } /** @@ -409,7 +450,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag } final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState); newState.add(state); - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, newState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, newState, body, parameters, snapshot, hints)); } /** @@ -430,7 +471,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.hints == hints) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** @@ -483,7 +524,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.flags == flags) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } @Override @@ -593,7 +634,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if(this.body == body) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags | (body.needsScope() ? FunctionNode.HAS_SCOPE_BLOCK : 0), name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags | (body.needsScope() ? FunctionNode.HAS_SCOPE_BLOCK : 0), sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** @@ -688,7 +729,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.lastToken == lastToken) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** @@ -710,7 +751,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.name.equals(name)) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** @@ -760,7 +801,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.parameters == parameters) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** @@ -825,6 +866,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag this, lastToken, flags, + sourceURL, name, type, compileUnit, @@ -863,7 +905,7 @@ public final class FunctionNode extends LexicalContextExpression implements Flag if (this.compileUnit == compileUnit) { return this; } - return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); + return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, sourceURL, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints)); } /** diff --git a/nashorn/src/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk/nashorn/internal/objects/Global.java index 0a09370aac9..819095c05e4 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java @@ -44,6 +44,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import jdk.internal.dynalink.linker.GuardedInvocation; import jdk.internal.dynalink.linker.LinkRequest; +import jdk.nashorn.internal.lookup.Lookup; import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; @@ -364,6 +365,11 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { private ScriptObject builtinFloat32Array; private ScriptObject builtinFloat64Array; + /* + * ECMA section 13.2.3 The [[ThrowTypeError]] Function Object + */ + private ScriptFunction typeErrorThrower; + private PropertyMap accessorPropertyDescriptorMap; private PropertyMap arrayBufferViewMap; private PropertyMap dataPropertyDescriptorMap; @@ -1114,6 +1120,10 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { return builtinArray; } + ScriptFunction getTypeErrorThrower() { + return typeErrorThrower; + } + /** * Called from compiled script code to test if builtin has been overridden * @@ -1695,8 +1705,25 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { initScripting(env); } - if (Context.DEBUG && System.getSecurityManager() == null) { - initDebug(); + if (Context.DEBUG) { + boolean debugOkay; + final SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + try { + sm.checkPermission(new RuntimePermission(Context.NASHORN_DEBUG_MODE)); + debugOkay = true; + } catch (final SecurityException ignored) { + // if no permission, don't initialize Debug object + debugOkay = false; + } + + } else { + debugOkay = true; + } + + if (debugOkay) { + initDebug(); + } } copyBuiltins(); @@ -2000,6 +2027,13 @@ public final class Global extends ScriptObject implements GlobalObject, Scope { anon.set("constructor", builtinFunction, false); anon.deleteOwnProperty(anon.getMap().findProperty("prototype")); + // use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3 + this.typeErrorThrower = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, false, false, false); + typeErrorThrower.setPrototype(UNDEFINED); + // Non-constructor built-in functions do not have "prototype" property + typeErrorThrower.deleteOwnProperty(typeErrorThrower.getMap().findProperty("prototype")); + typeErrorThrower.preventExtensions(); + // now initialize Object this.builtinObject = (ScriptFunction)initConstructor("Object"); final ScriptObject ObjectPrototype = getObjectPrototype(); diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java index d3e2effed3f..0541084d8bf 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java @@ -38,7 +38,6 @@ import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Property; import jdk.nashorn.internal.objects.annotations.ScriptClass; import jdk.nashorn.internal.objects.annotations.Where; -import jdk.nashorn.internal.objects.ScriptFunctionImpl; import jdk.nashorn.internal.runtime.ECMAException; import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.PropertyMap; @@ -75,7 +74,7 @@ public final class NativeError extends ScriptObject { static final String FILENAME = "__fileName__"; /** Message property name */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** ECMA 15.11.4.2 Error.prototype.name */ @@ -86,6 +85,10 @@ public final class NativeError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -93,6 +96,7 @@ public final class NativeError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") private NativeError(final Object msg, final ScriptObject proto, final PropertyMap map) { super(proto, map); if (msg != UNDEFINED) { @@ -100,6 +104,7 @@ public final class NativeError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + initException(this); } NativeError(final Object msg, final Global global) { @@ -129,6 +134,14 @@ public final class NativeError extends ScriptObject { return new NativeError(msg); } + // This is called NativeError, NativeTypeError etc. to + // associate a ECMAException with the ECMA Error object. + @SuppressWarnings("unused") + static void initException(final ScriptObject self) { + // ECMAException constructor has side effects + new ECMAException(self, null); + } + /** * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided. * @@ -136,16 +149,17 @@ public final class NativeError extends ScriptObject { * @param errorObj the error object * @return undefined */ - @SuppressWarnings("unused") @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public static Object captureStackTrace(final Object self, final Object errorObj) { Global.checkObject(errorObj); final ScriptObject sobj = (ScriptObject)errorObj; - new ECMAException(sobj, null); //constructor has side effects - sobj.delete("stack", false); - final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", GET_STACK); - final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", SET_STACK); - sobj.addOwnProperty("stack", Attribute.NOT_ENUMERABLE, getStack, setStack); + initException(sobj); + sobj.delete(STACK, false); + if (! sobj.has("stack")) { + final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", GET_STACK); + final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", SET_STACK); + sobj.addOwnProperty("stack", Attribute.NOT_ENUMERABLE, getStack, setStack); + } return UNDEFINED; } @@ -226,7 +240,11 @@ public final class NativeError extends ScriptObject { public static Object setLineNumber(final Object self, final Object value) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; - sobj.set(LINENUMBER, value, false); + if (sobj.hasOwnProperty(LINENUMBER)) { + sobj.put(LINENUMBER, value, false); + } else { + sobj.addOwnProperty(LINENUMBER, Attribute.NOT_ENUMERABLE, value); + } return value; } @@ -254,7 +272,11 @@ public final class NativeError extends ScriptObject { public static Object setColumnNumber(final Object self, final Object value) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; - sobj.set(COLUMNNUMBER, value, false); + if (sobj.hasOwnProperty(COLUMNNUMBER)) { + sobj.put(COLUMNNUMBER, value, false); + } else { + sobj.addOwnProperty(COLUMNNUMBER, Attribute.NOT_ENUMERABLE, value); + } return value; } @@ -282,7 +304,11 @@ public final class NativeError extends ScriptObject { public static Object setFileName(final Object self, final Object value) { Global.checkObject(self); final ScriptObject sobj = (ScriptObject)self; - sobj.set(FILENAME, value, false); + if (sobj.hasOwnProperty(FILENAME)) { + sobj.put(FILENAME, value, false); + } else { + sobj.addOwnProperty(FILENAME, Attribute.NOT_ENUMERABLE, value); + } return value; } @@ -304,10 +330,12 @@ public final class NativeError extends ScriptObject { final Object exception = ECMAException.getException(sobj); if (exception instanceof Throwable) { - return getScriptStackString(sobj, (Throwable)exception); + Object value = getScriptStackString(sobj, (Throwable)exception); + sobj.put(STACK, value, false); + return value; } - return ""; + return UNDEFINED; } /** diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java index 89e9485fd9d..df8164c1119 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java @@ -44,7 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeEvalError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -55,6 +55,10 @@ public final class NativeEvalError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -62,6 +66,7 @@ public final class NativeEvalError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") private NativeEvalError(final Object msg, final ScriptObject proto, final PropertyMap map) { super(proto, map); if (msg != UNDEFINED) { @@ -69,6 +74,7 @@ public final class NativeEvalError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } NativeEvalError(final Object msg, final Global global) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java index c2d2bd10e81..dd9231d9386 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java @@ -133,6 +133,11 @@ public final class NativeJavaImporter extends ScriptObject { return createAndSetProperty(desc) ? super.lookup(desc, request) : super.noSuchMethod(desc, request); } + @Override + protected Object invokeNoSuchProperty(final String name) { + return createProperty(name); + } + private boolean createAndSetProperty(final CallSiteDescriptor desc) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); final Object value = createProperty(name); diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java b/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java index cc50fbb4f00..ec53965ad1b 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java @@ -92,7 +92,7 @@ public final class NativeMath extends ScriptObject { * @return abs of value */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object abs(final Object self, final Object x) { + public static double abs(final Object self, final Object x) { return Math.abs(JSType.toNumber(x)); } @@ -144,7 +144,7 @@ public final class NativeMath extends ScriptObject { * @return acos of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object acos(final Object self, final Object x) { + public static double acos(final Object self, final Object x) { return Math.acos(JSType.toNumber(x)); } @@ -170,7 +170,7 @@ public final class NativeMath extends ScriptObject { * @return asin of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object asin(final Object self, final Object x) { + public static double asin(final Object self, final Object x) { return Math.asin(JSType.toNumber(x)); } @@ -196,7 +196,7 @@ public final class NativeMath extends ScriptObject { * @return atan of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object atan(final Object self, final Object x) { + public static double atan(final Object self, final Object x) { return Math.atan(JSType.toNumber(x)); } @@ -223,7 +223,7 @@ public final class NativeMath extends ScriptObject { * @return atan2 of x and y */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object atan2(final Object self, final Object y, final Object x) { + public static double atan2(final Object self, final Object y, final Object x) { return Math.atan2(JSType.toNumber(y), JSType.toNumber(x)); } @@ -250,7 +250,7 @@ public final class NativeMath extends ScriptObject { * @return ceil of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object ceil(final Object self, final Object x) { + public static double ceil(final Object self, final Object x) { return Math.ceil(JSType.toNumber(x)); } @@ -302,7 +302,7 @@ public final class NativeMath extends ScriptObject { * @return cos of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object cos(final Object self, final Object x) { + public static double cos(final Object self, final Object x) { return Math.cos(JSType.toNumber(x)); } @@ -328,7 +328,7 @@ public final class NativeMath extends ScriptObject { * @return exp of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object exp(final Object self, final Object x) { + public static double exp(final Object self, final Object x) { return Math.exp(JSType.toNumber(x)); } @@ -341,7 +341,7 @@ public final class NativeMath extends ScriptObject { * @return floor of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object floor(final Object self, final Object x) { + public static double floor(final Object self, final Object x) { return Math.floor(JSType.toNumber(x)); } @@ -393,7 +393,7 @@ public final class NativeMath extends ScriptObject { * @return log of argument */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object log(final Object self, final Object x) { + public static double log(final Object self, final Object x) { return Math.log(JSType.toNumber(x)); } @@ -419,7 +419,7 @@ public final class NativeMath extends ScriptObject { * @return the largest of the arguments, {@link Double#NEGATIVE_INFINITY} if no args given, or identity if one arg is given */ @Function(arity = 2, attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object max(final Object self, final Object... args) { + public static double max(final Object self, final Object... args) { switch (args.length) { case 0: return Double.NEGATIVE_INFINITY; @@ -497,7 +497,7 @@ public final class NativeMath extends ScriptObject { * @return the smallest of the arguments, {@link Double#NEGATIVE_INFINITY} if no args given, or identity if one arg is given */ @Function(arity = 2, attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object min(final Object self, final Object... args) { + public static double min(final Object self, final Object... args) { switch (args.length) { case 0: return Double.POSITIVE_INFINITY; @@ -576,7 +576,7 @@ public final class NativeMath extends ScriptObject { * @return x raised to the power of y */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object pow(final Object self, final Object x, final Object y) { + public static double pow(final Object self, final Object x, final Object y) { return Math.pow(JSType.toNumber(x), JSType.toNumber(y)); } @@ -602,7 +602,7 @@ public final class NativeMath extends ScriptObject { * @return random number in the range [0..1) */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object random(final Object self) { + public static double random(final Object self) { return Math.random(); } @@ -615,7 +615,7 @@ public final class NativeMath extends ScriptObject { * @return x rounded */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object round(final Object self, final Object x) { + public static double round(final Object self, final Object x) { final double d = JSType.toNumber(x); if (Math.getExponent(d) >= 52) { return d; @@ -632,7 +632,7 @@ public final class NativeMath extends ScriptObject { * @return sin of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object sin(final Object self, final Object x) { + public static double sin(final Object self, final Object x) { return Math.sin(JSType.toNumber(x)); } @@ -658,7 +658,7 @@ public final class NativeMath extends ScriptObject { * @return sqrt of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) - public static Object sqrt(final Object self, final Object x) { + public static double sqrt(final Object self, final Object x) { return Math.sqrt(JSType.toNumber(x)); } @@ -684,7 +684,7 @@ public final class NativeMath extends ScriptObject { * @return tan of x */ @Function(attributes = Attribute.NOT_ENUMERABLE, where=Where.CONSTRUCTOR) - public static Object tan(final Object self, final Object x) { + public static double tan(final Object self, final Object x) { return Math.tan(JSType.toNumber(x)); } diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java index d51a0c09d41..a71b28b19c2 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java @@ -44,7 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeRangeError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -55,6 +55,10 @@ public final class NativeRangeError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -62,6 +66,7 @@ public final class NativeRangeError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") private NativeRangeError(final Object msg, final ScriptObject proto, final PropertyMap map) { super(proto, map); if (msg != UNDEFINED) { @@ -69,6 +74,7 @@ public final class NativeRangeError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } NativeRangeError(final Object msg, final Global global) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java index a269b51520a..d02a325055b 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java @@ -44,7 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeReferenceError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -55,6 +55,10 @@ public final class NativeReferenceError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -62,6 +66,7 @@ public final class NativeReferenceError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") private NativeReferenceError(final Object msg, final ScriptObject proto, final PropertyMap map) { super(proto, map); if (msg != UNDEFINED) { @@ -69,6 +74,7 @@ public final class NativeReferenceError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } NativeReferenceError(final Object msg, final Global global) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java index de6e4b51435..b81cc2afad4 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java @@ -76,7 +76,7 @@ public final class NativeStrictArguments extends ScriptObject { super(proto, map); setIsArguments(); - final ScriptFunction func = ScriptFunctionImpl.getTypeErrorThrower(); + final ScriptFunction func = Global.instance().getTypeErrorThrower(); // We have to fill user accessor functions late as these are stored // in this object rather than in the PropertyMap of this object. setUserAccessors("caller", func, func); diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java index 45920ba7aec..5d71ade7d38 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java @@ -44,7 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeSyntaxError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -55,6 +55,10 @@ public final class NativeSyntaxError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -62,6 +66,7 @@ public final class NativeSyntaxError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") NativeSyntaxError(final Object msg, final Global global) { super(global.getSyntaxErrorPrototype(), global.getSyntaxErrorMap()); if (msg != UNDEFINED) { @@ -69,6 +74,7 @@ public final class NativeSyntaxError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } private NativeSyntaxError(final Object msg) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java index 2b2308b143e..8857da7142d 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java @@ -44,7 +44,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeTypeError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -55,6 +55,10 @@ public final class NativeTypeError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -62,6 +66,7 @@ public final class NativeTypeError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") NativeTypeError(final Object msg, final Global global) { super(global.getTypeErrorPrototype(), global.getTypeErrorMap()); if (msg != UNDEFINED) { @@ -69,6 +74,7 @@ public final class NativeTypeError extends ScriptObject { } else { delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } private NativeTypeError(final Object msg) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java b/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java index 2caf136954d..7ff6c196e3f 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java @@ -43,7 +43,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; public final class NativeURIError extends ScriptObject { /** message property in instance */ - @Property(name = NativeError.MESSAGE) + @Property(name = NativeError.MESSAGE, attributes = Attribute.NOT_ENUMERABLE) public Object instMessage; /** error name property */ @@ -54,6 +54,10 @@ public final class NativeURIError extends ScriptObject { @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE) public Object message; + /** Nashorn extension: underlying exception */ + @Property(attributes = Attribute.NOT_ENUMERABLE) + public Object nashornException; + // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -61,6 +65,7 @@ public final class NativeURIError extends ScriptObject { return $nasgenmap$; } + @SuppressWarnings("LeakingThisInConstructor") NativeURIError(final Object msg, final Global global) { super(global.getURIErrorPrototype(), global.getURIErrorMap()); if (msg != UNDEFINED) { @@ -68,6 +73,7 @@ public final class NativeURIError extends ScriptObject { } else { this.delete(NativeError.MESSAGE, false); } + NativeError.initException(this); } private NativeURIError(final Object msg) { diff --git a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java index 638d18a2087..f0bea3a6e33 100644 --- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java +++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java @@ -170,26 +170,6 @@ public class ScriptFunctionImpl extends ScriptFunction { boundfunctionmap$.setIsShared(); } - // function object representing TypeErrorThrower - private static ScriptFunction typeErrorThrower; - - /* - * ECMA section 13.2.3 The [[ThrowTypeError]] Function Object - */ - static synchronized ScriptFunction getTypeErrorThrower() { - if (typeErrorThrower == null) { - // use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3 - final ScriptFunctionImpl func = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, false, false, false); - func.setPrototype(UNDEFINED); - // Non-constructor built-in functions do not have "prototype" property - func.deleteOwnProperty(func.getMap().findProperty("prototype")); - func.preventExtensions(); - typeErrorThrower = func; - } - - return typeErrorThrower; - } - private static PropertyMap createStrictModeMap(final PropertyMap map) { final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE; PropertyMap newMap = map; @@ -313,12 +293,13 @@ public class ScriptFunctionImpl extends ScriptFunction { // We have to fill user accessor functions late as these are stored // in this object rather than in the PropertyMap of this object. + final ScriptFunction errorThrower = global.getTypeErrorThrower(); if (findProperty("arguments", true) != null) { - setUserAccessors("arguments", getTypeErrorThrower(), getTypeErrorThrower()); + setUserAccessors("arguments", errorThrower, errorThrower); } if (findProperty("caller", true) != null) { - setUserAccessors("caller", getTypeErrorThrower(), getTypeErrorThrower()); + setUserAccessors("caller", errorThrower, errorThrower); } } } diff --git a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java index 587ae869ef6..d4a42ba4497 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java +++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java @@ -26,6 +26,7 @@ package jdk.nashorn.internal.parser; import static jdk.nashorn.internal.parser.TokenType.COMMENT; +import static jdk.nashorn.internal.parser.TokenType.DIRECTIVE_COMMENT; import static jdk.nashorn.internal.parser.TokenType.EOF; import static jdk.nashorn.internal.parser.TokenType.EOL; import static jdk.nashorn.internal.parser.TokenType.IDENT; @@ -84,6 +85,9 @@ public abstract class AbstractParser { /** Is this parser running under strict mode? */ protected boolean isStrictMode; + /** //@ sourceURL or //# sourceURL */ + protected String sourceURL; + /** * Construct a parser. * @@ -156,17 +160,38 @@ public abstract class AbstractParser { protected final TokenType nextOrEOL() { do { nextToken(); - } while (type == COMMENT); + if (type == DIRECTIVE_COMMENT) { + checkDirectiveComment(); + } + } while (type == COMMENT || type == DIRECTIVE_COMMENT); return type; } + // sourceURL= after directive comment + private static final String SOURCE_URL_PREFIX = "sourceURL="; + + // currently only @sourceURL=foo supported + private void checkDirectiveComment() { + // if already set, ignore this one + if (sourceURL != null) { + return; + } + + final String comment = (String) lexer.getValueOf(token, isStrictMode); + final int len = comment.length(); + // 4 characters for directive comment marker //@\s or //#\s + if (len > 4 && comment.substring(4).startsWith(SOURCE_URL_PREFIX)) { + sourceURL = comment.substring(4 + SOURCE_URL_PREFIX.length()); + } + } + /** * Seek next token. * * @return tokenType of next token. */ - private final TokenType nextToken() { + private TokenType nextToken() { // Capture last token tokenType. last = type; if (type != EOF) { diff --git a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java index a01705dd956..653f04c02f5 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java +++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java @@ -27,6 +27,7 @@ package jdk.nashorn.internal.parser; import static jdk.nashorn.internal.parser.TokenType.ADD; import static jdk.nashorn.internal.parser.TokenType.COMMENT; +import static jdk.nashorn.internal.parser.TokenType.DIRECTIVE_COMMENT; import static jdk.nashorn.internal.parser.TokenType.DECIMAL; import static jdk.nashorn.internal.parser.TokenType.EOF; import static jdk.nashorn.internal.parser.TokenType.EOL; @@ -434,12 +435,18 @@ public class Lexer extends Scanner { if (ch1 == '/') { // Skip over //. skip(2); + + boolean directiveComment = false; + if ((ch0 == '#' || ch0 == '@') && (ch1 == ' ')) { + directiveComment = true; + } + // Scan for EOL. while (!atEOF() && !isEOL(ch0)) { skip(1); } // Did detect a comment. - add(COMMENT, start); + add(directiveComment? DIRECTIVE_COMMENT : COMMENT, start); return true; } else if (ch1 == '*') { // Skip over /*. @@ -1623,6 +1630,8 @@ public class Lexer extends Scanner { return valueOfPattern(start, len); // RegexToken::LexerToken case XML: return valueOfXML(start, len); // XMLToken::LexerToken + case DIRECTIVE_COMMENT: + return source.getString(start, len); default: break; } diff --git a/nashorn/src/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk/nashorn/internal/parser/Parser.java index 8e04fdceda7..60cbaccb68e 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java +++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java @@ -26,7 +26,7 @@ package jdk.nashorn.internal.parser; import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL; -import static jdk.nashorn.internal.codegen.CompilerConstants.FUNCTION_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.ANON_FUNCTION_PREFIX; import static jdk.nashorn.internal.codegen.CompilerConstants.RUN_SCRIPT; import static jdk.nashorn.internal.parser.TokenType.ASSIGN; import static jdk.nashorn.internal.parser.TokenType.CASE; @@ -389,7 +389,9 @@ loop: sb.append(parentFunction.getName()).append('$'); } - sb.append(ident != null ? ident.getName() : FUNCTION_PREFIX.symbolName()); + assert ident.getName() != null; + sb.append(ident.getName()); + final String name = namespace.uniqueName(sb.toString()); assert parentFunction != null || name.equals(RUN_SCRIPT.symbolName()) : "name = " + name;// must not rename runScript(). @@ -419,7 +421,8 @@ loop: name, parameters, kind, - flags); + flags, + sourceURL); lc.push(functionNode); // Create new block, and just put it on the context stack, restoreFunctionNode() will associate it with the @@ -638,6 +641,10 @@ loop: script = restoreFunctionNode(script, token); //commit code script = script.setBody(lc, script.getBody().setNeedsScope(lc)); + // user may have directive comment to set sourceURL + if (sourceURL != null) { + script = script.setSourceURL(lc, sourceURL); + } return script; } @@ -2132,11 +2139,20 @@ loop: final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); - final IdentNode argIdent = getIdent(); - verifyStrictIdent(argIdent, "setter argument"); + // be sloppy and allow missing setter parameter even though + // spec does not permit it! + final IdentNode argIdent; + if (type == IDENT || isNonStrictModeIdent()) { + argIdent = getIdent(); + verifyStrictIdent(argIdent, "setter argument"); + } else { + argIdent = null; + } expect(RPAREN); List<IdentNode> parameters = new ArrayList<>(); - parameters.add(argIdent); + if (argIdent != null) { + parameters.add(argIdent); + } functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER); return new PropertyNode(propertyToken, finish, setIdent, null, null, functionNode); @@ -2448,7 +2464,7 @@ loop: // name is null, generate anonymous name boolean isAnonymous = false; if (name == null) { - final String tmpName = "_L" + functionLine; + final String tmpName = ANON_FUNCTION_PREFIX.symbolName() + functionLine; name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName); isAnonymous = true; } diff --git a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java index 6287a234cf2..5c696cb92b7 100644 --- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java +++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java @@ -41,10 +41,14 @@ import static jdk.nashorn.internal.parser.TokenKind.UNARY; */ @SuppressWarnings("javadoc") public enum TokenType { - ERROR (SPECIAL, null), - EOF (SPECIAL, null), - EOL (SPECIAL, null), - COMMENT (SPECIAL, null), + ERROR (SPECIAL, null), + EOF (SPECIAL, null), + EOL (SPECIAL, null), + COMMENT (SPECIAL, null), + // comments of the form //@ foo=bar or //# foo=bar + // These comments are treated as special instructions + // to the lexer, parser or codegenerator. + DIRECTIVE_COMMENT (SPECIAL, null), NOT (UNARY, "!", 14, false), NE (BINARY, "!=", 9, true), diff --git a/nashorn/src/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk/nashorn/internal/runtime/Context.java index c9deee3501d..1817ca928ba 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java @@ -91,6 +91,11 @@ public final class Context { */ public static final String NASHORN_JAVA_REFLECTION = "nashorn.JavaReflection"; + /** + * Permission to enable nashorn debug mode. + */ + public static final String NASHORN_DEBUG_MODE = "nashorn.debugMode"; + // nashorn load psuedo URL prefixes private static final String LOAD_CLASSPATH = "classpath:"; private static final String LOAD_FX = "fx:"; diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java b/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java index 0ff843a4271..754ebbf955f 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java @@ -30,6 +30,7 @@ import java.util.Locale; import java.util.ResourceBundle; import jdk.nashorn.api.scripting.NashornException; import jdk.nashorn.internal.scripts.JS; +import jdk.nashorn.internal.codegen.CompilerConstants; /** * Helper class to throw various standard "ECMA error" exceptions such as Error, ReferenceError, TypeError etc. @@ -401,7 +402,7 @@ public final class ECMAErrors { final String className = frame.getClassName(); // Look for script package in class name (into which compiler puts generated code) - if (className.startsWith(scriptPackage)) { + if (className.startsWith(scriptPackage) && !frame.getMethodName().startsWith(CompilerConstants.INTERNAL_METHOD_PREFIX)) { final String source = frame.getFileName(); /* * Make sure that it is not some Java code that Nashorn has in that package! diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java index a32e721cc46..c900963de4a 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java @@ -25,7 +25,7 @@ package jdk.nashorn.internal.runtime; -import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup; +import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualField; import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; @@ -44,9 +44,9 @@ import jdk.nashorn.internal.codegen.CompilerConstants.FieldAccess; @SuppressWarnings("serial") public final class ECMAException extends NashornException { /** - * Method handle pointing to the constructor {@link ECMAException#ECMAException(Object, String, int, int)}, + * Method handle pointing to the constructor {@link ECMAException#create(Object, String, int, int)}, */ - public static final Call THROW_INIT = constructorNoLookup(ECMAException.class, Object.class, String.class, int.class, int.class); + public static final Call CREATE = staticCallNoLookup(ECMAException.class, "create", ECMAException.class, Object.class, String.class, int.class, int.class); /** Field handle to the{@link ECMAException#thrown} field, so that it can be accessed from generated code */ public static final FieldAccess THROWN = virtualField(ECMAException.class, "thrown", Object.class); @@ -57,23 +57,21 @@ public final class ECMAException extends NashornException { public final Object thrown; /** - * Constructor. This is called from generated code to implement the {@code throw} - * instruction from generated script code + * Constructor. Called from the factory method 'create'. * * @param thrown object to be thrown * @param fileName script file name * @param line line number of throw * @param column column number of throw */ - public ECMAException(final Object thrown, final String fileName, final int line, final int column) { + private ECMAException(final Object thrown, final String fileName, final int line, final int column) { super(ScriptRuntime.safeToString(thrown), asThrowable(thrown), fileName, line, column); this.thrown = thrown; setExceptionToThrown(); } /** - * Constructor. This is called from runtime code in Nashorn to throw things like - * type errors. + * Constructor. This is called from the runtime code. * * @param thrown object to be thrown * @param cause Java exception that triggered this throw @@ -84,10 +82,40 @@ public final class ECMAException extends NashornException { setExceptionToThrown(); } + /** + * Factory method to retrieve the underlying exception or create an exception. + * This method is called from the generated code. + * + * @param thrown object to be thrown + * @param fileName script file name + * @param line line number of throw + * @param column column number of throw + * @return ECMAException object + */ + public static ECMAException create(final Object thrown, final String fileName, final int line, final int column) { + // If thrown object is an Error or sub-object like TypeError, then + // an ECMAException object has been already initialized at constructor. + if (thrown instanceof ScriptObject) { + ScriptObject sobj = (ScriptObject)thrown; + Object exception = getException(sobj); + if (exception instanceof ECMAException) { + // copy over file name, line number and column number. + final ECMAException ee = (ECMAException)exception; + ee.setFileName(fileName); + ee.setLineNumber(line); + ee.setColumnNumber(column); + return ee; + } + } + + return new ECMAException(thrown, fileName, line, column); + } + /** * Get the thrown object * @return thrown object */ + @Override public Object getThrown() { return thrown; } @@ -256,6 +284,8 @@ public final class ECMAException extends NashornException { final ScriptObject sobj = (ScriptObject)thrown; if (!sobj.has(EXCEPTION_PROPERTY)) { sobj.addOwnProperty(EXCEPTION_PROPERTY, Property.NOT_ENUMERABLE, this); + } else { + sobj.set(EXCEPTION_PROPERTY, this, false); } } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java index c14accb7c4e..87a8c74849a 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java @@ -112,7 +112,7 @@ public final class FindProperty { return property != null && property.hasGetterFunction(prototype) ? self : prototype; } - /** + /** * Return the appropriate receiver for a setter. * @return appropriate receiver */ @@ -172,5 +172,20 @@ public final class FindProperty { property.setObjectValue(getSetterReceiver(), getOwner(), value, strict); } + /** + * Get the number of objects in the prototype chain between the {@code self} and the + * {@code owner} objects. + * @return the prototype chain length + */ + int getProtoChainLength() { + assert self != null; + int length = 0; + for (ScriptObject obj = self; obj != prototype; obj = obj.getProto()) { + assert !(obj instanceof WithObject); + ++length; + } + return length; + } + } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java index 99ba9e19fa5..a5abacb2134 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java @@ -196,26 +196,15 @@ public final class NativeJavaPackage extends ScriptObject { @Override public GuardedInvocation noSuchProperty(final CallSiteDescriptor desc, final LinkRequest request) { final String propertyName = desc.getNameToken(2); - final String fullName = name.isEmpty() ? propertyName : name + "." + propertyName; - - final Context context = Context.getContextTrusted(); - - Class<?> javaClass = null; - try { - javaClass = context.findClass(fullName); - } catch (final NoClassDefFoundError | ClassNotFoundException e) { - //ignored - } - - if (javaClass == null) { - set(propertyName, new NativeJavaPackage(fullName, getProto()), false); - } else { - set(propertyName, StaticClass.forClass(javaClass), false); - } - + createProperty(propertyName); return super.lookup(desc, request); } + @Override + protected Object invokeNoSuchProperty(final String name) { + return createProperty(name); + } + @Override public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc, final LinkRequest request) { return noSuchProperty(desc, request); @@ -224,4 +213,26 @@ public final class NativeJavaPackage extends ScriptObject { private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) { return MH.findStatic(MethodHandles.lookup(), NativeJavaPackage.class, name, MH.type(rtype, types)); } + + private Object createProperty(final String propertyName) { + final String fullName = name.isEmpty() ? propertyName : name + "." + propertyName; + final Context context = Context.getContextTrusted(); + + Class<?> javaClass = null; + try { + javaClass = context.findClass(fullName); + } catch (final NoClassDefFoundError | ClassNotFoundException e) { + //ignored + } + + final Object propertyValue; + if (javaClass == null) { + propertyValue = new NativeJavaPackage(fullName, getProto()); + } else { + propertyValue = StaticClass.forClass(javaClass); + } + + set(propertyName, propertyValue, false); + return propertyValue; + } } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java index 02160d69eee..4b85ed4ed5c 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java @@ -143,6 +143,8 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr private static final MethodHandle TRUNCATINGFILTER = findOwnMH("truncatingFilter", Object[].class, int.class, Object[].class); private static final MethodHandle KNOWNFUNCPROPGUARD = findOwnMH("knownFunctionPropertyGuard", boolean.class, Object.class, PropertyMap.class, MethodHandle.class, Object.class, ScriptFunction.class); + private static final ArrayList<MethodHandle> protoFilters = new ArrayList<>(); + /** Method handle for getting a function argument at a given index. Used from MapCreator */ public static final Call GET_ARGUMENT = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArgument", Object.class, int.class); @@ -1711,6 +1713,44 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr return getter.replaceMethods(MH.foldArguments(invoker, argDroppingGetter), getter.getGuard()); } + /** + * Test whether this object contains in its prototype chain or is itself a with-object. + * @return true if a with-object was found + */ + final boolean hasWithScope() { + if (isScope()) { + for (ScriptObject obj = this; obj != null; obj = obj.getProto()) { + if (obj instanceof WithObject) { + return true; + } + } + } + return false; + } + + /** + * Add a filter to the first argument of {@code methodHandle} that calls its {@link #getProto()} method + * {@code depth} times. + * @param methodHandle a method handle + * @param depth distance to target prototype + * @return the filtered method handle + */ + static MethodHandle addProtoFilter(final MethodHandle methodHandle, final int depth) { + if (depth == 0) { + return methodHandle; + } + final int listIndex = depth - 1; // We don't need 0-deep walker + MethodHandle filter = listIndex < protoFilters.size() ? protoFilters.get(listIndex) : null; + + if(filter == null) { + filter = addProtoFilter(GETPROTO, depth - 1); + protoFilters.add(null); + protoFilters.set(listIndex, filter); + } + + return MH.filterArguments(methodHandle, 0, filter.asType(filter.type().changeReturnType(methodHandle.type().parameterType(0)))); + } + /** * Find the appropriate GET method for an invoke dynamic call. * @@ -1722,7 +1762,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr */ protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if (request.isCallSiteUnstable()) { + if (request.isCallSiteUnstable() || hasWithScope()) { return findMegaMorphicGetMethod(desc, name, "getMethod".equals(operator)); } @@ -1748,22 +1788,24 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr final Property property = find.getProperty(); methodHandle = find.getGetter(returnType); + final boolean noGuard = ObjectClassGenerator.OBJECT_FIELDS_ONLY && NashornCallSiteDescriptor.isFastScope(desc) && !property.canChangeType(); // getMap() is fine as we have the prototype switchpoint depending on where the property was found - final MethodHandle guard = NashornGuards.getMapGuard(getMap()); + final MethodHandle guard = noGuard ? null : NashornGuards.getMapGuard(getMap()); if (methodHandle != null) { assert methodHandle.type().returnType().equals(returnType); if (find.isSelf()) { - return new GuardedInvocation(methodHandle, ObjectClassGenerator.OBJECT_FIELDS_ONLY && - NashornCallSiteDescriptor.isFastScope(desc) && !property.canChangeType() ? null : guard); + return new GuardedInvocation(methodHandle, guard); } - final ScriptObject prototype = find.getOwner(); - - if (!property.hasGetterFunction(prototype)) { - methodHandle = bindTo(methodHandle, prototype); + if (!property.hasGetterFunction(find.getOwner())) { + // If not a scope bind to actual prototype as changing prototype will change the property map. + // For scopes we install a filter that replaces the self object with the prototype owning the property. + methodHandle = isScope() ? + addProtoFilter(methodHandle, find.getProtoChainLength()) : + bindTo(methodHandle, find.getOwner()); } - return new GuardedInvocation(methodHandle, getMap().getProtoGetSwitchPoint(proto, name), guard); + return new GuardedInvocation(methodHandle, noGuard ? null : getMap().getProtoGetSwitchPoint(proto, name), guard); } assert !NashornCallSiteDescriptor.isFastScope(desc); @@ -1833,7 +1875,7 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr */ protected GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) { final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND); - if (request.isCallSiteUnstable()) { + if (request.isCallSiteUnstable() || hasWithScope()) { return findMegaMorphicSetMethod(desc, name); } @@ -1888,7 +1930,9 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr final ScriptObject obj = (ScriptObject)self; final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc); if (!obj.isExtensible()) { - throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj)); + if (isStrict) { + throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj)); + } } else if (obj.compareAndSetMap(oldMap, newMap)) { setter.invokeExact(self, value); } else { @@ -2049,12 +2093,13 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr return createEmptyGetter(desc, name); } + /** * Invoke fall back if a property is not found. * @param name Name of property. * @return Result from call. */ - private Object invokeNoSuchProperty(final String name) { + protected Object invokeNoSuchProperty(final String name) { final FindProperty find = findProperty(NO_SUCH_PROPERTY_NAME, true); if (find != null) { @@ -2759,7 +2804,8 @@ public abstract class ScriptObject extends PropertyListenerManager implements Pr public final void setObject(final FindProperty find, final boolean strict, final String key, final Object value) { FindProperty f = find; - if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty)) { + if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty) && !isScope()) { + // Setting a property should not modify the property in prototype unless this is a scope object. f = null; } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java index 777254d831c..7390aadd0cd 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java @@ -151,10 +151,12 @@ final class SetMethodCreator { assert methodHandle != null; assert property != null; - final ScriptObject prototype = find.getOwner(); final MethodHandle boundHandle; - if (!property.hasSetterFunction(prototype) && find.isInherited()) { - boundHandle = ScriptObject.bindTo(methodHandle, prototype); + if (!property.hasSetterFunction(find.getOwner()) && find.isInherited()) { + // Bind or add prototype filter depending on whether this is a scope object. + boundHandle = sobj.isScope() ? + ScriptObject.addProtoFilter(methodHandle, find.getProtoChainLength()): + ScriptObject.bindTo(methodHandle, find.getOwner()); } else { boundHandle = methodHandle; } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java index 5b8d4cfe3f0..ef2a6829a25 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java @@ -317,7 +317,7 @@ final class JavaAdapterBytecodeGenerator { final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_STATIC, CLASS_INIT, Type.getMethodDescriptor(Type.VOID_TYPE), null, null)); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR, false); final Label initGlobal; if(samName != null) { // If the class is a SAM, allow having a ScriptFunction passed as class overrides @@ -333,7 +333,7 @@ final class JavaAdapterBytecodeGenerator { if(mi.getName().equals(samName)) { mv.dup(); mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR, false); } else { mv.visitInsn(ACONST_NULL); } @@ -350,7 +350,7 @@ final class JavaAdapterBytecodeGenerator { mv.dup(); mv.aconst(mi.getName()); mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR, false); mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR); } @@ -367,7 +367,7 @@ final class JavaAdapterBytecodeGenerator { private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) { invokeGetGlobal(mv); mv.dup(); - mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context + mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context mv.pop(); } @@ -424,7 +424,7 @@ final class JavaAdapterBytecodeGenerator { mv.load(offset, argType); offset += argType.getSize(); } - mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor()); + mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false); endInitMethod(mv); } @@ -477,7 +477,7 @@ final class JavaAdapterBytecodeGenerator { mv.load(offset, argType); offset += argType.getSize(); } - mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor()); + mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false); // Get a descriptor to the appropriate "JavaAdapterFactory.getHandle" method. final String getHandleDescriptor = fromFunction ? GET_HANDLE_FUNCTION_DESCRIPTOR : GET_HANDLE_OBJECT_DESCRIPTOR; @@ -496,7 +496,7 @@ final class JavaAdapterBytecodeGenerator { mv.aconst(mi.getName()); } mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString())); - mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor); + mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor, false); } mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR); } @@ -520,11 +520,11 @@ final class JavaAdapterBytecodeGenerator { } private static void invokeGetGlobal(final InstructionAdapter mv) { - mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR); + mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false); } private static void invokeSetGlobal(final InstructionAdapter mv) { - mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR); + mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false); } /** @@ -647,11 +647,11 @@ final class JavaAdapterBytecodeGenerator { // If the super method is abstract, throw an exception mv.anew(UNSUPPORTED_OPERATION_TYPE); mv.dup(); - mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR); + mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR, false); mv.athrow(); } else { // If the super method is not abstract, delegate to it. - emitSuperCall(mv, name, methodDesc); + emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc); } final Label setupGlobal = new Label(); @@ -728,7 +728,7 @@ final class JavaAdapterBytecodeGenerator { // Invoke the target method handle final Label tryBlockStart = new Label(); mv.visitLabel(tryBlockStart); - mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString()); + mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false); final Label tryBlockEnd = new Label(); mv.visitLabel(tryBlockEnd); emitFinally(mv, currentGlobalVar, globalsDifferVar); @@ -744,7 +744,7 @@ final class JavaAdapterBytecodeGenerator { mv.anew(RUNTIME_EXCEPTION_TYPE); mv.dupX1(); mv.swap(); - mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE)); + mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE), false); // Fall through to rethrow handler } else { throwableHandler = null; @@ -830,12 +830,12 @@ final class JavaAdapterBytecodeGenerator { SUPER_PREFIX + name, methodDesc, null, getExceptionNames(method.getExceptionTypes()))); mv.visitCode(); - emitSuperCall(mv, name, methodDesc); + emitSuperCall(mv, method.getDeclaringClass(), name, methodDesc); endMethod(mv); } - private void emitSuperCall(final InstructionAdapter mv, final String name, final String methodDesc) { + private void emitSuperCall(final InstructionAdapter mv, final Class owner, final String name, final String methodDesc) { mv.visitVarInsn(ALOAD, 0); int nextParam = 1; final Type methodType = Type.getMethodType(methodDesc); @@ -843,7 +843,13 @@ final class JavaAdapterBytecodeGenerator { mv.load(nextParam, t); nextParam += t.getSize(); } - mv.invokespecial(superClassName, name, methodDesc); + + // default method - non-abstract, interface method + if (Modifier.isInterface(owner.getModifiers())) { + mv.invokespecial(Type.getInternalName(owner), name, methodDesc, false); + } else { + mv.invokespecial(superClassName, name, methodDesc, false); + } mv.areturn(methodType.getReturnType()); } diff --git a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java index 39f9364233d..6772cbee037 100644 --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java @@ -75,7 +75,8 @@ final class ReflectionCheckLinker implements TypeBasedGuardingDynamicLinker{ if ((self instanceof Class) && Modifier.isPublic(((Class<?>)self).getModifiers())) { final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor(); if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) { - if ("static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) { + if (desc.getNameTokenCount() > CallSiteDescriptor.NAME_OPERAND && + "static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) { if (Context.isAccessibleClass((Class<?>)self) && !isReflectionClass((Class<?>)self)) { // If "getProp:static" passes access checks, allow access. return; diff --git a/nashorn/test/script/basic/JDK-8010731.js b/nashorn/test/script/basic/JDK-8010731.js new file mode 100644 index 00000000000..532cf135e81 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8010731.js @@ -0,0 +1,64 @@ +/* + * 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-8010731: Nashorn exposes internal symbols such as __callee__, __scope__ to scripts + * + * @test + * @run + */ + +function checkCallee() { + var x = arguments[0]; // force __callee__ (renamed as :callee) + + print(__callee__); +} + +try { + checkCallee(); + fail("Should have thrown ReferenceError for __callee__"); +} catch (e) { + if (! (e instanceof ReferenceError)) { + fail("ReferenceError expected, got " + e); + } +} + +function checkScope() { + var x = 334; + + function inner() { + var y = x * x; // force __scope__ (renamed as :scope") + print(__scope__); + } + + inner(); +} + +try { + checkScope(); + fail("Should have thrown ReferenceError for __scope__"); +} catch (e) { + if (! (e instanceof ReferenceError)) { + fail("ReferenceError expected, got " + e); + } +} diff --git a/nashorn/test/script/basic/JDK-8025515.js b/nashorn/test/script/basic/JDK-8025515.js index f3d7cee47c0..29574d2a86a 100644 --- a/nashorn/test/script/basic/JDK-8025515.js +++ b/nashorn/test/script/basic/JDK-8025515.js @@ -30,13 +30,23 @@ // Make sure synthetic names of anonymous functions have correct line numbers +function getFirstScriptFrame(stack) { + for (frameNum in stack) { + var frame = stack[frameNum]; + if (frame.className.startsWith("jdk.nashorn.internal.scripts.Script$")) { + return frame; + } + } +} + function testMethodName(f, expected) { try { f(); fail("expected error"); } catch (e) { - var stack = e.getStackTrace(); - if (stack[0].methodName !== expected) { + var stack = e.nashornException.getStackTrace(); + var name = getFirstScriptFrame(stack).methodName; + if (name !== expected) { fail("got " + stack[0].methodName + ", expected " + expected); } } @@ -44,15 +54,15 @@ function testMethodName(f, expected) { testMethodName(function() { return a.b.c; -}, "_L45"); +}, "L:55"); -testMethodName(function() { throw new Error() }, "_L49"); +testMethodName(function() { throw new Error() }, "L:59"); var f = (function() { return function() { a.b.c; }; })(); -testMethodName(f, "_L51$_L52"); +testMethodName(f, "L:61$L:62"); testMethodName((function() { return function() { return a.b.c; }; -})(), "_L56$_L57"); +})(), "L:66$L:67"); diff --git a/nashorn/test/script/basic/JDK-8029364.js b/nashorn/test/script/basic/JDK-8029364.js new file mode 100644 index 00000000000..dfa8ea9de4f --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029364.js @@ -0,0 +1,49 @@ +/* + * 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-8029364: NashornException to expose thrown object + * + * @test + * @run + */ + +var m = new javax.script.ScriptEngineManager(); +var e = m.getEngineByName("nashorn"); +var g = e.eval("this"); +try { + e.eval("var e = new Error('foo'); e.bar = 33; throw e"); +} catch (se) { + // ScriptException instance's cause is a NashornException + print(se.getClass()); + var cause = se.cause; + print(cause.getClass()); + // NashornException instance has 'ecmaError' bean getter + print(cause.ecmaError); + // access to underlying ECMA Error object + print(cause.ecmaError instanceof g.Error); + print(cause.ecmaError.name); + print(cause.ecmaError.message); + print(cause.ecmaError.bar); +} + diff --git a/nashorn/test/script/basic/JDK-8029364.js.EXPECTED b/nashorn/test/script/basic/JDK-8029364.js.EXPECTED new file mode 100644 index 00000000000..d01bb9ee0b7 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029364.js.EXPECTED @@ -0,0 +1,7 @@ +class javax.script.ScriptException +class jdk.nashorn.internal.runtime.ECMAException +Error: foo +true +Error +foo +33 diff --git a/nashorn/test/script/basic/JDK-8029467.js b/nashorn/test/script/basic/JDK-8029467.js new file mode 100644 index 00000000000..ad7f2fde6bb --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029467.js @@ -0,0 +1,34 @@ +/* + * 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-8029467: Widening of booleans causes bad results + * + * @test + * @run + */ + +print((function (x) { return x ? true : 0 })(true)) +print((function (x) { if(x) { return true } else { return 0 } })(true)) +print(typeof (function (x) { return x ? 1 : "123" })(true) === "number") +print(typeof (function (x) { if(x) { return 1 } else { return "123" } })(true) === "number") diff --git a/nashorn/test/script/basic/JDK-8029467.js.EXPECTED b/nashorn/test/script/basic/JDK-8029467.js.EXPECTED new file mode 100644 index 00000000000..1140ff52e2b --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029467.js.EXPECTED @@ -0,0 +1,4 @@ +true +true +true +true diff --git a/nashorn/test/script/basic/JDK-8029667.js b/nashorn/test/script/basic/JDK-8029667.js new file mode 100644 index 00000000000..c0c2d156200 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029667.js @@ -0,0 +1,91 @@ +/* + * 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-8029667: Prototype linking is incorrect + * + * @test + * @run + */ + +function f(x) { + return (function inner() { + var y; (function dummy() { return y })() // force own scope for the inner function + with({}) { // 'with' block turns off fast scopes + return x + } + })(); +} +print(f(1)); +print(f(2)); + +function g(x) { + (function inner() { + var y; (function dummy() { return y })() // force own scope for the inner function + with({}) { // 'with' block turns off fast scopes + // Test setter as well as getter + x = x + 2; + } + })(); + print(x); +} + +g(1); +g(2); + +var withScopes = [{ func: function() { print("called 1");} }, { func: function() { print("called 2");} }]; + +for(var i in withScopes) { + with (withScopes[i]) { + var main = function() { + var frame; // <---- this local variable caused scope to be not set properly prior to fix + + function callFunc() { + frame = func(); + } + + callFunc(); + } + } + main(); +} + +for(var i in withScopes) { + with (withScopes[i]) { + var main = function() { + var frame; // <---- this local variable caused scope to be not set properly prior to fix + + function callFunc() { + frame = func = i; + } + + callFunc(); + } + } + main(); +} + +print(withScopes[0].func); +print(withScopes[1].func); + + diff --git a/nashorn/test/script/basic/JDK-8029667.js.EXPECTED b/nashorn/test/script/basic/JDK-8029667.js.EXPECTED new file mode 100644 index 00000000000..8aa78efed12 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8029667.js.EXPECTED @@ -0,0 +1,8 @@ +1 +2 +3 +4 +called 1 +called 2 +0 +1 diff --git a/nashorn/test/script/basic/JDK-8030182.js b/nashorn/test/script/basic/JDK-8030182.js new file mode 100644 index 00000000000..f3c492d41b2 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8030182.js @@ -0,0 +1,46 @@ +/* + * 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-8030182: scopeCall with -1 as line number + * + * @test + * @run + */ + +function func() { + throw new Error("Strange..."); +} + +var f2 = func; +var f3 = func; +var f4 = func; +var f5 = func; + +// check that "scopeCall" or some such internal method +// does not appear in script stack trace. +try { + func(); +} catch(err) { + print(err.stack.replace(/\\/g, '/')); +} diff --git a/nashorn/test/script/basic/JDK-8030182.js.EXPECTED b/nashorn/test/script/basic/JDK-8030182.js.EXPECTED new file mode 100644 index 00000000000..d12b6d7fd72 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8030182.js.EXPECTED @@ -0,0 +1,3 @@ +Error: Strange... + at func (test/script/basic/JDK-8030182.js:32) + at <program> (test/script/basic/JDK-8030182.js:43) diff --git a/nashorn/test/script/basic/JDK-8030182_2.js b/nashorn/test/script/basic/JDK-8030182_2.js new file mode 100644 index 00000000000..de507e1dad4 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8030182_2.js @@ -0,0 +1,46 @@ +/* + * 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-8030182: scopeCall with -1 as line number + * + * @test + * @run + */ + +var str = ""; + +// large code to force splitting +for (i = 0; i < 1000; ++i) + str +="o = new Object()\n"; + +str +="g()"; + +// check that "$split" or some such internal method +// does not appear in script stack trace!! +try { + eval(str); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + diff --git a/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED new file mode 100644 index 00000000000..772e504d917 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED @@ -0,0 +1,3 @@ +ReferenceError: "g" is not defined + at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@0:-1) + at <program> (test/script/basic/JDK-8030182_2.js:42) diff --git a/langtools/test/tools/javac/varargs/warning/Warn1.java b/nashorn/test/script/basic/JDK-8030809.js similarity index 71% rename from langtools/test/tools/javac/varargs/warning/Warn1.java rename to nashorn/test/script/basic/JDK-8030809.js index 8ffaabfbe11..01c7687c08a 100644 --- a/langtools/test/tools/javac/varargs/warning/Warn1.java +++ b/nashorn/test/script/basic/JDK-8030809.js @@ -1,42 +1,41 @@ /* - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * 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. */ -/* - * @test - * @bug 5035307 - * @summary fixed-arity warning given too often - * @author gafter +/** + * JDK-8030809: Anonymous functions should not be shown with internal names in script stack trace * - * @compile -Werror -source 1.4 -Xlint:-options Warn1.java + * @test + * @run */ -package varargs.warning.warn1; - -import java.util.List; -import java.util.Arrays; - -class Warn1 { - void f(String[] args) { - List l = java.util.Arrays.asList(args); - } +function func() { + (function() { + throw new Error(); + })(); +} + +try { + func(); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); } diff --git a/nashorn/test/script/basic/JDK-8030809.js.EXPECTED b/nashorn/test/script/basic/JDK-8030809.js.EXPECTED new file mode 100644 index 00000000000..6d2ee69b12a --- /dev/null +++ b/nashorn/test/script/basic/JDK-8030809.js.EXPECTED @@ -0,0 +1,4 @@ +Error + at <anonymous> (test/script/basic/JDK-8030809.js:33) + at func (test/script/basic/JDK-8030809.js:32) + at <program> (test/script/basic/JDK-8030809.js:38) diff --git a/langtools/test/tools/doclint/html/AAA.java b/nashorn/test/script/basic/JDK-8031317.js similarity index 74% rename from langtools/test/tools/doclint/html/AAA.java rename to nashorn/test/script/basic/JDK-8031317.js index 3880733edc9..240a63377a4 100644 --- a/langtools/test/tools/doclint/html/AAA.java +++ b/nashorn/test/script/basic/JDK-8031317.js @@ -1,35 +1,41 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * 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-8031317: SyntaxError when property setter has no parameter + * * @test - * @bug 8006728 - * @summary temporarily workaround jtreg problems for doclint tests in othervm + * @run */ -// dummy test/class to be compiled before other tests in this directory -// see JDK-8006730 -public class AAA { - public static void main(String... args) { } +var obj = { + get toto() { + print("in getter for 'toto'"); + }, + set toto() { + print("in setter for 'toto'"); + } } +obj.toto; +obj.toto = 344; diff --git a/nashorn/test/script/basic/JDK-8031317.js.EXPECTED b/nashorn/test/script/basic/JDK-8031317.js.EXPECTED new file mode 100644 index 00000000000..dda72eae985 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031317.js.EXPECTED @@ -0,0 +1,2 @@ +in getter for 'toto' +in setter for 'toto' diff --git a/nashorn/test/script/basic/JDK-8031359.js b/nashorn/test/script/basic/JDK-8031359.js new file mode 100644 index 00000000000..278fd7d2f32 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031359.js @@ -0,0 +1,62 @@ +/* + * 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 + * 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-8031359: Invocable.getInterface() works incorrectly if interface has default methods + * + * @test + * @run + */ + +var func = new java.util.function.Function() { + apply: function(arg) { + print("func called with " + arg); + return arg.toUpperCase(); + } +}; + +// Function.andThen is a default method +func.andThen(func)("hello"); + +// Function.compose is another default method +func.compose(new java.util.function.Function() { + apply: function(arg) { + print("compose called with " + arg); + return arg.charAt(0); + } +})("hello"); + +var func2 = new java.util.function.Function() { + apply: function(arg) { + print("I am func2: " + arg); + return arg; + }, + + andThen: function(func) { + print("This is my andThen!"); + return func; + } +}; + +func2.apply("hello"); +func2.andThen(func); diff --git a/nashorn/test/script/basic/JDK-8031359.js.EXPECTED b/nashorn/test/script/basic/JDK-8031359.js.EXPECTED new file mode 100644 index 00000000000..3fb72f1bc33 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031359.js.EXPECTED @@ -0,0 +1,6 @@ +func called with hello +func called with HELLO +compose called with hello +func called with h +I am func2: hello +This is my andThen! diff --git a/nashorn/test/script/basic/JDK-8031715.js b/nashorn/test/script/basic/JDK-8031715.js new file mode 100644 index 00000000000..19994f51f58 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031715.js @@ -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. + */ + +/** + * JDK-8031715: Indexed access to java package not working + * @test + * @run + */ + +print(java["net"]); +print(java["net"]["URL"]); +print(java["net"].URL); +print(java.net["URL"]); + +var is = "InputStream"; +var io = "io"; + +print(java.io[is]); +print(java[io]); +print(java[io][is]); + +var ji = new JavaImporter(java.util, java.io); +print(ji["InputStream"]); +print(ji['Vector']); + +var hash = "Hashtable"; +var printStream = "PrintStream"; +print(ji[hash]); +print(ji[printStream]); diff --git a/nashorn/test/script/basic/JDK-8031715.js.EXPECTED b/nashorn/test/script/basic/JDK-8031715.js.EXPECTED new file mode 100644 index 00000000000..1a71de34110 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031715.js.EXPECTED @@ -0,0 +1,11 @@ +[JavaPackage java.net] +[JavaClass java.net.URL] +[JavaClass java.net.URL] +[JavaClass java.net.URL] +[JavaClass java.io.InputStream] +[JavaPackage java.io] +[JavaClass java.io.InputStream] +[JavaClass java.io.InputStream] +[JavaClass java.util.Vector] +[JavaClass java.util.Hashtable] +[JavaClass java.io.PrintStream] diff --git a/nashorn/test/script/basic/JDK-8031983.js b/nashorn/test/script/basic/JDK-8031983.js new file mode 100644 index 00000000000..f0bfca13164 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031983.js @@ -0,0 +1,55 @@ +/* + * 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. + */ + +/** + * JDK-8031983: Error objects should capture stack at the constructor + * + * @test + * @run + */ + +var e = new Error(); +print("hello"); + +try { + throw e; +} catch (e) { + print(e.lineNumber); + print(e.stack.replace(/\\/g, '/')); +} + +Error.captureStackTrace(e); +try { + throw e; +} catch (e) { + print(e.lineNumber); + print(e.stack.replace(/\\/g, '/')); +} + +var obj = {}; +Error.captureStackTrace(obj); +try { + throw obj; +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} diff --git a/nashorn/test/script/basic/JDK-8031983.js.EXPECTED b/nashorn/test/script/basic/JDK-8031983.js.EXPECTED new file mode 100644 index 00000000000..9d62db31954 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8031983.js.EXPECTED @@ -0,0 +1,9 @@ +hello +35 +Error + at <program> (test/script/basic/JDK-8031983.js:31) +43 +Error + at <program> (test/script/basic/JDK-8031983.js:41) +[object Object] + at <program> (test/script/basic/JDK-8031983.js:50) diff --git a/nashorn/test/script/basic/JDK-8032004.js b/nashorn/test/script/basic/JDK-8032004.js new file mode 100644 index 00000000000..2995566c50a --- /dev/null +++ b/nashorn/test/script/basic/JDK-8032004.js @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/** + * JDK-8032004: instance property "message" of Error objects should be non-enumerable + * + * @test + * @run + */ + +function check(obj) { + if (obj.propertyIsEnumerable("message")) { + fail(obj.name + " object's message property is enumerable!"); + } +} + +check(new Error("test")); +check(new EvalError("test")); +check(new RangeError("test")); +check(new ReferenceError("test")); +check(new SyntaxError("test")); +check(new TypeError("test")); +check(new URIError("test")); diff --git a/nashorn/test/script/basic/JDK-8032068.js b/nashorn/test/script/basic/JDK-8032068.js new file mode 100644 index 00000000000..570789d737d --- /dev/null +++ b/nashorn/test/script/basic/JDK-8032068.js @@ -0,0 +1,56 @@ +/* + * 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. + */ + +/** + * JDK-8032068: implement @sourceURL and #sourceURL directives. + * + * @test + * @run + */ + + +try { + Function("throw new Error();\n//# sourceURL=foo.js")(); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + +try { + eval("function g() { throw Error('x');\n } g();\n//# sourceURL=bar.js"); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + +// check @sourceURL for compatibility +try { + Function("throw new Error();\n//@ sourceURL=foo2.js")(); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + +try { + eval("function g() { throw Error('x');\n } g();\n//@ sourceURL=bar2.js"); +} catch (e) { + print(e.stack.replace(/\\/g, '/')); +} + diff --git a/nashorn/test/script/basic/JDK-8032068.js.EXPECTED b/nashorn/test/script/basic/JDK-8032068.js.EXPECTED new file mode 100644 index 00000000000..b8891eee077 --- /dev/null +++ b/nashorn/test/script/basic/JDK-8032068.js.EXPECTED @@ -0,0 +1,14 @@ +Error + at <anonymous> (foo.js:2) + at <program> (test/script/basic/JDK-8032068.js:33) +Error: x + at g (bar.js:1) + at <program> (bar.js:2) + at <program> (test/script/basic/JDK-8032068.js:39) +Error + at <anonymous> (foo2.js:2) + at <program> (test/script/basic/JDK-8032068.js:46) +Error: x + at g (bar2.js:1) + at <program> (bar2.js:2) + at <program> (test/script/basic/JDK-8032068.js:52) diff --git a/nashorn/test/script/basic/NASHORN-111.js.EXPECTED b/nashorn/test/script/basic/NASHORN-111.js.EXPECTED index 287f25580c4..0967ef424bc 100644 --- a/nashorn/test/script/basic/NASHORN-111.js.EXPECTED +++ b/nashorn/test/script/basic/NASHORN-111.js.EXPECTED @@ -1 +1 @@ -{"message":"type error"} +{} diff --git a/nashorn/test/script/basic/NASHORN-441.js.EXPECTED b/nashorn/test/script/basic/NASHORN-441.js.EXPECTED index de9ea224be4..c0038426b2b 100644 --- a/nashorn/test/script/basic/NASHORN-441.js.EXPECTED +++ b/nashorn/test/script/basic/NASHORN-441.js.EXPECTED @@ -12,6 +12,6 @@ finally 4 try 5 rethrow 5 finally 5 -Error: try 5 thrown in line 71 +Error: try 5 thrown in line 74 try 6 finally 6 diff --git a/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED b/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED index 153524c70b4..9e4920dcfbf 100644 --- a/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED +++ b/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED @@ -1,13 +1,14 @@ -Compiled OK: box2d -Compiled OK: code-load -Compiled OK: crypto -Compiled OK: deltablue -Compiled OK: earley-boyer -Compiled OK: gbemu -Compiled OK: mandreel -Compiled OK: navier-stokes -Compiled OK: pdfjs -Compiled OK: raytrace -Compiled OK: regexp -Compiled OK: richards -Compiled OK: splay +[box2d] Compiled OK +[code-load] Compiled OK +[crypto] Compiled OK +[deltablue] Compiled OK +[earley-boyer] Compiled OK +[gbemu] Compiled OK +[mandreel] Compiled OK +[navier-stokes] Compiled OK +[pdfjs] Compiled OK +[raytrace] Compiled OK +[regexp] Compiled OK +[richards] Compiled OK +[splay] Compiled OK +[typescript] Compiled OK diff --git a/nashorn/test/script/basic/compile-octane.js.EXPECTED b/nashorn/test/script/basic/compile-octane.js.EXPECTED index 153524c70b4..9e4920dcfbf 100644 --- a/nashorn/test/script/basic/compile-octane.js.EXPECTED +++ b/nashorn/test/script/basic/compile-octane.js.EXPECTED @@ -1,13 +1,14 @@ -Compiled OK: box2d -Compiled OK: code-load -Compiled OK: crypto -Compiled OK: deltablue -Compiled OK: earley-boyer -Compiled OK: gbemu -Compiled OK: mandreel -Compiled OK: navier-stokes -Compiled OK: pdfjs -Compiled OK: raytrace -Compiled OK: regexp -Compiled OK: richards -Compiled OK: splay +[box2d] Compiled OK +[code-load] Compiled OK +[crypto] Compiled OK +[deltablue] Compiled OK +[earley-boyer] Compiled OK +[gbemu] Compiled OK +[mandreel] Compiled OK +[navier-stokes] Compiled OK +[pdfjs] Compiled OK +[raytrace] Compiled OK +[regexp] Compiled OK +[richards] Compiled OK +[splay] Compiled OK +[typescript] Compiled OK diff --git a/nashorn/test/script/basic/run-octane.js b/nashorn/test/script/basic/run-octane.js index b730040e4c5..840f07b743f 100644 --- a/nashorn/test/script/basic/run-octane.js +++ b/nashorn/test/script/basic/run-octane.js @@ -26,19 +26,22 @@ */ var tests = [ - {file:"box2d",suite:"Box2DBenchmark"}, - {file:"code-load",suite:"CodeLoad"}, - {file:"crypto",suite:"Crypto"}, - {file:"deltablue",suite:"DeltaBlue"}, - {file:"earley-boyer", suite:"EarleyBoyer"}, - {file:"gbemu", suite:"GameboyBenchmark"}, - {file:"mandreel", suite:"MandreelBenchmark"}, - {file:"navier-stokes", suite:"NavierStokes"}, - {file:"pdfjs", suite:"PdfJS"}, - {file:"raytrace", suite:"RayTrace"}, - {file:"regexp", suite:"RegExpSuite"}, - {file:"richards", suite:"Richards"}, - {file:"splay", suite:"Splay"} + {name:"box2d", files:["box2d.js"], suite:"Box2DBenchmark"}, + {name:"code-load", files:["code-load.js"], suite:"CodeLoad"}, + {name:"crypto", files:["crypto.js"], suite:"Crypto"}, + {name:"deltablue", files:["deltablue.js"], suite:"DeltaBlue"}, + {name:"earley-boyer", files:["earley-boyer.js"], suite:"EarleyBoyer"}, + {name:"gbemu", files:["gbemu-part1.js", "gbemu-part2.js"], suite:"GameboyBenchmark"}, + {name:"mandreel", files:["mandreel.js"], suite:"MandreelBenchmark"}, + {name:"navier-stokes", files:["navier-stokes.js"], suite:"NavierStokes"}, + {name:"pdfjs", files:["pdfjs.js"], suite:"PdfJS"}, + {name:"raytrace", files:["raytrace.js"], suite:"RayTrace"}, + {name:"regexp", files:["regexp.js"], suite:"RegExpSuite"}, + {name:"richards", files:["richards.js"], suite:"Richards"}, + {name:"splay", files:["splay.js"], suite:"Splay"}, + {name:"typescript", files:["typescript.js", "typescript-input.js", "typescript-compiler.js"], suite:"typescript"} + //zlib currently disabled - requires read + // {name:"zlib", files:["zlib.js", "zlib-data.js"], suite:"zlib"}, ]; var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__; @@ -58,26 +61,36 @@ function should_compile_only(name) { return (typeof compile_only !== 'undefined') } -function run_one_benchmark(arg, iters) { - var file_name; - var file = (arg.file + ".js").split('/'); +function load_bench(arg) { + + for (var idx = 0; idx < arg.files.length; idx++) { + var f = arg.files[idx]; + var file = f.split('/'); + var file_name = path + file[file.length - 1]; - file_name = path + file[file.length - 1]; - - var compile_and_return = should_compile_only(file_name); - if (compile_and_return) { - if (typeof compile_only === 'undefined') { //for a run, skip compile onlies, don't even compile them - return; + var compile_and_return = should_compile_only(file_name); + if (compile_and_return) { + if (typeof compile_only === 'undefined') { //for a run, skip compile onlies, don't even compile them + return true; + } } + + print_verbose(arg, "loading '" + arg.name + "' [" + f + "]..."); + load(file_name); } - - print_verbose("Loading... " + file_name); - load(file_name); - + if (compile_and_return) { - print_always("Compiled OK: " + arg.file); - return; + print_always(arg, "Compiled OK"); } + return !compile_and_return; + +} + +function run_one_benchmark(arg, iters) { + + if (!load_bench(arg)) { + return; + } var success = true; var current_name; @@ -95,9 +108,13 @@ function run_one_benchmark(arg, iters) { try { for (var x = 0; x < benchmarks.length ; x++) { + //do warmup run + //reset random number generator needed as of octane 9 before each run + BenchmarkSuite.ResetRNG(); benchmarks[x].Setup(); } - print_verbose("Running '" + arg.file + "' for " + iters + " iterations of no less than " + min_time + " seconds (" + runtime + ")"); + BenchmarkSuite.ResetRNG(); + print_verbose(arg, "running '" + arg.name + "' for " + iters + " iterations of no less than " + min_time + " seconds (" + runtime + ")"); var scores = []; @@ -112,6 +129,9 @@ function run_one_benchmark(arg, iters) { do { for (var i = 0; i < len; i++) { benchmarks[i].run(); + //important - no timing here like elapsed = new Date() - start, as in the + //original harness. This will make timing very non-deterministic. + //NOTHING else must live in this loop } ops += len; elapsed = new Date - start; @@ -120,7 +140,7 @@ function run_one_benchmark(arg, iters) { var score = ops / elapsed * 1000 * 60; scores.push(score); var name = it == 0 ? "warmup" : "iteration " + it; - print_verbose("[" + arg.file + "] " + name + " finished " + score.toFixed(0) + " ops/minute"); + print_verbose(arg, name + " finished " + score.toFixed(0) + " ops/minute"); } for (var x = 0; x < benchmarks.length ; x++) { @@ -140,20 +160,20 @@ function run_one_benchmark(arg, iters) { scores = [0]; } - var res = "[" + arg.file + "] " + mean_score.toFixed(0); + var res = mean_score.toFixed(0); if (verbose) { res += " ops/minute (" + min_score.toFixed(0) + "-" + max_score.toFixed(0) + "), warmup=" + scores[0].toFixed(0); } - print_always(res); + print_always(arg, res); } -function print_always(x) { - print(x); +function print_always(arg, x) { + print("[" + arg.name + "] " + x); } -function print_verbose(x) { +function print_verbose(arg, x) { if (verbose) { - print(x); + print_always(arg, x) } } @@ -209,7 +229,7 @@ for (var i = 0; i < args.length; i++) { } else { var found = false; for (j in tests) { - if (tests[j].file === arg) { + if (tests[j].name === arg) { tests_found.push(tests[j]); found = true; break; @@ -221,7 +241,7 @@ for (var i = 0; i < args.length; i++) { if (j != 0) { str += ", "; } - str += "'" + tests[j].file + "'"; + str += "'" + tests[j].name + "'"; } throw str; } diff --git a/langtools/test/tools/doclint/tool/AAA.java b/nashorn/test/script/markdown.js similarity index 76% rename from langtools/test/tools/doclint/tool/AAA.java rename to nashorn/test/script/markdown.js index 3880733edc9..c2ba57c9b25 100644 --- a/langtools/test/tools/doclint/tool/AAA.java +++ b/nashorn/test/script/markdown.js @@ -1,35 +1,38 @@ /* * Copyright (c) 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. */ /** - * @test - * @bug 8006728 - * @summary temporarily workaround jtreg problems for doclint tests in othervm + * Base library for Showdown markdown engine Nashorn testing. + * @subtest + * + * */ -// dummy test/class to be compiled before other tests in this directory -// see JDK-8006730 -public class AAA { - public static void main(String... args) { } +load(__DIR__ + "external/showdown/showdown.js"); +var shdwn = Showdown; +var window = { + Showdown: shdwn } +load(__DIR__ + "external/showdown/table.js"); +var converter = new Showdown.converter({extensions: ['table']}); diff --git a/langtools/test/tools/javac/Capture.java b/nashorn/test/script/markdown/anchors-by-reference.js similarity index 61% rename from langtools/test/tools/javac/Capture.java rename to nashorn/test/script/markdown/anchors-by-reference.js index e2baa883e5e..ea284fcd655 100644 --- a/langtools/test/tools/javac/Capture.java +++ b/nashorn/test/script/markdown/anchors-by-reference.js @@ -1,46 +1,33 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * 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. */ -/* - * @test - * @bug 4441338 4994508 - * @summary Captured variable synthetic parameters should be passed before explicit params. - * @author gafter +/** + * Test for Showdown markdown parser work with Nashorn. * - * @compile -source 1.4 -target 1.4 Capture.java - * @run main Capture + * @test + * @run */ -public class Capture { - final int k; - Capture(int n) { - k = n; - } - public static void main(String args[]) { - final int j; - int k1 = new Capture(2 + (j=3)){ - int get () {return k+j;} - }.get(); - if (k1 != 8) throw new Error("k1 = " + k1); - } -} +var input = "\nThis is [an example][id] reference-style link.\nThis is [another] [foo] reference-style link.\nThis is [a third][bar] reference-style link.\nThis is [a fourth][4] reference-style link.\n\n [id]: http://example.com/ \"Optional Title Here\"\n [foo]: http://example.com/ (Optional Title Here)\n [bar]: http://example.com/ (Optional Title Here)\n [4]: <http://example.com/>\n \"Optional Title Here\""; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/anchors-by-reference.js.EXPECTED b/nashorn/test/script/markdown/anchors-by-reference.js.EXPECTED new file mode 100644 index 00000000000..6115d50e302 --- /dev/null +++ b/nashorn/test/script/markdown/anchors-by-reference.js.EXPECTED @@ -0,0 +1,4 @@ +<p>This is <a href="http://example.com/" title="Optional Title Here">an example</a> reference-style link. +This is <a href="http://example.com/" title="Optional Title Here">another</a> reference-style link. +This is <a href="http://example.com/" title="Optional Title Here">a third</a> reference-style link. +This is <a href="http://example.com/" title="Optional Title Here">a fourth</a> reference-style link.</p> diff --git a/nashorn/test/script/markdown/automatic-anchors.js b/nashorn/test/script/markdown/automatic-anchors.js new file mode 100644 index 00000000000..d34ce77f317 --- /dev/null +++ b/nashorn/test/script/markdown/automatic-anchors.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n<http://example.com/>"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/automatic-anchors.js.EXPECTED b/nashorn/test/script/markdown/automatic-anchors.js.EXPECTED new file mode 100644 index 00000000000..6de71a9d275 --- /dev/null +++ b/nashorn/test/script/markdown/automatic-anchors.js.EXPECTED @@ -0,0 +1 @@ +<p><a href="http://example.com/">http://example.com/</a></p> diff --git a/nashorn/test/script/markdown/blockquote-nested-markdown.js b/nashorn/test/script/markdown/blockquote-nested-markdown.js new file mode 100644 index 00000000000..818ea0f32dc --- /dev/null +++ b/nashorn/test/script/markdown/blockquote-nested-markdown.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "> ## This is a header.\n>\n> 1. This is the first list item.\n> 2. This is the second list item.\n>\n> Here's some example code:\n>\n> return shell_exec(\"echo $input | $markdown_script\");"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/blockquote-nested-markdown.js.EXPECTED b/nashorn/test/script/markdown/blockquote-nested-markdown.js.EXPECTED new file mode 100644 index 00000000000..b32199cead1 --- /dev/null +++ b/nashorn/test/script/markdown/blockquote-nested-markdown.js.EXPECTED @@ -0,0 +1,13 @@ +<blockquote> + <h2 id="thisisaheader">This is a header.</h2> + + <ol> + <li>This is the first list item.</li> + <li>This is the second list item.</li> + </ol> + + <p>Here's some example code:</p> + +<pre><code>return shell_exec("echo $input | $markdown_script"); +</code></pre> +</blockquote> diff --git a/nashorn/test/script/markdown/blockquote.js b/nashorn/test/script/markdown/blockquote.js new file mode 100644 index 00000000000..7167a911a05 --- /dev/null +++ b/nashorn/test/script/markdown/blockquote.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = " \n > This is a multi line blockquote test\n >\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/blockquote.js.EXPECTED b/nashorn/test/script/markdown/blockquote.js.EXPECTED new file mode 100644 index 00000000000..c4956bbe5cf --- /dev/null +++ b/nashorn/test/script/markdown/blockquote.js.EXPECTED @@ -0,0 +1,5 @@ +<blockquote> + <p>This is a multi line blockquote test</p> + + <p>With more than one line.</p> +</blockquote> diff --git a/nashorn/test/script/markdown/code-block-html-escape.js b/nashorn/test/script/markdown/code-block-html-escape.js new file mode 100644 index 00000000000..dff9329f38f --- /dev/null +++ b/nashorn/test/script/markdown/code-block-html-escape.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is some HTML:\n\n <h1>Heading</h1>"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/code-block-html-escape.js.EXPECTED b/nashorn/test/script/markdown/code-block-html-escape.js.EXPECTED new file mode 100644 index 00000000000..028f874db70 --- /dev/null +++ b/nashorn/test/script/markdown/code-block-html-escape.js.EXPECTED @@ -0,0 +1,4 @@ +<p>This is some HTML:</p> + +<pre><code><h1>Heading</h1> +</code></pre> diff --git a/nashorn/test/script/markdown/code-block.js b/nashorn/test/script/markdown/code-block.js new file mode 100644 index 00000000000..e4c7413aaf3 --- /dev/null +++ b/nashorn/test/script/markdown/code-block.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is a normal paragraph:\n\n This is a code block."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/code-block.js.EXPECTED b/nashorn/test/script/markdown/code-block.js.EXPECTED new file mode 100644 index 00000000000..3e56099735f --- /dev/null +++ b/nashorn/test/script/markdown/code-block.js.EXPECTED @@ -0,0 +1,4 @@ +<p>This is a normal paragraph:</p> + +<pre><code>This is a code block. +</code></pre> diff --git a/nashorn/test/script/markdown/doubline-list.js b/nashorn/test/script/markdown/doubline-list.js new file mode 100644 index 00000000000..4a5736c9472 --- /dev/null +++ b/nashorn/test/script/markdown/doubline-list.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n * Bird\n\n * Magic"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/doubline-list.js.EXPECTED b/nashorn/test/script/markdown/doubline-list.js.EXPECTED new file mode 100644 index 00000000000..1065a44547e --- /dev/null +++ b/nashorn/test/script/markdown/doubline-list.js.EXPECTED @@ -0,0 +1,4 @@ +<ul> +<li><p>Bird</p></li> +<li><p>Magic</p></li> +</ul> diff --git a/nashorn/test/script/markdown/emphasis.js b/nashorn/test/script/markdown/emphasis.js new file mode 100644 index 00000000000..b9db46cdda4 --- /dev/null +++ b/nashorn/test/script/markdown/emphasis.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n*important*\n\n_important_\n\nthis mid*important*sentence"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/emphasis.js.EXPECTED b/nashorn/test/script/markdown/emphasis.js.EXPECTED new file mode 100644 index 00000000000..a1fda4ab651 --- /dev/null +++ b/nashorn/test/script/markdown/emphasis.js.EXPECTED @@ -0,0 +1,5 @@ +<p><em>important</em></p> + +<p><em>important</em></p> + +<p>this mid<em>important</em>sentence</p> diff --git a/nashorn/test/script/markdown/escaped-number-period.js b/nashorn/test/script/markdown/escaped-number-period.js new file mode 100644 index 00000000000..5f477449af1 --- /dev/null +++ b/nashorn/test/script/markdown/escaped-number-period.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "It happened in 1986\. What a great season."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/escaped-number-period.js.EXPECTED b/nashorn/test/script/markdown/escaped-number-period.js.EXPECTED new file mode 100644 index 00000000000..0ea83bac1bd --- /dev/null +++ b/nashorn/test/script/markdown/escaped-number-period.js.EXPECTED @@ -0,0 +1 @@ +<p>It happened in 1986. What a great season.</p> diff --git a/nashorn/test/script/markdown/escaping.js b/nashorn/test/script/markdown/escaping.js new file mode 100644 index 00000000000..077df7ecfcb --- /dev/null +++ b/nashorn/test/script/markdown/escaping.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThese should all be escaped:\n\n\\\n\n\`\n\n\*\n\n\_\n\n\{\n\n\}\n\n\[\n\n\]\n\n\(\n\n\)\n\n\#\n\n\+\n\n\-\n\n\.\n\n\!"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/escaping.js.EXPECTED b/nashorn/test/script/markdown/escaping.js.EXPECTED new file mode 100644 index 00000000000..1ac6a291997 --- /dev/null +++ b/nashorn/test/script/markdown/escaping.js.EXPECTED @@ -0,0 +1,31 @@ +<p>These should all be escaped:</p> + +<p>\</p> + +<p>`</p> + +<p>*</p> + +<p>_</p> + +<p>{</p> + +<p>}</p> + +<p>[</p> + +<p>]</p> + +<p>(</p> + +<p>)</p> + +<p>#</p> + +<p>+</p> + +<p>-</p> + +<p>.</p> + +<p>!</p> diff --git a/nashorn/test/script/markdown/github-style-at-start.js b/nashorn/test/script/markdown/github-style-at-start.js new file mode 100644 index 00000000000..0a99bec2b51 --- /dev/null +++ b/nashorn/test/script/markdown/github-style-at-start.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "```\nfunction MyFunc(a) {\n // ...\n}\n```\n\nThat is some code!"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/github-style-at-start.js.EXPECTED b/nashorn/test/script/markdown/github-style-at-start.js.EXPECTED new file mode 100644 index 00000000000..4f119a7697a --- /dev/null +++ b/nashorn/test/script/markdown/github-style-at-start.js.EXPECTED @@ -0,0 +1,6 @@ +<pre><code>function MyFunc(a) { + // ... +} +</code></pre> + +<p>That is some code!</p> diff --git a/nashorn/test/script/markdown/github-style-codeblock.js b/nashorn/test/script/markdown/github-style-codeblock.js new file mode 100644 index 00000000000..32341892605 --- /dev/null +++ b/nashorn/test/script/markdown/github-style-codeblock.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nDefine a function in javascript:\n\n```\nfunction MyFunc(a) {\n var s = '`';\n}\n```\n\nAnd some HTML\n\n```html\n<div>HTML!</div>\n```"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/github-style-codeblock.js.EXPECTED b/nashorn/test/script/markdown/github-style-codeblock.js.EXPECTED new file mode 100644 index 00000000000..5daca2f94ae --- /dev/null +++ b/nashorn/test/script/markdown/github-style-codeblock.js.EXPECTED @@ -0,0 +1,11 @@ +<p>Define a function in javascript:</p> + +<pre><code>function MyFunc(a) { + var s = '`'; +} +</code></pre> + +<p>And some HTML</p> + +<pre><code class="html"><div>HTML!</div> +</code></pre> diff --git a/nashorn/test/script/markdown/github-style-linebreaks.js b/nashorn/test/script/markdown/github-style-linebreaks.js new file mode 100644 index 00000000000..c912bee06f9 --- /dev/null +++ b/nashorn/test/script/markdown/github-style-linebreaks.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "```\ncode can go here\nthis is rendered on a second line\n```"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/github-style-linebreaks.js.EXPECTED b/nashorn/test/script/markdown/github-style-linebreaks.js.EXPECTED new file mode 100644 index 00000000000..276dbf03cb8 --- /dev/null +++ b/nashorn/test/script/markdown/github-style-linebreaks.js.EXPECTED @@ -0,0 +1,3 @@ +<pre><code>code can go here +this is rendered on a second line +</code></pre> diff --git a/nashorn/test/script/markdown/h1-with-double-hash.js b/nashorn/test/script/markdown/h1-with-double-hash.js new file mode 100644 index 00000000000..bd965702922 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-double-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "# This is an H1 #"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h1-with-double-hash.js.EXPECTED b/nashorn/test/script/markdown/h1-with-double-hash.js.EXPECTED new file mode 100644 index 00000000000..ab5b5555dd5 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-double-hash.js.EXPECTED @@ -0,0 +1 @@ +<h1 id="thisisanh1">This is an H1</h1> diff --git a/nashorn/test/script/markdown/h1-with-equals.js b/nashorn/test/script/markdown/h1-with-equals.js new file mode 100644 index 00000000000..54ee9628f50 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-equals.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "This is an H1\n============="; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h1-with-equals.js.EXPECTED b/nashorn/test/script/markdown/h1-with-equals.js.EXPECTED new file mode 100644 index 00000000000..ab5b5555dd5 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-equals.js.EXPECTED @@ -0,0 +1 @@ +<h1 id="thisisanh1">This is an H1</h1> diff --git a/nashorn/test/script/markdown/h1-with-single-hash.js b/nashorn/test/script/markdown/h1-with-single-hash.js new file mode 100644 index 00000000000..3559c22f615 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "# This is an H1"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h1-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h1-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..ab5b5555dd5 --- /dev/null +++ b/nashorn/test/script/markdown/h1-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h1 id="thisisanh1">This is an H1</h1> diff --git a/nashorn/test/script/markdown/h2-with-dashes.js b/nashorn/test/script/markdown/h2-with-dashes.js new file mode 100644 index 00000000000..016502f60d4 --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-dashes.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "This is an H2\n-------------"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED b/nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED new file mode 100644 index 00000000000..375a0d06ba8 --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-dashes.js.EXPECTED @@ -0,0 +1 @@ +<h2 id="thisisanh2">This is an H2</h2> diff --git a/nashorn/test/script/markdown/h2-with-double-hash.js b/nashorn/test/script/markdown/h2-with-double-hash.js new file mode 100644 index 00000000000..246c1701f5d --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-double-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "## This is an H2 ##"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h2-with-double-hash.js.EXPECTED b/nashorn/test/script/markdown/h2-with-double-hash.js.EXPECTED new file mode 100644 index 00000000000..375a0d06ba8 --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-double-hash.js.EXPECTED @@ -0,0 +1 @@ +<h2 id="thisisanh2">This is an H2</h2> diff --git a/nashorn/test/script/markdown/h2-with-single-hash.js b/nashorn/test/script/markdown/h2-with-single-hash.js new file mode 100644 index 00000000000..d1f7f000c44 --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "## This is an H2"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h2-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h2-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..375a0d06ba8 --- /dev/null +++ b/nashorn/test/script/markdown/h2-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h2 id="thisisanh2">This is an H2</h2> diff --git a/nashorn/test/script/markdown/h3-with-double-hash.js b/nashorn/test/script/markdown/h3-with-double-hash.js new file mode 100644 index 00000000000..e60e00988cb --- /dev/null +++ b/nashorn/test/script/markdown/h3-with-double-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "### This is an H3 ###"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h3-with-double-hash.js.EXPECTED b/nashorn/test/script/markdown/h3-with-double-hash.js.EXPECTED new file mode 100644 index 00000000000..13f8c9e7a59 --- /dev/null +++ b/nashorn/test/script/markdown/h3-with-double-hash.js.EXPECTED @@ -0,0 +1 @@ +<h3 id="thisisanh3">This is an H3</h3> diff --git a/nashorn/test/script/markdown/h3-with-single-hash.js b/nashorn/test/script/markdown/h3-with-single-hash.js new file mode 100644 index 00000000000..6af497079d0 --- /dev/null +++ b/nashorn/test/script/markdown/h3-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "### This is an H3"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h3-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h3-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..13f8c9e7a59 --- /dev/null +++ b/nashorn/test/script/markdown/h3-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h3 id="thisisanh3">This is an H3</h3> diff --git a/nashorn/test/script/markdown/h4-with-single-hash.js b/nashorn/test/script/markdown/h4-with-single-hash.js new file mode 100644 index 00000000000..01bc08e0a58 --- /dev/null +++ b/nashorn/test/script/markdown/h4-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "#### This is an H4"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h4-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h4-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..165b4ef2f46 --- /dev/null +++ b/nashorn/test/script/markdown/h4-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h4 id="thisisanh4">This is an H4</h4> diff --git a/nashorn/test/script/markdown/h5-with-single-hash.js b/nashorn/test/script/markdown/h5-with-single-hash.js new file mode 100644 index 00000000000..5fe8638bf8b --- /dev/null +++ b/nashorn/test/script/markdown/h5-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "##### This is an H5"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h5-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h5-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..28eac14834e --- /dev/null +++ b/nashorn/test/script/markdown/h5-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h5 id="thisisanh5">This is an H5</h5> diff --git a/nashorn/test/script/markdown/h6-with-single-hash.js b/nashorn/test/script/markdown/h6-with-single-hash.js new file mode 100644 index 00000000000..b1f20f5c8fe --- /dev/null +++ b/nashorn/test/script/markdown/h6-with-single-hash.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "###### This is an H6"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/h6-with-single-hash.js.EXPECTED b/nashorn/test/script/markdown/h6-with-single-hash.js.EXPECTED new file mode 100644 index 00000000000..47574cc5b92 --- /dev/null +++ b/nashorn/test/script/markdown/h6-with-single-hash.js.EXPECTED @@ -0,0 +1 @@ +<h6 id="thisisanh6">This is an H6</h6> diff --git a/nashorn/test/script/markdown/horizontal-rules.js b/nashorn/test/script/markdown/horizontal-rules.js new file mode 100644 index 00000000000..af2cabb91a2 --- /dev/null +++ b/nashorn/test/script/markdown/horizontal-rules.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n* * *\n\n***\n\n*****\n\n- - -\n\n---------------------------------------\n"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/horizontal-rules.js.EXPECTED b/nashorn/test/script/markdown/horizontal-rules.js.EXPECTED new file mode 100644 index 00000000000..aaef23eb8bb --- /dev/null +++ b/nashorn/test/script/markdown/horizontal-rules.js.EXPECTED @@ -0,0 +1,9 @@ +<hr /> + +<hr /> + +<hr /> + +<hr /> + +<hr /> diff --git a/nashorn/test/script/markdown/html5-strutural-tags.js b/nashorn/test/script/markdown/html5-strutural-tags.js new file mode 100644 index 00000000000..3bc4aad54bf --- /dev/null +++ b/nashorn/test/script/markdown/html5-strutural-tags.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThese HTML5 tags should pass through just fine.\n\n<section>hello</section>\n<header>head</header>\n<footer>footsies</footer>\n<nav>navigation</nav>\n<article>read me</article>\n<aside>ignore me</aside>\n<article>read\nme</article>\n<aside>\nignore me\n</aside>\n\nthe end"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/html5-strutural-tags.js.EXPECTED b/nashorn/test/script/markdown/html5-strutural-tags.js.EXPECTED new file mode 100644 index 00000000000..528731f56ef --- /dev/null +++ b/nashorn/test/script/markdown/html5-strutural-tags.js.EXPECTED @@ -0,0 +1,22 @@ +<p>These HTML5 tags should pass through just fine.</p> + +<section>hello</section> + +<header>head</header> + +<footer>footsies</footer> + +<nav>navigation</nav> + +<article>read me</article> + +<aside>ignore me</aside> + +<article>read +me</article> + +<aside> +ignore me +</aside> + +<p>the end</p> diff --git a/nashorn/test/script/markdown/images.js b/nashorn/test/script/markdown/images.js new file mode 100644 index 00000000000..da2a16a29ff --- /dev/null +++ b/nashorn/test/script/markdown/images.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n![Alt text](/path/to/img.jpg)\n\n![Alt text](/path/to/img.jpg \"Optional title\")\n\n![Alt text][id]\n\n [id]: url/to/image \"Optional title attribute\""; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/images.js.EXPECTED b/nashorn/test/script/markdown/images.js.EXPECTED new file mode 100644 index 00000000000..7df585521d9 --- /dev/null +++ b/nashorn/test/script/markdown/images.js.EXPECTED @@ -0,0 +1,5 @@ +<p><img src="/path/to/img.jpg" alt="Alt text" title="" /></p> + +<p><img src="/path/to/img.jpg" alt="Alt text" title="Optional title" /></p> + +<p><img src="url/to/image" alt="Alt text" title="Optional title attribute" /></p> diff --git a/nashorn/test/script/markdown/implicit-anchors.js b/nashorn/test/script/markdown/implicit-anchors.js new file mode 100644 index 00000000000..ba627fb9cb4 --- /dev/null +++ b/nashorn/test/script/markdown/implicit-anchors.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nSearch the web at [Google][] or [Daring Fireball][].\n\n [Google]: http://google.com/\n [Daring Fireball]: http://daringfireball.net/"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/implicit-anchors.js.EXPECTED b/nashorn/test/script/markdown/implicit-anchors.js.EXPECTED new file mode 100644 index 00000000000..01e62d9af84 --- /dev/null +++ b/nashorn/test/script/markdown/implicit-anchors.js.EXPECTED @@ -0,0 +1 @@ +<p>Search the web at <a href="http://google.com/">Google</a> or <a href="http://daringfireball.net/">Daring Fireball</a>.</p> diff --git a/nashorn/test/script/markdown/inline-anchors.js b/nashorn/test/script/markdown/inline-anchors.js new file mode 100644 index 00000000000..90fe181271c --- /dev/null +++ b/nashorn/test/script/markdown/inline-anchors.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThis is [an example](http://example.com/ \"Title\") inline link.\n\n[This link](http://example.net/) has no title attribute."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/inline-anchors.js.EXPECTED b/nashorn/test/script/markdown/inline-anchors.js.EXPECTED new file mode 100644 index 00000000000..52f90ed319d --- /dev/null +++ b/nashorn/test/script/markdown/inline-anchors.js.EXPECTED @@ -0,0 +1,3 @@ +<p>This is <a href="http://example.com/" title="Title">an example</a> inline link.</p> + +<p><a href="http://example.net/">This link</a> has no title attribute.</p> diff --git a/nashorn/test/script/markdown/inline-code.js b/nashorn/test/script/markdown/inline-code.js new file mode 100644 index 00000000000..6ab4f4f657e --- /dev/null +++ b/nashorn/test/script/markdown/inline-code.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nCreate a new `function`.\n\nUse the backtick in MySQL syntax ``SELECT `column` FROM whatever``.\n\nA single backtick in a code span: `` ` ``\n\nA backtick-delimited string in a code span: `` `foo` ``\n\nPlease don't use any `<blink>` tags.\n\n`—` is the decimal-encoded equivalent of `—`."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/inline-code.js.EXPECTED b/nashorn/test/script/markdown/inline-code.js.EXPECTED new file mode 100644 index 00000000000..ebb7fdc0dca --- /dev/null +++ b/nashorn/test/script/markdown/inline-code.js.EXPECTED @@ -0,0 +1,11 @@ +<p>Create a new <code>function</code>.</p> + +<p>Use the backtick in MySQL syntax <code>SELECT `column` FROM whatever</code>.</p> + +<p>A single backtick in a code span: <code>`</code></p> + +<p>A backtick-delimited string in a code span: <code>`foo`</code></p> + +<p>Please don't use any <code><blink></code> tags.</p> + +<p><code>&#8212;</code> is the decimal-encoded equivalent of <code>&mdash;</code>.</p> diff --git a/nashorn/test/script/markdown/inline-style-tag.js b/nashorn/test/script/markdown/inline-style-tag.js new file mode 100644 index 00000000000..a97ba64a5e5 --- /dev/null +++ b/nashorn/test/script/markdown/inline-style-tag.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n<style>\n p { line-height: 20px; }\n</style>\n\nAn exciting sentence."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/inline-style-tag.js.EXPECTED b/nashorn/test/script/markdown/inline-style-tag.js.EXPECTED new file mode 100644 index 00000000000..1006aa8fac4 --- /dev/null +++ b/nashorn/test/script/markdown/inline-style-tag.js.EXPECTED @@ -0,0 +1,5 @@ +<style> + p { line-height: 20px; } +</style> + +<p>An exciting sentence.</p> diff --git a/nashorn/test/script/markdown/lazy-blockquote.js b/nashorn/test/script/markdown/lazy-blockquote.js new file mode 100644 index 00000000000..274121658f2 --- /dev/null +++ b/nashorn/test/script/markdown/lazy-blockquote.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n > This is a multi line blockquote test\n\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/lazy-blockquote.js.EXPECTED b/nashorn/test/script/markdown/lazy-blockquote.js.EXPECTED new file mode 100644 index 00000000000..c4956bbe5cf --- /dev/null +++ b/nashorn/test/script/markdown/lazy-blockquote.js.EXPECTED @@ -0,0 +1,5 @@ +<blockquote> + <p>This is a multi line blockquote test</p> + + <p>With more than one line.</p> +</blockquote> diff --git a/nashorn/test/script/markdown/list-with-blockquote.js b/nashorn/test/script/markdown/list-with-blockquote.js new file mode 100644 index 00000000000..fa0044e616a --- /dev/null +++ b/nashorn/test/script/markdown/list-with-blockquote.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "* A list item with a blockquote:\n\n > This is a blockquote\n > inside a list item."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/list-with-blockquote.js.EXPECTED b/nashorn/test/script/markdown/list-with-blockquote.js.EXPECTED new file mode 100644 index 00000000000..7f18f5c11aa --- /dev/null +++ b/nashorn/test/script/markdown/list-with-blockquote.js.EXPECTED @@ -0,0 +1,8 @@ +<ul> +<li><p>A list item with a blockquote:</p> + +<blockquote> + <p>This is a blockquote + inside a list item.</p> +</blockquote></li> +</ul> diff --git a/nashorn/test/script/markdown/list-with-code.js b/nashorn/test/script/markdown/list-with-code.js new file mode 100644 index 00000000000..61cc1e9befb --- /dev/null +++ b/nashorn/test/script/markdown/list-with-code.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "* A list item with code:\n\n alert('Hello world!');"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/list-with-code.js.EXPECTED b/nashorn/test/script/markdown/list-with-code.js.EXPECTED new file mode 100644 index 00000000000..566fdae96a8 --- /dev/null +++ b/nashorn/test/script/markdown/list-with-code.js.EXPECTED @@ -0,0 +1,6 @@ +<ul> +<li><p>A list item with code:</p> + +<pre><code>alert('Hello world!'); +</code></pre></li> +</ul> diff --git a/nashorn/test/script/markdown/multi-paragraph-list.js b/nashorn/test/script/markdown/multi-paragraph-list.js new file mode 100644 index 00000000000..23ba37319e0 --- /dev/null +++ b/nashorn/test/script/markdown/multi-paragraph-list.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. This is a major bullet point.\n\n That contains multiple paragraphs.\n\n 2. And another line"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/multi-paragraph-list.js.EXPECTED b/nashorn/test/script/markdown/multi-paragraph-list.js.EXPECTED new file mode 100644 index 00000000000..3d751c503f5 --- /dev/null +++ b/nashorn/test/script/markdown/multi-paragraph-list.js.EXPECTED @@ -0,0 +1,6 @@ +<ol> +<li><p>This is a major bullet point.</p> + +<p>That contains multiple paragraphs.</p></li> +<li><p>And another line</p></li> +</ol> diff --git a/nashorn/test/script/markdown/multiline-unordered-list.js b/nashorn/test/script/markdown/multiline-unordered-list.js new file mode 100644 index 00000000000..bb1c2337e4a --- /dev/null +++ b/nashorn/test/script/markdown/multiline-unordered-list.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n - This line spans\n more than one line and is lazy\n - Similar to this line"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/multiline-unordered-list.js.EXPECTED b/nashorn/test/script/markdown/multiline-unordered-list.js.EXPECTED new file mode 100644 index 00000000000..fb2a58e0e7d --- /dev/null +++ b/nashorn/test/script/markdown/multiline-unordered-list.js.EXPECTED @@ -0,0 +1,5 @@ +<ul> +<li>This line spans +more than one line and is lazy</li> +<li>Similar to this line</li> +</ul> diff --git a/nashorn/test/script/markdown/nested-blockquote.js b/nashorn/test/script/markdown/nested-blockquote.js new file mode 100644 index 00000000000..e447494a58e --- /dev/null +++ b/nashorn/test/script/markdown/nested-blockquote.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n > This is a multi line blockquote test\n >\n > > And nesting!\n >\n > With more than one line."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/nested-blockquote.js.EXPECTED b/nashorn/test/script/markdown/nested-blockquote.js.EXPECTED new file mode 100644 index 00000000000..0b004934473 --- /dev/null +++ b/nashorn/test/script/markdown/nested-blockquote.js.EXPECTED @@ -0,0 +1,9 @@ +<blockquote> + <p>This is a multi line blockquote test</p> + + <blockquote> + <p>And nesting!</p> + </blockquote> + + <p>With more than one line.</p> +</blockquote> diff --git a/nashorn/test/script/markdown/ordered-list-same-number.js b/nashorn/test/script/markdown/ordered-list-same-number.js new file mode 100644 index 00000000000..00d05d2ae2a --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list-same-number.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. Red\n 1. Green\n 1. Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/ordered-list-same-number.js.EXPECTED b/nashorn/test/script/markdown/ordered-list-same-number.js.EXPECTED new file mode 100644 index 00000000000..b1abb536d96 --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list-same-number.js.EXPECTED @@ -0,0 +1,5 @@ +<ol> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ol> diff --git a/nashorn/test/script/markdown/ordered-list-wrong-numbers.js b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js new file mode 100644 index 00000000000..2592020bbee --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 8. Red\n 1. Green\n 3. Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/ordered-list-wrong-numbers.js.EXPECTED b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js.EXPECTED new file mode 100644 index 00000000000..b1abb536d96 --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list-wrong-numbers.js.EXPECTED @@ -0,0 +1,5 @@ +<ol> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ol> diff --git a/nashorn/test/script/markdown/ordered-list.js b/nashorn/test/script/markdown/ordered-list.js new file mode 100644 index 00000000000..d79529f1c06 --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n 1. Red\n 2. Green\n 3. Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/ordered-list.js.EXPECTED b/nashorn/test/script/markdown/ordered-list.js.EXPECTED new file mode 100644 index 00000000000..b1abb536d96 --- /dev/null +++ b/nashorn/test/script/markdown/ordered-list.js.EXPECTED @@ -0,0 +1,5 @@ +<ol> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ol> diff --git a/nashorn/test/script/markdown/relative-anchors.js b/nashorn/test/script/markdown/relative-anchors.js new file mode 100644 index 00000000000..7bfe01a6675 --- /dev/null +++ b/nashorn/test/script/markdown/relative-anchors.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nSee my [About](/about/) page for details."; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/relative-anchors.js.EXPECTED b/nashorn/test/script/markdown/relative-anchors.js.EXPECTED new file mode 100644 index 00000000000..6db73dc48c8 --- /dev/null +++ b/nashorn/test/script/markdown/relative-anchors.js.EXPECTED @@ -0,0 +1 @@ +<p>See my <a href="/about/">About</a> page for details.</p> diff --git a/nashorn/test/script/markdown/simple-paragraph.js b/nashorn/test/script/markdown/simple-paragraph.js new file mode 100644 index 00000000000..218918b7de2 --- /dev/null +++ b/nashorn/test/script/markdown/simple-paragraph.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nHello, world!"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/simple-paragraph.js.EXPECTED b/nashorn/test/script/markdown/simple-paragraph.js.EXPECTED new file mode 100644 index 00000000000..7ce535433d8 --- /dev/null +++ b/nashorn/test/script/markdown/simple-paragraph.js.EXPECTED @@ -0,0 +1 @@ +<p>Hello, world!</p> diff --git a/nashorn/test/script/markdown/strong.js b/nashorn/test/script/markdown/strong.js new file mode 100644 index 00000000000..a1778726640 --- /dev/null +++ b/nashorn/test/script/markdown/strong.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n**important**\n\n__important__\n\nreally **freaking**strong"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/strong.js.EXPECTED b/nashorn/test/script/markdown/strong.js.EXPECTED new file mode 100644 index 00000000000..5bcc675613d --- /dev/null +++ b/nashorn/test/script/markdown/strong.js.EXPECTED @@ -0,0 +1,5 @@ +<p><strong>important</strong></p> + +<p><strong>important</strong></p> + +<p>really <strong>freaking</strong>strong</p> diff --git a/nashorn/test/script/markdown/table-basic.js b/nashorn/test/script/markdown/table-basic.js new file mode 100644 index 00000000000..f2b9a3742e5 --- /dev/null +++ b/nashorn/test/script/markdown/table-basic.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header |\n| ------------- | ------------- |\n| Row 1 Cell 1 | Row 1 Cell 2 |\n| Row 2 Cell 1 | Row 2 Cell 2 |\n"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/table-basic.js.EXPECTED b/nashorn/test/script/markdown/table-basic.js.EXPECTED new file mode 100644 index 00000000000..d909e65b45d --- /dev/null +++ b/nashorn/test/script/markdown/table-basic.js.EXPECTED @@ -0,0 +1,21 @@ +<table> +<thead> +<tr> +<th id="first_header" style="text-align:left;"> First Header </th> +<th id="second_header" style="text-align:left;"> Second Header </th> +</tr> +</thead> + +<tbody> +<tr> +<td style="text-align:left;"><p>Row 1 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 1 Cell 2 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 2 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 2 Cell 2 </p></td> +</tr> + +</tbody> +</table> diff --git a/nashorn/test/script/markdown/table-large.js b/nashorn/test/script/markdown/table-large.js new file mode 100644 index 00000000000..ad7554d06d4 --- /dev/null +++ b/nashorn/test/script/markdown/table-large.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header | Third Header | Fourth Header |\n| ------------- | ------------- | ------------ | ------------- |\n| Row 1 Cell 1 | Row 1 Cell 2 | Row 1 Cell 3 | Row 1 Cell 4 |\n| Row 2 Cell 1 | Row 2 Cell 2 | Row 2 Cell 3 | Row 2 Cell 4 |\n| Row 3 Cell 1 | Row 3 Cell 2 | Row 3 Cell 3 | Row 3 Cell 4 |\n| Row 4 Cell 1 | Row 4 Cell 2 | Row 4 Cell 3 | Row 4 Cell 4 |\n| Row 5 Cell 1 | Row 5 Cell 2 | Row 5 Cell 3 | Row 5 Cell 4 |\n"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/table-large.js.EXPECTED b/nashorn/test/script/markdown/table-large.js.EXPECTED new file mode 100644 index 00000000000..332bdab6e85 --- /dev/null +++ b/nashorn/test/script/markdown/table-large.js.EXPECTED @@ -0,0 +1,48 @@ +<table> +<thead> +<tr> +<th id="first_header" style="text-align:left;"> First Header </th> +<th id="second_header" style="text-align:left;"> Second Header </th> +<th id="third_header" style="text-align:left;"> Third Header </th> +<th id="fourth_header" style="text-align:left;"> Fourth Header </th> +</tr> +</thead> + +<tbody> +<tr> +<td style="text-align:left;"><p>Row 1 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 1 Cell 2 </p></td> +<td style="text-align:left;"><p>Row 1 Cell 3 </p></td> +<td style="text-align:left;"><p>Row 1 Cell 4 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 2 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 2 Cell 2 </p></td> +<td style="text-align:left;"><p>Row 2 Cell 3 </p></td> +<td style="text-align:left;"><p>Row 2 Cell 4 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 3 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 3 Cell 2 </p></td> +<td style="text-align:left;"><p>Row 3 Cell 3 </p></td> +<td style="text-align:left;"><p>Row 3 Cell 4 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 4 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 4 Cell 2 </p></td> +<td style="text-align:left;"><p>Row 4 Cell 3 </p></td> +<td style="text-align:left;"><p>Row 4 Cell 4 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 5 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 5 Cell 2 </p></td> +<td style="text-align:left;"><p>Row 5 Cell 3 </p></td> +<td style="text-align:left;"><p>Row 5 Cell 4 </p></td> +</tr> + +</tbody> +</table> diff --git a/nashorn/test/script/markdown/table-with-equals.js b/nashorn/test/script/markdown/table-with-equals.js new file mode 100644 index 00000000000..574223956d6 --- /dev/null +++ b/nashorn/test/script/markdown/table-with-equals.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "| First Header | Second Header |\n| ============= | ============= |\n| Row 1 Cell 1 | Row 1 Cell 2 |\n| Row 2 Cell 1 | Row 2 Cell 2 |\n"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/table-with-equals.js.EXPECTED b/nashorn/test/script/markdown/table-with-equals.js.EXPECTED new file mode 100644 index 00000000000..d909e65b45d --- /dev/null +++ b/nashorn/test/script/markdown/table-with-equals.js.EXPECTED @@ -0,0 +1,21 @@ +<table> +<thead> +<tr> +<th id="first_header" style="text-align:left;"> First Header </th> +<th id="second_header" style="text-align:left;"> Second Header </th> +</tr> +</thead> + +<tbody> +<tr> +<td style="text-align:left;"><p>Row 1 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 1 Cell 2 </p></td> +</tr> + +<tr> +<td style="text-align:left;"><p>Row 2 Cell 1 </p></td> +<td style="text-align:left;"><p>Row 2 Cell 2 </p></td> +</tr> + +</tbody> +</table> diff --git a/nashorn/test/script/markdown/unordered-list-asterisk.js b/nashorn/test/script/markdown/unordered-list-asterisk.js new file mode 100644 index 00000000000..8e2c01b10e5 --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-asterisk.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n * Red\n * Green\n * Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/unordered-list-asterisk.js.EXPECTED b/nashorn/test/script/markdown/unordered-list-asterisk.js.EXPECTED new file mode 100644 index 00000000000..b445990aede --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-asterisk.js.EXPECTED @@ -0,0 +1,5 @@ +<ul> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ul> diff --git a/nashorn/test/script/markdown/unordered-list-minus.js b/nashorn/test/script/markdown/unordered-list-minus.js new file mode 100644 index 00000000000..19bcbac7085 --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-minus.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n - Red\n - Green\n - Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/unordered-list-minus.js.EXPECTED b/nashorn/test/script/markdown/unordered-list-minus.js.EXPECTED new file mode 100644 index 00000000000..b445990aede --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-minus.js.EXPECTED @@ -0,0 +1,5 @@ +<ul> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ul> diff --git a/nashorn/test/script/markdown/unordered-list-plus.js b/nashorn/test/script/markdown/unordered-list-plus.js new file mode 100644 index 00000000000..55b4dfb8fa9 --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-plus.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\n + Red\n + Green\n + Blue"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/unordered-list-plus.js.EXPECTED b/nashorn/test/script/markdown/unordered-list-plus.js.EXPECTED new file mode 100644 index 00000000000..b445990aede --- /dev/null +++ b/nashorn/test/script/markdown/unordered-list-plus.js.EXPECTED @@ -0,0 +1,5 @@ +<ul> +<li>Red</li> +<li>Green</li> +<li>Blue</li> +</ul> diff --git a/nashorn/test/script/markdown/url-with-parenthesis.js b/nashorn/test/script/markdown/url-with-parenthesis.js new file mode 100644 index 00000000000..dc6ce740938 --- /dev/null +++ b/nashorn/test/script/markdown/url-with-parenthesis.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/** + * Test for Showdown markdown parser work with Nashorn. + * + * @test + * @run + */ + +var input = "\nThere's an [episode](http://en.memory-alpha.org/wiki/Darmok_(episode)) of Star Trek: The Next Generation"; +var output = converter.makeHtml(input); +print(output); diff --git a/nashorn/test/script/markdown/url-with-parenthesis.js.EXPECTED b/nashorn/test/script/markdown/url-with-parenthesis.js.EXPECTED new file mode 100644 index 00000000000..9e1e7cc9966 --- /dev/null +++ b/nashorn/test/script/markdown/url-with-parenthesis.js.EXPECTED @@ -0,0 +1 @@ +<p>There's an <a href="http://en.memory-alpha.org/wiki/Darmok_(episode)">episode</a> of Star Trek: The Next Generation</p> diff --git a/nashorn/test/script/sandbox/JDK-8031106.js b/nashorn/test/script/sandbox/JDK-8031106.js new file mode 100644 index 00000000000..d5d83f6927f --- /dev/null +++ b/nashorn/test/script/sandbox/JDK-8031106.js @@ -0,0 +1,39 @@ +/* + * 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 + * 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-8031106: Nashorn: IndexOutOfBoundsException in NashornCallSiteDescriptor.getNameToken() + * + * @test + * @run + */ + +var cl = new java.lang.Object().getClass(); +try { + cl["forName"]; + fail("Should have thrown exception!"); +} catch (e) { + if (! (e instanceof java.lang.SecurityException)) { + fail("SecurityException expected, got " + e); + } +} diff --git a/nashorn/test/script/trusted/JDK-8032060.js b/nashorn/test/script/trusted/JDK-8032060.js new file mode 100644 index 00000000000..8cb350cc238 --- /dev/null +++ b/nashorn/test/script/trusted/JDK-8032060.js @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/** + * JDK-8032060: PropertyMap of Error objects is not stable + * + * @test + * @option -Dnashorn.debug=true + * @fork + * @run + */ + +function checkMap(e1, e2) { + if (! Debug.identical(Debug.map(e1), Debug.map(e2))) { + fail("e1 and e2 have different maps"); + } + + var m1, m2; + + try { + throw e1 + } catch (e) { + m1 = Debug.map(e) + } + + try { + throw e2 + } catch (e) { + m2 = Debug.map(e) + } + + if (! Debug.identical(m1, m2)) { + fail("e1 and e2 have different maps after being thrown"); + } +} + +checkMap(new Error(), new Error()); +checkMap(new EvalError(), new EvalError()); +checkMap(new RangeError(), new RangeError()); +checkMap(new ReferenceError(), new ReferenceError()); +checkMap(new SyntaxError(), new SyntaxError()); +checkMap(new TypeError(), new TypeError()); +checkMap(new URIError(), new URIError()); + +// now try with message param +checkMap(new Error("x"), new Error("y")); +checkMap(new EvalError("x"), new EvalError("y")); +checkMap(new RangeError("x"), new RangeError("y")); +checkMap(new ReferenceError("x"), new ReferenceError("y")); +checkMap(new SyntaxError("x"), new SyntaxError("y")); +checkMap(new TypeError("x"), new TypeError("y")); +checkMap(new URIError("x"), new URIError("y")); diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java index fad3f3722b1..a6722f571f5 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java @@ -26,6 +26,7 @@ package jdk.nashorn.api.scripting; import java.util.Objects; +import java.util.function.Function; import javax.script.Invocable; import javax.script.ScriptContext; import javax.script.ScriptEngine; @@ -522,4 +523,16 @@ public class InvocableTest { Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]"); Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]"); } + + @Test + @SuppressWarnings("unchecked") + public void defaultMethodTest() throws ScriptException { + final ScriptEngineManager m = new ScriptEngineManager(); + final ScriptEngine e = m.getEngineByName("nashorn"); + final Invocable inv = (Invocable) e; + + Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})"); + Function<String, String> func = inv.getInterface(obj, Function.class); + assertEquals(func.apply("hello"), "HELLO"); + } }