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 5b8db585a33c3cc48e70e688ceee57dd9271dc5d jdk9-b49
1550b2f6b63d1411fa84dc7bbc6f04809aedb43f jdk9-b50 1550b2f6b63d1411fa84dc7bbc6f04809aedb43f jdk9-b50
6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51 6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51
d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52

View file

@ -294,3 +294,4 @@ b6cca3e6175a69f39e5799b7349ddb0176630291 jdk9-b47
d91ed1951b948210590ce1394bea5515357246ba jdk9-b49 d91ed1951b948210590ce1394bea5515357246ba jdk9-b49
d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50 d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50
6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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 # $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_PATH], AC_DEFUN([BASIC_FIXUP_PATH],
[ [
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Only process if variable expands to non-empty
BASIC_FIXUP_PATH_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then if test "x[$]$1" != x; then
BASIC_FIXUP_PATH_MSYS($1) if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
else BASIC_FIXUP_PATH_CYGWIN($1)
# We're on a unix platform. Hooray! :) elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
path="[$]$1" BASIC_FIXUP_PATH_MSYS($1)
has_space=`$ECHO "$path" | $GREP " "` else
if test "x$has_space" != x; then # We're on a unix platform. Hooray! :)
AC_MSG_NOTICE([The path of $1, which resolves as "$path", is invalid.]) path="[$]$1"
AC_MSG_ERROR([Spaces are not allowed in this path.]) has_space=`$ECHO "$path" | $GREP " "`
fi 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 ~ # Use eval to expand a potential ~
eval path="$path" eval path="$path"
if test ! -f "$path" && test ! -d "$path"; then if test ! -f "$path" && test ! -d "$path"; then
AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.]) AC_MSG_ERROR([The path of $1, which resolves as "$path", is not found.])
fi fi
$1="`cd "$path"; $THEPWDCMD -L`" $1="`cd "$path"; $THEPWDCMD -L`"
fi
fi fi
]) ])
@ -113,57 +117,61 @@ AC_DEFUN([BASIC_FIXUP_PATH],
# $1: The name of the variable to fix # $1: The name of the variable to fix
AC_DEFUN([BASIC_FIXUP_EXECUTABLE], AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
[ [
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then # Only process if variable expands to non-empty
BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then if test "x[$]$1" != x; then
BASIC_FIXUP_EXECUTABLE_MSYS($1) if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
else BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
# We're on a unix platform. Hooray! :) elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
# First separate the path from the arguments. This will split at the first BASIC_FIXUP_EXECUTABLE_MSYS($1)
# 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"
else else
# This is an absolute path, we can use it without further modifications. # We're on a unix platform. Hooray! :)
new_path="$path" # First separate the path from the arguments. This will split at the first
fi # space.
complete="[$]$1"
path="${complete%% *}"
tmp="$complete EOL"
arguments="${tmp#* }"
if test "x$new_path" = x; then # Cannot rely on the command "which" here since it doesn't always work.
AC_MSG_NOTICE([The path of $1, which resolves as "$complete", is not found.]) is_absolute_path=`$ECHO "$path" | $GREP ^/`
has_space=`$ECHO "$complete" | $GREP " "` if test -z "$is_absolute_path"; then
if test "x$has_space" != x; then # Path to executable is not absolute. Find it.
AC_MSG_NOTICE([This might be caused by spaces in the path, which is not allowed.]) 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 fi
AC_MSG_ERROR([Cannot locate the the path of $1])
fi fi
fi
# Now join together the path and the arguments once again # Now join together the path and the arguments once again
if test "x$arguments" != xEOL; then if test "x$arguments" != xEOL; then
new_complete="$new_path ${arguments% *}" new_complete="$new_path ${arguments% *}"
else else
new_complete="$new_path" new_complete="$new_path"
fi fi
if test "x$complete" != "x$new_complete"; then if test "x$complete" != "x$new_complete"; then
$1="$new_complete" $1="$new_complete"
AC_MSG_NOTICE([Rewriting $1 to "$new_complete"]) AC_MSG_NOTICE([Rewriting $1 to "$new_complete"])
fi
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=";" IFS=";"
for i in $VS_INCLUDE; do for i in $VS_INCLUDE; do
ipath=$i ipath=$i
IFS="$OLDIFS" # Only process non-empty elements
BASIC_FIXUP_PATH([ipath]) if test "x$ipath" != x; then
IFS=";" IFS="$OLDIFS"
SYSROOT_CFLAGS="$SYSROOT_CFLAGS -I$ipath" # 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 done
# Convert VS_LIB into SYSROOT_LDFLAGS # Convert VS_LIB into SYSROOT_LDFLAGS
for i in $VS_LIB; do for i in $VS_LIB; do
libpath=$i libpath=$i
IFS="$OLDIFS" # Only process non-empty elements
BASIC_FIXUP_PATH([libpath]) if test "x$libpath" != x; then
IFS=";" IFS="$OLDIFS"
SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath" # 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 done
IFS="$OLDIFS" IFS="$OLDIFS"
fi 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/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/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/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/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/internal : jdk/src/share/classes/sun/security/internal
jdk/src/java.base/share/classes/sun/security/jca : jdk/src/share/classes/sun/security/jca 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 9285d14eb7b6b0815679bae98dd936dbc136218d jdk9-b49
224f593393e5b01b3c8f1e591b7f4b1790a3737a jdk9-b50 224f593393e5b01b3c8f1e591b7f4b1790a3737a jdk9-b50
2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51 2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51
b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52

View file

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

View file

@ -454,3 +454,4 @@ cc775a4a24c7f5d9e624b4205e9fbd48a17331f6 jdk9-b48
360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49 360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49
e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50 e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50
403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.amd64; package sun.jvm.hotspot.debugger.amd64;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; 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 // subset of the registers' values are guaranteed to be present (and
// must be present for the SA's stack walking to work) // 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 R15 = 0;
public static final int R14 = 1; public static final int R14 = 1;
public static final int R13 = 2; 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.ppc64; package sun.jvm.hotspot.debugger.ppc64;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; 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 // subset of the registers' values are guaranteed to be present (and
// must be present for the SA's stack walking to work). // 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 R31 = 0;
public static final int R30 = 1; public static final int R30 = 1;
public static final int R29 = 2; 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.sparc; package sun.jvm.hotspot.debugger.sparc;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.*;
@ -34,6 +36,10 @@ import sun.jvm.hotspot.debugger.cdbg.*;
public abstract class SPARCThreadContext implements ThreadContext { public abstract class SPARCThreadContext implements ThreadContext {
// Taken from /usr/include/sys/procfs_isa.h // 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_G0 = 0;
public static final int R_G1 = 1; public static final int R_G1 = 1;
public static final int R_G2 = 2; 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,8 @@
package sun.jvm.hotspot.debugger.x86; package sun.jvm.hotspot.debugger.x86;
import java.lang.annotation.Native;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*; 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, // must be present for the SA's stack walking to work): EAX, EBX,
// ECX, EDX, ESI, EDI, EBP, ESP, and EIP. // 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 GS = 0;
public static final int FS = 1; public static final int FS = 1;
public static final int ES = 2; 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 { public class GenCollectedHeap extends SharedHeap {
private static CIntegerField nGensField; private static CIntegerField nGensField;
private static long gensOffset; private static AddressField youngGenField;
private static AddressField oldGenField;
private static AddressField genSpecsField; private static AddressField genSpecsField;
private static GenerationFactory genFactory; private static GenerationFactory genFactory;
@ -52,7 +53,8 @@ public class GenCollectedHeap extends SharedHeap {
Type type = db.lookupType("GenCollectedHeap"); Type type = db.lookupType("GenCollectedHeap");
nGensField = type.getCIntegerField("_n_gens"); 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"); genSpecsField = type.getAddressField("_gen_specs");
genFactory = new GenerationFactory(); genFactory = new GenerationFactory();
@ -68,18 +70,19 @@ public class GenCollectedHeap extends SharedHeap {
public Generation getGen(int i) { public Generation getGen(int i) {
if (Assert.ASSERTS_ENABLED) { if (Assert.ASSERTS_ENABLED) {
Assert.that((i >= 0) && (i < nGens()), "Index " + i + Assert.that((i == 0) || (i == 1), "Index " + i +
" out of range (should be between 0 and " + nGens() + ")"); " 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; 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) { 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. # Copyright 2012, 2013 SAP AG. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # 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. # are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell! # Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) $(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) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(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) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(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.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: clean:
rm -rf $(SA_CLASSDIR) 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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. # are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell! # Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) $(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) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(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) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(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.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: clean:
rm -rf $(SA_CLASSDIR) 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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. # are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell! # Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) $(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) $(REMOTE) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(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) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(REMOTE) $(RUN.JAR) cf $@ -C $(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.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: clean:
rm -rf $(SA_CLASSDIR) 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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. # are in AGENT_FILES, so use the shell to expand them.
# Be extra carefull to not produce too long command lines in the shell! # Be extra carefull to not produce too long command lines in the shell!
$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST))) $(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) $(COMPILE.RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES) $(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(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) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/
$(QUIETLY) $(RUN.JAR) cf $@ -C $(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.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: clean:
rm -rf $(SA_CLASSDIR) 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # 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) $(QUIETLY) mkdir -p $(SA_CLASSDIR)
@echo ...Building sa-jdi.jar into $(SA_CLASSDIR) @echo ...Building sa-jdi.jar into $(SA_CLASSDIR)
@echo ...$(COMPILE_JAVAC) -classpath $(SA_CLASSPATH) -d $(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 $(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
$(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES) $(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES)
$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(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) $(QUIETLY) $(CP) -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)
$(RUN_JAR) cf $@ -C $(SA_CLASSDIR) . $(RUN_JAR) cf $@ -C $(SA_CLASSDIR) .
$(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR) META-INF/services/com.sun.jdi.connect.Connector $(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 "runtime/os.hpp"
#include "vm_version_sparc.hpp" #include "vm_version_sparc.hpp"
static bool detect_niagara() { static bool cpuinfo_field_contains(const char* field, const char* value) {
char cpu[128]; char line[1024];
bool rv = false; bool rv = false;
FILE* fp = fopen("/proc/cpuinfo", "r"); FILE* fp = fopen("/proc/cpuinfo", "r");
@ -35,9 +35,10 @@ static bool detect_niagara() {
return rv; return rv;
} }
while (!feof(fp)) { while (fgets(line, sizeof(line), fp) != NULL) {
if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) { assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small.");
if (strstr(cpu, "Niagara") != NULL) { if (strncmp(line, field, strlen(field)) == 0) {
if (strstr(line, value) != NULL) {
rv = true; rv = true;
} }
break; break;
@ -45,10 +46,17 @@ static bool detect_niagara() {
} }
fclose(fp); fclose(fp);
return rv; 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) { int VM_Version::platform_features(int features) {
// Default to generic v9 // Default to generic v9
features = generic_v9_m; features = generic_v9_m;
@ -58,5 +66,9 @@ int VM_Version::platform_features(int features) {
features = niagara1_m | T_family_m; features = niagara1_m | T_family_m;
} }
if (detect_blkinit()) {
features |= blk_init_instructions_m;
}
return features; return features;
} }

View file

@ -26,6 +26,7 @@
#define SHARE_VM_CI_CIKLASS_HPP #define SHARE_VM_CI_CIKLASS_HPP
#include "ci/ciType.hpp" #include "ci/ciType.hpp"
#include "oops/klass.hpp"
// ciKlass // 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
#include "classfile/classFileParser.hpp" #include "classfile/classFileParser.hpp"
#include "classfile/stackMapTable.hpp" #include "classfile/stackMapTable.hpp"
#include "classfile/verifier.hpp" #include "classfile/verifier.hpp"
#include "memory/resourceArea.hpp"
// Keep these in a separate file to prevent inlining // Keep these in a separate file to prevent inlining

View file

@ -38,6 +38,7 @@
#include "memory/metadataFactory.hpp" #include "memory/metadataFactory.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/referenceType.hpp" #include "memory/referenceType.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp" #include "memory/universe.inline.hpp"
#include "oops/constantPool.hpp" #include "oops/constantPool.hpp"
#include "oops/fieldStreams.hpp" #include "oops/fieldStreams.hpp"
@ -59,6 +60,7 @@
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/array.hpp" #include "utilities/array.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/exceptions.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"
#include "utilities/resourceHash.hpp" #include "utilities/resourceHash.hpp"
@ -313,6 +315,19 @@ inline Symbol* check_symbol_at(constantPoolHandle cp, int index) {
return NULL; 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) { constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) {
ClassFileStream* cfs = stream(); ClassFileStream* cfs = stream();
constantPoolHandle nullHandle; constantPoolHandle nullHandle;

View file

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

View file

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

View file

@ -31,7 +31,6 @@
#include "code/nmethod.hpp" #include "code/nmethod.hpp"
#include "code/pcDesc.hpp" #include "code/pcDesc.hpp"
#include "compiler/compileBroker.hpp" #include "compiler/compileBroker.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/gcLocker.hpp" #include "memory/gcLocker.hpp"
#include "memory/iterator.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "code/compressedStream.hpp" #include "code/compressedStream.hpp"
#include "code/nmethod.hpp" #include "code/nmethod.hpp"
#include "memory/resourceArea.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
#include "utilities/hashtable.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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) { if (prev_level >= 0) {
size_t prev_size = 0; size_t prev_size = 0;
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
Generation* prev_gen = gch->_gens[prev_level]; Generation* prev_gen = gch->get_gen(prev_level);
prev_size = prev_gen->capacity(); prev_size = prev_gen->capacity();
gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT, gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT,
prev_size/1000); prev_size/1000);

View file

@ -37,7 +37,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
_use_cache = true; _use_cache = true;
_hot_cache_size = (size_t)1 << G1ConcRSLogCacheSize; _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(); reset_hot_cache_internal();
@ -52,7 +52,8 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
G1HotCardCache::~G1HotCardCache() { G1HotCardCache::~G1HotCardCache() {
if (default_use_cache()) { if (default_use_cache()) {
assert(_hot_cache != NULL, "Logic"); 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; G1CardCounts _card_counts;
ArrayAllocator<jbyte*, mtGC> _hot_cache_memory;
// The card cache table // The card cache table
jbyte** _hot_cache; jbyte** _hot_cache;

View file

@ -26,6 +26,8 @@
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
#include "gc_implementation/parallelScavenge/gcTaskManager.hpp" #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.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/psTasks.hpp"
#include "gc_implementation/parallelScavenge/psYoungGen.hpp" #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"

View file

@ -66,6 +66,15 @@ void PSPromotionManager::initialize() {
// for work stealing. // 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) { PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
assert(_manager_array != NULL, "Sanity"); 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); 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); template <class T> inline void claim_or_forward_depth(T* p);
TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& 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> template <class T>
inline void PSPromotionManager::claim_or_forward_depth(T* p) { 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, assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
"Sanity"); "Sanity");
assert(Universe::heap()->is_in(p), "pointer outside heap"); 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> template<bool promote_immediately>
oop PSPromotionManager::copy_to_survivor_space(oop o) { oop PSPromotionManager::copy_to_survivor_space(oop o) {
assert(PSScavenge::should_scavenge(&o), "Sanity"); assert(should_scavenge(&o), "Sanity");
oop new_obj = NULL; oop new_obj = NULL;
@ -257,7 +257,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
// information. // information.
if (TraceScavenge) { if (TraceScavenge) {
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", 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()); new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
} }
#endif #endif
@ -265,6 +265,40 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
return new_obj; 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) { inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
if (is_oop_masked(p)) { if (is_oop_masked(p)) {
@ -274,9 +308,9 @@ inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
} else { } else {
if (p.is_narrow()) { if (p.is_narrow()) {
assert(UseCompressedOops, "Error"); 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 { } 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. // Weak refs may be visited more than once.
if (PSScavenge::should_scavenge(p, _to_space)) { 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); } 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, MutableSpace* to_space);
template <class T> static inline bool should_scavenge(T* p, bool check_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); static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
// Is an object in the young generation // Is an object in the young generation

View file

@ -27,7 +27,6 @@
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
#include "gc_implementation/parallelScavenge/psScavenge.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
@ -63,42 +62,6 @@ inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) {
return should_scavenge(p); 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> template<bool promote_immediately>
class PSRootsClosure: public OopClosure { class PSRootsClosure: public OopClosure {
private: private:
@ -108,7 +71,7 @@ class PSRootsClosure: public OopClosure {
template <class T> void do_oop_work(T *p) { template <class T> void do_oop_work(T *p) {
if (PSScavenge::should_scavenge(p)) { if (PSScavenge::should_scavenge(p)) {
// We never card mark roots, maybe call a func without test? // 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: 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "code/stubs.hpp" #include "code/stubs.hpp"
#include "interpreter/cppInterpreter.hpp" #include "interpreter/cppInterpreter.hpp"
#include "interpreter/templateInterpreter.hpp" #include "interpreter/templateInterpreter.hpp"
#include "memory/resourceArea.hpp"
#ifdef ZERO #ifdef ZERO
#ifdef TARGET_ARCH_zero #ifdef TARGET_ARCH_zero
# include "entry_zero.hpp" # include "entry_zero.hpp"

View file

@ -965,32 +965,38 @@ public:
} }
static void test_old_size() { 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 // If OldSize is set on the command line, it should be used
// for both min and initial old size if less than min heap. // for both min and initial old size if less than min heap.
flag_value = 20 * M; flag_value = 20 * M;
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value); FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_old_min(flag_value); verify_old_min(flag_value);
set_basic_flag_values(); set_basic_flag_values();
FLAG_SET_CMDLINE(uintx, OldSize, flag_value); FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
verify_old_initial(flag_value); // Calculate what we expect the flag to be.
size_t expected_old_initial = align_size_up(InitialHeapSize, heap_alignment) - MaxNewSize;
// If MaxNewSize is large, the maximum OldSize will be less than verify_old_initial(expected_old_initial);
// 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);
// 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) { static void verify_young_min(size_t expected) {
@ -1011,6 +1017,12 @@ public:
MarkSweepPolicy msp; MarkSweepPolicy msp;
msp.initialize_all(); 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); 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(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected));
assert(FLAG_IS_ERGO(NewSize) && NewSize == 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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, assert(next_level < gch->_n_gens,
"DefNewGeneration cannot be an oldest gen"); "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 old_size = next_gen->capacity();
size_t new_size_before = _virtual_space.committed_size(); size_t new_size_before = _virtual_space.committed_size();
size_t min_new_size = spec()->init_size(); size_t min_new_size = spec()->init_size();

View file

@ -86,6 +86,7 @@ jint GenCollectedHeap::initialize() {
int i; int i;
_n_gens = gen_policy()->number_of_generations(); _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 // While there are no constraints in the GC code that HeapWordSize
// be any particular value, there are multiple other areas in the // be any particular value, there are multiple other areas in the
@ -126,11 +127,12 @@ jint GenCollectedHeap::initialize() {
_gch = this; _gch = this;
for (i = 0; i < _n_gens; i++) { ReservedSpace young_rs = heap_rs.first_part(_gen_specs[0]->max_size(), false, false);
ReservedSpace this_rs = heap_rs.first_part(_gen_specs[i]->max_size(), false, false); _young_gen = _gen_specs[0]->init(young_rs, 0, rem_set());
_gens[i] = _gen_specs[i]->init(this_rs, i, rem_set()); heap_rs = heap_rs.last_part(_gen_specs[0]->max_size());
heap_rs = heap_rs.last_part(_gen_specs[i]->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(); clear_incremental_collection_failed();
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
@ -145,7 +147,6 @@ jint GenCollectedHeap::initialize() {
return JNI_OK; return JNI_OK;
} }
char* GenCollectedHeap::allocate(size_t alignment, char* GenCollectedHeap::allocate(size_t alignment,
ReservedSpace* heap_rs){ ReservedSpace* heap_rs){
const char overflow_msg[] = "The size of the object heap + VM data exceeds " 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(); return heap_rs->base();
} }
void GenCollectedHeap::post_initialize() { void GenCollectedHeap::post_initialize() {
SharedHeap::post_initialize(); SharedHeap::post_initialize();
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy(); GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
@ -195,41 +195,30 @@ void GenCollectedHeap::post_initialize() {
void GenCollectedHeap::ref_processing_init() { void GenCollectedHeap::ref_processing_init() {
SharedHeap::ref_processing_init(); SharedHeap::ref_processing_init();
for (int i = 0; i < _n_gens; i++) { _young_gen->ref_processor_init();
_gens[i]->ref_processor_init(); _old_gen->ref_processor_init();
}
} }
size_t GenCollectedHeap::capacity() const { size_t GenCollectedHeap::capacity() const {
size_t res = 0; return _young_gen->capacity() + _old_gen->capacity();
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->capacity();
}
return res;
} }
size_t GenCollectedHeap::used() const { size_t GenCollectedHeap::used() const {
size_t res = 0; return _young_gen->used() + _old_gen->used();
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->used();
}
return res;
} }
// Save the "used_region" for generations level and lower. // Save the "used_region" for generations level and lower.
void GenCollectedHeap::save_used_regions(int level) { void GenCollectedHeap::save_used_regions(int level) {
assert(level >= 0, "Illegal level parameter");
assert(level < _n_gens, "Illegal level parameter"); assert(level < _n_gens, "Illegal level parameter");
for (int i = level; i >= 0; i--) { if (level == 1) {
_gens[i]->save_used_region(); _old_gen->save_used_region();
} }
_young_gen->save_used_region();
} }
size_t GenCollectedHeap::max_capacity() const { size_t GenCollectedHeap::max_capacity() const {
size_t res = 0; return _young_gen->max_capacity() + _old_gen->max_capacity();
for (int i = 0; i < _n_gens; i++) {
res += _gens[i]->max_capacity();
}
return res;
} }
// Update the _full_collections_completed counter // 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, HeapWord* GenCollectedHeap::attempt_allocation(size_t size,
bool is_tlab, bool is_tlab,
bool first_only) { bool first_only) {
HeapWord* res; HeapWord* res = NULL;
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->should_allocate(size, is_tlab)) { if (_young_gen->should_allocate(size, is_tlab)) {
res = _gens[i]->allocate(size, is_tlab); res = _young_gen->allocate(size, is_tlab);
if (res != NULL) return res; if (res != NULL || first_only) {
else if (first_only) break; 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, 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)); (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, bool clear_all_soft_refs,
size_t size, size_t size,
bool is_tlab, bool is_tlab,
int max_level) { int max_level) {
bool prepared_for_verification = false;
ResourceMark rm; ResourceMark rm;
DEBUG_ONLY(Thread* my_thread = Thread::current();) DEBUG_ONLY(Thread* my_thread = Thread::current();)
@ -367,141 +455,62 @@ void GenCollectedHeap::do_collection(bool full,
increment_total_collections(complete); increment_total_collections(complete);
size_t gch_prev_used = used(); size_t gch_prev_used = used();
bool run_verification = total_collections() >= VerifyGCStartAt;
int starting_level = 0; bool prepared_for_verification = false;
if (full) { int max_level_collected = 0;
// Search for the oldest generation which will collect all younger bool old_collects_young = (max_level == 1) &&
// generations, and start collection loop there. full &&
for (int i = max_level; i >= 0; i--) { _old_gen->full_collects_younger_generations();
if (_gens[i]->full_collects_younger_generations()) { if (!old_collects_young &&
starting_level = i; _young_gen->should_collect(full, size, is_tlab)) {
break; 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; bool must_restore_marks_for_biased_locking = false;
int max_level_collected = starting_level; if (max_level == 1 && _old_gen->should_collect(full, size, is_tlab)) {
for (int i = starting_level; i <= max_level; i++) { if (!complete) {
if (_gens[i]->should_collect(full, size, is_tlab)) { // The full_collections increment was missed above.
if (i == n_gens() - 1) { // a major collection is to happen increment_total_full_collections();
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);
}
} }
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 -- // 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.
// Adjust generation sizes. if (max_level_collected == 1) {
_gens[j]->compute_new_size(); _old_gen->compute_new_size();
} }
_young_gen->compute_new_size();
if (complete) { if (complete) {
// Delete metaspaces for unloaded class loaders and clean up loader_data graph // 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 (younger_gens_as_roots) {
if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) { if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) {
for (int i = 0; i < level; i++) { if (level == 1) {
not_older_gens->set_generation(_gens[i]); not_older_gens->set_generation(_young_gen);
_gens[i]->oop_iterate(not_older_gens); _young_gen->oop_iterate(not_older_gens);
} }
not_older_gens->reset_generation(); not_older_gens->reset_generation();
} }
} }
// When collection is parallel, all threads get to cooperate to do // When collection is parallel, all threads get to cooperate to do
// older-gen scanning. // older-gen scanning.
for (int i = level+1; i < _n_gens; i++) { if (level == 0) {
older_gens->set_generation(_gens[i]); older_gens->set_generation(_old_gen);
rem_set()->younger_refs_iterate(_gens[i], older_gens); rem_set()->younger_refs_iterate(_old_gen, older_gens);
older_gens->reset_generation(); older_gens->reset_generation();
} }
@ -635,9 +645,8 @@ gen_process_roots(int level,
void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
SharedHeap::process_weak_roots(root_closure); SharedHeap::process_weak_roots(root_closure);
// "Local" "weak" refs // "Local" "weak" refs
for (int i = 0; i < _n_gens; i++) { _young_gen->ref_processor()->weak_oops_do(root_closure);
_gens[i]->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) \ #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
@ -645,9 +654,11 @@ void GenCollectedHeap:: \
oop_since_save_marks_iterate(int level, \ oop_since_save_marks_iterate(int level, \
OopClosureType* cur, \ OopClosureType* cur, \
OopClosureType* older) { \ OopClosureType* older) { \
_gens[level]->oop_since_save_marks_iterate##nv_suffix(cur); \ if (level == 0) { \
for (int i = level+1; i < n_gens(); i++) { \ _young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
_gens[i]->oop_since_save_marks_iterate##nv_suffix(older); \ _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 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
bool GenCollectedHeap::no_allocs_since_save_marks(int level) { bool GenCollectedHeap::no_allocs_since_save_marks(int level) {
for (int i = level; i < _n_gens; i++) { if (level == 0 && !_young_gen->no_allocs_since_save_marks()) {
if (!_gens[i]->no_allocs_since_save_marks()) return false; return false;
} }
return true; return _old_gen->no_allocs_since_save_marks();
} }
bool GenCollectedHeap::supports_inline_contig_alloc() const { 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 { HeapWord** GenCollectedHeap::top_addr() const {
return _gens[0]->top_addr(); return _young_gen->top_addr();
} }
HeapWord** GenCollectedHeap::end_addr() const { HeapWord** GenCollectedHeap::end_addr() const {
return _gens[0]->end_addr(); return _young_gen->end_addr();
} }
// public collection interfaces // public collection interfaces
@ -734,12 +745,12 @@ void GenCollectedHeap::collect_locked(GCCause::Cause cause, int max_level) {
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
bool GenCollectedHeap::create_cms_collector() { bool GenCollectedHeap::create_cms_collector() {
assert(_gens[1]->kind() == Generation::ConcurrentMarkSweep, assert(_old_gen->kind() == Generation::ConcurrentMarkSweep,
"Unexpected generation kinds"); "Unexpected generation kinds");
// Skip two header words in the block content verification // Skip two header words in the block content verification
NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();) NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();)
CMSCollector* collector = new CMSCollector( CMSCollector* collector = new CMSCollector(
(ConcurrentMarkSweepGeneration*)_gens[1], (ConcurrentMarkSweepGeneration*)_old_gen,
_rem_set->as_CardTableRS(), _rem_set->as_CardTableRS(),
(ConcurrentMarkSweepPolicy*) collector_policy()); (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 GenCollectedHeap::is_in_young(oop p) {
bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start(); bool result = ((HeapWord*)p) < _old_gen->reserved().start();
assert(result == _gens[0]->is_in_reserved(p), assert(result == _young_gen->is_in_reserved(p),
err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p))); err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p)));
return result; return result;
} }
@ -825,13 +836,7 @@ bool GenCollectedHeap::is_in(const void* p) const {
VMError::fatal_error_in_progress(), "too expensive"); VMError::fatal_error_in_progress(), "too expensive");
#endif #endif
// This might be sped up with a cache of the last generation that return _young_gen->is_in(p) || _old_gen->is_in(p);
// answered yes.
for (int i = 0; i < _n_gens; i++) {
if (_gens[i]->is_in(p)) return true;
}
// Otherwise...
return false;
} }
#ifdef ASSERT #ifdef ASSERT
@ -840,114 +845,97 @@ bool GenCollectedHeap::is_in(const void* p) const {
bool GenCollectedHeap::is_in_partial_collection(const void* p) { bool GenCollectedHeap::is_in_partial_collection(const void* p) {
assert(is_in_reserved(p) || p == NULL, assert(is_in_reserved(p) || p == NULL,
"Does not work if address is non-null and outside of the heap"); "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 #endif
void GenCollectedHeap::oop_iterate(ExtendedOopClosure* cl) { void GenCollectedHeap::oop_iterate(ExtendedOopClosure* cl) {
for (int i = 0; i < _n_gens; i++) { _young_gen->oop_iterate(cl);
_gens[i]->oop_iterate(cl); _old_gen->oop_iterate(cl);
}
} }
void GenCollectedHeap::object_iterate(ObjectClosure* cl) { void GenCollectedHeap::object_iterate(ObjectClosure* cl) {
for (int i = 0; i < _n_gens; i++) { _young_gen->object_iterate(cl);
_gens[i]->object_iterate(cl); _old_gen->object_iterate(cl);
}
} }
void GenCollectedHeap::safe_object_iterate(ObjectClosure* cl) { void GenCollectedHeap::safe_object_iterate(ObjectClosure* cl) {
for (int i = 0; i < _n_gens; i++) { _young_gen->safe_object_iterate(cl);
_gens[i]->safe_object_iterate(cl); _old_gen->safe_object_iterate(cl);
}
} }
Space* GenCollectedHeap::space_containing(const void* addr) const { Space* GenCollectedHeap::space_containing(const void* addr) const {
for (int i = 0; i < _n_gens; i++) { Space* res = _young_gen->space_containing(addr);
Space* res = _gens[i]->space_containing(addr); if (res != NULL) {
if (res != NULL) return res; return res;
} }
// Otherwise... res = _old_gen->space_containing(addr);
assert(false, "Could not find containing space"); assert(res != NULL, "Could not find containing space");
return NULL; return res;
} }
HeapWord* GenCollectedHeap::block_start(const void* addr) const { HeapWord* GenCollectedHeap::block_start(const void* addr) const {
assert(is_in_reserved(addr), "block_start of address outside of heap"); assert(is_in_reserved(addr), "block_start of address outside of heap");
for (int i = 0; i < _n_gens; i++) { if (_young_gen->is_in_reserved(addr)) {
if (_gens[i]->is_in_reserved(addr)) { assert(_young_gen->is_in(addr), "addr should be in allocated part of generation");
assert(_gens[i]->is_in(addr), return _young_gen->block_start(addr);
"addr should be in allocated part of generation");
return _gens[i]->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 { size_t GenCollectedHeap::block_size(const HeapWord* addr) const {
assert(is_in_reserved(addr), "block_size of address outside of heap"); assert(is_in_reserved(addr), "block_size of address outside of heap");
for (int i = 0; i < _n_gens; i++) { if (_young_gen->is_in_reserved(addr)) {
if (_gens[i]->is_in_reserved(addr)) { assert(_young_gen->is_in(addr), "addr should be in allocated part of generation");
assert(_gens[i]->is_in(addr), return _young_gen->block_size(addr);
"addr should be in allocated part of generation");
return _gens[i]->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 { bool GenCollectedHeap::block_is_obj(const HeapWord* addr) const {
assert(is_in_reserved(addr), "block_is_obj of address outside of heap"); assert(is_in_reserved(addr), "block_is_obj of address outside of heap");
assert(block_start(addr) == addr, "addr must be a block start"); assert(block_start(addr) == addr, "addr must be a block start");
for (int i = 0; i < _n_gens; i++) { if (_young_gen->is_in_reserved(addr)) {
if (_gens[i]->is_in_reserved(addr)) { return _young_gen->block_is_obj(addr);
return _gens[i]->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 { bool GenCollectedHeap::supports_tlab_allocation() const {
for (int i = 0; i < _n_gens; i += 1) { assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
if (_gens[i]->supports_tlab_allocation()) { return _young_gen->supports_tlab_allocation();
return true;
}
}
return false;
} }
size_t GenCollectedHeap::tlab_capacity(Thread* thr) const { size_t GenCollectedHeap::tlab_capacity(Thread* thr) const {
size_t result = 0; assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
for (int i = 0; i < _n_gens; i += 1) { if (_young_gen->supports_tlab_allocation()) {
if (_gens[i]->supports_tlab_allocation()) { return _young_gen->tlab_capacity();
result += _gens[i]->tlab_capacity();
}
} }
return result; return 0;
} }
size_t GenCollectedHeap::tlab_used(Thread* thr) const { size_t GenCollectedHeap::tlab_used(Thread* thr) const {
size_t result = 0; assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
for (int i = 0; i < _n_gens; i += 1) { if (_young_gen->supports_tlab_allocation()) {
if (_gens[i]->supports_tlab_allocation()) { return _young_gen->tlab_used();
result += _gens[i]->tlab_used();
}
} }
return result; return 0;
} }
size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const { size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const {
size_t result = 0; assert(!_old_gen->supports_tlab_allocation(), "Old gen supports TLAB allocation?!");
for (int i = 0; i < _n_gens; i += 1) { if (_young_gen->supports_tlab_allocation()) {
if (_gens[i]->supports_tlab_allocation()) { return _young_gen->unsafe_max_tlab_alloc();
result += _gens[i]->unsafe_max_tlab_alloc();
}
} }
return result; return 0;
} }
HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) { 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, ScratchBlock* GenCollectedHeap::gather_scratch(Generation* requestor,
size_t max_alloc_words) { size_t max_alloc_words) {
ScratchBlock* res = NULL; ScratchBlock* res = NULL;
for (int i = 0; i < _n_gens; i++) { _young_gen->contribute_scratch(res, requestor, max_alloc_words);
_gens[i]->contribute_scratch(res, requestor, max_alloc_words); _old_gen->contribute_scratch(res, requestor, max_alloc_words);
}
sort_scratch_list(res); sort_scratch_list(res);
return res; return res;
} }
void GenCollectedHeap::release_scratch() { void GenCollectedHeap::release_scratch() {
for (int i = 0; i < _n_gens; i++) { _young_gen->reset_scratch();
_gens[i]->reset_scratch(); _old_gen->reset_scratch();
}
} }
class GenPrepareForVerifyClosure: public GenCollectedHeap::GenClosure { class GenPrepareForVerifyClosure: public GenCollectedHeap::GenClosure {
@ -1021,39 +1007,29 @@ void GenCollectedHeap::prepare_for_verify() {
generation_iterate(&blk, false); generation_iterate(&blk, false);
} }
void GenCollectedHeap::generation_iterate(GenClosure* cl, void GenCollectedHeap::generation_iterate(GenClosure* cl,
bool old_to_young) { bool old_to_young) {
if (old_to_young) { if (old_to_young) {
for (int i = _n_gens-1; i >= 0; i--) { cl->do_generation(_old_gen);
cl->do_generation(_gens[i]); cl->do_generation(_young_gen);
}
} else { } else {
for (int i = 0; i < _n_gens; i++) { cl->do_generation(_young_gen);
cl->do_generation(_gens[i]); cl->do_generation(_old_gen);
}
} }
} }
void GenCollectedHeap::space_iterate(SpaceClosure* cl) { void GenCollectedHeap::space_iterate(SpaceClosure* cl) {
for (int i = 0; i < _n_gens; i++) { _young_gen->space_iterate(cl, true);
_gens[i]->space_iterate(cl, true); _old_gen->space_iterate(cl, true);
}
} }
bool GenCollectedHeap::is_maximal_no_gc() const { bool GenCollectedHeap::is_maximal_no_gc() const {
for (int i = 0; i < _n_gens; i++) { return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
if (!_gens[i]->is_maximal_no_gc()) {
return false;
}
}
return true;
} }
void GenCollectedHeap::save_marks() { void GenCollectedHeap::save_marks() {
for (int i = 0; i < _n_gens; i++) { _young_gen->save_marks();
_gens[i]->save_marks(); _old_gen->save_marks();
}
} }
GenCollectedHeap* GenCollectedHeap::heap() { GenCollectedHeap* GenCollectedHeap::heap() {
@ -1065,27 +1041,33 @@ GenCollectedHeap* GenCollectedHeap::heap() {
void GenCollectedHeap::prepare_for_compaction() { void GenCollectedHeap::prepare_for_compaction() {
guarantee(_n_gens = 2, "Wrong number of generations"); guarantee(_n_gens = 2, "Wrong number of generations");
Generation* old_gen = _gens[1];
// Start by compacting into same gen. // Start by compacting into same gen.
CompactPoint cp(old_gen); CompactPoint cp(_old_gen);
old_gen->prepare_for_compaction(&cp); _old_gen->prepare_for_compaction(&cp);
Generation* young_gen = _gens[0]; _young_gen->prepare_for_compaction(&cp);
young_gen->prepare_for_compaction(&cp);
} }
GCStats* GenCollectedHeap::gc_stats(int level) const { 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 */) { void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
for (int i = _n_gens-1; i >= 0; i--) { if (!silent) {
Generation* g = _gens[i]; gclog_or_tty->print("%s", _old_gen->name());
if (!silent) { gclog_or_tty->print(" ");
gclog_or_tty->print("%s", g->name());
gclog_or_tty->print(" ");
}
g->verify();
} }
_old_gen->verify();
if (!silent) {
gclog_or_tty->print("%s", _young_gen->name());
gclog_or_tty->print(" ");
}
_young_gen->verify();
if (!silent) { if (!silent) {
gclog_or_tty->print("remset "); gclog_or_tty->print("remset ");
} }
@ -1093,9 +1075,8 @@ void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
} }
void GenCollectedHeap::print_on(outputStream* st) const { void GenCollectedHeap::print_on(outputStream* st) const {
for (int i = 0; i < _n_gens; i++) { _young_gen->print_on(st);
_gens[i]->print_on(st); _old_gen->print_on(st);
}
MetaspaceAux::print_on(st); MetaspaceAux::print_on(st);
} }

View file

@ -33,7 +33,7 @@
class SubTasksDone; class SubTasksDone;
// A "GenCollectedHeap" is a SharedHeap that uses generational // 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 { class GenCollectedHeap : public SharedHeap {
friend class GenCollectorPolicy; friend class GenCollectorPolicy;
friend class Generation; friend class Generation;
@ -63,7 +63,10 @@ public:
private: private:
int _n_gens; int _n_gens;
Generation* _gens[max_gens];
Generation* _young_gen;
Generation* _old_gen;
GenerationSpec** _gen_specs; GenerationSpec** _gen_specs;
// The singleton Gen Remembered Set. // The singleton Gen Remembered Set.
@ -85,6 +88,11 @@ public:
SubTasksDone* _gen_process_roots_tasks; SubTasksDone* _gen_process_roots_tasks;
SubTasksDone* gen_process_roots_tasks() { return _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 // In block contents verification, the number of header words to skip
NOT_PRODUCT(static size_t _skip_header_HeapWords;) NOT_PRODUCT(static size_t _skip_header_HeapWords;)
@ -138,8 +146,12 @@ public:
return CollectedHeap::GenCollectedHeap; return CollectedHeap::GenCollectedHeap;
} }
Generation* young_gen() { return _young_gen; }
Generation* old_gen() { return _old_gen; }
// The generational collector policy. // The generational collector policy.
GenCollectorPolicy* gen_policy() const { return _gen_policy; } GenCollectorPolicy* gen_policy() const { return _gen_policy; }
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); } virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
// Adaptive size policy // Adaptive size policy
@ -309,20 +321,17 @@ public:
// Update above counter, as appropriate, at the end of a concurrent GC cycle // Update above counter, as appropriate, at the end of a concurrent GC cycle
unsigned int update_full_collections_completed(unsigned int count); unsigned int update_full_collections_completed(unsigned int count);
// Update "time of last gc" for all constituent generations // Update "time of last gc" for all generations to "now".
// to "now".
void update_time_of_last_gc(jlong now) { void update_time_of_last_gc(jlong now) {
for (int i = 0; i < _n_gens; i++) { _young_gen->update_time_of_last_gc(now);
_gens[i]->update_time_of_last_gc(now); _old_gen->update_time_of_last_gc(now);
}
} }
// Update the gc statistics for each generation. // Update the gc statistics for each generation.
// "level" is the level of the latest collection. // "level" is the level of the latest collection.
void update_gc_stats(int current_level, bool full) { void update_gc_stats(int current_level, bool full) {
for (int i = 0; i < _n_gens; i++) { _young_gen->update_gc_stats(current_level, full);
_gens[i]->update_gc_stats(current_level, full); _old_gen->update_gc_stats(current_level, full);
}
} }
// Override. // Override.
@ -366,21 +375,23 @@ public:
// Return the generation before "gen". // Return the generation before "gen".
Generation* prev_gen(Generation* gen) const { Generation* prev_gen(Generation* gen) const {
int l = gen->level(); guarantee(gen->level() == 1, "Out of bounds");
guarantee(l > 0, "Out of bounds"); return _young_gen;
return _gens[l-1];
} }
// Return the generation after "gen". // Return the generation after "gen".
Generation* next_gen(Generation* gen) const { Generation* next_gen(Generation* gen) const {
int l = gen->level() + 1; guarantee(gen->level() == 0, "Out of bounds");
guarantee(l < _n_gens, "Out of bounds"); return _old_gen;
return _gens[l];
} }
Generation* get_gen(int i) const { Generation* get_gen(int i) const {
guarantee(i >= 0 && i < _n_gens, "Out of bounds"); guarantee(i == 0 || i == 1, "Out of bounds");
return _gens[i]; if (i == 0) {
return _young_gen;
} else {
return _old_gen;
}
} }
int n_gens() const { 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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(); GenCollectedHeap* gch = GenCollectedHeap::heap();
// Scratch request on behalf of oldest generation; will do no // Scratch request on behalf of oldest generation; will do no
// allocation. // 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 // $$$ To cut a corner, we'll only use the first scratch block, and then
// revert to malloc. // revert to malloc.

View file

@ -26,6 +26,7 @@
#include "classfile/classLoaderData.hpp" #include "classfile/classLoaderData.hpp"
#include "memory/cardTableRS.hpp" #include "memory/cardTableRS.hpp"
#include "memory/genRemSet.hpp" #include "memory/genRemSet.hpp"
#include "oops/klass.hpp"
// This kind of "BarrierSet" allows a "CollectedHeap" to detect and // This kind of "BarrierSet" allows a "CollectedHeap" to detect and
// enumerate ref fields that have been modified (since the last // 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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(); GenCollectedHeap* gch = GenCollectedHeap::heap();
int next = level() + 1; int next = level() + 1;
if (next < gch->_n_gens) { if (next < gch->_n_gens) {
return gch->_gens[next]; return gch->get_gen(next);
} else { } else {
return NULL; return NULL;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -90,8 +90,6 @@
# include "gc_implementation/shared/gcUtil.hpp" # include "gc_implementation/shared/gcUtil.hpp"
# include "gc_implementation/shared/generationCounters.hpp" # include "gc_implementation/shared/generationCounters.hpp"
# include "gc_implementation/shared/immutableSpace.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/mutableSpace.hpp"
# include "gc_implementation/shared/spaceCounters.hpp" # include "gc_implementation/shared/spaceCounters.hpp"
# include "gc_implementation/shared/spaceDecorator.hpp" # include "gc_implementation/shared/spaceDecorator.hpp"

View file

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

View file

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

View file

@ -25,7 +25,11 @@
#ifndef SHARE_VM_RUNTIME_HANDLES_HPP #ifndef SHARE_VM_RUNTIME_HANDLES_HPP
#define 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 // In order to preserve oops during garbage collection, they should be
@ -201,16 +205,16 @@ class instanceKlassHandle : public KlassHandle {
/* Constructors */ /* Constructors */
instanceKlassHandle () : KlassHandle() {} instanceKlassHandle () : KlassHandle() {}
instanceKlassHandle (const Klass* k) : KlassHandle(k) { instanceKlassHandle (const Klass* k) : KlassHandle(k) {
assert(k == NULL || k->oop_is_instance(), assert(k == NULL || is_instanceKlass(k), "illegal type");
"illegal type");
} }
instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) { instanceKlassHandle (Thread* thread, const Klass* k) : KlassHandle(thread, k) {
assert(k == NULL || k->oop_is_instance(), assert(k == NULL || is_instanceKlass(k), "illegal type");
"illegal type");
} }
/* Access to klass part */ /* Access to klass part */
InstanceKlass* operator () () const { return (InstanceKlass*)obj(); } InstanceKlass* operator () () const { return (InstanceKlass*)obj(); }
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 "precompiled.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_interface/collectedHeap.hpp" #include "gc_interface/collectedHeap.hpp"
#include "gc_interface/collectedHeap.inline.hpp" #include "gc_interface/collectedHeap.inline.hpp"
#include "memory/genCollectedHeap.hpp" #include "memory/genCollectedHeap.hpp"

View file

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

View file

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

View file

@ -22,7 +22,7 @@
* *
*/ */
#include "precompiled.hpp" #include "precompiled.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#include "services/nmtDCmd.hpp" #include "services/nmtDCmd.hpp"
#include "services/memReporter.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
#include "precompiled.hpp" #include "precompiled.hpp"
#include "classfile/classLoader.hpp" #include "classfile/classLoader.hpp"
#include "runtime/vm_version.hpp"
#include "services/attachListener.hpp" #include "services/attachListener.hpp"
#include "services/management.hpp" #include "services/management.hpp"
#include "services/runtimeService.hpp" #include "services/runtimeService.hpp"

View file

@ -30,7 +30,6 @@
#include "code/vtableStubs.hpp" #include "code/vtableStubs.hpp"
#include "compiler/compileBroker.hpp" #include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp" #include "compiler/disassembler.hpp"
#include "gc_implementation/shared/markSweep.hpp"
#include "gc_interface/collectedHeap.hpp" #include "gc_interface/collectedHeap.hpp"
#include "interpreter/bytecodeHistogram.hpp" #include "interpreter/bytecodeHistogram.hpp"
#include "interpreter/interpreter.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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -143,11 +143,24 @@ ifndef PRODUCT_HOME
endif endif
# Expect JPRT to set JAVA_ARGS (e.g. -server etc.) # Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
JAVA_OPTIONS = JAVA_OPTIONS =
ifdef JAVA_ARGS ifdef JAVA_ARGS
JAVA_OPTIONS = $(JAVA_ARGS) JAVA_OPTIONS = $(JAVA_ARGS)
endif 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) # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ifdef JPRT_ARCHIVE_BUNDLE ifdef JPRT_ARCHIVE_BUNDLE
@ -303,6 +316,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \ -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \ -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \ -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_NATIVE_PATH) \
$(JTREG_EXCLUSIONS) \ $(JTREG_EXCLUSIONS) \
$(JTREG_TEST_OPTIONS) \ $(JTREG_TEST_OPTIONS) \
$(TEST_SELECTION) \ $(TEST_SELECTION) \
@ -313,7 +327,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
PHONY_LIST += jtreg_tests PHONY_LIST += jtreg_tests
# flags used to execute java in test targets # flags used to execute java in test targets
TEST_FLAGS += -version -Xinternalversion -X -help TEST_FLAGS += -version -Xinternalversion -X -help
sanitytest: prep $(PRODUCT_HOME) sanitytest: prep $(PRODUCT_HOME)
@for flag in $(TEST_FLAGS); \ @for flag in $(TEST_FLAGS); \

View file

@ -334,6 +334,9 @@ applicable_cmsgc = \
hotspot_wbapitest = \ hotspot_wbapitest = \
sanity/ sanity/
hotspot_native_sanity = \
native_sanity
hotspot_compiler_1 = \ hotspot_compiler_1 = \
compiler/arraycopy/ \ compiler/arraycopy/ \
compiler/c1/ \ 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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; import java.util.List;
public class CompressedClassSpaceSizeInJmapHeap { 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 { public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) { if (!Platform.is64bit()) {
// Compressed Class Space is only available on 64-bit JVMs // 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 786058752e0ac3e48d7aef79e0885d29d6a2a7eb jdk9-b49
74ead7bddde19263fd463bc1bd87de84f27d1b5e jdk9-b50 74ead7bddde19263fd463bc1bd87de84f27d1b5e jdk9-b50
7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51 7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51
57b26c883d54f45912bc3885ccad3c6b80960b1f jdk9-b52

View file

@ -297,3 +297,4 @@ e529374fbe526dbd668e5e98fc047b42b3bc6d33 jdk9-b45
435a49db1de0589acc86b2cc5fd61d546f94b56c jdk9-b49 435a49db1de0589acc86b2cc5fd61d546f94b56c jdk9-b49
45a30e7ee623031a1532685512dd2c2d8e8fa0ad jdk9-b50 45a30e7ee623031a1532685512dd2c2d8e8fa0ad jdk9-b50
bb9cf97a5ac6aa1aa2a1034676d64413071f58ea jdk9-b51 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.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.logging.Level; import java.util.logging.Level;
@ -85,19 +87,25 @@ public final class ClassFactory {
if(consRef!=null) if(consRef!=null)
cons = consRef.get(); cons = consRef.get();
if(cons==null) { if(cons==null) {
try { cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() {
cons = clazz.getDeclaredConstructor(emptyClass); @Override
} catch (NoSuchMethodException e) { public Constructor<T> run() {
logger.log(Level.INFO,"No default constructor found on "+clazz,e); try {
NoSuchMethodError exp; return clazz.getDeclaredConstructor(emptyClass);
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) { } catch (NoSuchMethodException e) {
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName())); logger.log(Level.INFO,"No default constructor found on "+clazz,e);
} else { NoSuchMethodError exp;
exp = new NoSuchMethodError(e.getMessage()); 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(); int classMod = clazz.getModifiers();

View file

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

View file

@ -25,8 +25,6 @@
package com.sun.tools.internal.ws.wsdl.document.soap; package com.sun.tools.internal.ws.wsdl.document.soap;
import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
/** /**
@ -37,7 +35,9 @@ import javax.xml.namespace.QName;
public interface SOAPConstants { public interface SOAPConstants {
// namespace URIs // 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 = public static final String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/"; "http://schemas.xmlsoap.org/wsdl/soap/";
public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; 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 541a8cef4e0d54c3e4b52a98c6af3c31e2096669 jdk9-b49
f6b8edd397ee463be208fee27517c99101293267 jdk9-b50 f6b8edd397ee463be208fee27517c99101293267 jdk9-b50
a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51 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 charset x-EUC-TW EUC_TW
package sun.nio.cs.ext package sun.nio.cs.ext
type source type template
alias euc_tw # JDK historical alias euc_tw # JDK historical
alias euctw alias euctw
alias cns11643 alias cns11643
@ -1660,6 +1660,16 @@ charset IBM290 IBM290
alias EBCDIC-JP-kana alias EBCDIC-JP-kana
alias 290 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 charset x-IBM300 IBM300
package sun.nio.cs.ext package sun.nio.cs.ext
type dbcsonly type dbcsonly
@ -1816,3 +1826,17 @@ charset x-JIS0212_MS5022X JIS_X_0212_MS5022X
ascii false ascii false
minmax 0x21 0x7e 0x21 0x7e minmax 0x21 0x7e 0x21 0x7e
internal true # "internal implementation 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 IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext
IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext
IBM1149 IBM01149 Cp1149 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 IBM273 IBM273 Cp273 false sun.nio.cs.ext
IBM277 IBM277 Cp277 false sun.nio.cs.ext IBM277 IBM277 Cp277 false sun.nio.cs.ext
IBM278 IBM278 Cp278 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
EUC_JP_LINUX EUC_JP_LINUX
EUC_JP_Open EUC_JP_Open
EUC_TW
GBK GBK
ISO_8859_11 ISO_8859_11
ISO_8859_3 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) \ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
extcs charsets $(CHARSET_STANDARD_OS) \ extcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \ $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(CHARSET_EXTENDED_JAVA_DIR) $(LOG_INFO) $(CHARSET_EXTENDED_JAVA_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
$(LOG_INFO)
$(TOUCH) '$@' $(TOUCH) '$@'
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \ $(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_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_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
CHARSET_TEMPLATES := \ CHARSET_TEMPLATES := \
$(CHARSET_DATA_DIR)/SingleByte-X.java.template \ $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
$(CHARSET_DATA_DIR)/DoubleByte-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) $(MKDIR) -p $(@D)
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \ $(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
stdcs charsets $(CHARSET_STANDARD_OS) \ 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) '$@' $(TOUCH) '$@'
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs 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 1 - Variable to add targets to, must not contain space
# Param 2 - Properties files to process # Param 2 - Properties files to process
# Param 3 - The super class for the generated classes # Param 3 - The super class for the generated classes
# Param 4 - Module path root, defaults to $(JDK_TOPDIR)/src
define SetupCompileProperties define SetupCompileProperties
$1_SRCS := $2 $1_SRCS := $2
$1_CLASS := $3 $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 # 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 # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
# Strip away prefix and suffix, leaving for example only: # Strip away prefix and suffix, leaving for example only:
# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN" # "<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/%, \ $(SUPPORT_OUTPUTDIR)/gensrc/%, \
$$(patsubst %.properties, %.java, \ $$(patsubst %.properties, %.java, \
$$(subst /$(OPENJDK_TARGET_OS)/classes,, \ $$(subst /$(OPENJDK_TARGET_OS)/classes,, \

View file

@ -31,6 +31,7 @@ class Charset {
String csName; String csName;
String hisName; String hisName;
String type; String type;
String os;
boolean isASCII; boolean isASCII;
int b1Min; int b1Min;
int b1Max; 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*+.*"); 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")); InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"), PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
"ISO-8859-1"); "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 // 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(copyright);
out.format("%n// -- This file was mechanically generated: Do not edit! -- //%n"); 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"); out.format("class EUC_TWMapping {%n%n");
// boundaries // boundaries

View file

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

View file

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

View file

@ -33,8 +33,10 @@ import java.util.Scanner;
public class SPI { public class SPI {
public static void genClass(String type, LinkedHashMap<String, Charset> charsets, public static void genClass(String type,
String srcDir, String dstDir, String template) LinkedHashMap<String, Charset> charsets,
String srcDir, String dstDir, String template,
String os)
throws Exception throws Exception
{ {
try (Scanner s = new Scanner(new File(template)); try (Scanner s = new Scanner(new File(template));
@ -50,7 +52,8 @@ public class SPI {
charsets.values() charsets.values()
.stream() .stream()
.filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") && .filter(cs -> cs.pkgName.equals("sun.nio.cs.ext") &&
!cs.isInternal) !cs.isInternal &&
(cs.os == null || cs.os.equals(os)))
.forEach( cs -> { .forEach( cs -> {
out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName); out.printf(" charset(\"%s\", \"%s\",%n", cs.csName, cs.clzName);
out.printf(" new String[] {%n"); 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]); parameterClasses[i] = toClass(parameterTypes[i]);
// Perform access check // Perform access check
Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass(); final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED, enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true); 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, * Loop over all declared methods; match method name,
* number of and type of parameters, *and* return * number of and type of parameters, *and* return
* type. Matching return type is also necessary * type. Matching return type is also necessary
* because of covariant returns, etc. * because of covariant returns, etc.
*/ */
for(Method m: enclosingCandidate.getDeclaredMethods()) { for(Method m: candidates) {
if (m.getName().equals(enclosingInfo.getName()) ) { if (m.getName().equals(enclosingInfo.getName()) ) {
Class<?>[] candidateParamClasses = m.getParameterTypes(); Class<?>[] candidateParamClasses = m.getParameterTypes();
if (candidateParamClasses.length == parameterClasses.length) { if (candidateParamClasses.length == parameterClasses.length) {
@ -1215,14 +1223,22 @@ public final class Class<T> implements java.io.Serializable,
parameterClasses[i] = toClass(parameterTypes[i]); parameterClasses[i] = toClass(parameterTypes[i]);
// Perform access check // Perform access check
Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass(); final Class<?> enclosingCandidate = enclosingInfo.getEnclosingClass();
enclosingCandidate.checkMemberAccess(Member.DECLARED, enclosingCandidate.checkMemberAccess(Member.DECLARED,
Reflection.getCallerClass(), true); 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 * Loop over all declared constructors; match number
* of and type of parameters. * of and type of parameters.
*/ */
for(Constructor<?> c: enclosingCandidate.getDeclaredConstructors()) { for(Constructor<?> c: candidates) {
Class<?>[] candidateParamClasses = c.getParameterTypes(); Class<?>[] candidateParamClasses = c.getParameterTypes();
if (candidateParamClasses.length == parameterClasses.length) { if (candidateParamClasses.length == parameterClasses.length) {
boolean matches = true; boolean matches = true;

View file

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

View file

@ -521,7 +521,7 @@ import java.util.Objects;
} }
@SuppressWarnings("LeakingThisInConstructor") @SuppressWarnings("LeakingThisInConstructor")
public MemberName(Method m, boolean wantSpecial) { public MemberName(Method m, boolean wantSpecial) {
m.getClass(); // NPE check Objects.requireNonNull(m);
// fill in vmtarget, vmindex while we have m in hand: // fill in vmtarget, vmindex while we have m in hand:
MethodHandleNatives.init(this, m); MethodHandleNatives.init(this, m);
if (clazz == null) { // MHN.init failed 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. */ /** Create a name for the given reflected constructor. The resulting name will be in a resolved state. */
@SuppressWarnings("LeakingThisInConstructor") @SuppressWarnings("LeakingThisInConstructor")
public MemberName(Constructor<?> ctor) { public MemberName(Constructor<?> ctor) {
ctor.getClass(); // NPE check Objects.requireNonNull(ctor);
// fill in vmtarget, vmindex while we have ctor in hand: // fill in vmtarget, vmindex while we have ctor in hand:
MethodHandleNatives.init(this, ctor); MethodHandleNatives.init(this, ctor);
assert(isResolved() && this.clazz != null); assert(isResolved() && this.clazz != null);
@ -615,7 +615,7 @@ import java.util.Objects;
} }
@SuppressWarnings("LeakingThisInConstructor") @SuppressWarnings("LeakingThisInConstructor")
public MemberName(Field fld, boolean makeSetter) { public MemberName(Field fld, boolean makeSetter) {
fld.getClass(); // NPE check Objects.requireNonNull(fld);
// fill in vmtarget, vmindex while we have fld in hand: // fill in vmtarget, vmindex while we have fld in hand:
MethodHandleNatives.init(this, fld); MethodHandleNatives.init(this, fld);
assert(isResolved() && this.clazz != null); 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 // @param type type (permanently assigned) of the new method handle
/*non-public*/ MethodHandle(MethodType type, LambdaForm form) { /*non-public*/ MethodHandle(MethodType type, LambdaForm form) {
type.getClass(); // explicit NPE this.type = Objects.requireNonNull(type);
form.getClass(); // explicit NPE this.form = Objects.requireNonNull(form).uncustomize();
this.type = type;
this.form = form.uncustomize();
this.form.prepare(); // TO DO: Try to delay this step until just before invocation. 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 * @see #asFixedArity
*/ */
public MethodHandle asVarargsCollector(Class<?> arrayType) { public MethodHandle asVarargsCollector(Class<?> arrayType) {
arrayType.getClass(); // explicit NPE Objects.requireNonNull(arrayType);
boolean lastMatch = asCollectorChecks(arrayType, 0); boolean lastMatch = asCollectorChecks(arrayType, 0);
if (isVarargsCollector() && lastMatch) if (isVarargsCollector() && lastMatch)
return this; return this;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,8 +27,15 @@ package java.net;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.spi.URLStreamHandlerProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Hashtable; 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; import sun.security.util.SecurityConstants;
/** /**
@ -248,23 +255,19 @@ public final class URL implements java.io.Serializable {
* stream protocol handler. * stream protocol handler.
* <li>If no {@code URLStreamHandlerFactory} has yet been set up, * <li>If no {@code URLStreamHandlerFactory} has yet been set up,
* or if the factory's {@code createURLStreamHandler} method * or if the factory's {@code createURLStreamHandler} method
* returns {@code null}, then the constructor finds the * returns {@code null}, then the {@linkplain java.util.ServiceLoader
* value of the system property: * ServiceLoader} mechanism is used to locate {@linkplain
* <blockquote><pre> * java.net.spi.URLStreamHandlerProvider URLStreamHandlerProvider}
* java.protocol.handler.pkgs * implementations using the system class
* </pre></blockquote> * loader. The order that providers are located is implementation
* If the value of that system property is not {@code null}, * specific, and an implementation is free to cache the located
* it is interpreted as a list of packages separated by a vertical * providers. A {@linkplain java.util.ServiceConfigurationError
* slash character '{@code |}'. The constructor tries to load * ServiceConfigurationError}, {@code Error} or {@code RuntimeException}
* the class named: * thrown from the {@code createURLStreamHandler}, if encountered, will
* <blockquote><pre> * be propagated to the calling thread. The {@code
* &lt;<i>package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler * createURLStreamHandler} method of each provider, if instantiated, is
* </pre></blockquote> * invoked, with the protocol string, until a provider returns non-null,
* where &lt;<i>package</i>&gt; is replaced by the name of the package * or all providers have been exhausted.
* 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.
* <li>If the previous step fails to find a protocol handler, then the * <li>If the previous step fails to find a protocol handler, then the
* constructor tries to load a built-in protocol handler. * 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 * 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> * <blockquote><pre>
* http, https, file, and jar * http, https, file, and jar
* </pre></blockquote> * </pre></blockquote>
* Protocol handlers for additional protocols may also be * Protocol handlers for additional protocols may also be available.
* 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. * <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(); 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 // safe publication of URLStreamHandlerFactory with volatile write
factory = fac; 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. * A table of protocol handlers.
*/ */
static Hashtable<String,URLStreamHandler> handlers = new Hashtable<>(); static Hashtable<String,URLStreamHandler> handlers = new Hashtable<>();
private static Object streamHandlerLock = new Object(); private static final Object streamHandlerLock = new Object();
/** /**
* Returns the Stream Handler. * Returns the Stream Handler.
@ -1129,66 +1231,33 @@ public final class URL implements java.io.Serializable {
static URLStreamHandler getURLStreamHandler(String protocol) { static URLStreamHandler getURLStreamHandler(String protocol) {
URLStreamHandler handler = handlers.get(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 // Use the factory (if any). Volatile read makes
// URLStreamHandlerFactory appear fully initialized to current thread. // URLStreamHandlerFactory appear fully initialized to current thread.
URLStreamHandlerFactory fac = factory; fac = factory;
if (fac != null) { if (fac != null) {
handler = fac.createURLStreamHandler(protocol); handler = fac.createURLStreamHandler(protocol);
checkedWithFactory = true; checkedWithFactory = true;
} }
// Try java protocol handler if (handler == null && !protocol.equalsIgnoreCase("jar")) {
if (handler == null) { handler = lookupViaProviders(protocol);
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
}
}
} }
}
synchronized (streamHandlerLock) { synchronized (streamHandlerLock) {
if (handler == null) {
// Try the built-in protocol handler
handler = defaultFactory.createURLStreamHandler(protocol);
} else {
URLStreamHandler handler2 = null; URLStreamHandler handler2 = null;
// Check again with hashtable just in case another // 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 // Check with factory if another thread set a
// factory since our last check // factory since our last check
if (!checkedWithFactory && (fac = factory) != null) { if (!checkedWithFactory && (fac = factory) != null) {
handler2 = fac.createURLStreamHandler(protocol); handler2 = fac.createURLStreamHandler(protocol);
} }
if (handler2 != null) { if (handler2 != null) {
@ -1211,29 +1280,17 @@ public final class URL implements java.io.Serializable {
// this thread created. // this thread created.
handler = handler2; handler = handler2;
} }
}
// Insert this handler into the hashtable // Insert this handler into the hashtable
if (handler != null) { if (handler != null) {
handlers.put(protocol, handler); handlers.put(protocol, handler);
}
} }
} }
return 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 * WriteObject is called to save the state of the URL to an
* ObjectOutputStream. The handler is not saved since it is * ObjectOutputStream. The handler is not saved since it is

View file

@ -44,7 +44,9 @@ public interface URLStreamHandlerFactory {
* *
* @param protocol the protocol ("{@code ftp}", * @param protocol the protocol ("{@code ftp}",
* "{@code http}", "{@code nntp}", etc.). * "{@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 * @see java.net.URLStreamHandler
*/ */
URLStreamHandler createURLStreamHandler(String protocol); URLStreamHandler createURLStreamHandler(String protocol);

View file

@ -143,13 +143,11 @@
* a similar URL will try to instantiate the handler for the specified protocol; * a similar URL will try to instantiate the handler for the specified protocol;
* if it doesn't exist an exception will be thrown. * if it doesn't exist an exception will be thrown.
* <p>By default the protocol handlers are loaded dynamically from the default * <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 * location. It is, however, possible to deploy additional protocols handlers
* the {@code java.protocol.handler.pkgs} system property. For instance if * as {@link java.util.ServiceLoader services}. Service providers of type
* it is set to {@code myapp.protocols}, then the URL code will try, in the * {@linkplain java.net.spi.URLStreamHandlerProvider} are located at
* case of http, first to load {@code myapp.protocols.http.Handler}, then, * runtime, as specified in the {@linkplain
* if this fails, {@code http.Handler} from the default location. * java.net.URL#URL(String,String,int,String) URL constructor}.
* <p>Note that the Handler class <b>has to</b> be a subclass of the abstract
* class {@link java.net.URLStreamHandler}.</p>
* <h2>Additional Specification</h2> * <h2>Additional Specification</h2>
* <ul> * <ul>
* <li><a href="doc-files/net-properties.html"> * <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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,26 +23,13 @@
* questions. * questions.
*/ */
package sun.security.acl;
import java.security.*;
/** /**
* This class implements a group of principals. * Service-provider classes for the <tt>{@link java.net}</tt> package.
* @author Satish Dharmaraj *
* <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) { package java.net.spi;
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;
}
}

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