This commit is contained in:
Vladimir Ivanov 2015-03-02 07:20:09 -08:00
commit b4b2912109
219 changed files with 8892 additions and 5506 deletions

View File

@ -294,3 +294,4 @@ b2f9702efbe95527ea3a991474fda23987ff1c5c jdk9-b48
5b8db585a33c3cc48e70e688ceee57dd9271dc5d jdk9-b49
1550b2f6b63d1411fa84dc7bbc6f04809aedb43f jdk9-b50
6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51
d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52

View File

@ -294,3 +294,4 @@ b6cca3e6175a69f39e5799b7349ddb0176630291 jdk9-b47
d91ed1951b948210590ce1394bea5515357246ba jdk9-b49
d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50
6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51
1822e59f17121b09e7899cf338cfb6e37fe5fceb jdk9-b52

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -77,26 +77,30 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH],
# $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_PATH],
[
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_PATH_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_PATH_MSYS($1)
else
# We're on a unix platform. Hooray! :)
path="[$]$1"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
AC_MSG_ERROR([Spaces are not allowed in this path.])
fi
# Only process if variable expands to non-empty
if test "x[$]$1" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_PATH_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_PATH_MSYS($1)
else
# We're on a unix platform. Hooray! :)
path="[$]$1"
has_space=`$ECHO "$path" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.])
AC_MSG_ERROR([Spaces are not allowed in this path.])
fi
# Use eval to expand a potential ~
eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
fi
# Use eval to expand a potential ~
eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
fi
$1="`cd "$path"; $THEPWDCMD -L`"
$1="`cd "$path"; $THEPWDCMD -L`"
fi
fi
])
@ -113,57 +117,61 @@ AC_DEFUN([BASIC_FIXUP_PATH],
# $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
[
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_EXECUTABLE_MSYS($1)
else
# We're on a unix platform. Hooray! :)
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
# Cannot rely on the command "which" here since it doesn't always work.
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test -z "$is_absolute_path"; then
# Path to executable is not absolute. Find it.
IFS_save="$IFS"
IFS=:
for p in $PATH; do
if test -f "$p/$path" && test -x "$p/$path"; then
new_path="$p/$path"
break
fi
done
IFS="$IFS_save"
# Only process if variable expands to non-empty
if test "x[$]$1" != x; then
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
BASIC_FIXUP_EXECUTABLE_MSYS($1)
else
# This is an absolute path, we can use it without further modifications.
new_path="$path"
fi
# We're on a unix platform. Hooray! :)
# First separate the path from the arguments. This will split at the first
# space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
if test "x$new_path" = x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.])
# Cannot rely on the command "which" here since it doesn't always work.
is_absolute_path=`$ECHO "$path" | $GREP ^/`
if test -z "$is_absolute_path"; then
# Path to executable is not absolute. Find it.
IFS_save="$IFS"
IFS=:
for p in $PATH; do
if test -f "$p/$path" && test -x "$p/$path"; then
new_path="$p/$path"
break
fi
done
IFS="$IFS_save"
else
# This is an absolute path, we can use it without further modifications.
new_path="$path"
fi
if test "x$new_path" = x; then
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.])
has_space=`$ECHO "$complete" | $GREP " "`
if test "x$has_space" != x; then
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.])
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
# Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}"
else
new_complete="$new_path"
fi
if test "x$complete" != "x$new_complete"; then
$1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
if test "x$complete" != "x$new_complete"; then
$1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
fi
fi
])

File diff suppressed because it is too large Load Diff

View File

@ -351,18 +351,34 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
IFS=";"
for i in $VS_INCLUDE; do
ipath=$i
IFS="$OLDIFS"
BASIC_FIXUP_PATH([ipath])
IFS=";"
SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
# Only process non-empty elements
if test "x$ipath" != x; then
IFS="$OLDIFS"
# Check that directory exists before calling fixup_path
testpath=$ipath
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
if test -d "$testpath"; then
BASIC_FIXUP_PATH([ipath])
SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath"
fi
IFS=";"
fi
done
# Convert VS_LIB into SYSROOT_LDFLAGS
for i in $VS_LIB; do
libpath=$i
IFS="$OLDIFS"
BASIC_FIXUP_PATH([libpath])
IFS=";"
SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
# Only process non-empty elements
if test "x$libpath" != x; then
IFS="$OLDIFS"
# Check that directory exists before calling fixup_path
testpath=$libpath
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
if test -d "$testpath"; then
BASIC_FIXUP_PATH([libpath])
SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
fi
IFS=";"
fi
done
IFS="$OLDIFS"
fi

View File

@ -180,7 +180,6 @@ jdk/src/java.base/share/classes/sun/nio/ch : jdk/src/share/classes/sun/nio/ch
jdk/src/java.base/share/classes/sun/nio/cs : jdk/src/share/classes/sun/nio/cs
jdk/src/java.base/share/classes/sun/nio/fs : jdk/src/share/classes/sun/nio/fs
jdk/src/java.base/share/classes/sun/reflect : jdk/src/share/classes/sun/reflect
jdk/src/java.base/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
jdk/src/java.base/share/classes/sun/security/action : jdk/src/share/classes/sun/security/action
jdk/src/java.base/share/classes/sun/security/internal : jdk/src/share/classes/sun/security/internal
jdk/src/java.base/share/classes/sun/security/jca : jdk/src/share/classes/sun/security/jca

View File

@ -294,3 +294,4 @@ a13c49c5f2899b702652a460ed7aa73123e671e6 jdk9-b48
9285d14eb7b6b0815679bae98dd936dbc136218d jdk9-b49
224f593393e5b01b3c8f1e591b7f4b1790a3737a jdk9-b50
2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51
b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52

View File

@ -43,7 +43,6 @@ import java.io.FileInputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import sun.security.action.GetPropertyAction;
import java.util.Properties;
class GetORBPropertiesFileAction implements PrivilegedAction {

View File

@ -454,3 +454,4 @@ cc775a4a24c7f5d9e624b4205e9fbd48a17331f6 jdk9-b48
360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49
e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50
403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
9fb7fdc554db5be5c5b10f88f529ec3b870c44e3 jdk9-b52

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.amd64;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
@ -39,6 +41,9 @@ public abstract class AMD64ThreadContext implements ThreadContext {
// subset of the registers' values are guaranteed to be present (and
// must be present for the SA's stack walking to work)
// One instance of the Native annotation is enough to trigger header generation
// for this file.
@Native
public static final int R15 = 0;
public static final int R14 = 1;
public static final int R13 = 2;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.ppc64;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
@ -38,6 +40,9 @@ public abstract class PPC64ThreadContext implements ThreadContext {
// subset of the registers' values are guaranteed to be present (and
// must be present for the SA's stack walking to work).
// One instance of the Native annotation is enough to trigger header generation
// for this file.
@Native
public static final int R31 = 0;
public static final int R30 = 1;
public static final int R29 = 2;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.sparc;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
@ -34,6 +36,10 @@ import sun.jvm.hotspot.debugger.cdbg.*;
public abstract class SPARCThreadContext implements ThreadContext {
// Taken from /usr/include/sys/procfs_isa.h
// One instance of the Native annotation is enough to trigger header generation
// for this file.
@Native
public static final int R_G0 = 0;
public static final int R_G1 = 1;
public static final int R_G2 = 2;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.x86;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
@ -40,6 +42,9 @@ public abstract class X86ThreadContext implements ThreadContext {
// must be present for the SA's stack walking to work): EAX, EBX,
// ECX, EDX, ESI, EDI, EBP, ESP, and EIP.
// One instance of the Native annotation is enough to trigger header generation
// for this file.
@Native
public static final int GS = 0;
public static final int FS = 1;
public static final int ES = 2;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,8 @@ import sun.jvm.hotspot.utilities.*;
public class GenCollectedHeap extends SharedHeap {
private static CIntegerField nGensField;
private static long gensOffset;
private static AddressField youngGenField;
private static AddressField oldGenField;
private static AddressField genSpecsField;
private static GenerationFactory genFactory;
@ -52,7 +53,8 @@ public class GenCollectedHeap extends SharedHeap {
Type type = db.lookupType("GenCollectedHeap");
nGensField = type.getCIntegerField("_n_gens");
gensOffset = type.getField("_gens").getOffset();
youngGenField = type.getAddressField("_young_gen");
oldGenField = type.getAddressField("_old_gen");
genSpecsField = type.getAddressField("_gen_specs");
genFactory = new GenerationFactory();
@ -68,18 +70,19 @@ public class GenCollectedHeap extends SharedHeap {
public Generation getGen(int i) {
if (Assert.ASSERTS_ENABLED) {
Assert.that((i >= 0) && (i < nGens()), "Index " + i +
" out of range (should be between 0 and " + nGens() + ")");
Assert.that((i == 0) || (i == 1), "Index " + i +
" out of range (should be 0 or 1)");
}
if ((i < 0) || (i >= nGens())) {
switch (i) {
case 0:
return genFactory.newObject(youngGenField.getValue(addr));
case 1:
return genFactory.newObject(oldGenField.getValue(addr));
default:
// no generation for i, and assertions disabled.
return null;
}
Address genAddr = addr.getAddressAt(gensOffset +
(i * VM.getVM().getAddressSize()));
return genFactory.newObject(addr.getAddressAt(gensOffset +
(i * VM.getVM().getAddressSize())));
}
public boolean isIn(Address a) {

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012, 2013 SAP AG. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
@ -94,7 +94,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
@ -105,10 +105,6 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext
clean:
rm -rf $(SA_CLASSDIR)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -120,7 +120,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
@ -131,10 +131,6 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler
clean:
rm -rf $(SA_CLASSDIR)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -95,7 +95,7 @@ $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
@ -106,11 +106,6 @@ $(GENERATED)/sa-jdi.jar:: $(AGENT_FILES)
$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
$(QUIETLY) $(REMOTE) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.sparc.SPARCThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.ppc64.PPC64ThreadContext
$(QUIETLY) $(REMOTE) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler
clean:
rm -rf $(SA_CLASSDIR)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# 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,7 +86,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
# are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
$(QUIETLY) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(COMPILE.JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
$(QUIETLY) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
@ -97,8 +97,6 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(RUN.JAR) cf $@ -C $(SA_CLASSDIR)/ .
$(QUIETLY) $(RUN.JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(QUIETLY) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal
$(QUIETLY) $(RUN.JAVAH) -classpath $(SA_CLASSDIR) -d $(GENERATED) -jni sun.jvm.hotspot.asm.Disassembler
clean:
rm -rf $(SA_CLASSDIR)

View File

@ -0,0 +1,81 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# 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.
#
################################################################################
# This file builds the native component of the JTReg tests for Hotspot.
# It also covers the test-image part, where the built files are copied to the
# test image.
################################################################################
default: all
include $(SPEC)
include MakeBase.gmk
include TestFilesCompilation.gmk
################################################################################
# Targets for building the native tests themselves.
################################################################################
# Add more directories here when needed.
BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
$(HOTSPOT_TOPDIR)/test/native_sanity \
#
BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
))
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_EXECUTABLES, \
TYPE := PROGRAM, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
))
build-test-hotspot-jtreg-native: $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES)
################################################################################
# Targets for building test-image.
################################################################################
# Copy to hotspot jtreg test image
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_JTREG_NATIVE, \
SRC := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \
FILES := $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES), \
FLATTEN := true))
test-image-hotspot-jtreg-native: $(COPY_HOTSPOT_JTREG_NATIVE)
all: build-test-hotspot-jtreg-native
test-image: test-image-hotspot-jtreg-native
.PHONY: default all build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native test-image

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -72,7 +72,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) mkdir -p $(SA_CLASSDIR)
@echo ...Building sa-jdi.jar into $(SA_CLASSDIR)
@echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(SA_CLASSDIR) ....
@$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES)
@$(COMPILE_JAVAC) -h $(GENERATED) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) $(AGENT_FILES)
$(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
@ -83,10 +83,6 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
$(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)
$(RUN_JAR) cf $@ -C $(SA_CLASSDIR) .
$(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext
$(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.asm.Disassembler

View File

@ -26,8 +26,8 @@
#include "runtime/os.hpp"
#include "vm_version_sparc.hpp"
static bool detect_niagara() {
char cpu[128];
static bool cpuinfo_field_contains(const char* field, const char* value) {
char line[1024];
bool rv = false;
FILE* fp = fopen("/proc/cpuinfo", "r");
@ -35,9 +35,10 @@ static bool detect_niagara() {
return rv;
}
while (!feof(fp)) {
if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) {
if (strstr(cpu, "Niagara") != NULL) {
while (fgets(line, sizeof(line), fp) != NULL) {
assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small.");
if (strncmp(line, field, strlen(field)) == 0) {
if (strstr(line, value) != NULL) {
rv = true;
}
break;
@ -45,10 +46,17 @@ static bool detect_niagara() {
}
fclose(fp);
return rv;
}
static bool detect_niagara() {
return cpuinfo_field_contains("cpu", "Niagara");
}
static bool detect_blkinit() {
return cpuinfo_field_contains("cpucaps", "blkinit");
}
int VM_Version::platform_features(int features) {
// Default to generic v9
features = generic_v9_m;
@ -58,5 +66,9 @@ int VM_Version::platform_features(int features) {
features = niagara1_m | T_family_m;
}
if (detect_blkinit()) {
features |= blk_init_instructions_m;
}
return features;
}

View File

@ -26,6 +26,7 @@
#define SHARE_VM_CI_CIKLASS_HPP
#include "ci/ciType.hpp"
#include "oops/klass.hpp"
// ciKlass
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
#include "classfile/classFileParser.hpp"
#include "classfile/stackMapTable.hpp"
#include "classfile/verifier.hpp"
#include "memory/resourceArea.hpp"
// Keep these in a separate file to prevent inlining

View File

@ -38,6 +38,7 @@
#include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp"
#include "memory/referenceType.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/constantPool.hpp"
#include "oops/fieldStreams.hpp"
@ -59,6 +60,7 @@
#include "services/threadService.hpp"
#include "utilities/array.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
#include "utilities/resourceHash.hpp"
@ -313,6 +315,19 @@ inline Symbol* check_symbol_at(constantPoolHandle cp, int index) {
return NULL;
}
PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED
void ClassFileParser::report_assert_property_failure(const char* msg, TRAPS) {
ResourceMark rm(THREAD);
fatal(err_msg(msg, _class_name->as_C_string()));
}
void ClassFileParser::report_assert_property_failure(const char* msg, int index, TRAPS) {
ResourceMark rm(THREAD);
fatal(err_msg(msg, index, _class_name->as_C_string()));
}
PRAGMA_DIAG_POP
constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
ClassFileStream* cfs = stream();
constantPoolHandle nullHandle;

View File

@ -26,12 +26,15 @@
#define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
#include "classfile/classFileStream.hpp"
#include "memory/resourceArea.hpp"
#include "classfile/symbolTable.hpp"
#include "oops/annotations.hpp"
#include "oops/constantPool.hpp"
#include "oops/typeArrayOop.hpp"
#include "utilities/accessFlags.hpp"
#include "classfile/symbolTable.hpp"
class CompressedLineNumberWriteStream;
class FieldAllocationCount;
class FieldInfo;
class FieldLayoutInfo;
@ -315,13 +318,13 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
if (!b) { classfile_parse_error(msg, CHECK); }
}
PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED
inline void assert_property(bool b, const char* msg, TRAPS) {
void report_assert_property_failure(const char* msg, TRAPS);
void report_assert_property_failure(const char* msg, int index, TRAPS);
inline void assert_property(bool b, const char* msg, TRAPS) {
#ifdef ASSERT
if (!b) {
ResourceMark rm(THREAD);
fatal(err_msg(msg, _class_name->as_C_string()));
report_assert_property_failure(msg, THREAD);
}
#endif
}
@ -329,12 +332,10 @@ inline void assert_property(bool b, const char* msg, TRAPS) {
inline void assert_property(bool b, const char* msg, int index, TRAPS) {
#ifdef ASSERT
if (!b) {
ResourceMark rm(THREAD);
fatal(err_msg(msg, index, _class_name->as_C_string()));
report_assert_property_failure(msg, index, THREAD);
}
#endif
}
PRAGMA_DIAG_POP
inline void check_property(bool property, const char* msg, int index, TRAPS) {
if (_need_verify) {

View File

@ -26,6 +26,8 @@
#define SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP
#include "classfile/classLoader.hpp"
#include "oops/instanceKlass.hpp"
#include "runtime/handles.hpp"
class ClassLoaderExt: public ClassLoader { // AllStatic
public:

View File

@ -31,7 +31,6 @@
#include "code/nmethod.hpp"
#include "code/pcDesc.hpp"
#include "compiler/compileBroker.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/gcLocker.hpp"
#include "memory/iterator.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
#include "classfile/systemDictionary.hpp"
#include "code/compressedStream.hpp"
#include "code/nmethod.hpp"
#include "memory/resourceArea.hpp"
#include "utilities/growableArray.hpp"
#include "utilities/hashtable.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -869,7 +869,7 @@ void ConcurrentMarkSweepGeneration::compute_new_size_free_list() {
if (prev_level >= 0) {
size_t prev_size = 0;
GenCollectedHeap* gch = GenCollectedHeap::heap();
Generation* prev_gen = gch->_gens[prev_level];
Generation* prev_gen = gch->get_gen(prev_level);
prev_size = prev_gen->capacity();
gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT,
prev_size/1000);

View File

@ -37,7 +37,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
_use_cache = true;
_hot_cache_size = (size_t)1 << G1ConcRSLogCacheSize;
_hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC);
_hot_cache = _hot_cache_memory.allocate(_hot_cache_size);
reset_hot_cache_internal();
@ -52,7 +52,8 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
G1HotCardCache::~G1HotCardCache() {
if (default_use_cache()) {
assert(_hot_cache != NULL, "Logic");
FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
_hot_cache_memory.free();
_hot_cache = NULL;
}
}

View File

@ -61,6 +61,8 @@ class G1HotCardCache: public CHeapObj<mtGC> {
G1CardCounts _card_counts;
ArrayAllocator<jbyte*, mtGC> _hot_cache_memory;
// The card cache table
jbyte** _hot_cache;

View File

@ -26,6 +26,8 @@
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
#include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "gc_implementation/parallelScavenge/psTasks.hpp"
#include "gc_implementation/parallelScavenge/psYoungGen.hpp"
#include "oops/oop.inline.hpp"

View File

@ -66,6 +66,15 @@ void PSPromotionManager::initialize() {
// for work stealing.
}
// Helper functions to get around the circular dependency between
// psScavenge.inline.hpp and psPromotionManager.inline.hpp.
bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) {
return PSScavenge::should_scavenge(p, check_to_space);
}
bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) {
return PSScavenge::should_scavenge(p, check_to_space);
}
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
assert(_manager_array != NULL, "Sanity");

View File

@ -203,6 +203,12 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
inline void process_popped_location_depth(StarTask p);
static bool should_scavenge(oop* p, bool check_to_space = false);
static bool should_scavenge(narrowOop* p, bool check_to_space = false);
template <class T, bool promote_immediately>
void copy_and_push_safe_barrier(T* p);
template <class T> inline void claim_or_forward_depth(T* p);
TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);)

View File

@ -56,7 +56,7 @@ inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
template <class T>
inline void PSPromotionManager::claim_or_forward_depth(T* p) {
assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
assert(should_scavenge(p, true), "revisiting object?");
assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
"Sanity");
assert(Universe::heap()->is_in(p), "pointer outside heap");
@ -98,7 +98,7 @@ inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj,
//
template<bool promote_immediately>
oop PSPromotionManager::copy_to_survivor_space(oop o) {
assert(PSScavenge::should_scavenge(&o), "Sanity");
assert(should_scavenge(&o), "Sanity");
oop new_obj = NULL;
@ -257,7 +257,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
// information.
if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
should_scavenge(&new_obj) ? "copying" : "tenuring",
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
}
#endif
@ -265,6 +265,40 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
return new_obj;
}
// Attempt to "claim" oop at p via CAS, push the new obj if successful
// This version tests the oop* to make sure it is within the heap before
// attempting marking.
template <class T, bool promote_immediately>
inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) {
assert(should_scavenge(p, true), "revisiting object?");
oop o = oopDesc::load_decode_heap_oop_not_null(p);
oop new_obj = o->is_forwarded()
? o->forwardee()
: copy_to_survivor_space<promote_immediately>(o);
#ifndef PRODUCT
// This code must come after the CAS test, or it will print incorrect
// information.
if (TraceScavenge && o->is_forwarded()) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding",
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
}
#endif
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
// We cannot mark without test, as some code passes us pointers
// that are outside the heap. These pointers are either from roots
// or from metadata.
if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
Universe::heap()->is_in_reserved(p)) {
if (PSScavenge::is_obj_in_young(new_obj)) {
PSScavenge::card_table()->inline_write_ref_field_gc(p, new_obj);
}
}
}
inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
if (is_oop_masked(p)) {
@ -274,9 +308,9 @@ inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
} else {
if (p.is_narrow()) {
assert(UseCompressedOops, "Error");
PSScavenge::copy_and_push_safe_barrier<narrowOop, /*promote_immediately=*/false>(this, p);
copy_and_push_safe_barrier<narrowOop, /*promote_immediately=*/false>(p);
} else {
PSScavenge::copy_and_push_safe_barrier<oop, /*promote_immediately=*/false>(this, p);
copy_and_push_safe_barrier<oop, /*promote_immediately=*/false>(p);
}
}
}

View File

@ -105,7 +105,7 @@ public:
// Weak refs may be visited more than once.
if (PSScavenge::should_scavenge(p, _to_space)) {
PSScavenge::copy_and_push_safe_barrier<T, /*promote_immediately=*/false>(_promotion_manager, p);
_promotion_manager->copy_and_push_safe_barrier<T, /*promote_immediately=*/false>(p);
}
}
virtual void do_oop(oop* p) { PSKeepAliveClosure::do_oop_work(p); }

View File

@ -144,9 +144,6 @@ class PSScavenge: AllStatic {
template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
template <class T, bool promote_immediately>
inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
// Is an object in the young generation

View File

@ -27,7 +27,6 @@
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "memory/iterator.hpp"
@ -63,42 +62,6 @@ inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) {
return should_scavenge(p);
}
// Attempt to "claim" oop at p via CAS, push the new obj if successful
// This version tests the oop* to make sure it is within the heap before
// attempting marking.
template <class T, bool promote_immediately>
inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
T* p) {
assert(should_scavenge(p, true), "revisiting object?");
oop o = oopDesc::load_decode_heap_oop_not_null(p);
oop new_obj = o->is_forwarded()
? o->forwardee()
: pm->copy_to_survivor_space<promote_immediately>(o);
#ifndef PRODUCT
// This code must come after the CAS test, or it will print incorrect
// information.
if (TraceScavenge && o->is_forwarded()) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
"forwarding",
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
}
#endif
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
// We cannot mark without test, as some code passes us pointers
// that are outside the heap. These pointers are either from roots
// or from metadata.
if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
Universe::heap()->is_in_reserved(p)) {
if (PSScavenge::is_obj_in_young(new_obj)) {
card_table()->inline_write_ref_field_gc(p, new_obj);
}
}
}
template<bool promote_immediately>
class PSRootsClosure: public OopClosure {
private:
@ -108,7 +71,7 @@ class PSRootsClosure: public OopClosure {
template <class T> void do_oop_work(T *p) {
if (PSScavenge::should_scavenge(p)) {
// We never card mark roots, maybe call a func without test?
PSScavenge::copy_and_push_safe_barrier<T, promote_immediately>(_promotion_manager, p);
_promotion_manager->copy_and_push_safe_barrier<T, promote_immediately>(p);
}
}
public:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "code/stubs.hpp"
#include "interpreter/cppInterpreter.hpp"
#include "interpreter/templateInterpreter.hpp"
#include "memory/resourceArea.hpp"
#ifdef ZERO
#ifdef TARGET_ARCH_zero
# include "entry_zero.hpp"

View File

@ -965,32 +965,38 @@ public:
}
static void test_old_size() {
size_t flag_value;
size_t flag_value;
size_t heap_alignment = CollectorPolicy::compute_heap_alignment();
save_flags();
save_flags();
// If OldSize is set on the command line, it should be used
// for both min and initial old size if less than min heap.
flag_value = 20 * M;
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_old_min(flag_value);
// If OldSize is set on the command line, it should be used
// for both min and initial old size if less than min heap.
flag_value = 20 * M;
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_old_min(flag_value);
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_old_initial(flag_value);
// If MaxNewSize is large, the maximum OldSize will be less than
// what's requested on the command line and it should be reset
// ergonomically.
flag_value = 30 * M;
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M);
// Calculate what we expect the flag to be.
flag_value = MaxHeapSize - MaxNewSize;
verify_old_initial(flag_value);
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
// Calculate what we expect the flag to be.
size_t expected_old_initial = align_size_up(InitialHeapSize, heap_alignment) - MaxNewSize;
verify_old_initial(expected_old_initial);
// If MaxNewSize is large, the maximum OldSize will be less than
// what's requested on the command line and it should be reset
// ergonomically.
// We intentionally set MaxNewSize + OldSize > MaxHeapSize (see over_size).
flag_value = 30 * M;
set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
size_t over_size = 20*M;
size_t new_size_value = align_size_up(MaxHeapSize, heap_alignment) - flag_value + over_size;
FLAG_SET_CMDLINE(uintx, MaxNewSize, new_size_value);
// Calculate what we expect the flag to be.
expected_old_initial = align_size_up(MaxHeapSize, heap_alignment) - MaxNewSize;
verify_old_initial(expected_old_initial);
restore_flags();
}
static void verify_young_min(size_t expected) {
@ -1011,6 +1017,12 @@ public:
MarkSweepPolicy msp;
msp.initialize_all();
if (InitialHeapSize > initial_heap_size) {
// InitialHeapSize was adapted by msp.initialize_all, e.g. due to alignment
// caused by 64K page size.
initial_heap_size = InitialHeapSize;
}
size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size);
assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected));
assert(FLAG_IS_ERGO(NewSize) && NewSize == expected,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -383,7 +383,7 @@ void DefNewGeneration::compute_new_size() {
assert(next_level < gch->_n_gens,
"DefNewGeneration cannot be an oldest gen");
Generation* next_gen = gch->_gens[next_level];
Generation* next_gen = gch->get_gen(next_level);
size_t old_size = next_gen->capacity();
size_t new_size_before = _virtual_space.committed_size();
size_t min_new_size = spec()->init_size();

View File

@ -86,6 +86,7 @@ jint GenCollectedHeap::initialize() {
int i;
_n_gens = gen_policy()->number_of_generations();
assert(_n_gens == 2, "There is no support for more than two generations");
// While there are no constraints in the GC code that HeapWordSize
// be any particular value, there are multiple other areas in the
@ -126,11 +127,12 @@ jint GenCollectedHeap::initialize() {
_gch = this;
for (i = 0; i < _n_gens; i++) {
ReservedSpace this_rs = heap_rs.first_part(_gen_specs[i]->max_size(), false, false);
_gens[i] = _gen_specs[i]->init(this_rs, i, rem_set());
heap_rs = heap_rs.last_part(_gen_specs[i]->max_size());
}
ReservedSpace young_rs = heap_rs.first_part(_gen_specs[0]->max_size(), false, false);
_young_gen = _gen_specs[0]->init(young_rs, 0, rem_set());
heap_rs = heap_rs.last_part(_gen_specs[0]->max_size());
ReservedSpace old_rs = heap_rs.first_part(_gen_specs[1]->max_size(), false, false);
_old_gen = _gen_specs[1]->init(old_rs, 1, rem_set());
clear_incremental_collection_failed();
#if INCLUDE_ALL_GCS
@ -145,7 +147,6 @@ jint GenCollectedHeap::initialize() {
return JNI_OK;
}
char* GenCollectedHeap::allocate(size_t alignment,
ReservedSpace* heap_rs){
const char overflow_msg[] = "The size of the object heap + VM data exceeds "
@ -172,7 +173,6 @@ char* GenCollectedHeap::allocate(size_t alignment,
return heap_rs->base();
}
void GenCollectedHeap::post_initialize() {
SharedHeap::post_initialize();
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
@ -195,41 +195,30 @@ void GenCollectedHeap::post_initialize() {
void GenCollectedHeap::ref_processing_init() {
SharedHeap::ref_processing_init();
for (int i = 0; i < _n_gens; i++) {
_gens[i]->ref_processor_init();
}
_young_gen->ref_processor_init();
_old_gen->ref_processor_init();
}
size_t GenCollectedHeap::capacity() const {
size_t res = 0;
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->capacity();
}
return res;
return _young_gen->capacity() + _old_gen->capacity();
}
size_t GenCollectedHeap::used() const {
size_t res = 0;
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->used();
}
return res;
return _young_gen->used() + _old_gen->used();
}
// Save the "used_region" for generations level and lower.
void GenCollectedHeap::save_used_regions(int level) {
assert(level >= 0, "Illegal level parameter");
assert(level < _n_gens, "Illegal level parameter");
for (int i = level; i >= 0; i--) {
_gens[i]->save_used_region();
if (level == 1) {
_old_gen->save_used_region();
}
_young_gen->save_used_region();
}
size_t GenCollectedHeap::max_capacity() const {
size_t res = 0;
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->max_capacity();
}
return res;
return _young_gen->max_capacity() + _old_gen->max_capacity();
}
// Update the _full_collections_completed counter
@ -293,16 +282,20 @@ void GenCollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr,
HeapWord* GenCollectedHeap::attempt_allocation(size_t size,
bool is_tlab,
bool first_only) {
HeapWord* res;
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->should_allocate(size, is_tlab)) {
res = _gens[i]->allocate(size, is_tlab);
if (res != NULL) return res;
else if (first_only) break;
HeapWord* res = NULL;
if (_young_gen->should_allocate(size, is_tlab)) {
res = _young_gen->allocate(size, is_tlab);
if (res != NULL || first_only) {
return res;
}
}
// Otherwise...
return NULL;
if (_old_gen->should_allocate(size, is_tlab)) {
res = _old_gen->allocate(size, is_tlab);
}
return res;
}
HeapWord* GenCollectedHeap::mem_allocate(size_t size,
@ -322,12 +315,107 @@ bool GenCollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
(cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent));
}
void GenCollectedHeap::do_collection(bool full,
void GenCollectedHeap::collect_generation(Generation* gen, bool full, size_t size,
bool is_tlab, bool run_verification, bool clear_soft_refs,
bool restore_marks_for_biased_locking) {
// Timer for individual generations. Last argument is false: no CR
// FIXME: We should try to start the timing earlier to cover more of the GC pause
// The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
// so we can assume here that the next GC id is what we want.
GCTraceTime t1(gen->short_name(), PrintGCDetails, false, NULL, GCId::peek());
TraceCollectorStats tcs(gen->counters());
TraceMemoryManagerStats tmms(gen->kind(),gc_cause());
size_t prev_used = gen->used();
gen->stat_record()->invocations++;
gen->stat_record()->accumulated_time.start();
// Must be done anew before each collection because
// a previous collection will do mangling and will
// change top of some spaces.
record_gen_tops_before_GC();
if (PrintGC && Verbose) {
gclog_or_tty->print("level=%d invoke=%d size=" SIZE_FORMAT,
gen->level(),
gen->stat_record()->invocations,
size * HeapWordSize);
}
if (run_verification && VerifyBeforeGC) {
HandleMark hm; // Discard invalid handles created during verification
Universe::verify(" VerifyBeforeGC:");
}
COMPILER2_PRESENT(DerivedPointerTable::clear());
if (restore_marks_for_biased_locking) {
// We perform this mark word preservation work lazily
// because it's only at this point that we know whether we
// absolutely have to do it; we want to avoid doing it for
// scavenge-only collections where it's unnecessary
BiasedLocking::preserve_marks();
}
// Do collection work
{
// Note on ref discovery: For what appear to be historical reasons,
// GCH enables and disabled (by enqueing) refs discovery.
// In the future this should be moved into the generation's
// collect method so that ref discovery and enqueueing concerns
// are local to a generation. The collect method could return
// an appropriate indication in the case that notification on
// the ref lock was needed. This will make the treatment of
// weak refs more uniform (and indeed remove such concerns
// from GCH). XXX
HandleMark hm; // Discard invalid handles created during gc
save_marks(); // save marks for all gens
// We want to discover references, but not process them yet.
// This mode is disabled in process_discovered_references if the
// generation does some collection work, or in
// enqueue_discovered_references if the generation returns
// without doing any work.
ReferenceProcessor* rp = gen->ref_processor();
// If the discovery of ("weak") refs in this generation is
// atomic wrt other collectors in this configuration, we
// are guaranteed to have empty discovered ref lists.
if (rp->discovery_is_atomic()) {
rp->enable_discovery();
rp->setup_policy(clear_soft_refs);
} else {
// collect() below will enable discovery as appropriate
}
gen->collect(full, clear_soft_refs, size, is_tlab);
if (!rp->enqueuing_is_done()) {
rp->enqueue_discovered_references();
} else {
rp->set_enqueuing_is_done(false);
}
rp->verify_no_references_recorded();
}
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
gen->stat_record()->accumulated_time.stop();
update_gc_stats(gen->level(), full);
if (run_verification && VerifyAfterGC) {
HandleMark hm; // Discard invalid handles created during verification
Universe::verify(" VerifyAfterGC:");
}
if (PrintGCDetails) {
gclog_or_tty->print(":");
gen->print_heap_change(prev_used);
}
}
void GenCollectedHeap::do_collection(bool full,
bool clear_all_soft_refs,
size_t size,
bool is_tlab,
int max_level) {
bool prepared_for_verification = false;
ResourceMark rm;
DEBUG_ONLY(Thread* my_thread = Thread::current();)
@ -367,141 +455,62 @@ void GenCollectedHeap::do_collection(bool full,
increment_total_collections(complete);
size_t gch_prev_used = used();
bool run_verification = total_collections() >= VerifyGCStartAt;
int starting_level = 0;
if (full) {
// Search for the oldest generation which will collect all younger
// generations, and start collection loop there.
for (int i = max_level; i >= 0; i--) {
if (_gens[i]->full_collects_younger_generations()) {
starting_level = i;
break;
}
bool prepared_for_verification = false;
int max_level_collected = 0;
bool old_collects_young = (max_level == 1) &&
full &&
_old_gen->full_collects_younger_generations();
if (!old_collects_young &&
_young_gen->should_collect(full, size, is_tlab)) {
if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
prepare_for_verify();
prepared_for_verification = true;
}
assert(!_young_gen->performs_in_place_marking(), "No young generation do in place marking");
collect_generation(_young_gen,
full,
size,
is_tlab,
run_verification && VerifyGCLevel <= 0,
do_clear_all_soft_refs,
false);
if (size > 0 && (!is_tlab || _young_gen->supports_tlab_allocation()) &&
size * HeapWordSize <= _young_gen->unsafe_max_alloc_nogc()) {
// Allocation request was met by young GC.
size = 0;
}
}
bool must_restore_marks_for_biased_locking = false;
int max_level_collected = starting_level;
for (int i = starting_level; i <= max_level; i++) {
if (_gens[i]->should_collect(full, size, is_tlab)) {
if (i == n_gens() - 1) { // a major collection is to happen
if (!complete) {
// The full_collections increment was missed above.
increment_total_full_collections();
}
pre_full_gc_dump(NULL); // do any pre full gc dumps
}
// Timer for individual generations. Last argument is false: no CR
// FIXME: We should try to start the timing earlier to cover more of the GC pause
// The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
// so we can assume here that the next GC id is what we want.
GCTraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, NULL, GCId::peek());
TraceCollectorStats tcs(_gens[i]->counters());
TraceMemoryManagerStats tmms(_gens[i]->kind(),gc_cause());
size_t prev_used = _gens[i]->used();
_gens[i]->stat_record()->invocations++;
_gens[i]->stat_record()->accumulated_time.start();
// Must be done anew before each collection because
// a previous collection will do mangling and will
// change top of some spaces.
record_gen_tops_before_GC();
if (PrintGC && Verbose) {
gclog_or_tty->print("level=%d invoke=%d size=" SIZE_FORMAT,
i,
_gens[i]->stat_record()->invocations,
size*HeapWordSize);
}
if (VerifyBeforeGC && i >= VerifyGCLevel &&
total_collections() >= VerifyGCStartAt) {
HandleMark hm; // Discard invalid handles created during verification
if (!prepared_for_verification) {
prepare_for_verify();
prepared_for_verification = true;
}
Universe::verify(" VerifyBeforeGC:");
}
COMPILER2_PRESENT(DerivedPointerTable::clear());
if (!must_restore_marks_for_biased_locking &&
_gens[i]->performs_in_place_marking()) {
// We perform this mark word preservation work lazily
// because it's only at this point that we know whether we
// absolutely have to do it; we want to avoid doing it for
// scavenge-only collections where it's unnecessary
must_restore_marks_for_biased_locking = true;
BiasedLocking::preserve_marks();
}
// Do collection work
{
// Note on ref discovery: For what appear to be historical reasons,
// GCH enables and disabled (by enqueing) refs discovery.
// In the future this should be moved into the generation's
// collect method so that ref discovery and enqueueing concerns
// are local to a generation. The collect method could return
// an appropriate indication in the case that notification on
// the ref lock was needed. This will make the treatment of
// weak refs more uniform (and indeed remove such concerns
// from GCH). XXX
HandleMark hm; // Discard invalid handles created during gc
save_marks(); // save marks for all gens
// We want to discover references, but not process them yet.
// This mode is disabled in process_discovered_references if the
// generation does some collection work, or in
// enqueue_discovered_references if the generation returns
// without doing any work.
ReferenceProcessor* rp = _gens[i]->ref_processor();
// If the discovery of ("weak") refs in this generation is
// atomic wrt other collectors in this configuration, we
// are guaranteed to have empty discovered ref lists.
if (rp->discovery_is_atomic()) {
rp->enable_discovery();
rp->setup_policy(do_clear_all_soft_refs);
} else {
// collect() below will enable discovery as appropriate
}
_gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab);
if (!rp->enqueuing_is_done()) {
rp->enqueue_discovered_references();
} else {
rp->set_enqueuing_is_done(false);
}
rp->verify_no_references_recorded();
}
max_level_collected = i;
// Determine if allocation request was met.
if (size > 0) {
if (!is_tlab || _gens[i]->supports_tlab_allocation()) {
if (size*HeapWordSize <= _gens[i]->unsafe_max_alloc_nogc()) {
size = 0;
}
}
}
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
_gens[i]->stat_record()->accumulated_time.stop();
update_gc_stats(i, full);
if (VerifyAfterGC && i >= VerifyGCLevel &&
total_collections() >= VerifyGCStartAt) {
HandleMark hm; // Discard invalid handles created during verification
Universe::verify(" VerifyAfterGC:");
}
if (PrintGCDetails) {
gclog_or_tty->print(":");
_gens[i]->print_heap_change(prev_used);
}
if (max_level == 1 && _old_gen->should_collect(full, size, is_tlab)) {
if (!complete) {
// The full_collections increment was missed above.
increment_total_full_collections();
}
pre_full_gc_dump(NULL); // do any pre full gc dumps
if (!prepared_for_verification && run_verification &&
VerifyGCLevel <= 1 && VerifyBeforeGC) {
prepare_for_verify();
}
assert(_old_gen->performs_in_place_marking(), "All old generations do in place marking");
collect_generation(_old_gen,
full,
size,
is_tlab,
run_verification && VerifyGCLevel <= 1,
do_clear_all_soft_refs,
true);
must_restore_marks_for_biased_locking = true;
max_level_collected = 1;
}
// Update "complete" boolean wrt what actually transpired --
@ -523,10 +532,11 @@ void GenCollectedHeap::do_collection(bool full,
}
}
for (int j = max_level_collected; j >= 0; j -= 1) {
// Adjust generation sizes.
_gens[j]->compute_new_size();
// Adjust generation sizes.
if (max_level_collected == 1) {
_old_gen->compute_new_size();
}
_young_gen->compute_new_size();
if (complete) {
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
@ -583,18 +593,18 @@ gen_process_roots(int level,
if (younger_gens_as_roots) {
if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) {
for (int i = 0; i < level; i++) {
not_older_gens->set_generation(_gens[i]);
_gens[i]->oop_iterate(not_older_gens);
if (level == 1) {
not_older_gens->set_generation(_young_gen);
_young_gen->oop_iterate(not_older_gens);
}
not_older_gens->reset_generation();
}
}
// When collection is parallel, all threads get to cooperate to do
// older-gen scanning.
for (int i = level+1; i < _n_gens; i++) {
older_gens->set_generation(_gens[i]);
rem_set()->younger_refs_iterate(_gens[i], older_gens);
if (level == 0) {
older_gens->set_generation(_old_gen);
rem_set()->younger_refs_iterate(_old_gen, older_gens);
older_gens->reset_generation();
}
@ -635,9 +645,8 @@ gen_process_roots(int level,
void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
SharedHeap::process_weak_roots(root_closure);
// "Local" "weak" refs
for (int i = 0; i < _n_gens; i++) {
_gens[i]->ref_processor()->weak_oops_do(root_closure);
}
_young_gen->ref_processor()->weak_oops_do(root_closure);
_old_gen->ref_processor()->weak_oops_do(root_closure);
}
#define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
@ -645,9 +654,11 @@ void GenCollectedHeap:: \
oop_since_save_marks_iterate(int level, \
OopClosureType* cur, \
OopClosureType* older) { \
_gens[level]->oop_since_save_marks_iterate##nv_suffix(cur); \
for (int i = level+1; i < n_gens(); i++) { \
_gens[i]->oop_since_save_marks_iterate##nv_suffix(older); \
if (level == 0) { \
_young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
_old_gen->oop_since_save_marks_iterate##nv_suffix(older); \
} else { \
_old_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
} \
}
@ -656,22 +667,22 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN)
#undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
bool GenCollectedHeap::no_allocs_since_save_marks(int level) {
for (int i = level; i < _n_gens; i++) {
if (!_gens[i]->no_allocs_since_save_marks()) return false;
if (level == 0 && !_young_gen->no_allocs_since_save_marks()) {
return false;
}
return true;
return _old_gen->no_allocs_since_save_marks();
}
bool GenCollectedHeap::supports_inline_contig_alloc() const {
return _gens[0]->supports_inline_contig_alloc();
return _young_gen->supports_inline_contig_alloc();
}
HeapWord** GenCollectedHeap::top_addr() const {
return _gens[0]->top_addr();
return _young_gen->top_addr();
}
HeapWord** GenCollectedHeap::end_addr() const {
return _gens[0]->end_addr();
return _young_gen->end_addr();
}
// public collection interfaces
@ -734,12 +745,12 @@ void GenCollectedHeap::collect_locked(GCCause::Cause cause, int max_level) {
#if INCLUDE_ALL_GCS
bool GenCollectedHeap::create_cms_collector() {
assert(_gens[1]->kind() == Generation::ConcurrentMarkSweep,
assert(_old_gen->kind() == Generation::ConcurrentMarkSweep,
"Unexpected generation kinds");
// Skip two header words in the block content verification
NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();)
CMSCollector* collector = new CMSCollector(
(ConcurrentMarkSweepGeneration*)_gens[1],
(ConcurrentMarkSweepGeneration*)_old_gen,
_rem_set->as_CardTableRS(),
(ConcurrentMarkSweepPolicy*) collector_policy());
@ -806,8 +817,8 @@ void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs,
}
bool GenCollectedHeap::is_in_young(oop p) {
bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start();
assert(result == _gens[0]->is_in_reserved(p),
bool result = ((HeapWord*)p) < _old_gen->reserved().start();
assert(result == _young_gen->is_in_reserved(p),
err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p)));
return result;
}
@ -825,13 +836,7 @@ bool GenCollectedHeap::is_in(const void* p) const {
VMError::fatal_error_in_progress(), "too expensive");
#endif
// This might be sped up with a cache of the last generation that
// answered yes.
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->is_in(p)) return true;
}
// Otherwise...
return false;
return _young_gen->is_in(p) || _old_gen->is_in(p);
}
#ifdef ASSERT
@ -840,114 +845,97 @@ bool GenCollectedHeap::is_in(const void* p) const {
bool GenCollectedHeap::is_in_partial_collection(const void* p) {
assert(is_in_reserved(p) || p == NULL,
"Does not work if address is non-null and outside of the heap");
return p < _gens[_n_gens - 2]->reserved().end() && p != NULL;
return p < _young_gen->reserved().end() && p != NULL;
}
#endif
void GenCollectedHeap::oop_iterate(ExtendedOopClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->oop_iterate(cl);
}
_young_gen->oop_iterate(cl);
_old_gen->oop_iterate(cl);
}
void GenCollectedHeap::object_iterate(ObjectClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->object_iterate(cl);
}
_young_gen->object_iterate(cl);
_old_gen->object_iterate(cl);
}
void GenCollectedHeap::safe_object_iterate(ObjectClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->safe_object_iterate(cl);
}
_young_gen->safe_object_iterate(cl);
_old_gen->safe_object_iterate(cl);
}
Space* GenCollectedHeap::space_containing(const void* addr) const {
for (int i = 0; i < _n_gens; i++) {
Space* res = _gens[i]->space_containing(addr);
if (res != NULL) return res;
Space* res = _young_gen->space_containing(addr);
if (res != NULL) {
return res;
}
// Otherwise...
assert(false, "Could not find containing space");
return NULL;
res = _old_gen->space_containing(addr);
assert(res != NULL, "Could not find containing space");
return res;
}
HeapWord* GenCollectedHeap::block_start(const void* addr) const {
assert(is_in_reserved(addr), "block_start of address outside of heap");
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->is_in_reserved(addr)) {
assert(_gens[i]->is_in(addr),
"addr should be in allocated part of generation");
return _gens[i]->block_start(addr);
}
if (_young_gen->is_in_reserved(addr)) {
assert(_young_gen->is_in(addr), "addr should be in allocated part of generation");
return _young_gen->block_start(addr);
}
assert(false, "Some generation should contain the address");
return NULL;
assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address");
assert(_old_gen->is_in(addr), "addr should be in allocated part of generation");
return _old_gen->block_start(addr);
}
size_t GenCollectedHeap::block_size(const HeapWord* addr) const {
assert(is_in_reserved(addr), "block_size of address outside of heap");
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->is_in_reserved(addr)) {
assert(_gens[i]->is_in(addr),
"addr should be in allocated part of generation");
return _gens[i]->block_size(addr);
}
if (_young_gen->is_in_reserved(addr)) {
assert(_young_gen->is_in(addr), "addr should be in allocated part of generation");
return _young_gen->block_size(addr);
}
assert(false, "Some generation should contain the address");
return 0;
assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address");
assert(_old_gen->is_in(addr), "addr should be in allocated part of generation");
return _old_gen->block_size(addr);
}
bool GenCollectedHeap::block_is_obj(const HeapWord* addr) const {
assert(is_in_reserved(addr), "block_is_obj of address outside of heap");
assert(block_start(addr) == addr, "addr must be a block start");
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->is_in_reserved(addr)) {
return _gens[i]->block_is_obj(addr);
}
if (_young_gen->is_in_reserved(addr)) {
return _young_gen->block_is_obj(addr);
}
assert(false, "Some generation should contain the address");
return false;
assert(_old_gen->is_in_reserved(addr), "Some generation should contain the address");
return _old_gen->block_is_obj(addr);
}
bool GenCollectedHeap::supports_tlab_allocation() const {
for (int i = 0; i < _n_gens; i += 1) {
if (_gens[i]->supports_tlab_allocation()) {
return true;
}
}
return false;
assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
return _young_gen->supports_tlab_allocation();
}
size_t GenCollectedHeap::tlab_capacity(Thread* thr) const {
size_t result = 0;
for (int i = 0; i < _n_gens; i += 1) {
if (_gens[i]->supports_tlab_allocation()) {
result += _gens[i]->tlab_capacity();
}
assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
if (_young_gen->supports_tlab_allocation()) {
return _young_gen->tlab_capacity();
}
return result;
return 0;
}
size_t GenCollectedHeap::tlab_used(Thread* thr) const {
size_t result = 0;
for (int i = 0; i < _n_gens; i += 1) {
if (_gens[i]->supports_tlab_allocation()) {
result += _gens[i]->tlab_used();
}
assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
if (_young_gen->supports_tlab_allocation()) {
return _young_gen->tlab_used();
}
return result;
return 0;
}
size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const {
size_t result = 0;
for (int i = 0; i < _n_gens; i += 1) {
if (_gens[i]->supports_tlab_allocation()) {
result += _gens[i]->unsafe_max_tlab_alloc();
}
assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
if (_young_gen->supports_tlab_allocation()) {
return _young_gen->unsafe_max_tlab_alloc();
}
return result;
return 0;
}
HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) {
@ -996,17 +984,15 @@ static void sort_scratch_list(ScratchBlock*& list) {
ScratchBlock* GenCollectedHeap::gather_scratch(Generation* requestor,
size_t max_alloc_words) {
ScratchBlock* res = NULL;
for (int i = 0; i < _n_gens; i++) {
_gens[i]->contribute_scratch(res, requestor, max_alloc_words);
}
_young_gen->contribute_scratch(res, requestor, max_alloc_words);
_old_gen->contribute_scratch(res, requestor, max_alloc_words);
sort_scratch_list(res);
return res;
}
void GenCollectedHeap::release_scratch() {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->reset_scratch();
}
_young_gen->reset_scratch();
_old_gen->reset_scratch();
}
class GenPrepareForVerifyClosure: public GenCollectedHeap::GenClosure {
@ -1021,39 +1007,29 @@ void GenCollectedHeap::prepare_for_verify() {
generation_iterate(&blk, false);
}
void GenCollectedHeap::generation_iterate(GenClosure* cl,
bool old_to_young) {
if (old_to_young) {
for (int i = _n_gens-1; i >= 0; i--) {
cl->do_generation(_gens[i]);
}
cl->do_generation(_old_gen);
cl->do_generation(_young_gen);
} else {
for (int i = 0; i < _n_gens; i++) {
cl->do_generation(_gens[i]);
}
cl->do_generation(_young_gen);
cl->do_generation(_old_gen);
}
}
void GenCollectedHeap::space_iterate(SpaceClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->space_iterate(cl, true);
}
_young_gen->space_iterate(cl, true);
_old_gen->space_iterate(cl, true);
}
bool GenCollectedHeap::is_maximal_no_gc() const {
for (int i = 0; i < _n_gens; i++) {
if (!_gens[i]->is_maximal_no_gc()) {
return false;
}
}
return true;
return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
}
void GenCollectedHeap::save_marks() {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->save_marks();
}
_young_gen->save_marks();
_old_gen->save_marks();
}
GenCollectedHeap* GenCollectedHeap::heap() {
@ -1065,27 +1041,33 @@ GenCollectedHeap* GenCollectedHeap::heap() {
void GenCollectedHeap::prepare_for_compaction() {
guarantee(_n_gens = 2, "Wrong number of generations");
Generation* old_gen = _gens[1];
// Start by compacting into same gen.
CompactPoint cp(old_gen);
old_gen->prepare_for_compaction(&cp);
Generation* young_gen = _gens[0];
young_gen->prepare_for_compaction(&cp);
CompactPoint cp(_old_gen);
_old_gen->prepare_for_compaction(&cp);
_young_gen->prepare_for_compaction(&cp);
}
GCStats* GenCollectedHeap::gc_stats(int level) const {
return _gens[level]->gc_stats();
if (level == 0) {
return _young_gen->gc_stats();
} else {
return _old_gen->gc_stats();
}
}
void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
for (int i = _n_gens-1; i >= 0; i--) {
Generation* g = _gens[i];
if (!silent) {
gclog_or_tty->print("%s", g->name());
gclog_or_tty->print(" ");
}
g->verify();
if (!silent) {
gclog_or_tty->print("%s", _old_gen->name());
gclog_or_tty->print(" ");
}
_old_gen->verify();
if (!silent) {
gclog_or_tty->print("%s", _young_gen->name());
gclog_or_tty->print(" ");
}
_young_gen->verify();
if (!silent) {
gclog_or_tty->print("remset ");
}
@ -1093,9 +1075,8 @@ void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
}
void GenCollectedHeap::print_on(outputStream* st) const {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->print_on(st);
}
_young_gen->print_on(st);
_old_gen->print_on(st);
MetaspaceAux::print_on(st);
}

View File

@ -33,7 +33,7 @@
class SubTasksDone;
// A "GenCollectedHeap" is a SharedHeap that uses generational
// collection. It is represented with a sequence of Generation's.
// collection. It has two generations, young and old.
class GenCollectedHeap : public SharedHeap {
friend class GenCollectorPolicy;
friend class Generation;
@ -63,7 +63,10 @@ public:
private:
int _n_gens;
Generation* _gens[max_gens];
Generation* _young_gen;
Generation* _old_gen;
GenerationSpec** _gen_specs;
// The singleton Gen Remembered Set.
@ -85,6 +88,11 @@ public:
SubTasksDone* _gen_process_roots_tasks;
SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
// Collects the given generation.
void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
bool run_verification, bool clear_soft_refs,
bool restore_marks_for_biased_locking);
// In block contents verification, the number of header words to skip
NOT_PRODUCT(static size_t _skip_header_HeapWords;)
@ -138,8 +146,12 @@ public:
return CollectedHeap::GenCollectedHeap;
}
Generation* young_gen() { return _young_gen; }
Generation* old_gen() { return _old_gen; }
// The generational collector policy.
GenCollectorPolicy* gen_policy() const { return _gen_policy; }
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
// Adaptive size policy
@ -309,20 +321,17 @@ public:
// Update above counter, as appropriate, at the end of a concurrent GC cycle
unsigned int update_full_collections_completed(unsigned int count);
// Update "time of last gc" for all constituent generations
// to "now".
// Update "time of last gc" for all generations to "now".
void update_time_of_last_gc(jlong now) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->update_time_of_last_gc(now);
}
_young_gen->update_time_of_last_gc(now);
_old_gen->update_time_of_last_gc(now);
}
// Update the gc statistics for each generation.
// "level" is the level of the latest collection.
void update_gc_stats(int current_level, bool full) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->update_gc_stats(current_level, full);
}
_young_gen->update_gc_stats(current_level, full);
_old_gen->update_gc_stats(current_level, full);
}
// Override.
@ -366,21 +375,23 @@ public:
// Return the generation before "gen".
Generation* prev_gen(Generation* gen) const {
int l = gen->level();
guarantee(l > 0, "Out of bounds");
return _gens[l-1];
guarantee(gen->level() == 1, "Out of bounds");
return _young_gen;
}
// Return the generation after "gen".
Generation* next_gen(Generation* gen) const {
int l = gen->level() + 1;
guarantee(l < _n_gens, "Out of bounds");
return _gens[l];
guarantee(gen->level() == 0, "Out of bounds");
return _old_gen;
}
Generation* get_gen(int i) const {
guarantee(i >= 0 && i < _n_gens, "Out of bounds");
return _gens[i];
guarantee(i == 0 || i == 1, "Out of bounds");
if (i == 0) {
return _young_gen;
} else {
return _old_gen;
}
}
int n_gens() const {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -159,7 +159,7 @@ void GenMarkSweep::allocate_stacks() {
GenCollectedHeap* gch = GenCollectedHeap::heap();
// Scratch request on behalf of oldest generation; will do no
// allocation.
ScratchBlock* scratch = gch->gather_scratch(gch->_gens[gch->_n_gens-1], 0);
ScratchBlock* scratch = gch->gather_scratch(gch->get_gen(gch->_n_gens-1), 0);
// $$$ To cut a corner, we'll only use the first scratch block, and then
// revert to malloc.

View File

@ -26,6 +26,7 @@
#include "classfile/classLoaderData.hpp"
#include "memory/cardTableRS.hpp"
#include "memory/genRemSet.hpp"
#include "oops/klass.hpp"
// This kind of "BarrierSet" allows a "CollectedHeap" to detect and
// enumerate ref fields that have been modified (since the last

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -155,7 +155,7 @@ Generation* Generation::next_gen() const {
GenCollectedHeap* gch = GenCollectedHeap::heap();
int next = level() + 1;
if (next < gch->_n_gens) {
return gch->_gens[next];
return gch->get_gen(next);
} else {
return NULL;
}

View File

@ -23,7 +23,6 @@
*/
#include "precompiled.hpp"
#include "gc_implementation/shared/markSweep.inline.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/rewriter.hpp"
#include "memory/universe.inline.hpp"

View File

@ -41,7 +41,6 @@
#if INCLUDE_ALL_GCS
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#include "oops/oop.pcgc.inline.hpp"
#endif // INCLUDE_ALL_GCS

View File

@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc_implementation/shared/markSweep.inline.hpp"
#include "memory/gcLocker.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"

View File

@ -33,7 +33,6 @@
#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
#include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#endif // INCLUDE_ALL_GCS
inline void oopDesc::update_contents(ParCompactionManager* cm) {

View File

@ -29,7 +29,6 @@
#if INCLUDE_ALL_GCS
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#endif // INCLUDE_ALL_GCS
// ParallelScavengeHeap methods

View File

@ -90,8 +90,6 @@
# include "gc_implementation/shared/gcUtil.hpp"
# include "gc_implementation/shared/generationCounters.hpp"
# include "gc_implementation/shared/immutableSpace.hpp"
# include "gc_implementation/shared/markSweep.hpp"
# include "gc_implementation/shared/markSweep.inline.hpp"
# include "gc_implementation/shared/mutableSpace.hpp"
# include "gc_implementation/shared/spaceCounters.hpp"
# include "gc_implementation/shared/spaceDecorator.hpp"

View File

@ -3840,12 +3840,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages");
#endif
#if INCLUDE_ALL_GCS
#if (defined JAVASE_EMBEDDED || defined ARM)
UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
#endif
#endif
ArgumentsExt::report_unsupported_options();
#ifndef PRODUCT

View File

@ -214,4 +214,8 @@ ResetNoHandleMark::~ResetNoHandleMark() {
area->_no_handle_mark_nesting = _no_handle_mark_nesting;
}
bool instanceKlassHandle::is_instanceKlass(const Klass* k) {
return k->oop_is_instance();
}
#endif

View File

@ -25,7 +25,11 @@
#ifndef SHARE_VM_RUNTIME_HANDLES_HPP
#define SHARE_VM_RUNTIME_HANDLES_HPP
#include "oops/klass.hpp"
#include "oops/oop.hpp"
#include "oops/oopsHierarchy.hpp"
class InstanceKlass;
class Klass;
//------------------------------------------------------------------------------------------------------------------------
// In order to preserve oops during garbage collection, they should be
@ -201,16 +205,16 @@ class instanceKlassHandle : public KlassHandle {
/* Constructors */
instanceKlassHandle () : KlassHandle() {}
instanceKlassHandle (const Klass* k) : KlassHandle(k) {
assert(k == NULL || k->oop_is_instance(),
"illegal type");
assert(k == NULL || is_instanceKlass(k), "illegal type");
}
instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) {
assert(k == NULL || k->oop_is_instance(),
"illegal type");
assert(k == NULL || is_instanceKlass(k), "illegal type");
}
/* Access to klass part */
InstanceKlass* operator () () const { return (InstanceKlass*)obj(); }
InstanceKlass* operator -> () const { return (InstanceKlass*)obj(); }
debug_only(bool is_instanceKlass(const Klass* k));
};

View File

@ -23,7 +23,6 @@
*/
#include "precompiled.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "memory/genCollectedHeap.hpp"

View File

@ -67,7 +67,6 @@
#if INCLUDE_ALL_GCS
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#endif // INCLUDE_ALL_GCS
#ifdef COMPILER1
#include "c1/c1_Compiler.hpp"

View File

@ -46,7 +46,6 @@
#include "compiler/oopMap.hpp"
#include "compiler/compileBroker.hpp"
#include "gc_implementation/shared/immutableSpace.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_implementation/shared/mutableSpace.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "interpreter/bytecodeInterpreter.hpp"
@ -552,8 +551,9 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
nonstatic_field(GenerationSpec, _max_size, size_t) \
\
static_field(GenCollectedHeap, _gch, GenCollectedHeap*) \
nonstatic_field(GenCollectedHeap, _young_gen, Generation*) \
nonstatic_field(GenCollectedHeap, _old_gen, Generation*) \
nonstatic_field(GenCollectedHeap, _n_gens, int) \
unchecked_nonstatic_field(GenCollectedHeap, _gens, sizeof(GenCollectedHeap::_gens)) /* NOTE: no type */ \
nonstatic_field(GenCollectedHeap, _gen_specs, GenerationSpec**) \
\
nonstatic_field(HeapWord, i, char*) \

View File

@ -22,7 +22,7 @@
*
*/
#include "precompiled.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/mutexLocker.hpp"
#include "services/nmtDCmd.hpp"
#include "services/memReporter.hpp"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/runtimeService.hpp"

View File

@ -30,7 +30,6 @@
#include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "interpreter/bytecodeHistogram.hpp"
#include "interpreter/interpreter.hpp"

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -143,11 +143,24 @@ ifndef PRODUCT_HOME
endif
# Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
JAVA_OPTIONS =
JAVA_OPTIONS =
ifdef JAVA_ARGS
JAVA_OPTIONS = $(JAVA_ARGS)
endif
# jtreg -nativepath <dir>
#
# Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
# should be JPRT_TESTNATIVE_PATH
ifdef TEST_IMAGE_DIR
TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
else ifdef JPRT_TESTNATIVE_PATH
TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
endif
ifdef TESTNATIVE_DIR
JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/hotspot/jtreg/native")
endif
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ifdef JPRT_ARCHIVE_BUNDLE
@ -303,6 +316,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_NATIVE_PATH) \
$(JTREG_EXCLUSIONS) \
$(JTREG_TEST_OPTIONS) \
$(TEST_SELECTION) \
@ -313,7 +327,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
PHONY_LIST += jtreg_tests
# flags used to execute java in test targets
TEST_FLAGS += -version -Xinternalversion -X -help
TEST_FLAGS += -version -Xinternalversion -X -help
sanitytest: prep $(PRODUCT_HOME)
@for flag in $(TEST_FLAGS); \

View File

@ -334,6 +334,9 @@ applicable_cmsgc = \
hotspot_wbapitest = \
sanity/
hotspot_native_sanity = \
native_sanity
hotspot_compiler_1 = \
compiler/arraycopy/ \
compiler/c1/ \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* 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,7 @@ import java.nio.charset.Charset;
import java.util.List;
public class CompressedClassSpaceSizeInJmapHeap {
// Note that on some platforms it may require root privileges to run this test.
public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) {
// Compressed Class Space is only available on 64-bit JVMs

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* 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
* @run main/native JniVersion
*/
public class JniVersion {
public static final int JNI_VERSION_1_8 = 0x00010008;
public static void main(String... args) throws Exception {
System.loadLibrary("JniVersion");
int res = getJniVersion();
if (res < JNI_VERSION_1_8) {
throw new Exception("Unexpected value returned from getJniVersion(): 0x" + Integer.toHexString(res));
}
}
static native int getJniVersion();
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <jni.h>
JNIEXPORT jint JNICALL
Java_JniVersion_getJniVersion(JNIEnv *env, jclass clz) {
return (*env)->GetVersion(env);
}

View File

@ -294,3 +294,4 @@ e391de88e69b59d7c618387e3cf91032f6991ce9 jdk9-b47
786058752e0ac3e48d7aef79e0885d29d6a2a7eb jdk9-b49
74ead7bddde19263fd463bc1bd87de84f27d1b5e jdk9-b50
7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51
57b26c883d54f45912bc3885ccad3c6b80960b1f jdk9-b52

View File

@ -297,3 +297,4 @@ e529374fbe526dbd668e5e98fc047b42b3bc6d33 jdk9-b45
435a49db1de0589acc86b2cc5fd61d546f94b56c jdk9-b49
45a30e7ee623031a1532685512dd2c2d8e8fa0ad jdk9-b50
bb9cf97a5ac6aa1aa2a1034676d64413071f58ea jdk9-b51
1d1e7704eca9c77ebe6a8705d17ac568801f7a3b jdk9-b52

View File

@ -30,6 +30,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
@ -85,19 +87,25 @@ public final class ClassFactory {
if(consRef!=null)
cons = consRef.get();
if(cons==null) {
try {
cons = clazz.getDeclaredConstructor(emptyClass);
} catch (NoSuchMethodException e) {
logger.log(Level.INFO,"No default constructor found on "+clazz,e);
NoSuchMethodError exp;
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName()));
} else {
exp = new NoSuchMethodError(e.getMessage());
cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() {
@Override
public Constructor<T> run() {
try {
return clazz.getDeclaredConstructor(emptyClass);
} catch (NoSuchMethodException e) {
logger.log(Level.INFO,"No default constructor found on "+clazz,e);
NoSuchMethodError exp;
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS
.format(clazz.getName()));
} else {
exp = new NoSuchMethodError(e.getMessage());
}
exp.initCause(e);
throw exp;
}
}
exp.initCause(e);
throw exp;
}
});
int classMod = clazz.getModifiers();

View File

@ -36,9 +36,6 @@ import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
//TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver
import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
//TODO MtomCodec
import com.sun.xml.internal.bind.v2.runtime.output.Encoded;
//TODO ExceptionBean
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

View File

@ -25,8 +25,6 @@
package com.sun.tools.internal.ws.wsdl.document.soap;
import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
import javax.xml.namespace.QName;
/**
@ -37,7 +35,9 @@ import javax.xml.namespace.QName;
public interface SOAPConstants {
// namespace URIs
public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
public static final String URI_ENVELOPE =
"http://schemas.xmlsoap.org/soap/envelope/";
public static final String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/";
public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";

View File

@ -294,3 +294,4 @@ ebb2eb7f1aec78eb6d8cc4c96f018afa11093cde jdk9-b48
541a8cef4e0d54c3e4b52a98c6af3c31e2096669 jdk9-b49
f6b8edd397ee463be208fee27517c99101293267 jdk9-b50
a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51
607ea68032cd4a4cf2c7a7a41fcb39602d6a75e2 jdk9-b52

View File

@ -0,0 +1 @@
0x15 U+0085

View File

@ -0,0 +1,256 @@
0x00 U+0000
0x01 U+0001
0x02 U+0002
0x03 U+0003
0x04 U+009c
0x05 U+0009
0x06 U+0086
0x07 U+007f
0x08 U+0097
0x09 U+008d
0x0a U+008e
0x0b U+000b
0x0c U+000c
0x0d U+000d
0x0e U+000e
0x0f U+000f
0x10 U+0010
0x11 U+0011
0x12 U+0012
0x13 U+0013
0x14 U+009d
0x15 U+000a
0x16 U+0008
0x17 U+0087
0x18 U+0018
0x19 U+0019
0x1a U+0092
0x1b U+008f
0x1c U+001c
0x1d U+001d
0x1e U+001e
0x1f U+001f
0x20 U+0080
0x21 U+0081
0x22 U+0082
0x23 U+0083
0x24 U+0084
0x25 U+000a
0x26 U+0017
0x27 U+001b
0x28 U+0088
0x29 U+0089
0x2a U+008a
0x2b U+008b
0x2c U+008c
0x2d U+0005
0x2e U+0006
0x2f U+0007
0x30 U+0090
0x31 U+0091
0x32 U+0016
0x33 U+0093
0x34 U+0094
0x35 U+0095
0x36 U+0096
0x37 U+0004
0x38 U+0098
0x39 U+0099
0x3a U+009a
0x3b U+009b
0x3c U+0014
0x3d U+0015
0x3e U+009e
0x3f U+001a
0x40 U+0020
0x41 U+00a0
0x42 U+04d9
0x43 U+0493
0x44 U+0451
0x45 U+0454
0x46 U+0455
0x47 U+0456
0x48 U+049b
0x49 U+0458
0x4a U+005b
0x4b U+002e
0x4c U+003c
0x4d U+0028
0x4e U+002b
0x4f U+0021
0x50 U+0026
0x51 U+04a3
0x52 U+04e9
0x53 U+04b1
0x54 U+04af
0x55 U+045e
0x56 U+04bb
0x57 U+042a
0x58 U+2116
0x59 U+04d8
0x5a U+005d
0x5b U+0024
0x5c U+002a
0x5d U+0029
0x5e U+003b
0x5f U+005e
0x60 U+002d
0x61 U+002f
0x62 U+0492
0x63 U+0401
0x64 U+0404
0x65 U+0405
0x66 U+0406
0x67 U+049a
0x68 U+0408
0x69 U+04a2
0x6a U+007c
0x6b U+002c
0x6c U+0025
0x6d U+005f
0x6e U+003e
0x6f U+003f
0x70 U+04e8
0x71 U+04b0
0x72 U+04ae
0x73 U+00ad
0x74 U+040e
0x75 U+04ba
0x76 U+044e
0x77 U+0430
0x78 U+0431
0x79 U+0060
0x7a U+003a
0x7b U+0023
0x7c U+0040
0x7d U+0027
0x7e U+003d
0x7f U+0022
0x80 U+0446
0x81 U+0061
0x82 U+0062
0x83 U+0063
0x84 U+0064
0x85 U+0065
0x86 U+0066
0x87 U+0067
0x88 U+0068
0x89 U+0069
0x8a U+0434
0x8b U+0435
0x8c U+0444
0x8d U+0433
0x8e U+0445
0x8f U+0438
0x90 U+0439
0x91 U+006a
0x92 U+006b
0x93 U+006c
0x94 U+006d
0x95 U+006e
0x96 U+006f
0x97 U+0070
0x98 U+0071
0x99 U+0072
0x9a U+043a
0x9b U+043b
0x9c U+043c
0x9d U+043d
0x9e U+043e
0x9f U+043f
0xa0 U+044f
0xa1 U+007e
0xa2 U+0073
0xa3 U+0074
0xa4 U+0075
0xa5 U+0076
0xa6 U+0077
0xa7 U+0078
0xa8 U+0079
0xa9 U+007a
0xaa U+0440
0xab U+0441
0xac U+0442
0xad U+0443
0xae U+0436
0xaf U+0432
0xb0 U+044c
0xb1 U+044b
0xb2 U+0437
0xb3 U+0448
0xb4 U+044d
0xb5 U+0449
0xb6 U+0447
0xb7 U+044a
0xb8 U+042e
0xb9 U+0410
0xba U+0411
0xbb U+0426
0xbc U+0414
0xbd U+0415
0xbe U+0424
0xbf U+0413
0xc0 U+007b
0xc1 U+0041
0xc2 U+0042
0xc3 U+0043
0xc4 U+0044
0xc5 U+0045
0xc6 U+0046
0xc7 U+0047
0xc8 U+0048
0xc9 U+0049
0xca U+0425
0xcb U+0418
0xcc U+0419
0xcd U+041a
0xce U+041b
0xcf U+041c
0xd0 U+007d
0xd1 U+004a
0xd2 U+004b
0xd3 U+004c
0xd4 U+004d
0xd5 U+004e
0xd6 U+004f
0xd7 U+0050
0xd8 U+0051
0xd9 U+0052
0xda U+041d
0xdb U+041e
0xdc U+041f
0xdd U+042f
0xde U+0420
0xdf U+0421
0xe0 U+005c
0xe1 U+20ac
0xe2 U+0053
0xe3 U+0054
0xe4 U+0055
0xe5 U+0056
0xe6 U+0057
0xe7 U+0058
0xe8 U+0059
0xe9 U+005a
0xea U+0422
0xeb U+0423
0xec U+0416
0xed U+0412
0xee U+042c
0xef U+042b
0xf0 U+0030
0xf1 U+0031
0xf2 U+0032
0xf3 U+0033
0xf4 U+0034
0xf5 U+0035
0xf6 U+0036
0xf7 U+0037
0xf8 U+0038
0xf9 U+0039
0xfa U+0417
0xfb U+0428
0xfc U+042d
0xfd U+0429
0xfe U+0427
0xff U+009f

View File

@ -0,0 +1 @@
0x25 U+000a

View File

@ -503,7 +503,7 @@ charset x-windows-874 MS874
charset x-EUC-TW EUC_TW
package sun.nio.cs.ext
type source
type template
alias euc_tw # JDK historical
alias euctw
alias cns11643
@ -1660,6 +1660,16 @@ charset IBM290 IBM290
alias EBCDIC-JP-kana
alias 290
charset x-IBM1166 IBM1166
package sun.nio.cs.ext
type sbcs
hisname Cp1166
ascii false
alias cp1166
alias ibm1166
alias ibm-1166
alias 1166
charset x-IBM300 IBM300
package sun.nio.cs.ext
type dbcsonly
@ -1816,3 +1826,17 @@ charset x-JIS0212_MS5022X JIS_X_0212_MS5022X
ascii false
minmax 0x21 0x7e 0x21 0x7e
internal true # "internal implementation
########################################################
#
# platform specific charsets, to be registered into spi
##
########################################################
charset x-COMPOUND_TEXT COMPOUND_TEXT
package sun.nio.cs.ext
type source
os unix
alias COMPOUND_TEXT # JDK historical
alias x11-compound_text
alias x-compound-text

View File

@ -57,6 +57,7 @@ IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext
IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext
IBM1166 x-IBM1166 Cp1166 false sun.nio.cs.ext
IBM273 IBM273 Cp273 false sun.nio.cs.ext
IBM277 IBM277 Cp277 false sun.nio.cs.ext
IBM278 IBM278 Cp278 false sun.nio.cs.ext

View File

@ -9,6 +9,7 @@ EUC_KR
EUC_JP
EUC_JP_LINUX
EUC_JP_Open
EUC_TW
GBK
ISO_8859_11
ISO_8859_3

View File

@ -50,7 +50,9 @@ $(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
extcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(CHARSET_EXTENDED_JAVA_DIR) $(LOG_INFO)
$(CHARSET_EXTENDED_JAVA_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
$(LOG_INFO)
$(TOUCH) '$@'
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \

View File

@ -32,6 +32,7 @@ CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
CHARSET_EXTSRC_DIR := $(JDK_TOPDIR)/src/jdk.charsets/share/classes/sun/nio/cs/ext
CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
CHARSET_TEMPLATES := \
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \
$(CHARSET_DATA_DIR)/DoubleByte-X.java.template
@ -46,7 +47,9 @@ $(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
$(MKDIR) -p $(@D)
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
stdcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) $(LOG_INFO)
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
$(LOG_INFO)
$(TOUCH) '$@'
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs

View File

@ -53,15 +53,21 @@ endef
# Param 1 - Variable to add targets to, must not contain space
# Param 2 - Properties files to process
# Param 3 - The super class for the generated classes
# Param 4 - Module path root, defaults to $(JDK_TOPDIR)/src
define SetupCompileProperties
$1_SRCS := $2
$1_CLASS := $3
$1_MODULE_PATH_ROOT := $4
ifeq ($$($1_MODULE_PATH_ROOT), )
$1_MODULE_PATH_ROOT := $(JDK_TOPDIR)/src
endif
# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
# Strip away prefix and suffix, leaving for example only:
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
$1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
$$(patsubst %.properties, %.java, \
$$(subst /$(OPENJDK_TARGET_OS)/classes,, \

View File

@ -31,6 +31,7 @@ class Charset {
String csName;
String hisName;
String type;
String os;
boolean isASCII;
int b1Min;
int b1Max;

View File

@ -80,12 +80,12 @@ public class EUC_TW {
private static Pattern euctw = Pattern.compile("(?:8ea)?(\\p{XDigit}++)\\s++(\\p{XDigit}++)?\\s*+.*");
static void genClass(String args[]) throws Exception
static void genClass(String pkg, String args[]) throws Exception
{
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
"ISO-8859-1");
String copyright = getCopyright(new File(args[3]));
String copyright = getCopyright(new File(args[7], "EUC_TW.java"));
// ranges of byte1 and byte2, something should come from a "config" file
@ -128,7 +128,7 @@ public class EUC_TW {
out.format(copyright);
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n");
out.format("package sun.nio.cs.ext;%n%n");
out.format("package %s;%n%n", pkg);
out.format("class EUC_TWMapping {%n%n");
// boundaries

View File

@ -42,7 +42,7 @@ public class HKSCS {
private static Pattern hkscs =
Pattern.compile("(?:0x)?+(\\p{XDigit}++)\\s++(?:0x|U\\+)?+(\\p{XDigit}++)?\\s*+(?:0x|U\\+)?(\\p{XDigit}++)?\\s*+.*");
static void genClass2008(String srcDir, String dstDir, String pkgName)
static void genClass2008(String srcDir, String dstDir, String pkgName, File copyright)
throws Exception
{
// hkscs2008
@ -53,10 +53,11 @@ public class HKSCS {
pkgName,
"HKSCSMapping",
true,
"");
getCopyright(copyright));
}
static void genClassXP(String srcDir, String dstDir, String pkgName)
static void genClassXP(String srcDir, String dstDir, String pkgName, File copyright)
throws Exception
{
genClass0(new FileInputStream(new File(srcDir, "HKSCS_XP.map")),
@ -66,7 +67,7 @@ public class HKSCS {
pkgName,
"HKSCS_XPMapping",
false,
"");
getCopyright(copyright));
}
static void genClass2001(String args[]) throws Exception {

View File

@ -41,6 +41,7 @@ public class Main {
int OS = 4;
int TEMPLATE = 5;
int EXT_SRC = 6;
int COPYRIGHT_SRC = 7;
if (args.length < 3 ) {
System.out.println("Usage: java -jar charsetmapping.jar src dst spiType charsets os [template]");
@ -54,6 +55,7 @@ public class Main {
String[] osStdcs = getOSStdCSList(new File(args[SRC_DIR], args[OS]));
boolean hasBig5_HKSCS = false;
boolean hasMS950_HKSCS_XP = false;
boolean hasEUC_TW = false;
for (String name : osStdcs) {
Charset cs = charsets.get(name);
if (cs != null) {
@ -63,6 +65,8 @@ public class Main {
hasBig5_HKSCS = true;
} else if (name.equals("MS950_HKSCS_XP")) {
hasMS950_HKSCS_XP = true;
} else if (name.equals("EUC_TW")) {
hasEUC_TW = true;
}
}
for (Charset cs : charsets.values()) {
@ -89,19 +93,28 @@ public class Main {
}
}
// provider StandardCharsets.java / ExtendedCharsets.java
SPI.genClass(args[TYPE], charsets, args[SRC_DIR], args[DST_DIR], args[TEMPLATE]);
SPI.genClass(args[TYPE], charsets,
args[SRC_DIR], args[DST_DIR],
args[TEMPLATE],
args[OS].endsWith("windows") ? "windows" : "unix");
// HKSCSMapping2008/XP.java goes together with Big5/MS950XP_HKSCS
if (isStandard && hasBig5_HKSCS || isExtended && !hasBig5_HKSCS) {
HKSCS.genClass2008(args[SRC_DIR], args[DST_DIR],
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
new File(args[COPYRIGHT_SRC], "HKSCS.java"));
}
if (isStandard && hasMS950_HKSCS_XP || isExtended && !hasMS950_HKSCS_XP) {
HKSCS.genClassXP(args[SRC_DIR], args[DST_DIR],
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext");
isStandard ? "sun.nio.cs" : "sun.nio.cs.ext",
new File(args[COPYRIGHT_SRC], "HKSCS.java"));
}
if (isStandard && hasEUC_TW) {
EUC_TW.genClass("sun.nio.cs", args);
}
if (!isStandard && !hasEUC_TW) {
EUC_TW.genClass("sun.nio.cs.ext", args);
}
} else if ("euctw".equals(args[TYPE])) {
EUC_TW.genClass(args);
} else if ("sjis0213".equals(args[TYPE])) {
JIS0213.genClass(args);
} else if ("hkscs".equals(args[TYPE])) {
@ -157,6 +170,9 @@ public class Main {
case "type":
cs.type = tokens[2];
break;
case "os":
cs.os = tokens[2];
break;
case "hisname":
cs.hisName = tokens[2];
break;

View File

@ -33,8 +33,10 @@ import java.util.Scanner;
public class SPI {
public static void genClass(String type, LinkedHashMap<String, Charset> charsets,
String srcDir, String dstDir, String template)
public static void genClass(String type,
LinkedHashMap<String, Charset> charsets,
String srcDir, String dstDir, String template,
String os)
throws Exception
{
try (Scanner s = new Scanner(new File(template));
@ -50,7 +52,8 @@ public class SPI {
charsets.values()
.stream()
.filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") &&
!cs.isInternal)
!cs.isInternal &&
(cs.os == null || cs.os.equals(os)))
.forEach( cs -> {
out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName);
out.printf(" new String[] {%n");

View File

@ -1063,16 +1063,24 @@ public final class Class<T> implements java.io.Serializable,
parameterClasses[i] = toClass(parameterTypes[i]);
// Perform access check
Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Method[] candidates = AccessController.doPrivileged(
new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
return enclosingCandidate.getDeclaredMethods();
}
});
/*
* Loop over all declared methods; match method name,
* number of and type of parameters, *and* return
* type. Matching return type is also necessary
* because of covariant returns, etc.
*/
for(Method m: enclosingCandidate.getDeclaredMethods()) {
for(Method m: candidates) {
if (m.getName().equals(enclosingInfo.getName()) ) {
Class<?>[] candidateParamClasses = m.getParameterTypes();
if (candidateParamClasses.length == parameterClasses.length) {
@ -1215,14 +1223,22 @@ public final class Class<T> implements java.io.Serializable,
parameterClasses[i] = toClass(parameterTypes[i]);
// Perform access check
Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true);
// Client is ok to access declared methods but j.l.Class might not be.
Constructor<?>[] candidates = AccessController.doPrivileged(
new PrivilegedAction<Constructor<?>[]>() {
@Override
public Constructor<?>[] run() {
return enclosingCandidate.getDeclaredConstructors();
}
});
/*
* Loop over all declared constructors; match number
* of and type of parameters.
*/
for(Constructor<?> c: enclosingCandidate.getDeclaredConstructors()) {
for(Constructor<?> c: candidates) {
Class<?>[] candidateParamClasses = c.getParameterTypes();
if (candidateParamClasses.length == parameterClasses.length) {
boolean matches = true;

View File

@ -35,6 +35,7 @@ import static java.lang.invoke.MethodTypeForm.*;
import static java.lang.invoke.MethodHandleStatics.*;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.util.Objects;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyType;
import sun.invoke.util.Wrapper;
@ -439,8 +440,7 @@ class DirectMethodHandle extends MethodHandle {
// Therefore, the only remaining check is for null.
// Since this check is *not* guaranteed by Unsafe.getInt
// and its siblings, we need to make an explicit one here.
obj.getClass(); // maybe throw NPE
return obj;
return Objects.requireNonNull(obj);
}
/** This subclass handles static field references. */
@ -468,8 +468,7 @@ class DirectMethodHandle extends MethodHandle {
@ForceInline
/*non-public*/ static Object nullCheck(Object obj) {
obj.getClass();
return obj;
return Objects.requireNonNull(obj);
}
@ForceInline

View File

@ -521,7 +521,7 @@ import java.util.Objects;
}
@SuppressWarnings("LeakingThisInConstructor")
public MemberName(Method m, boolean wantSpecial) {
m.getClass(); // NPE check
Objects.requireNonNull(m);
// fill in vmtarget, vmindex while we have m in hand:
MethodHandleNatives.init(this, m);
if (clazz == null) { // MHN.init failed
@ -600,7 +600,7 @@ import java.util.Objects;
/** Create a name for the given reflected constructor. The resulting name will be in a resolved state. */
@SuppressWarnings("LeakingThisInConstructor")
public MemberName(Constructor<?> ctor) {
ctor.getClass(); // NPE check
Objects.requireNonNull(ctor);
// fill in vmtarget, vmindex while we have ctor in hand:
MethodHandleNatives.init(this, ctor);
assert(isResolved() && this.clazz != null);
@ -615,7 +615,7 @@ import java.util.Objects;
}
@SuppressWarnings("LeakingThisInConstructor")
public MemberName(Field fld, boolean makeSetter) {
fld.getClass(); // NPE check
Objects.requireNonNull(fld);
// fill in vmtarget, vmindex while we have fld in hand:
MethodHandleNatives.init(this, fld);
assert(isResolved() && this.clazz != null);

View File

@ -453,10 +453,8 @@ public abstract class MethodHandle {
*/
// @param type type (permanently assigned) of the new method handle
/*non-public*/ MethodHandle(MethodType type, LambdaForm form) {
type.getClass(); // explicit NPE
form.getClass(); // explicit NPE
this.type = type;
this.form = form.uncustomize();
this.type = Objects.requireNonNull(type);
this.form = Objects.requireNonNull(form).uncustomize();
this.form.prepare(); // TO DO: Try to delay this step until just before invocation.
}
@ -1171,7 +1169,7 @@ assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
* @see #asFixedArity
*/
public MethodHandle asVarargsCollector(Class<?> arrayType) {
arrayType.getClass(); // explicit NPE
Objects.requireNonNull(arrayType);
boolean lastMatch = asCollectorChecks(arrayType, 0);
if (isVarargsCollector() && lastMatch)
return this;

View File

@ -29,6 +29,7 @@ import java.lang.reflect.*;
import java.util.BitSet;
import java.util.List;
import java.util.Arrays;
import java.util.Objects;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyAccess;
@ -632,7 +633,7 @@ public class MethodHandles {
* @throws NullPointerException if the argument is null
*/
public Lookup in(Class<?> requestedLookupClass) {
requestedLookupClass.getClass(); // null check
Objects.requireNonNull(requestedLookupClass);
if (allowedModes == TRUSTED) // IMPL_LOOKUP can make any lookup at all
return new Lookup(requestedLookupClass, ALL_MODES);
if (requestedLookupClass == this.lookupClass)
@ -1367,16 +1368,16 @@ return mh1;
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, Class<?> type) throws NoSuchFieldException, IllegalAccessException {
checkSymbolicClass(refc); // do this before attempting to resolve
name.getClass(); // NPE
type.getClass(); // NPE
Objects.requireNonNull(name);
Objects.requireNonNull(type);
return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
NoSuchFieldException.class);
}
MemberName resolveOrFail(byte refKind, Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException {
checkSymbolicClass(refc); // do this before attempting to resolve
name.getClass(); // NPE
type.getClass(); // NPE
Objects.requireNonNull(name);
Objects.requireNonNull(type);
checkMethodName(refKind, name); // NPE check on name
return IMPL_NAMES.resolveOrFail(refKind, new MemberName(refc, name, type, refKind), lookupClassOrNull(),
NoSuchMethodException.class);
@ -1384,14 +1385,14 @@ return mh1;
MemberName resolveOrFail(byte refKind, MemberName member) throws ReflectiveOperationException {
checkSymbolicClass(member.getDeclaringClass()); // do this before attempting to resolve
member.getName().getClass(); // NPE
member.getType().getClass(); // NPE
Objects.requireNonNull(member.getName());
Objects.requireNonNull(member.getType());
return IMPL_NAMES.resolveOrFail(refKind, member, lookupClassOrNull(),
ReflectiveOperationException.class);
}
void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
refc.getClass(); // NPE
Objects.requireNonNull(refc);
Class<?> caller = lookupClassOrNull();
if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes))
throw new MemberName(refc).makeAccessException("symbolic reference class is not public", this);

View File

@ -25,6 +25,7 @@
package java.lang.invoke;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -275,7 +276,7 @@ public class MutableCallSite extends CallSite {
if (sites.length == 0) return;
STORE_BARRIER.lazySet(0);
for (MutableCallSite site : sites) {
site.getClass(); // trigger NPE on first null
Objects.requireNonNull(site); // trigger NPE on first null
}
// FIXME: NYI
}

View File

@ -296,7 +296,8 @@ public final class Constructor<T> extends Executable {
* constructor has default (package) access.
*
* @return a string describing this {@code Constructor}
* @jls 8.8.3. Constructor Modifiers
* @jls 8.8.3 Constructor Modifiers
* @jls 8.9.2 Enum Body Declarations
*/
public String toString() {
return sharedToString(Modifier.constructorModifiers(),
@ -342,7 +343,8 @@ public final class Constructor<T> extends Executable {
* include type parameters
*
* @since 1.5
* @jls 8.8.3. Constructor Modifiers
* @jls 8.8.3 Constructor Modifiers
* @jls 8.9.2 Enum Body Declarations
*/
@Override
public String toGenericString() {

View File

@ -356,6 +356,8 @@ public final class Method extends Executable {
* @return a string describing this {@code Method}
*
* @jls 8.4.3 Method Modifiers
* @jls 9.4 Method Declarations
* @jls 9.6.1 Annotation Type Elements
*/
public String toString() {
return sharedToString(Modifier.methodModifiers(),
@ -409,6 +411,8 @@ public final class Method extends Executable {
* @since 1.5
*
* @jls 8.4.3 Method Modifiers
* @jls 9.4 Method Declarations
* @jls 9.6.1 Annotation Type Elements
*/
@Override
public String toGenericString() {

View File

@ -388,14 +388,13 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
while (iProxy.hasNext()) {
p = iProxy.next();
if (p == null || p == Proxy.NO_PROXY) {
if (p == null || p.type() != Proxy.Type.SOCKS) {
super.connect(epoint, remainingMillis(deadlineMillis));
return;
}
if (p.type() != Proxy.Type.SOCKS)
throw new SocketException("Unknown proxy type : " + p.type());
if (!(p.address() instanceof InetSocketAddress))
throw new SocketException("Unknow address type for proxy: " + p);
throw new SocketException("Unknown address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString();
serverPort = ((InetSocketAddress) p.address()).getPort();
@ -707,13 +706,12 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
}
while (iProxy.hasNext()) {
p = iProxy.next();
if (p == null || p == Proxy.NO_PROXY) {
if (p == null || p.type() != Proxy.Type.SOCKS) {
return;
}
if (p.type() != Proxy.Type.SOCKS)
throw new SocketException("Unknown proxy type : " + p.type());
if (!(p.address() instanceof InetSocketAddress))
throw new SocketException("Unknow address type for proxy: " + p);
throw new SocketException("Unknown address type for proxy: " + p);
// Use getHostString() to avoid reverse lookups
server = ((InetSocketAddress) p.address()).getHostString();
serverPort = ((InetSocketAddress) p.address()).getPort();

View File

@ -27,8 +27,15 @@ package java.net;
import java.io.IOException;
import java.io.InputStream;
import java.net.spi.URLStreamHandlerProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import sun.security.util.SecurityConstants;
/**
@ -248,23 +255,19 @@ public final class URL implements java.io.Serializable {
* stream protocol handler.
* <li>If no {@code URLStreamHandlerFactory} has yet been set up,
* or if the factory's {@code createURLStreamHandler} method
* returns {@code null}, then the constructor finds the
* value of the system property:
* <blockquote><pre>
* java.protocol.handler.pkgs
* </pre></blockquote>
* If the value of that system property is not {@code null},
* it is interpreted as a list of packages separated by a vertical
* slash character '{@code |}'. The constructor tries to load
* the class named:
* <blockquote><pre>
* &lt;<i>package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler
* </pre></blockquote>
* where &lt;<i>package</i>&gt; is replaced by the name of the package
* and &lt;<i>protocol</i>&gt; is replaced by the name of the protocol.
* If this class does not exist, or if the class exists but it is not
* a subclass of {@code URLStreamHandler}, then the next package
* in the list is tried.
* returns {@code null}, then the {@linkplain java.util.ServiceLoader
* ServiceLoader} mechanism is used to locate {@linkplain
* java.net.spi.URLStreamHandlerProvider URLStreamHandlerProvider}
* implementations using the system class
* loader. The order that providers are located is implementation
* specific, and an implementation is free to cache the located
* providers. A {@linkplain java.util.ServiceConfigurationError
* ServiceConfigurationError}, {@code Error} or {@code RuntimeException}
* thrown from the {@code createURLStreamHandler}, if encountered, will
* be propagated to the calling thread. The {@code
* createURLStreamHandler} method of each provider, if instantiated, is
* invoked, with the protocol string, until a provider returns non-null,
* or all providers have been exhausted.
* <li>If the previous step fails to find a protocol handler, then the
* constructor tries to load a built-in protocol handler.
* If this class does not exist, or if the class exists but it is not a
@ -277,8 +280,12 @@ public final class URL implements java.io.Serializable {
* <blockquote><pre>
* http, https, file, and jar
* </pre></blockquote>
* Protocol handlers for additional protocols may also be
* available.
* Protocol handlers for additional protocols may also be available.
* Some protocol handlers, for example those used for loading platform
* classes or classes on the class path, may not be overridden. The details
* of such restrictions, and when those restrictions apply (during
* initialization of the runtime for example), are implementation specific
* and therefore not specified
*
* <p>No validation of the inputs is performed by this constructor.
*
@ -1107,20 +1114,115 @@ public final class URL implements java.io.Serializable {
}
handlers.clear();
// ensure the core protocol handlers are loaded before setting
// a custom URLStreamHandlerFactory
ensureHandlersLoaded("jrt", "jar", "file");
// safe publication of URLStreamHandlerFactory with volatile write
factory = fac;
}
}
private static final URLStreamHandlerFactory defaultFactory = new DefaultFactory();
private static class DefaultFactory implements URLStreamHandlerFactory {
private static String PREFIX = "sun.net.www.protocol";
public URLStreamHandler createURLStreamHandler(String protocol) {
String name = PREFIX + "." + protocol + ".Handler";
try {
Class<?> c = Class.forName(name);
return (URLStreamHandler)c.newInstance();
} catch (ClassNotFoundException x) {
// ignore
} catch (Exception e) {
// For compatibility, all Exceptions are ignored.
// any number of exceptions can get thrown here
}
return null;
}
}
private static Iterator<URLStreamHandlerProvider> providers() {
return new Iterator<URLStreamHandlerProvider>() {
ClassLoader cl = ClassLoader.getSystemClassLoader();
ServiceLoader<URLStreamHandlerProvider> sl =
ServiceLoader.load(URLStreamHandlerProvider.class, cl);
Iterator<URLStreamHandlerProvider> i = sl.iterator();
URLStreamHandlerProvider next = null;
private boolean getNext() {
while (next == null) {
try {
if (!i.hasNext())
return false;
next = i.next();
} catch (ServiceConfigurationError sce) {
if (sce.getCause() instanceof SecurityException) {
// Ignore security exceptions
continue;
}
throw sce;
}
}
return true;
}
public boolean hasNext() {
return getNext();
}
public URLStreamHandlerProvider next() {
if (!getNext())
throw new NoSuchElementException();
URLStreamHandlerProvider n = next;
next = null;
return n;
}
};
}
// Thread-local gate to prevent recursive provider lookups
private static ThreadLocal<Object> gate = new ThreadLocal<>();
private static URLStreamHandler lookupViaProviders(final String protocol) {
if (!sun.misc.VM.isBooted())
return null;
if (gate.get() != null)
throw new Error("Circular loading of URL stream handler providers detected");
gate.set(gate);
try {
return AccessController.doPrivileged(
new PrivilegedAction<URLStreamHandler>() {
public URLStreamHandler run() {
Iterator<URLStreamHandlerProvider> itr = providers();
while (itr.hasNext()) {
URLStreamHandlerProvider f = itr.next();
URLStreamHandler h = f.createURLStreamHandler(protocol);
if (h != null)
return h;
}
return null;
}
});
} finally {
gate.set(null);
}
}
private static final String[] NON_OVERRIDEABLE_PROTOCOLS = {"file", "jrt"};
private static boolean isOverrideable(String protocol) {
for (String p : NON_OVERRIDEABLE_PROTOCOLS)
if (protocol.equalsIgnoreCase(p))
return false;
return true;
}
/**
* A table of protocol handlers.
*/
static Hashtable<String,URLStreamHandler> handlers = new Hashtable<>();
private static Object streamHandlerLock = new Object();
private static final Object streamHandlerLock = new Object();
/**
* Returns the Stream Handler.
@ -1129,66 +1231,33 @@ public final class URL implements java.io.Serializable {
static URLStreamHandler getURLStreamHandler(String protocol) {
URLStreamHandler handler = handlers.get(protocol);
if (handler == null) {
boolean checkedWithFactory = false;
if (handler != null) {
return handler;
}
URLStreamHandlerFactory fac;
boolean checkedWithFactory = false;
if (isOverrideable(protocol)) {
// Use the factory (if any). Volatile read makes
// URLStreamHandlerFactory appear fully initialized to current thread.
URLStreamHandlerFactory fac = factory;
fac = factory;
if (fac != null) {
handler = fac.createURLStreamHandler(protocol);
checkedWithFactory = true;
}
// Try java protocol handler
if (handler == null) {
String packagePrefixList = null;
packagePrefixList
= java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction(
protocolPathProp,""));
if (packagePrefixList != "") {
packagePrefixList += "|";
}
// REMIND: decide whether to allow the "null" class prefix
// or not.
packagePrefixList += "sun.net.www.protocol";
StringTokenizer packagePrefixIter =
new StringTokenizer(packagePrefixList, "|");
while (handler == null &&
packagePrefixIter.hasMoreTokens()) {
String packagePrefix =
packagePrefixIter.nextToken().trim();
try {
String clsName = packagePrefix + "." + protocol +
".Handler";
Class<?> cls = null;
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl != null) {
cls = cl.loadClass(clsName);
}
}
if (cls != null) {
handler =
(URLStreamHandler)cls.newInstance();
}
} catch (Exception e) {
// any number of exceptions can get thrown here
}
}
if (handler == null && !protocol.equalsIgnoreCase("jar")) {
handler = lookupViaProviders(protocol);
}
}
synchronized (streamHandlerLock) {
synchronized (streamHandlerLock) {
if (handler == null) {
// Try the built-in protocol handler
handler = defaultFactory.createURLStreamHandler(protocol);
} else {
URLStreamHandler handler2 = null;
// Check again with hashtable just in case another
@ -1202,7 +1271,7 @@ public final class URL implements java.io.Serializable {
// Check with factory if another thread set a
// factory since our last check
if (!checkedWithFactory && (fac = factory) != null) {
handler2 = fac.createURLStreamHandler(protocol);
handler2 = fac.createURLStreamHandler(protocol);
}
if (handler2 != null) {
@ -1211,29 +1280,17 @@ public final class URL implements java.io.Serializable {
// this thread created.
handler = handler2;
}
}
// Insert this handler into the hashtable
if (handler != null) {
handlers.put(protocol, handler);
}
// Insert this handler into the hashtable
if (handler != null) {
handlers.put(protocol, handler);
}
}
return handler;
}
/**
* Ensures that the given protocol handlers are loaded
*/
private static void ensureHandlersLoaded(String... protocols) {
for (String protocol: protocols) {
getURLStreamHandler(protocol);
}
}
/**
* WriteObject is called to save the state of the URL to an
* ObjectOutputStream. The handler is not saved since it is

View File

@ -44,7 +44,9 @@ public interface URLStreamHandlerFactory {
*
* @param protocol the protocol ("{@code ftp}",
* "{@code http}", "{@code nntp}", etc.).
* @return a {@code URLStreamHandler} for the specific protocol.
* @return a {@code URLStreamHandler} for the specific protocol, or {@code
* null} if this factory cannot create a handler for the specific
* protocol
* @see java.net.URLStreamHandler
*/
URLStreamHandler createURLStreamHandler(String protocol);

View File

@ -143,13 +143,11 @@
* a similar URL will try to instantiate the handler for the specified protocol;
* if it doesn't exist an exception will be thrown.
* <p>By default the protocol handlers are loaded dynamically from the default
* location. It is, however, possible to add to the search path by setting
* the {@code java.protocol.handler.pkgs} system property. For instance if
* it is set to {@code myapp.protocols}, then the URL code will try, in the
* case of http, first to load {@code myapp.protocols.http.Handler}, then,
* if this fails, {@code http.Handler} from the default location.
* <p>Note that the Handler class <b>has to</b> be a subclass of the abstract
* class {@link java.net.URLStreamHandler}.</p>
* location. It is, however, possible to deploy additional protocols handlers
* as {@link java.util.ServiceLoader services}. Service providers of type
* {@linkplain java.net.spi.URLStreamHandlerProvider} are located at
* runtime, as specified in the {@linkplain
* java.net.URL#URL(String,String,int,String) URL constructor}.
* <h2>Additional Specification</h2>
* <ul>
* <li><a href="doc-files/net-properties.html">

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* 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 java.net.spi;
import java.net.URLStreamHandlerFactory;
/**
* URL stream handler service-provider class.
*
*<p> A URL stream handler provider is a concrete subclass of this class that
* has a zero-argument constructor. URL stream handler providers may be
* installed in an instance of the Java platform by adding them to the
* application class path.
*
* <p> A URL stream handler provider identifies itself with a
* provider-configuration file named java.net.spi.URLStreamHandlerProvider in
* the resource directory META-INF/services. The file should contain a list of
* fully-qualified concrete URL stream handler provider class names, one per
* line.
*
* @since 1.9
*/
public abstract class URLStreamHandlerProvider
implements URLStreamHandlerFactory
{
private static Void checkPermission() {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new RuntimePermission("setFactory"));
return null;
}
private URLStreamHandlerProvider(Void ignore) { }
/**
* Initializes a new URL stream handler provider.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link RuntimePermission}{@code ("setFactory")}.
*/
protected URLStreamHandlerProvider() {
this(checkPermission());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,26 +23,13 @@
* questions.
*/
package sun.security.acl;
import java.security.*;
/**
* This class implements a group of principals.
* @author Satish Dharmaraj
* Service-provider classes for the <tt>{@link java.net}</tt> package.
*
* <p> Only developers who are defining new URL stream handler providers
* should need to make direct use of this package.
*
* @since 1.9
*/
public class WorldGroupImpl extends GroupImpl {
public WorldGroupImpl(String s) {
super(s);
}
/**
* returns true for all passed principals
* @param member The principal whose membership must be checked in this Group.
* @return true always since this is the "world" group.
*/
public boolean isMember(Principal member) {
return true;
}
}
package java.net.spi;

Some files were not shown because too many files have changed in this diff Show More