This commit is contained in:
Phil Race 2018-06-27 10:06:03 -07:00
commit bd7d1af092
524 changed files with 63183 additions and 34960 deletions

View File

@ -327,7 +327,8 @@ define SetupApiDocsGenerationBody
)
ifeq ($$($1_JAVADOC_CMD), )
$1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true $$($1_JAVA_ARGS) \
$1_JAVADOC_CMD := $$(JAVA) -Djava.awt.headless=true \
-Dextlink.spec.version=$$(VERSION_SPECIFICATION) $$($1_JAVA_ARGS) \
$$(NEW_JAVADOC)
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -147,6 +147,7 @@ GZIP := gzip
HEAD := head
LS := ls
LN := ln
MIG := mig
MKDIR := mkdir
MV := mv
NAWK := nawk

View File

@ -121,6 +121,9 @@ TOOL_GENCLASSLOADERMAP = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
build.tools.module.GenModuleLoaderMap
TOOL_PUBLICSUFFIXLIST = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.publicsuffixlist.GeneratePublicSuffixList
##########################################################################################
endif # _TOOLS_GMK

View File

@ -1208,6 +1208,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
BASIC_REQUIRE_PROGS(DSYMUTIL, dsymutil)
BASIC_REQUIRE_PROGS(MIG, mig)
BASIC_REQUIRE_PROGS(XATTR, xattr)
BASIC_PATH_PROGS(CODESIGN, codesign)
if test "x$CODESIGN" != "x"; then

View File

@ -491,6 +491,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# (see http://llvm.org/bugs/show_bug.cgi?id=7554)
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
# In principle the stack alignment below is cpu- and ABI-dependent and
# should agree with values of StackAlignmentInBytes in various
# src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
# works for all platforms.
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
TOOLCHAIN_CFLAGS_JDK="-pipe"
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
@ -601,10 +607,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
fi
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
fi
# Optional POSIX functionality needed by the JVM
#
# Check if clock_gettime is available and in which library. This indicates

View File

@ -675,6 +675,7 @@ GZIP:=@GZIP@
HEAD:=@HEAD@
LS:=@LS@
LN:=@LN@
MIG:=@MIG@
MKDIR:=@MKDIR@
MV:=@MV@
NAWK:=@NAWK@

View File

@ -523,17 +523,6 @@ var getJibProfilesProfiles = function (input, common, data) {
profiles[maketestName] = concatObjects(profiles[name], testmakeBase);
profiles[maketestName].default_make_targets = [ "test-make" ];
});
// Generate cmp-baseline profiles for each main profile. This profile does
// a compare build run with no changes to verify that the compare script
// has a clean baseline
common.main_profile_names.forEach(function (name) {
var cmpBaselineName = name + "-cmp-baseline";
profiles[cmpBaselineName] = clone(profiles[name]);
// Only compare the images target. This should pressumably be expanded
// to include more build targets when possible.
profiles[cmpBaselineName].default_make_targets = [ "images" ];
profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
});
// Profiles for building the zero jvm variant. These are used for verification
// in JPRT.
@ -727,6 +716,22 @@ var getJibProfilesProfiles = function (input, common, data) {
profiles[debugName] = concatObjects(profiles[debugName], configureArgs);
});
// Generate cmp-baseline profiles for each main profile and their
// corresponding debug profile. This profile does a compare build run with no
// changes to verify that the compare script has a clean baseline
common.main_profile_names.forEach(function (name) {
[ "", common.open_suffix ].forEach(function (suffix) {
var cmpBaselineName = name + suffix + "-cmp-baseline";
profiles[cmpBaselineName] = clone(profiles[name + suffix]);
// Only compare the images target. This should pressumably be expanded
// to include more build targets when possible.
profiles[cmpBaselineName].default_make_targets = [ "images" ];
profiles[cmpBaselineName].make_args = [ "COMPARE_BUILD=CONF=" ];
// Do not inherit artifact definitions from base profile
delete profiles[cmpBaselineName].artifacts;
});
});
// Profiles used to run tests. Used in JPRT and Mach 5.
var testOnlyProfiles = {
"run-test-jprt": {

View File

@ -0,0 +1,2 @@
Github: https://raw.githubusercontent.com/publicsuffix/list/2225db8d9f4a2a27ec697c883360632fa0c16261/public_suffix_list.dat
Date: 2018-05-09

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,8 @@ include GendataBlacklistedCerts.gmk
include GendataCryptoPolicy.gmk
include GendataPublicSuffixList.gmk
################################################################################
GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat

View File

@ -0,0 +1,38 @@
#
# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
# 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.
#
include $(SPEC)
GENDATA_PUBLICSUFFIXLIST_SRC += $(TOPDIR)/make/data/publicsuffixlist/public_suffix_list.dat
GENDATA_PUBLICSUFFIXLIST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/public_suffix_list.dat
$(GENDATA_PUBLICSUFFIXLIST): $(GENDATA_PUBLICSUFFIXLIST_SRC) $(BUILD_TOOLS)
$(call LogInfo, Generating public suffix list)
$(call MakeDir, $(@D))
$(RM) $@
$(TOOL_PUBLICSUFFIXLIST) $< $@
$(CHMOD) 444 $@
TARGETS += $(GENDATA_PUBLICSUFFIXLIST)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -42,6 +42,21 @@ TARGETS += $(SA_PROPERTIES)
################################################################################
ifeq ($(OPENJDK_TARGET_OS), macosx)
MIG_OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
MACH_EXC_HEADER := $(MIG_OUTPUT_DIR)/mach_exc.h
MACH_EXC_USER := $(MIG_OUTPUT_DIR)/mach_excUser.c
MACH_EXC_SERVER := $(MIG_OUTPUT_DIR)/mach_excServer.c
$(MACH_EXC_SERVER): $(SDKROOT)/usr/include/mach/mach_exc.defs
$(MIG) -isysroot $(SDKROOT) -server $@ -user $(MACH_EXC_USER) \
-header $(MACH_EXC_HEADER) $(SDKROOT)/usr/include/mach/mach_exc.defs
TARGETS += $(MACH_EXC_SERVER)
endif
################################################################################
all: $(TARGETS)
.PHONY: all default

View File

@ -0,0 +1,154 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* 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 build.tools.publicsuffixlist;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.file.attribute.FileTime;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* This tool takes the original Mozilla public suffix rule list as input
* and slices it into a set of files, one for each top-level domain.
* Each file contains only the rules for that domain. Lines containing comments
* or only whitespace are not copied. Each of these files are then combined
* into the target zipfile.
*
* Usage: java GeneratePublicSuffixList mozilla_file destination_zipfile
*/
public final class GeneratePublicSuffixList {
// patterns
private static final String COMMENT = "//";
private static final String BEGIN_PRIVATE = "// ===BEGIN PRIVATE DOMAINS===";
private static final Pattern WHITESPACE = Pattern.compile("\\s*");
private static final byte ICANN = 0x00;
private static final byte PRIVATE = 0x01;
private static class Domain {
final String name;
final byte type;
Domain(String name, byte type) {
this.name = name;
this.type = type;
}
}
public static void main(String[] args) throws Exception {
if (args.length != 2) {
throw new Exception("2 args required: input_file output_file");
}
try (FileInputStream fis = new FileInputStream(args[0]);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(args[1])))
{
BufferedReader br =
new BufferedReader(new InputStreamReader(fis, "UTF-8"));
List<Domain> domains = new LinkedList<>();
byte type = ICANN;
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith(COMMENT)) {
if (line.startsWith(BEGIN_PRIVATE)) {
type = PRIVATE;
}
continue;
}
if (WHITESPACE.matcher(line).matches()) {
continue;
}
domains.add(new Domain(line, type));
}
// have a list of rules now
// Map of TLD names to rules with the same TLD
Map<String, List<Domain>> rules = addDomains(domains);
// stream for writing the file contents
BufferedWriter bw =
new BufferedWriter(new OutputStreamWriter(zos, "UTF-8"));
// now output each map entry to its own file,
// whose filename is the TLD
writeRules(zos, bw, rules);
}
}
private static Map<String, List<Domain>> addDomains(List<Domain> domains) {
Map<String, List<Domain>> rules = new HashMap<>();
for (Domain domain : domains) {
String tld = getTLD(domain.name);
rules.compute(tld, (k, v) -> {
if (v == null) {
List<Domain> newV = new LinkedList<>();
newV.add(domain);
return newV;
} else {
v.add(domain);
return v;
}
});
}
return rules;
}
private static void writeRules(ZipOutputStream zos, BufferedWriter bw,
Map<String, List<Domain>> rules)
throws IOException {
// Sort keys for deterministic output
List<String> tlds = rules.keySet().stream().sorted().collect(Collectors.toList());
for (String tld : tlds) {
List<Domain> entries = rules.get(tld);
ZipEntry ze = new ZipEntry(tld);
ze.setLastModifiedTime(FileTime.fromMillis(0));
zos.putNextEntry(ze);
for (Domain entry : entries) {
bw.write(entry.type);
bw.write(entry.name, 0, entry.name.length());
bw.newLine();
}
bw.flush();
}
}
private static String getTLD(String line) {
int dotIndex = line.lastIndexOf('.');
return (dotIndex == -1) ? line : line.substring(dotIndex + 1);
}
}

View File

@ -37,7 +37,6 @@ import com.sun.source.doctree.UnknownInlineTagTree;
import jdk.javadoc.doclet.Taglet;
import static com.sun.source.doctree.DocTree.Kind.*;
import static jdk.javadoc.doclet.Taglet.Location.*;
/**
* An inline tag to conveniently insert an external link.
@ -53,13 +52,23 @@ import static jdk.javadoc.doclet.Taglet.Location.*;
* }
*/
public class ExtLink implements Taglet {
static final String SPEC_VERSION;
static {
SPEC_VERSION = System.getProperty("extlink.spec.version");
if (SPEC_VERSION == null) {
throw new RuntimeException("extlink.spec.version property not set");
}
}
static final String TAG_NAME = "extLink";
static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase10&amp;id=";
static final String URL = "https://www.oracle.com/pls/topic/lookup?ctx=javase" +
SPEC_VERSION + "&amp;id=";
static final Pattern TAG_PATTERN = Pattern.compile("(?s)(\\s*)(?<name>\\w+)(\\s+)(?<desc>.*)$");
/**
* Returns the set of locations in which the tag may be used.
*/

View File

@ -38,6 +38,7 @@ else ifeq ($(OPENJDK_TARGET_OS), solaris)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
SA_CFLAGS := -Damd64 -D_GNU_SOURCE -mno-omit-leaf-frame-pointer \
-mstack-alignment=16 -fPIC
LIBSA_EXTRA_SRC := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
else ifeq ($(OPENJDK_TARGET_OS), windows)
SA_CFLAGS := -D_WINDOWS -D_DEBUG -D_CONSOLE -D_MBCS -EHsc
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
@ -57,6 +58,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
CFLAGS := $(CFLAGS_JDKLIB) $(SA_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \
EXTRA_SRC := $(LIBSA_EXTRA_SRC), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_LDFLAGS), \
LIBS_linux := -lthread_db $(LIBDL), \
LIBS_solaris := -ldl -ldemangle -lthread -lproc, \

View File

@ -265,9 +265,11 @@ static OopMap* save_live_registers(StubAssembler* sasm,
__ push(RegSet::range(r0, r29), sp); // integer registers except lr & sp
if (save_fpu_registers) {
for (int i = 30; i >= 0; i -= 2)
__ stpd(as_FloatRegister(i), as_FloatRegister(i+1),
Address(__ pre(sp, -2 * wordSize)));
for (int i = 31; i>= 0; i -= 4) {
__ sub(sp, sp, 4 * wordSize); // no pre-increment for st1. Emulate it without modifying other registers
__ st1(as_FloatRegister(i-3), as_FloatRegister(i-2), as_FloatRegister(i-1),
as_FloatRegister(i), __ T1D, Address(sp));
}
} else {
__ add(sp, sp, -32 * wordSize);
}
@ -277,9 +279,9 @@ static OopMap* save_live_registers(StubAssembler* sasm,
static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
if (restore_fpu_registers) {
for (int i = 0; i < 32; i += 2)
__ ldpd(as_FloatRegister(i), as_FloatRegister(i+1),
Address(__ post(sp, 2 * wordSize)));
for (int i = 0; i < 32; i += 4)
__ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
as_FloatRegister(i+3), __ T1D, Address(__ post(sp, 4 * wordSize)));
} else {
__ add(sp, sp, 32 * wordSize);
}
@ -290,9 +292,9 @@ static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registe
static void restore_live_registers_except_r0(StubAssembler* sasm, bool restore_fpu_registers = true) {
if (restore_fpu_registers) {
for (int i = 0; i < 32; i += 2)
__ ldpd(as_FloatRegister(i), as_FloatRegister(i+1),
Address(__ post(sp, 2 * wordSize)));
for (int i = 0; i < 32; i += 4)
__ ld1(as_FloatRegister(i), as_FloatRegister(i+1), as_FloatRegister(i+2),
as_FloatRegister(i+3), __ T1D, Address(__ post(sp, 4 * wordSize)));
} else {
__ add(sp, sp, 32 * wordSize);
}

View File

@ -2127,8 +2127,7 @@ void MacroAssembler::resolve_jobject(Register value, Register thread, Register t
bind(not_weak);
// Resolve (untagged) jobject.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT, value, Address(value, 0), tmp,
thread);
access_load_at(T_OBJECT, IN_NATIVE, value, Address(value, 0), tmp, thread);
verify_oop(value);
bind(done);
}
@ -3643,8 +3642,7 @@ void MacroAssembler::load_klass(Register dst, Register src) {
// ((OopHandle)result).resolve();
void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
// OopHandle::resolve is an indirection.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
result, Address(result, 0), tmp, noreg);
access_load_at(T_OBJECT, IN_NATIVE, result, Address(result, 0), tmp, noreg);
}
void MacroAssembler::load_mirror(Register dst, Register method, Register tmp) {

View File

@ -321,9 +321,10 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorator
void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null) {
bool in_heap = (decorators & IN_HEAP) != 0;
bool in_concurrent_root = (decorators & IN_CONCURRENT_ROOT) != 0;
bool as_normal = (decorators & AS_NORMAL) != 0;
assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported");
bool needs_pre_barrier = in_heap || in_concurrent_root;
bool needs_pre_barrier = as_normal;
bool needs_post_barrier = (new_val != noreg) && in_heap;
// flatten object address if needed
@ -360,7 +361,7 @@ void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet deco
g1_write_barrier_post(masm, store_addr, new_val, tmp1, tmp2, tmp3);
}
}
};
}
#ifdef COMPILER1

View File

@ -2140,7 +2140,7 @@ void MacroAssembler::resolve_jobject(Register value,
b(done);
bind(not_weak);
// Resolve (untagged) jobject.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
access_load_at(T_OBJECT, IN_NATIVE,
Address(value, 0), value, tmp1, tmp2, noreg);
verify_oop(value);
bind(done);

View File

@ -725,18 +725,6 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
// Fairer handling of safepoints for native methods.
//
// Generate code which reads from the polling page. This special handling is needed as the
// linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults in 64bit mode
// (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6), especially when we try
// to read from the safepoint polling page.
address generate_load_from_poll() {
StubCodeMark mark(this, "StubRoutines", "generate_load_from_poll");
address start = __ function_entry();
__ unimplemented("StubRoutines::verify_oop", 95); // TODO PPC port
return start;
}
// -XX:+OptimizeFill : convert fill/copy loops into intrinsic
//

View File

@ -3320,9 +3320,9 @@ void TemplateTable::fast_xaccess(TosState state) {
// - byte_no
//
// Output:
// - Rmethod: The method to invoke next.
// - Rmethod: The method to invoke next or i-klass (invokeinterface).
// - Rret_addr: The return address to return to.
// - Rindex: MethodType (invokehandle) or CallSite obj (invokedynamic)
// - Rindex: MethodType (invokehandle), CallSite obj (invokedynamic) or Method (invokeinterface)
// - Rrecv: Cache for "this" pointer, might be noreg if static call.
// - Rflags: Method flags from const pool cache.
//
@ -3332,7 +3332,7 @@ void TemplateTable::fast_xaccess(TosState state) {
void TemplateTable::prepare_invoke(int byte_no,
Register Rmethod, // linked method (or i-klass)
Register Rret_addr,// return address
Register Rindex, // itable index, MethodType, etc.
Register Rindex, // itable index, MethodType, Method, etc.
Register Rrecv, // If caller wants to see it.
Register Rflags, // If caller wants to test it.
Register Rscratch
@ -3618,9 +3618,9 @@ void TemplateTable::invokeinterface(int byte_no) {
Register Rscratch = Rflags; // Rflags is dead now.
__ profile_final_call(Rscratch1, Rscratch);
__ profile_arguments_type(Rindex, Rscratch, Rrecv_klass /* scratch */, true);
__ profile_arguments_type(Rmethod, Rscratch, Rrecv_klass /* scratch */, true);
__ call_from_interpreter(Rindex, Rret_addr, Rscratch, Rrecv_klass /* scratch */);
__ call_from_interpreter(Rmethod, Rret_addr, Rscratch, Rrecv_klass /* scratch */);
__ bind(LnotVFinal);

View File

@ -400,9 +400,10 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Register
void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Register val, Address dst, Register tmp) {
bool in_heap = (decorators & IN_HEAP) != 0;
bool in_concurrent_root = (decorators & IN_CONCURRENT_ROOT) != 0;
bool as_normal = (decorators & AS_NORMAL) != 0;
assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported");
bool needs_pre_barrier = in_heap || in_concurrent_root;
bool needs_pre_barrier = as_normal;
// No need for post barrier if storing NULL
bool needs_post_barrier = val != G0 && in_heap;

View File

@ -182,8 +182,7 @@ void MacroAssembler::resolve_jobject(Register value, Register tmp) {
br (Assembler::always, true, Assembler::pt, done);
delayed()->nop();
bind(not_weak);
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
Address(value, 0), value, tmp);
access_load_at(T_OBJECT, IN_NATIVE, Address(value, 0), value, tmp);
verify_oop(value);
bind(done);
}
@ -3402,8 +3401,7 @@ void MacroAssembler::reserved_stack_check() {
// ((OopHandle)result).resolve();
void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
// OopHandle::resolve is an indirection.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
Address(result, 0), result, tmp);
access_load_at(T_OBJECT, IN_NATIVE, Address(result, 0), result, tmp);
}
void MacroAssembler::load_mirror(Register mirror, Register method, Register tmp) {

View File

@ -349,9 +349,10 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
Address dst, Register val, Register tmp1, Register tmp2) {
bool in_heap = (decorators & IN_HEAP) != 0;
bool in_concurrent_root = (decorators & IN_CONCURRENT_ROOT) != 0;
bool as_normal = (decorators & AS_NORMAL) != 0;
assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported");
bool needs_pre_barrier = in_heap || in_concurrent_root;
bool needs_pre_barrier = as_normal;
bool needs_post_barrier = val != noreg && in_heap;
Register tmp3 = LP64_ONLY(r8) NOT_LP64(rsi);

View File

@ -5238,8 +5238,7 @@ void MacroAssembler::resolve_jobject(Register value,
jmp(done);
bind(not_weak);
// Resolve (untagged) jobject.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
value, Address(value, 0), tmp, thread);
access_load_at(T_OBJECT, IN_NATIVE, value, Address(value, 0), tmp, thread);
verify_oop(value);
bind(done);
}
@ -6216,7 +6215,7 @@ void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
// Only 64 bit platforms support GCs that require a tmp register
// Only IN_HEAP loads require a thread_tmp register
// OopHandle::resolve is an indirection like jobject.
access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
access_load_at(T_OBJECT, IN_NATIVE,
result, Address(result, 0), tmp, /*tmp_thread*/noreg);
}

View File

@ -38,7 +38,7 @@ void SafepointMechanism::pd_initialize() {
// Allocate one protected page
char* map_address = (char*)MAP_FAILED;
const size_t page_size = os::vm_page_size();
const size_t map_size = ThreadLocalHandshakes ? 2 * os::vm_page_size() : os::vm_page_size();
const int prot = PROT_READ;
const int flags = MAP_PRIVATE | MAP_ANONYMOUS;
@ -68,7 +68,7 @@ void SafepointMechanism::pd_initialize() {
// AIX: AIX needs MAP_FIXED if we provide an address and mmap will
// fail if the address is already mapped.
map_address = (char*) ::mmap(address_wishes[i],
page_size, prot,
map_size, prot,
flags | MAP_FIXED,
-1, 0);
log_debug(os)("SafePoint Polling Page address: %p (wish) => %p",
@ -81,24 +81,27 @@ void SafepointMechanism::pd_initialize() {
if (map_address != (char*)MAP_FAILED) {
// Map succeeded, but polling_page is not at wished address, unmap and continue.
::munmap(map_address, page_size);
::munmap(map_address, map_size);
map_address = (char*)MAP_FAILED;
}
// Map failed, continue loop.
}
}
if (map_address == (char*)MAP_FAILED) {
map_address = (char*) ::mmap(NULL, page_size, prot, flags, -1, 0);
map_address = (char*) ::mmap(NULL, map_size, prot, flags, -1, 0);
}
guarantee(map_address != (char*)MAP_FAILED, "SafepointMechanism::pd_initialize: failed to allocate polling page");
guarantee(map_address != (char*)MAP_FAILED && map_address != NULL,
"SafepointMechanism::pd_initialize: failed to allocate polling page");
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(map_address));
os::set_polling_page((address)(map_address));
// Use same page for ThreadLocalHandshakes without SIGTRAP
if (ThreadLocalHandshakes) {
set_uses_thread_local_poll();
intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address);
_poll_armed_value = reinterpret_cast<void*>(bad_page_val | poll_bit());
_poll_disarmed_value = NULL; // Readable on AIX
os::make_polling_page_unreadable();
intptr_t bad_page_val = reinterpret_cast<intptr_t>(map_address),
good_page_val = bad_page_val + os::vm_page_size();
_poll_armed_value = reinterpret_cast<void*>(bad_page_val + poll_bit());
_poll_disarmed_value = reinterpret_cast<void*>(good_page_val);
}
}

View File

@ -4612,12 +4612,17 @@ static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
InstanceKlass::cast(super),
vca_result);
if (msg == NULL) {
bool same_module = (this_klass->module() == super->module());
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
"class %s cannot access its superclass %s",
"class %s cannot access its %ssuperclass %s (%s%s%s)",
this_klass->external_name(),
super->external_name());
super->is_abstract() ? "abstract " : "",
super->external_name(),
(same_module) ? this_klass->joint_in_module_of_loader(super) : this_klass->class_in_module_of_loader(),
(same_module) ? "" : "; ",
(same_module) ? "" : super->class_in_module_of_loader());
} else {
// Add additional message content.
Exceptions::fthrow(
@ -4646,12 +4651,16 @@ static void check_super_interface_access(const InstanceKlass* this_klass, TRAPS)
InstanceKlass::cast(k),
vca_result);
if (msg == NULL) {
bool same_module = (this_klass->module() == k->module());
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
"class %s cannot access its superinterface %s",
"class %s cannot access its superinterface %s (%s%s%s)",
this_klass->external_name(),
k->external_name());
k->external_name(),
(same_module) ? this_klass->joint_in_module_of_loader(k) : this_klass->class_in_module_of_loader(),
(same_module) ? "" : "; ",
(same_module) ? "" : k->class_in_module_of_loader());
} else {
// Add additional message content.
Exceptions::fthrow(

View File

@ -832,9 +832,7 @@ void ClassLoaderData::remove_handle(OopHandle h) {
oop* ptr = h.ptr_raw();
if (ptr != NULL) {
assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
// This root is not walked in safepoints, and hence requires an appropriate
// decorator that e.g. maintains the SATB invariant in SATB collectors.
NativeAccess<IN_CONCURRENT_ROOT>::oop_store(ptr, oop(NULL));
NativeAccess<>::oop_store(ptr, oop(NULL));
}
}

View File

@ -4425,6 +4425,12 @@ oop java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(
return obj->obj_field(_owner_offset);
}
#if INCLUDE_CDS
void java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(SerializeClosure* f) {
AOS_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif
static int member_offset(int hardcoded_offset) {
return (hardcoded_offset * heapOopSize) + instanceOopDesc::base_offset_in_bytes();
}

View File

@ -1488,6 +1488,7 @@ class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic {
public:
static void compute_offsets();
static oop get_owner_threadObj(oop obj);
static void serialize(SerializeClosure* f) NOT_CDS_RETURN;
};
// Use to declare fields that need to be injected into Java classes

View File

@ -197,6 +197,9 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
ClassFileStream* old_stream = stream;
// increment counter
THREAD->statistical_info().incr_define_class_count();
// Skip this processing for VM anonymous classes
if (host_klass == NULL) {
stream = check_class_file_load_hook(stream,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -150,7 +150,7 @@ class verification_type_info {
case ITEM_Object:
st->print("Object[#%d]", cpool_index()); break;
default:
assert(false, "Bad verification_type_info");
st->print("BAD:%d", tag()); break;
}
}
};

View File

@ -499,7 +499,6 @@ void StringTable::clean_dead_entries(JavaThread* jt) {
StringTableDeleteCheck stdc;
StringTableDoDelete stdd;
bool interrupted = false;
{
TraceTime timer("Clean", TRACETIME_LOG(Debug, stringtable, perf));
while(bdt.do_task(jt, stdc, stdd)) {
@ -507,15 +506,8 @@ void StringTable::clean_dead_entries(JavaThread* jt) {
{
ThreadBlockInVM tbivm(jt);
}
if (!bdt.cont(jt)) {
interrupted = true;
break;
}
bdt.cont(jt);
}
}
if (interrupted) {
_has_work = true;
} else {
bdt.done(jt);
}
log_debug(stringtable)("Cleaned %ld of %ld", stdc._count, stdc._item);

View File

@ -2709,11 +2709,11 @@ Handle SystemDictionary::link_method_handle_constant(Klass* caller,
java_lang_invoke_MemberName::set_flags(mname(), MethodHandles::ref_kind_to_flags(ref_kind));
if (ref_kind == JVM_REF_invokeVirtual &&
callee->name() == vmSymbols::java_lang_invoke_MethodHandle() &&
(name == vmSymbols::invoke_name() || name == vmSymbols::invokeExact_name())) {
// Skip resolution for j.l.i.MethodHandle.invoke()/invokeExact().
// They are public signature polymorphic methods, but require appendix argument
// which MemberName resolution doesn't handle. There's special logic on JDK side to handle them
MethodHandles::is_signature_polymorphic_public_name(callee, name)) {
// Skip resolution for public signature polymorphic methods such as
// j.l.i.MethodHandle.invoke()/invokeExact() and those on VarHandle
// They require appendix argument which MemberName resolution doesn't handle.
// There's special logic on JDK side to handle them
// (see MethodHandles.linkMethodHandleConstant() and MethodHandles.findVirtualForMH()).
} else {
MethodHandles::resolve_MemberName(mname, caller, /*speculative_resolve*/false, CHECK_(empty));

View File

@ -2435,7 +2435,7 @@ class VerifyAllBlksClosure: public BlkClosure {
}
};
class VerifyAllOopsClosure: public OopClosure {
class VerifyAllOopsClosure: public BasicOopIterateClosure {
private:
const CMSCollector* _collector;
const CompactibleFreeListSpace* _sp;
@ -2524,9 +2524,8 @@ void CompactibleFreeListSpace::verify() const {
VerifyAllOopsClosure cl(_collector, this, span, past_remark,
_collector->markBitMap());
// Iterate over all oops in the heap. Uses the _no_header version
// since we are not interested in following the klass pointers.
CMSHeap::heap()->oop_iterate_no_header(&cl);
// Iterate over all oops in the heap.
CMSHeap::heap()->oop_iterate(&cl);
}
if (VerifyObjectStartArray) {

View File

@ -52,11 +52,6 @@ void G1BarrierSetC1::pre_barrier(LIRAccess& access, LIR_Opr addr_opr,
LIR_Opr pre_val, CodeEmitInfo* info) {
LIRGenerator* gen = access.gen();
DecoratorSet decorators = access.decorators();
bool in_heap = (decorators & IN_HEAP) != 0;
bool in_conc_root = (decorators & IN_CONCURRENT_ROOT) != 0;
if (!in_heap && !in_conc_root) {
return;
}
// First we test whether marking is in progress.
BasicType flag_type;

View File

@ -54,10 +54,10 @@ void G1Arguments::initialize_verification_types() {
}
void G1Arguments::parse_verification_type(const char* type) {
if (strcmp(type, "young-only") == 0) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyYoungOnly);
} else if (strcmp(type, "initial-mark") == 0) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyInitialMark);
if (strcmp(type, "young-normal") == 0) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyYoungNormal);
} else if (strcmp(type, "concurrent-start") == 0) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyConcurrentStart);
} else if (strcmp(type, "mixed") == 0) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyMixed);
} else if (strcmp(type, "remark") == 0) {
@ -68,7 +68,7 @@ void G1Arguments::parse_verification_type(const char* type) {
G1HeapVerifier::enable_verification_type(G1HeapVerifier::G1VerifyFull);
} else {
log_warning(gc, verify)("VerifyGCType: '%s' is unknown. Available types are: "
"young-only, initial-mark, mixed, remark, cleanup and full", type);
"young-normal, concurrent-start, mixed, remark, cleanup and full", type);
}
}

View File

@ -98,12 +98,10 @@ template <DecoratorSet decorators, typename BarrierSetT>
template <typename T>
inline void G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
oop_store_not_in_heap(T* addr, oop new_value) {
if (HasDecorator<decorators, IN_CONCURRENT_ROOT>::value) {
// For roots not scanned in a safepoint, we have to apply SATB barriers
// even for roots.
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_field_pre<decorators>(addr);
}
// Apply SATB barriers for all non-heap references, to allow
// concurrent scanning of such references.
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
bs->write_ref_field_pre<decorators>(addr);
Raw::oop_store(addr, new_value);
}

View File

@ -2813,15 +2813,19 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
GCTraceCPUTime tcpu;
G1HeapVerifier::G1VerifyType verify_type;
FormatBuffer<> gc_string("Pause ");
FormatBuffer<> gc_string("Pause Young ");
if (collector_state()->in_initial_mark_gc()) {
gc_string.append("Initial Mark");
verify_type = G1HeapVerifier::G1VerifyInitialMark;
gc_string.append("(Concurrent Start)");
verify_type = G1HeapVerifier::G1VerifyConcurrentStart;
} else if (collector_state()->in_young_only_phase()) {
gc_string.append("Young");
verify_type = G1HeapVerifier::G1VerifyYoungOnly;
if (collector_state()->in_young_gc_before_mixed()) {
gc_string.append("(Prepare Mixed)");
} else {
gc_string.append("(Normal)");
}
verify_type = G1HeapVerifier::G1VerifyYoungNormal;
} else {
gc_string.append("Mixed");
gc_string.append("(Mixed)");
verify_type = G1HeapVerifier::G1VerifyMixed;
}
GCTraceTime(Info, gc) tm(gc_string, NULL, gc_cause(), true);

View File

@ -120,8 +120,7 @@ void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
if (VerifyDuringGC) {
_verify_closure.set_containing_obj(array);
NoHeaderExtendedOopClosure no(&_verify_closure);
array->oop_iterate_range(&no, beg_index, end_index);
array->oop_iterate_range(&_verify_closure, beg_index, end_index);
if (_verify_closure.failures()) {
assert(false, "Failed");
}
@ -141,7 +140,7 @@ inline void G1FullGCMarker::follow_object(oop obj) {
return;
}
_verify_closure.set_containing_obj(obj);
obj->oop_iterate_no_header(&_verify_closure);
obj->oop_iterate(&_verify_closure);
if (_verify_closure.failures()) {
log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
assert(false, "Failed");

View File

@ -84,7 +84,7 @@ public:
virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
};
class G1VerifyOopClosure: public OopClosure {
class G1VerifyOopClosure: public BasicOopIterateClosure {
private:
G1CollectedHeap* _g1h;
bool _failures;

View File

@ -180,7 +180,7 @@ class VerifyCLDClosure: public CLDClosure {
}
};
class VerifyLivenessOopClosure: public OopClosure {
class VerifyLivenessOopClosure: public BasicOopIterateClosure {
G1CollectedHeap* _g1h;
VerifyOption _vo;
public:
@ -226,7 +226,7 @@ public:
guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
}
o->oop_iterate_no_header(&isLive);
o->oop_iterate(&isLive);
if (!_hr->obj_allocated_since_prev_marking(o)) {
size_t obj_size = o->size(); // Make sure we don't overflow
_live_bytes += (obj_size * HeapWordSize);
@ -236,7 +236,7 @@ public:
size_t live_bytes() { return _live_bytes; }
};
class VerifyArchiveOopClosure: public OopClosure {
class VerifyArchiveOopClosure: public BasicOopIterateClosure {
HeapRegion* _hr;
public:
VerifyArchiveOopClosure(HeapRegion *hr)
@ -269,7 +269,7 @@ public:
void do_object(oop o) {
VerifyArchiveOopClosure checkOop(_hr);
assert(o != NULL, "Should not be here for NULL oops");
o->oop_iterate_no_header(&checkOop);
o->oop_iterate(&checkOop);
}
};

View File

@ -42,13 +42,13 @@ private:
public:
enum G1VerifyType {
G1VerifyYoungOnly = 1, // -XX:VerifyGCType=young-only
G1VerifyInitialMark = 2, // -XX:VerifyGCType=initial-mark
G1VerifyMixed = 4, // -XX:VerifyGCType=mixed
G1VerifyRemark = 8, // -XX:VerifyGCType=remark
G1VerifyCleanup = 16, // -XX:VerifyGCType=cleanup
G1VerifyFull = 32, // -XX:VerifyGCType=full
G1VerifyAll = -1
G1VerifyYoungNormal = 1, // -XX:VerifyGCType=young-normal
G1VerifyConcurrentStart = 2, // -XX:VerifyGCType=concurrent-start
G1VerifyMixed = 4, // -XX:VerifyGCType=mixed
G1VerifyRemark = 8, // -XX:VerifyGCType=remark
G1VerifyCleanup = 16, // -XX:VerifyGCType=cleanup
G1VerifyFull = 32, // -XX:VerifyGCType=full
G1VerifyAll = -1
};
G1HeapVerifier(G1CollectedHeap* heap) : _g1h(heap) {}

View File

@ -215,12 +215,12 @@ bool MutableSpace::cas_deallocate(HeapWord *obj, size_t size) {
return Atomic::cmpxchg(obj, top_addr(), expected_top) == expected_top;
}
void MutableSpace::oop_iterate_no_header(OopClosure* cl) {
void MutableSpace::oop_iterate(OopIterateClosure* cl) {
HeapWord* obj_addr = bottom();
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
obj_addr += oop(obj_addr)->oop_iterate_no_header(cl);
obj_addr += oop(obj_addr)->oop_iterate_size(cl);
}
}

View File

@ -134,7 +134,7 @@ class MutableSpace: public ImmutableSpace {
bool cas_deallocate(HeapWord *obj, size_t size);
// Iteration.
void oop_iterate_no_header(OopClosure* cl);
void oop_iterate(OopIterateClosure* cl);
void object_iterate(ObjectClosure* cl);
// Debugging

View File

@ -39,7 +39,7 @@
// Checks an individual oop for missing precise marks. Mark
// may be either dirty or newgen.
class CheckForUnmarkedOops : public OopClosure {
class CheckForUnmarkedOops : public BasicOopIterateClosure {
private:
PSYoungGen* _young_gen;
PSCardTable* _card_table;
@ -89,7 +89,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
// fail unless the object head is also unmarked.
virtual void do_object(oop obj) {
CheckForUnmarkedOops object_check(_young_gen, _card_table);
obj->oop_iterate_no_header(&object_check);
obj->oop_iterate(&object_check);
if (object_check.has_unmarked_oop()) {
guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
}
@ -97,7 +97,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
};
// Checks for precise marking of oops as newgen.
class CheckForPreciseMarks : public OopClosure {
class CheckForPreciseMarks : public BasicOopIterateClosure {
private:
PSYoungGen* _young_gen;
PSCardTable* _card_table;
@ -336,7 +336,7 @@ void PSCardTable::verify_all_young_refs_precise() {
CheckForPreciseMarks check(heap->young_gen(), this);
old_gen->oop_iterate_no_header(&check);
old_gen->oop_iterate(&check);
verify_all_young_refs_precise_helper(old_gen->object_space()->used_region());
}

View File

@ -192,7 +192,7 @@ class PSOldGen : public CHeapObj<mtGC> {
HeapWord* allocate(size_t word_size);
// Iteration.
void oop_iterate_no_header(OopClosure* cl) { object_space()->oop_iterate_no_header(cl); }
void oop_iterate(OopIterateClosure* cl) { object_space()->oop_iterate(cl); }
void object_iterate(ObjectClosure* cl) { object_space()->object_iterate(cl); }
// Debugging - do not use for time critical operations

View File

@ -33,6 +33,7 @@
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/stack.inline.hpp"
inline void MarkSweep::mark_object(oop obj) {
// some marks may contain information we need to preserve so we store them away

View File

@ -330,7 +330,7 @@ void CardTableRS::invalidate_or_clear(Generation* old_gen) {
}
class VerifyCleanCardClosure: public OopClosure {
class VerifyCleanCardClosure: public BasicOopIterateClosure {
private:
HeapWord* _boundary;
HeapWord* _begin;
@ -430,7 +430,7 @@ void CardTableRS::verify_space(Space* s, HeapWord* gen_boundary) {
VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
oop(cur)->oop_iterate_no_header(&verify_blk, mr);
oop(cur)->oop_iterate(&verify_blk, mr);
}
}
}

View File

@ -1042,11 +1042,6 @@ bool GenCollectedHeap::is_in_partial_collection(const void* p) {
}
#endif
void GenCollectedHeap::oop_iterate_no_header(OopClosure* cl) {
NoHeaderExtendedOopClosure no_header_cl(cl);
oop_iterate(&no_header_cl);
}
void GenCollectedHeap::oop_iterate(OopIterateClosure* cl) {
_young_gen->oop_iterate(cl);
_old_gen->oop_iterate(cl);

View File

@ -258,7 +258,6 @@ public:
virtual void verify_nmethod(nmethod* nmethod);
// Iteration functions.
void oop_iterate_no_header(OopClosure* cl);
void oop_iterate(OopIterateClosure* cl);
void object_iterate(ObjectClosure* cl);
void safe_object_iterate(ObjectClosure* cl);

View File

@ -133,8 +133,7 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
"Only ones we deal with for now.");
assert(_precision != CardTable::ObjHeadPreciseArray ||
_cl->idempotent() || _last_bottom == NULL ||
top <= _last_bottom,
_last_bottom == NULL || top <= _last_bottom,
"Not decreasing");
NOT_PRODUCT(_last_bottom = mr.start());
@ -172,14 +171,7 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
walk_mem_region(extended_mr, bottom_obj, top);
}
// An idempotent closure might be applied in any order, so we don't
// record a _min_done for it.
if (!_cl->idempotent()) {
_min_done = bottom;
} else {
assert(_min_done == _last_explicit_min_done,
"Don't update _min_done for idempotent cl");
}
_min_done = bottom;
}
DirtyCardToOopClosure* Space::new_dcto_cl(OopIterateClosure* cl,

View File

@ -281,13 +281,11 @@ typeArrayOop StringDedupTable::lookup(typeArrayOop value, bool latin1, unsigned
StringDedupEntry** list, uintx &count) {
for (StringDedupEntry* entry = *list; entry != NULL; entry = entry->next()) {
if (entry->hash() == hash && entry->latin1() == latin1) {
typeArrayOop existing_value = entry->obj();
if (equals(value, existing_value)) {
// Apply proper barrier to make sure it is kept alive. Concurrent mark might
// otherwise declare it dead if there are no other strong references to this object.
oop* obj_addr = (oop*)entry->obj_addr();
oop obj = NativeAccess<IN_CONCURRENT_ROOT | ON_WEAK_OOP_REF>::oop_load(obj_addr);
return typeArrayOop(obj);
oop* obj_addr = (oop*)entry->obj_addr();
oop obj = NativeAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(obj_addr);
if (equals(value, static_cast<typeArrayOop>(obj))) {
obj = NativeAccess<ON_PHANTOM_OOP_REF>::oop_load(obj_addr);
return static_cast<typeArrayOop>(obj);
}
}
count++;

View File

@ -653,7 +653,6 @@ Node* ZBarrierSetC2::load_at_resolved(C2Access& access, const Type* val_type) co
return p;
}
bool conc_root = (access.decorators() & IN_CONCURRENT_ROOT) != 0;
bool weak = (access.decorators() & ON_WEAK_OOP_REF) != 0;
GraphKit* kit = access.kit();

View File

@ -48,12 +48,9 @@ bool ZBarrierSet::barrier_needed(DecoratorSet decorators, BasicType type) {
//assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Unexpected decorator");
if (type == T_OBJECT || type == T_ARRAY) {
if (((decorators & IN_HEAP) != 0) ||
((decorators & IN_CONCURRENT_ROOT) != 0) ||
((decorators & ON_PHANTOM_OOP_REF) != 0)) {
// Barrier needed
return true;
}
assert((decorators & (IN_HEAP | IN_NATIVE)) != 0, "Where is reference?");
// Barrier needed even when IN_NATIVE, to allow concurrent scanning.
return true;
}
// Barrier not neeed

View File

@ -623,7 +623,7 @@ void ZStatPhaseCycle::register_start(const Ticks& start) const {
}
#define ZUSED_FMT SIZE_FORMAT "M(%.0lf%%)"
#define ZUSED_ARGS(size, max_capacity) ((size) / M), (percent_of<size_t>(size, max_capacity))
#define ZUSED_ARGS(size, max_capacity) ((size) / M), (percent_of(size, max_capacity))
void ZStatPhaseCycle::register_end(const Ticks& start, const Ticks& end) const {
timer()->register_gc_end(end);
@ -641,6 +641,7 @@ void ZStatPhaseCycle::register_end(const Ticks& start, const Ticks& end) const {
ZStatMark::print();
ZStatRelocation::print();
ZStatNMethods::print();
ZStatMetaspace::print();
ZStatReferences::print();
ZStatHeap::print();
@ -1128,6 +1129,19 @@ void ZStatNMethods::print() {
ZNMethodTable::unregistered_nmethods());
}
//
// Stat metaspace
//
void ZStatMetaspace::print() {
log_info(gc, metaspace)("Metaspace: "
SIZE_FORMAT "M used, " SIZE_FORMAT "M capacity, "
SIZE_FORMAT "M committed, " SIZE_FORMAT "M reserved",
MetaspaceUtils::used_bytes() / M,
MetaspaceUtils::capacity_bytes() / M,
MetaspaceUtils::committed_bytes() / M,
MetaspaceUtils::reserved_bytes() / M);
}
//
// Stat references
//
@ -1187,7 +1201,7 @@ ZStatHeap::ZAtRelocateEnd ZStatHeap::_at_relocate_end;
#define ZSIZE_NA "%9s", "-"
#define ZSIZE_ARGS(size) SIZE_FORMAT_W(8) "M (%.0lf%%)", \
((size) / M), (percent_of<size_t>(size, _at_initialize.max_capacity))
((size) / M), (percent_of(size, _at_initialize.max_capacity))
size_t ZStatHeap::available(size_t used) {
return _at_initialize.max_capacity - used;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -406,6 +406,14 @@ public:
static void print();
};
//
// Stat metaspace
//
class ZStatMetaspace : public AllStatic {
public:
static void print();
};
//
// Stat references
//

View File

@ -218,7 +218,7 @@ void CallInfo::verify() {
fatal("Unexpected call kind %d", call_kind());
}
}
#endif //ASSERT
#endif // ASSERT
#ifndef PRODUCT
void CallInfo::print() {
@ -294,7 +294,7 @@ void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass,
base_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
}
// The element type could be a typeArray - we only need the access
// check if it is an reference to another class.
// check if it is a reference to another class.
if (!base_klass->is_instance_klass()) {
return; // no relevant check to do
}
@ -306,13 +306,17 @@ void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass,
char* msg = Reflection::verify_class_access_msg(ref_klass,
InstanceKlass::cast(base_klass),
vca_result);
bool same_module = (base_klass->module() == ref_klass->module());
if (msg == NULL) {
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
"failed to access class %s from class %s",
"failed to access class %s from class %s (%s%s%s)",
base_klass->external_name(),
ref_klass->external_name());
ref_klass->external_name(),
(same_module) ? base_klass->joint_in_module_of_loader(ref_klass) : base_klass->class_in_module_of_loader(),
(same_module) ? "" : "; ",
(same_module) ? "" : ref_klass->class_in_module_of_loader());
} else {
// Use module specific message returned by verify_class_access_msg().
Exceptions::fthrow(
@ -596,8 +600,11 @@ void LinkResolver::check_method_accessability(Klass* ref_klass,
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
"class %s tried to access method %s.%s%s (%s%s%s)",
"class %s tried to access %s%s%smethod %s.%s%s (%s%s%s)",
ref_klass->external_name(),
sel_method->is_abstract() ? "abstract " : "",
sel_method->is_protected() ? "protected " : "",
sel_method->is_private() ? "private " : "",
sel_klass->external_name(),
sel_method->name()->as_C_string(),
sel_method->signature()->as_C_string(),
@ -927,14 +934,20 @@ void LinkResolver::check_field_accessability(Klass* ref_klass,
// Any existing exceptions that may have been thrown, for example LinkageErrors
// from nest-host resolution, have been allowed to propagate.
if (!can_access) {
bool same_module = (sel_klass->module() == ref_klass->module());
ResourceMark rm(THREAD);
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
"tried to access field %s.%s from class %s",
"class %s tried to access %s%sfield %s.%s (%s%s%s)",
ref_klass->external_name(),
fd.is_protected() ? "protected " : "",
fd.is_private() ? "private " : "",
sel_klass->external_name(),
fd.name()->as_C_string(),
ref_klass->external_name()
(same_module) ? ref_klass->joint_in_module_of_loader(sel_klass) : ref_klass->class_in_module_of_loader(),
(same_module) ? "" : "; ",
(same_module) ? "" : sel_klass->class_in_module_of_loader()
);
return;
}

View File

@ -234,10 +234,15 @@ objArrayHandle CompilerToVM::initialize_intrinsics(TRAPS) {
do_bool_flag(UseCRC32Intrinsics) \
do_bool_flag(UseCompressedClassPointers) \
do_bool_flag(UseCompressedOops) \
do_bool_flag(UseConcMarkSweepGC) \
X86_ONLY(do_bool_flag(UseCountLeadingZerosInstruction)) \
X86_ONLY(do_bool_flag(UseCountTrailingZerosInstruction)) \
do_bool_flag(UseConcMarkSweepGC) \
do_bool_flag(UseG1GC) \
do_bool_flag(UseParallelGC) \
do_bool_flag(UseParallelOldGC) \
do_bool_flag(UseSerialGC) \
do_bool_flag(UseZGC) \
do_bool_flag(UseEpsilonGC) \
COMPILER2_PRESENT(do_bool_flag(UseMontgomeryMultiplyIntrinsic)) \
COMPILER2_PRESENT(do_bool_flag(UseMontgomerySquareIntrinsic)) \
COMPILER2_PRESENT(do_bool_flag(UseMulAddIntrinsic)) \

View File

@ -94,10 +94,6 @@ class OopIterateClosure : public OopClosure {
virtual void do_klass(Klass* k) = 0;
virtual void do_cld(ClassLoaderData* cld) = 0;
// True iff this closure may be safely applied more than once to an oop
// location without an intervening "major reset" (like the end of a GC).
virtual bool idempotent() { return false; }
#ifdef ASSERT
// Default verification of each visited oop field.
template <typename T> void verify(T* p);
@ -117,16 +113,6 @@ public:
virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
};
// Wrapper closure only used to implement oop_iterate_no_header().
class NoHeaderExtendedOopClosure : public BasicOopIterateClosure {
OopClosure* _wrapped_closure;
public:
NoHeaderExtendedOopClosure(OopClosure* cl) : _wrapped_closure(cl) {}
// Warning: this calls the virtual version do_oop in the the wrapped closure.
virtual void do_oop(oop* p) { _wrapped_closure->do_oop(p); }
virtual void do_oop(narrowOop* p) { _wrapped_closure->do_oop(p); }
};
class KlassClosure : public Closure {
public:
virtual void do_klass(Klass* k) = 0;

View File

@ -508,7 +508,7 @@ Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
return NULL;
}
log_debug(gc, metaspace, alloc)("Free list allocate humongous chunk size " SIZE_FORMAT " for requested size " SIZE_FORMAT " waste " SIZE_FORMAT,
log_trace(gc, metaspace, alloc)("Free list allocate humongous chunk size " SIZE_FORMAT " for requested size " SIZE_FORMAT " waste " SIZE_FORMAT,
chunk->word_size(), word_size, chunk->word_size() - word_size);
}
@ -550,7 +550,7 @@ Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) {
assert((word_size <= chunk->word_size()) ||
(list_index(chunk->word_size()) == HumongousIndex),
"Non-humongous variable sized chunk");
LogTarget(Debug, gc, metaspace, freelist) lt;
LogTarget(Trace, gc, metaspace, freelist) lt;
if (lt.is_enabled()) {
size_t list_count;
if (list_index(word_size) < HumongousIndex) {

View File

@ -152,11 +152,11 @@ size_t SpaceManager::calc_chunk_size(size_t word_size) {
" chunk_word_size " SIZE_FORMAT,
word_size, chunk_word_size);
Log(gc, metaspace, alloc) log;
if (log.is_debug() && SpaceManager::is_humongous(word_size)) {
log.debug("Metadata humongous allocation:");
log.debug(" word_size " PTR_FORMAT, word_size);
log.debug(" chunk_word_size " PTR_FORMAT, chunk_word_size);
log.debug(" chunk overhead " PTR_FORMAT, Metachunk::overhead());
if (log.is_trace() && SpaceManager::is_humongous(word_size)) {
log.trace("Metadata humongous allocation:");
log.trace(" word_size " PTR_FORMAT, word_size);
log.trace(" chunk_word_size " PTR_FORMAT, chunk_word_size);
log.trace(" chunk overhead " PTR_FORMAT, Metachunk::overhead());
}
return chunk_word_size;
}
@ -390,9 +390,9 @@ Metachunk* SpaceManager::get_new_chunk(size_t chunk_word_size) {
}
Log(gc, metaspace, alloc) log;
if (log.is_debug() && next != NULL &&
if (log.is_trace() && next != NULL &&
SpaceManager::is_humongous(next->word_size())) {
log.debug(" new humongous chunk word size " PTR_FORMAT, next->word_size());
log.trace(" new humongous chunk word size " PTR_FORMAT, next->word_size());
}
return next;

View File

@ -428,7 +428,7 @@ Metachunk* VirtualSpaceNode::take_from_committed(size_t chunk_word_size) {
"The committed memory doesn't match the expanded memory.");
if (!is_available(chunk_word_size)) {
LogTarget(Debug, gc, metaspace, freelist) lt;
LogTarget(Trace, gc, metaspace, freelist) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size);

View File

@ -455,6 +455,7 @@ void MetaspaceShared::serialize_well_known_classes(SerializeClosure* soc) {
java_lang_StackTraceElement::serialize(soc);
java_lang_StackFrameInfo::serialize(soc);
java_lang_LiveStackFrameInfo::serialize(soc);
java_util_concurrent_locks_AbstractOwnableSynchronizer::serialize(soc);
}
address MetaspaceShared::cds_i2i_entry_code_buffers(size_t total_size) {

View File

@ -375,8 +375,7 @@ void Access<decorators>::verify_decorators() {
const DecoratorSet location_decorators = decorators & IN_DECORATOR_MASK;
STATIC_ASSERT(location_decorators == 0 || ( // make sure location decorators are disjoint if set
(location_decorators ^ IN_NATIVE) == 0 ||
(location_decorators ^ IN_HEAP) == 0 ||
(location_decorators ^ (IN_NATIVE | IN_CONCURRENT_ROOT)) == 0
(location_decorators ^ IN_HEAP) == 0
));
}

View File

@ -153,8 +153,8 @@ const DecoratorSet MO_DECORATOR_MASK = MO_UNORDERED | MO_VOLATILE | MO_RELAXED |
// Note that primitive accesses will only be resolved on the barrier set if the appropriate build-time
// decorator for enabling primitive barriers is enabled for the build.
const DecoratorSet AS_RAW = UCONST64(1) << 12;
const DecoratorSet AS_NO_KEEPALIVE = UCONST64(1) << 14;
const DecoratorSet AS_NORMAL = UCONST64(1) << 15;
const DecoratorSet AS_NO_KEEPALIVE = UCONST64(1) << 13;
const DecoratorSet AS_NORMAL = UCONST64(1) << 14;
const DecoratorSet AS_DECORATOR_MASK = AS_RAW | AS_NO_KEEPALIVE | AS_NORMAL;
// === Reference Strength Decorators ===
@ -166,10 +166,10 @@ const DecoratorSet AS_DECORATOR_MASK = AS_RAW | AS_NO_KEEPALIVE | AS_NORMA
// * ON_UNKNOWN_OOP_REF: The memory access is performed on a reference of unknown strength.
// This could for example come from the unsafe API.
// * Default (no explicit reference strength specified): ON_STRONG_OOP_REF
const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 16;
const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 17;
const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 18;
const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 19;
const DecoratorSet ON_STRONG_OOP_REF = UCONST64(1) << 15;
const DecoratorSet ON_WEAK_OOP_REF = UCONST64(1) << 16;
const DecoratorSet ON_PHANTOM_OOP_REF = UCONST64(1) << 17;
const DecoratorSet ON_UNKNOWN_OOP_REF = UCONST64(1) << 18;
const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF |
ON_PHANTOM_OOP_REF | ON_UNKNOWN_OOP_REF;
@ -179,13 +179,9 @@ const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF |
// * IN_HEAP: The access is performed in the heap. Many barriers such as card marking will
// be omitted if this decorator is not set.
// * IN_NATIVE: The access is performed in an off-heap data structure pointing into the Java heap.
// * IN_CONCURRENT_ROOT: The access is performed in an off-heap data structure pointing into the Java heap,
// but is notably not scanned during safepoints. This is sometimes a special case for some GCs and
// implies that it is also an IN_NATIVE.
const DecoratorSet IN_HEAP = UCONST64(1) << 20;
const DecoratorSet IN_NATIVE = UCONST64(1) << 22;
const DecoratorSet IN_CONCURRENT_ROOT = UCONST64(1) << 23;
const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE | IN_CONCURRENT_ROOT;
const DecoratorSet IN_HEAP = UCONST64(1) << 19;
const DecoratorSet IN_NATIVE = UCONST64(1) << 20;
const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE;
// == Boolean Flag Decorators ==
// * IS_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
@ -194,8 +190,8 @@ const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE | IN_CONCURRENT_ROOT
// marking that the previous value is uninitialized nonsense rather than a real value.
// * IS_NOT_NULL: This property can make certain barriers faster such as compressing oops.
const DecoratorSet IS_ARRAY = UCONST64(1) << 21;
const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 13;
const DecoratorSet IS_NOT_NULL = UCONST64(1) << 25;
const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 22;
const DecoratorSet IS_NOT_NULL = UCONST64(1) << 23;
// == Arraycopy Decorators ==
// * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
@ -207,17 +203,17 @@ const DecoratorSet IS_NOT_NULL = UCONST64(1) << 25;
// * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
// * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
// * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 26;
const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 27;
const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 28;
const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 29;
const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 30;
const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 24;
const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 25;
const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 26;
const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 27;
const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 28;
const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT |
ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF |
ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED;
// Keep track of the last decorator.
const DecoratorSet DECORATOR_LAST = UCONST64(1) << 30;
const DecoratorSet DECORATOR_LAST = UCONST64(1) << 28;
namespace AccessInternal {
// This class adds implied decorators that follow according to decorator rules.
@ -235,9 +231,7 @@ namespace AccessInternal {
// If no barrier strength has been picked, normal will be used
static const DecoratorSet barrier_strength_default = memory_ordering_default |
((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
static const DecoratorSet conc_root_is_root = barrier_strength_default |
((IN_CONCURRENT_ROOT & barrier_strength_default) != 0 ? IN_NATIVE : INTERNAL_EMPTY);
static const DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
static const DecoratorSet value = barrier_strength_default | BT_BUILDTIME_DECORATORS;
};
// This function implements the above DecoratorFixup rules, but without meta
@ -253,9 +247,7 @@ namespace AccessInternal {
// If no barrier strength has been picked, normal will be used
DecoratorSet barrier_strength_default = memory_ordering_default |
((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
DecoratorSet conc_root_is_root = barrier_strength_default |
((IN_CONCURRENT_ROOT & barrier_strength_default) != 0 ? IN_NATIVE : INTERNAL_EMPTY);
DecoratorSet value = conc_root_is_root | BT_BUILDTIME_DECORATORS;
DecoratorSet value = barrier_strength_default | BT_BUILDTIME_DECORATORS;
return value;
}
}

View File

@ -3430,7 +3430,7 @@ void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
// Verification
class VerifyFieldClosure: public OopClosure {
class VerifyFieldClosure: public BasicOopIterateClosure {
protected:
template <class T> void do_oop_work(T* p) {
oop obj = RawAccess<>::oop_load(p);
@ -3578,7 +3578,7 @@ void InstanceKlass::verify_on(outputStream* st) {
void InstanceKlass::oop_verify_on(oop obj, outputStream* st) {
Klass::oop_verify_on(obj, st);
VerifyFieldClosure blk;
obj->oop_iterate_no_header(&blk);
obj->oop_iterate(&blk);
}

View File

@ -302,9 +302,6 @@ class oopDesc {
template <typename OopClosureType>
inline void oop_iterate_backwards(OopClosureType* cl);
inline int oop_iterate_no_header(OopClosure* bk);
inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
inline static bool is_instanceof_or_null(oop obj, Klass* klass);
// identity hash; returns the identity hash key (computes it if necessary)

View File

@ -463,18 +463,6 @@ void oopDesc::oop_iterate_backwards(OopClosureType* cl) {
OopIteratorClosureDispatch::oop_oop_iterate_backwards(cl, this, klass());
}
int oopDesc::oop_iterate_no_header(OopClosure* blk) {
// The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
// the do_oop calls, but turns off all other features in OopIterateClosure.
NoHeaderExtendedOopClosure cl(blk);
return oop_iterate_size(&cl);
}
int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
NoHeaderExtendedOopClosure cl(blk);
return oop_iterate_size(&cl, mr);
}
bool oopDesc::is_instanceof_or_null(oop obj, Klass* klass) {
return obj == NULL || obj->klass()->is_subtype_of(klass);
}

View File

@ -29,7 +29,7 @@
#include "oops/oopHandle.hpp"
inline oop OopHandle::resolve() const {
return (_obj == NULL) ? (oop)NULL : NativeAccess<IN_CONCURRENT_ROOT>::oop_load(_obj);
return (_obj == NULL) ? (oop)NULL : NativeAccess<>::oop_load(_obj);
}
#endif // SHARE_VM_OOPS_OOPHANDLE_INLINE_HPP

View File

@ -1149,6 +1149,11 @@ Node* SafePointNode::Identity(PhaseGVN* phase) {
assert( n0->is_Call(), "expect a call here" );
}
if( n0->is_Call() && n0->as_Call()->guaranteed_safepoint() ) {
// Don't remove a safepoint belonging to an OuterStripMinedLoopEndNode.
// If the loop dies, they will be removed together.
if (has_out_with(Op_OuterStripMinedLoopEnd)) {
return this;
}
// Useless Safepoint, so remove it
return in(TypeFunc::Control);
}

View File

@ -683,38 +683,40 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
Block* store_block = get_block_for_node(store);
assert(store_block != NULL, "unused killing projections skipped above");
if (store->is_Phi()) {
if (store->in(0)->is_Loop()) {
// 'load' uses memory which is one (or more) of the Phi's inputs.
// It must be scheduled not before the Phi, but rather before
// each of the relevant Phi inputs.
//
// Instead of finding the LCA of all inputs to a Phi that match 'mem',
// we mark each corresponding predecessor block and do a combined
// hoisting operation later (raise_LCA_above_marks).
//
// Do not assert(store_block != early, "Phi merging memory after access")
// PhiNode may be at start of block 'early' with backedge to 'early'
DEBUG_ONLY(bool found_match = false);
for (uint j = PhiNode::Input, jmax = store->req(); j < jmax; j++) {
if (store->in(j) == mem) { // Found matching input?
DEBUG_ONLY(found_match = true);
Block* pred_block = get_block_for_node(store_block->pred(j));
if (pred_block != early) {
// If any predecessor of the Phi matches the load's "early block",
// we do not need a precedence edge between the Phi and 'load'
// since the load will be forced into a block preceding the Phi.
pred_block->set_raise_LCA_mark(load_index);
assert(!LCA_orig->dominates(pred_block) ||
early->dominates(pred_block), "early is high enough");
must_raise_LCA = true;
} else {
// anti-dependent upon PHI pinned below 'early', no edge needed
LCA = early; // but can not schedule below 'early'
}
if (store->is_Phi() && store->in(0)->is_Loop()) {
// Loop-phis need to raise load before input. (Other phis are treated
// as store below.)
//
// 'load' uses memory which is one (or more) of the Phi's inputs.
// It must be scheduled not before the Phi, but rather before
// each of the relevant Phi inputs.
//
// Instead of finding the LCA of all inputs to a Phi that match 'mem',
// we mark each corresponding predecessor block and do a combined
// hoisting operation later (raise_LCA_above_marks).
//
// Do not assert(store_block != early, "Phi merging memory after access")
// PhiNode may be at start of block 'early' with backedge to 'early'
DEBUG_ONLY(bool found_match = false);
for (uint j = PhiNode::Input, jmax = store->req(); j < jmax; j++) {
if (store->in(j) == mem) { // Found matching input?
DEBUG_ONLY(found_match = true);
Block* pred_block = get_block_for_node(store_block->pred(j));
if (pred_block != early) {
// If any predecessor of the Phi matches the load's "early block",
// we do not need a precedence edge between the Phi and 'load'
// since the load will be forced into a block preceding the Phi.
pred_block->set_raise_LCA_mark(load_index);
assert(!LCA_orig->dominates(pred_block) ||
early->dominates(pred_block), "early is high enough");
must_raise_LCA = true;
} else {
// anti-dependent upon PHI pinned below 'early', no edge needed
LCA = early; // but can not schedule below 'early'
}
}
assert(found_match, "no worklist bug");
}
assert(found_match, "no worklist bug");
#ifdef TRACK_PHI_INPUTS
#ifdef ASSERT
// This assert asks about correct handling of PhiNodes, which may not
@ -728,7 +730,6 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
"Expect at least one phi input will not be from original memory state");
#endif //ASSERT
#endif //TRACK_PHI_INPUTS
}
} else if (store_block != early) {
// 'store' is between the current LCA and earliest possible block.
// Label its block, and decide later on how to raise the LCA

View File

@ -491,6 +491,24 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb
return vmIntrinsics::_none;
}
// Returns true if method is signature polymorphic and public
bool MethodHandles::is_signature_polymorphic_public_name(Klass* klass, Symbol* name) {
if (is_signature_polymorphic_name(klass, name)) {
InstanceKlass* iklass = InstanceKlass::cast(klass);
int me;
int ms = iklass->find_method_by_name(name, &me);
assert(ms != -1, "");
for (; ms < me; ms++) {
Method* m = iklass->methods()->at(ms);
int required = JVM_ACC_NATIVE | JVM_ACC_VARARGS | JVM_ACC_PUBLIC;
int flags = m->access_flags().as_int();
if ((flags & required) == required && ArgumentCount(m->signature()).size() == 1) {
return true;
}
}
}
return false;
}
// convert the external string or reflective type to an internal signature
Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) {
@ -741,7 +759,7 @@ Handle MethodHandles::resolve_MemberName(Handle mname, Klass* caller,
vmIntrinsics::ID mh_invoke_id = vmIntrinsics::_none;
if ((flags & ALL_KINDS) == IS_METHOD &&
(defc == SystemDictionary::MethodHandle_klass()) &&
(defc == SystemDictionary::MethodHandle_klass() || defc == SystemDictionary::VarHandle_klass()) &&
(ref_kind == JVM_REF_invokeVirtual ||
ref_kind == JVM_REF_invokeSpecial ||
// static invocation mode is required for _linkToVirtual, etc.:

View File

@ -143,6 +143,7 @@ class MethodHandles: AllStatic {
static bool is_signature_polymorphic_name(Klass* klass, Symbol* name) {
return signature_polymorphic_name_id(klass, name) != vmIntrinsics::_none;
}
static bool is_signature_polymorphic_public_name(Klass* klass, Symbol* name);
static Bytecodes::Code signature_polymorphic_intrinsic_bytecode(vmIntrinsics::ID id);

View File

@ -855,7 +855,16 @@ WB_END
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
// Screen for unavailable/bad comp level or null method
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
if (method == NULL || comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier) || comp == NULL) {
if (method == NULL) {
tty->print_cr("WB error: request to compile NULL method");
return false;
}
if (comp_level > MIN2((CompLevel) TieredStopAtLevel, CompLevel_highest_tier)) {
tty->print_cr("WB error: invalid compilation level %d", comp_level);
return false;
}
if (comp == NULL) {
tty->print_cr("WB error: no compiler for requested compilation level %d", comp_level);
return false;
}
@ -868,7 +877,17 @@ bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* T
// Compile method and check result
nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, THREAD);
MutexLockerEx mu(Compile_lock);
return ((!is_blocking && mh->queued_for_compilation()) || nm != NULL);
bool is_queued = mh->queued_for_compilation();
if ((!is_blocking && is_queued) || nm != NULL) {
return true;
}
tty->print("WB error: failed to %s compile at level %d method ", is_blocking ? "blocking" : "", comp_level);
mh->print_short_name(tty);
tty->cr();
if (is_blocking && is_queued) {
tty->print_cr("WB error: blocking compilation is still in queue!");
}
return false;
}
WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))

View File

@ -570,6 +570,9 @@ static SpecialFlag const special_jvm_flags[] = {
{ "InlineNotify", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "EnableTracing", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "UseLockedTracing", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "NativeMonitorTimeout", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "NativeMonitorSpinLimit", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
{ "NativeMonitorFlags", JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },

View File

@ -661,6 +661,9 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
product(bool, PrintCompilation, false, \
"Print compilations") \
\
product(bool, PrintExtendedThreadInfo, false, \
"Print more information in thread dump") \
\
diagnostic(bool, TraceNMethodInstalls, false, \
"Trace nmethod installation") \
\
@ -854,12 +857,6 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
"When true prevents OS-level spurious, or premature, wakeups " \
"from Object.wait (Ignored for Windows)") \
\
experimental(intx, NativeMonitorTimeout, -1, "(Unstable)") \
\
experimental(intx, NativeMonitorFlags, 0, "(Unstable)") \
\
experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)") \
\
develop(bool, UsePthreads, false, \
"Use pthread-based instead of libthread-based synchronization " \
"(SPARC only)") \

View File

@ -109,7 +109,7 @@ jobject JNIHandles::make_global(Handle obj, AllocFailType alloc_failmode) {
// Return NULL on allocation failure.
if (ptr != NULL) {
assert(*ptr == NULL, "invariant");
NativeAccess<IN_CONCURRENT_ROOT>::oop_store(ptr, obj());
NativeAccess<>::oop_store(ptr, obj());
res = reinterpret_cast<jobject>(ptr);
} else {
report_handle_allocation_failure(alloc_failmode, "global");
@ -175,7 +175,7 @@ void JNIHandles::destroy_global(jobject handle) {
if (handle != NULL) {
assert(!is_jweak(handle), "wrong method for detroying jweak");
oop* oop_ptr = jobject_ptr(handle);
NativeAccess<IN_CONCURRENT_ROOT>::oop_store(oop_ptr, (oop)NULL);
NativeAccess<>::oop_store(oop_ptr, (oop)NULL);
global_handles()->release(oop_ptr);
}
}

View File

@ -57,7 +57,7 @@ inline oop JNIHandles::resolve_impl(jobject handle) {
if (is_jweak(handle)) { // Unlikely
result = resolve_jweak(handle);
} else {
result = NativeAccess<IN_CONCURRENT_ROOT>::oop_load(jobject_ptr(handle));
result = NativeAccess<>::oop_load(jobject_ptr(handle));
// Construction of jobjects canonicalize a null value into a null
// jobject, so for non-jweak the pointee should never be null.
assert(external_guard || result != NULL, "Invalid JNI handle");

View File

@ -348,9 +348,7 @@ int Monitor::TrySpin(Thread * const Self) {
int Probes = 0;
int Delay = 0;
int Steps = 0;
int SpinMax = NativeMonitorSpinLimit;
int flgs = NativeMonitorFlags;
int SpinMax = 20;
for (;;) {
intptr_t v = _LockWord.FullWord;
if ((v & _LBIT) == 0) {
@ -360,9 +358,7 @@ int Monitor::TrySpin(Thread * const Self) {
continue;
}
if ((flgs & 8) == 0) {
SpinPause();
}
SpinPause();
// Periodically increase Delay -- variable Delay form
// conceptually: delay *= 1 + 1/Exponent
@ -374,8 +370,6 @@ int Monitor::TrySpin(Thread * const Self) {
// CONSIDER: Delay += 1 + (Delay/4); Delay &= 0x7FF ;
}
if (flgs & 2) continue;
// Consider checking _owner's schedctl state, if OFFPROC abort spin.
// If the owner is OFFPROC then it's unlike that the lock will be dropped
// in a timely fashion, which suggests that spinning would not be fruitful
@ -390,12 +384,11 @@ int Monitor::TrySpin(Thread * const Self) {
// spin loop. N1 and brethren write-around the L1$ over the xbar into the L2$.
// Furthermore, they don't have a W$ like traditional SPARC processors.
// We currently use a Marsaglia Shift-Xor RNG loop.
Steps += Delay;
if (Self != NULL) {
jint rv = Self->rng[0];
for (int k = Delay; --k >= 0;) {
rv = MarsagliaXORV(rv);
if ((flgs & 4) == 0 && SafepointMechanism::poll(Self)) return 0;
if (SafepointMechanism::poll(Self)) return 0;
}
Self->rng[0] = rv;
} else {
@ -406,10 +399,6 @@ int Monitor::TrySpin(Thread * const Self) {
static int ParkCommon(ParkEvent * ev, jlong timo) {
// Diagnostic support - periodically unwedge blocked threads
intx nmt = NativeMonitorTimeout;
if (nmt > 0 && (nmt < timo || timo <= 0)) {
timo = nmt;
}
int err = OS_OK;
if (0 == timo) {
ev->park();
@ -466,11 +455,6 @@ void Monitor::ILock(Thread * Self) {
ESelf->reset();
OrderAccess::fence();
// Optional optimization ... try barging on the inner lock
if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) {
goto OnDeck_LOOP;
}
if (AcquireOrPush(ESelf)) goto Exeunt;
// At any given time there is at most one ondeck thread.
@ -484,7 +468,6 @@ void Monitor::ILock(Thread * Self) {
// Self is now in the OnDeck position and will remain so until it
// manages to acquire the lock.
OnDeck_LOOP:
for (;;) {
assert(_OnDeck == ESelf, "invariant");
if (TrySpin(Self)) break;
@ -706,11 +689,6 @@ bool Monitor::notify() {
nfy->Notified = 1;
}
Thread::muxRelease(_WaitLock);
if (nfy != NULL && (NativeMonitorFlags & 16)) {
// Experimental code ... light up the wakee in the hope that this thread (the owner)
// will drop the lock just about the time the wakee comes ONPROC.
nfy->unpark();
}
assert(ILocked(), "invariant");
return true;
}
@ -794,7 +772,7 @@ int Monitor::IWait(Thread * Self, jlong timo) {
for (;;) {
if (ESelf->Notified) break;
int err = ParkCommon(ESelf, timo);
if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break;
if (err == OS_TIMEOUT) break;
}
// Prepare for reentry - if necessary, remove ESelf from WaitSet

View File

@ -93,6 +93,7 @@
#include "runtime/thread.inline.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/threadSMR.inline.hpp"
#include "runtime/threadStatisticalInfo.hpp"
#include "runtime/timer.hpp"
#include "runtime/timerTrace.hpp"
#include "runtime/vframe.inline.hpp"
@ -869,13 +870,29 @@ void Thread::metadata_handles_do(void f(Metadata*)) {
}
}
void Thread::print_on(outputStream* st) const {
void Thread::print_on(outputStream* st, bool print_extended_info) const {
// get_priority assumes osthread initialized
if (osthread() != NULL) {
int os_prio;
if (os::get_native_priority(this, &os_prio) == OS_OK) {
st->print("os_prio=%d ", os_prio);
}
st->print("cpu=%.2fms ",
os::thread_cpu_time(const_cast<Thread*>(this), true) / 1000000.0
);
st->print("elapsed=%.2fs ",
_statistical_info.getElapsedTime() / 1000.0
);
if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) {
size_t allocated_bytes = (size_t) const_cast<Thread*>(this)->cooked_allocated_bytes();
st->print("allocated=" SIZE_FORMAT "%s ",
byte_size_in_proper_unit(allocated_bytes),
proper_unit_for_byte_size(allocated_bytes)
);
st->print("defined_classes=" INT64_FORMAT " ", _statistical_info.getDefineClassCount());
}
st->print("tid=" INTPTR_FORMAT " ", p2i(this));
osthread()->print_on(st);
}
@ -2871,7 +2888,7 @@ void JavaThread::print_thread_state() const {
#endif // PRODUCT
// Called by Threads::print() for VM_PrintThreads operation
void JavaThread::print_on(outputStream *st) const {
void JavaThread::print_on(outputStream *st, bool print_extended_info) const {
st->print_raw("\"");
st->print_raw(get_thread_name());
st->print_raw("\" ");
@ -2881,7 +2898,7 @@ void JavaThread::print_on(outputStream *st) const {
if (java_lang_Thread::is_daemon(thread_oop)) st->print("daemon ");
st->print("prio=%d ", java_lang_Thread::priority(thread_oop));
}
Thread::print_on(st);
Thread::print_on(st, print_extended_info);
// print guess for valid stack memory region (assume 4K pages); helps lock debugging
st->print_cr("[" INTPTR_FORMAT "]", (intptr_t)last_Java_sp() & ~right_n_bits(12));
if (thread_oop != NULL) {
@ -4531,7 +4548,8 @@ JavaThread *Threads::owning_thread_from_monitor_owner(ThreadsList * t_list,
// Threads::print_on() is called at safepoint by VM_PrintThreads operation.
void Threads::print_on(outputStream* st, bool print_stacks,
bool internal_format, bool print_concurrent_locks) {
bool internal_format, bool print_concurrent_locks,
bool print_extended_info) {
char buf[32];
st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
@ -4554,7 +4572,7 @@ void Threads::print_on(outputStream* st, bool print_stacks,
ALL_JAVA_THREADS(p) {
ResourceMark rm;
p->print_on(st);
p->print_on(st, print_extended_info);
if (print_stacks) {
if (internal_format) {
p->trace_stack();

View File

@ -44,6 +44,7 @@
#include "runtime/stubRoutines.hpp"
#include "runtime/threadHeapSampler.hpp"
#include "runtime/threadLocalStorage.hpp"
#include "runtime/threadStatisticalInfo.hpp"
#include "runtime/unhandledOops.hpp"
#include "utilities/align.hpp"
#include "utilities/exceptions.hpp"
@ -341,6 +342,8 @@ class Thread: public ThreadShadow {
// the Java heap
ThreadHeapSampler _heap_sampler; // For use when sampling the memory.
ThreadStatisticalInfo _statistical_info; // Statistics about the thread
JFR_ONLY(DEFINE_THREAD_LOCAL_FIELD_JFR;) // Thread-local data for jfr
int _vm_operation_started_count; // VM_Operation support
@ -521,6 +524,8 @@ class Thread: public ThreadShadow {
ThreadHeapSampler& heap_sampler() { return _heap_sampler; }
ThreadStatisticalInfo& statistical_info() { return _statistical_info; }
JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
@ -638,7 +643,8 @@ protected:
void set_lgrp_id(int value) { _lgrp_id = value; }
// Printing
virtual void print_on(outputStream* st) const;
void print_on(outputStream* st, bool print_extended_info) const;
virtual void print_on(outputStream* st) const { print_on(st, false); }
void print() const { print_on(tty); }
virtual void print_on_error(outputStream* st, char* buf, int buflen) const;
void print_value_on(outputStream* st) const;
@ -1759,7 +1765,8 @@ class JavaThread: public Thread {
// Misc. operations
char* name() const { return (char*)get_thread_name(); }
void print_on(outputStream* st) const;
void print_on(outputStream* st, bool print_extended_info) const;
void print_on(outputStream* st) const { print_on(st, false); }
void print_value();
void print_thread_state_on(outputStream*) const PRODUCT_RETURN;
void print_thread_state() const PRODUCT_RETURN;
@ -2173,10 +2180,10 @@ class Threads: AllStatic {
// Verification
static void verify();
static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks);
static void print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks, bool print_extended_info);
static void print(bool print_stacks, bool internal_format) {
// this function is only used by debug.cpp
print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */);
print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */, false /* simple format */);
}
static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
static void print_on_error(Thread* this_thread, outputStream* st, Thread* current, char* buf,

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_RUNTIME_THREADSTATISTICS_HPP
#define SHARE_VM_RUNTIME_THREADSTATISTICS_HPP
#include "jni.h"
#include "runtime/os.hpp"
#include "utilities/globalDefinitions.hpp"
class ThreadStatisticalInfo {
// The time stamp the thread was started.
const uint64_t _start_time_stamp;
uint64_t _define_class_count;
public:
ThreadStatisticalInfo() : _start_time_stamp(os::javaTimeMillis()), _define_class_count(0) {}
uint64_t getStartTime() const { return _start_time_stamp; }
uint64_t getDefineClassCount() const { return _define_class_count; }
void setDefineClassCount(uint64_t defineClassCount) { _define_class_count = defineClassCount; }
void incr_define_class_count() { _define_class_count += 1; }
uint64_t getElapsedTime() const { return os::javaTimeMillis() - getStartTime(); }
};
#endif // SHARE_VM_RUNTIME_THREADSTATISTICS_HPP

View File

@ -212,7 +212,7 @@ bool VM_PrintThreads::doit_prologue() {
}
void VM_PrintThreads::doit() {
Threads::print_on(_out, true, false, _print_concurrent_locks);
Threads::print_on(_out, true, false, _print_concurrent_locks, _print_extended_info);
}
void VM_PrintThreads::doit_epilogue() {

View File

@ -372,10 +372,17 @@ class VM_PrintThreads: public VM_Operation {
private:
outputStream* _out;
bool _print_concurrent_locks;
bool _print_extended_info;
public:
VM_PrintThreads() { _out = tty; _print_concurrent_locks = PrintConcurrentLocks; }
VM_PrintThreads(outputStream* out, bool print_concurrent_locks) { _out = out; _print_concurrent_locks = print_concurrent_locks; }
VMOp_Type type() const { return VMOp_PrintThreads; }
VM_PrintThreads()
: _out(tty), _print_concurrent_locks(PrintConcurrentLocks), _print_extended_info(false)
{}
VM_PrintThreads(outputStream* out, bool print_concurrent_locks, bool print_extended_info)
: _out(out), _print_concurrent_locks(print_concurrent_locks), _print_extended_info(print_extended_info)
{}
VMOp_Type type() const {
return VMOp_PrintThreads;
}
void doit();
bool doit_prologue();
void doit_epilogue();

View File

@ -168,12 +168,20 @@ static jint data_dump(AttachOperation* op, outputStream* out) {
//
static jint thread_dump(AttachOperation* op, outputStream* out) {
bool print_concurrent_locks = false;
if (op->arg(0) != NULL && strcmp(op->arg(0), "-l") == 0) {
print_concurrent_locks = true;
bool print_extended_info = false;
if (op->arg(0) != NULL) {
for (int i = 0; op->arg(0)[i] != 0; ++i) {
if (op->arg(0)[i] == 'l') {
print_concurrent_locks = true;
}
if (op->arg(0)[i] == 'e') {
print_extended_info = true;
}
}
}
// thread stacks
VM_PrintThreads op1(out, print_concurrent_locks);
VM_PrintThreads op1(out, print_concurrent_locks, print_extended_info);
VMThread::execute(&op1);
// JNI global handles

View File

@ -612,13 +612,15 @@ int ClassStatsDCmd::num_arguments() {
ThreadDumpDCmd::ThreadDumpDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
_locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false") {
_locks("-l", "print java.util.concurrent locks", "BOOLEAN", false, "false"),
_extended("-e", "print extended thread information", "BOOLEAN", false, "false") {
_dcmdparser.add_dcmd_option(&_locks);
_dcmdparser.add_dcmd_option(&_extended);
}
void ThreadDumpDCmd::execute(DCmdSource source, TRAPS) {
// thread stacks
VM_PrintThreads op1(output(), _locks.value());
VM_PrintThreads op1(output(), _locks.value(), _extended.value());
VMThread::execute(&op1);
// JNI global handles

View File

@ -446,6 +446,7 @@ public:
class ThreadDumpDCmd : public DCmdWithParser {
protected:
DCmdArgument<bool> _locks;
DCmdArgument<bool> _extended;
public:
ThreadDumpDCmd(outputStream* output, bool heap);
static const char* name() { return "Thread.print"; }

View File

@ -63,7 +63,8 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::BucketsOperation {
}
// Calculate starting values.
void setup() {
void setup(Thread* thread) {
thread_owns_resize_lock(thread);
_size_log2 = _cht->_table->_log2_size;
_task_size_log2 = MIN2(_task_size_log2, _size_log2);
size_t tmp = _size_log2 > _task_size_log2 ?
@ -76,12 +77,6 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::BucketsOperation {
return OrderAccess::load_acquire(&_next_to_claim) >= _stop_task;
}
// If we have changed size.
bool is_same_table() {
// Not entirely true.
return _size_log2 != _cht->_table->_log2_size;
}
void thread_owns_resize_lock(Thread* thread) {
assert(BucketsOperation::_cht->_resize_lock_owner == thread,
"Should be locked by me");
@ -100,6 +95,24 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::BucketsOperation {
assert(BucketsOperation::_cht->_resize_lock_owner != thread,
"Should not be locked by me");
}
public:
// Pauses for safepoint
void pause(Thread* thread) {
// This leaves internal state locked.
this->thread_owns_resize_lock(thread);
BucketsOperation::_cht->_resize_lock->unlock();
this->thread_owns_only_state_lock(thread);
}
// Continues after safepoint.
void cont(Thread* thread) {
this->thread_owns_only_state_lock(thread);
// If someone slips in here directly after safepoint.
while (!BucketsOperation::_cht->_resize_lock->try_lock())
{ /* for ever */ };
this->thread_owns_resize_lock(thread);
}
};
// For doing pausable/parallel bulk delete.
@ -117,8 +130,7 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::BulkDeleteTask :
if (!lock) {
return false;
}
this->setup();
this->thread_owns_resize_lock(thread);
this->setup(thread);
return true;
}
@ -135,30 +147,8 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::BulkDeleteTask :
BucketsOperation::_cht->do_bulk_delete_locked_for(thread, start, stop,
eval_f, del_f,
BucketsOperation::_is_mt);
return true;
}
// Pauses this operations for a safepoint.
void pause(Thread* thread) {
this->thread_owns_resize_lock(thread);
// This leaves internal state locked.
BucketsOperation::_cht->unlock_resize_lock(thread);
this->thread_do_not_own_resize_lock(thread);
}
// Continues this operations after a safepoint.
bool cont(Thread* thread) {
this->thread_do_not_own_resize_lock(thread);
if (!BucketsOperation::_cht->try_resize_lock(thread)) {
this->thread_do_not_own_resize_lock(thread);
return false;
}
if (BucketsOperation::is_same_table()) {
BucketsOperation::_cht->unlock_resize_lock(thread);
this->thread_do_not_own_resize_lock(thread);
return false;
}
this->thread_owns_resize_lock(thread);
assert(BucketsOperation::_cht->_resize_lock_owner != NULL,
"Should be locked");
return true;
}
@ -183,8 +173,7 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::GrowTask :
thread, BucketsOperation::_cht->_log2_size_limit)) {
return false;
}
this->thread_owns_resize_lock(thread);
BucketsOperation::setup();
this->setup(thread);
return true;
}
@ -202,23 +191,6 @@ class ConcurrentHashTable<VALUE, CONFIG, F>::GrowTask :
return true;
}
// Pauses growing for safepoint
void pause(Thread* thread) {
// This leaves internal state locked.
this->thread_owns_resize_lock(thread);
BucketsOperation::_cht->_resize_lock->unlock();
this->thread_owns_only_state_lock(thread);
}
// Continues growing after safepoint.
void cont(Thread* thread) {
this->thread_owns_only_state_lock(thread);
// If someone slips in here directly after safepoint.
while (!BucketsOperation::_cht->_resize_lock->try_lock())
{ /* for ever */ };
this->thread_owns_resize_lock(thread);
}
// Must be called after do_task returns false.
void done(Thread* thread) {
this->thread_owns_resize_lock(thread);

View File

@ -1703,7 +1703,7 @@ void VMError::controlled_crash(int how) {
// from racing with Threads::add() or Threads::remove() as we
// generate the hs_err_pid file. This makes our ErrorHandling tests
// more stable.
MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock, Mutex::_no_safepoint_check_flag);
switch (how) {
case 1: vmassert(str == NULL, "expected null"); break;

View File

@ -29,8 +29,8 @@ import java.nio.file.*;
import java.nio.file.attribute.*;
import java.nio.file.spi.FileTypeDetector;
import java.io.IOException;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
import jdk.internal.util.StaticProperty;
/**
* Linux implementation of FileSystemProvider
@ -102,7 +102,7 @@ public class LinuxFileSystemProvider extends UnixFileSystemProvider {
@Override
FileTypeDetector getFileTypeDetector() {
String userHome = GetPropertyAction.privilegedGetProperty("user.home");
String userHome = StaticProperty.userHome();
Path userMimeTypes = Path.of(userHome, ".mime.types");
Path etcMimeTypes = Path.of("/etc/mime.types");

View File

@ -27,6 +27,7 @@ package sun.nio.fs;
import java.nio.file.Path;
import java.nio.file.spi.FileTypeDetector;
import jdk.internal.util.StaticProperty;
import sun.security.action.GetPropertyAction;
/**
@ -45,8 +46,7 @@ public class MacOSXFileSystemProvider extends BsdFileSystemProvider {
@Override
FileTypeDetector getFileTypeDetector() {
Path userMimeTypes = Path.of(GetPropertyAction
.privilegedGetProperty("user.home"), ".mime.types");
Path userMimeTypes = Path.of(StaticProperty.userHome(), ".mime.types");
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
new UTIFileTypeDetector());

View File

@ -95,7 +95,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
premasterMajor = premaster[0] & 0xff;
premasterMinor = premaster[1] & 0xff;
} else {
// DH, KRB5, others
// DH, others
premasterMajor = -1;
premasterMinor = -1;
}

View File

@ -113,27 +113,19 @@ class VerifierWrapper implements javax.net.ssl.HostnameVerifier {
* In com.sun.net.ssl.HostnameVerifier the method is defined
* as verify(String urlHostname, String certHostname).
* This means we need to extract the hostname from the X.509 certificate
* or from the Kerberos principal name, in this wrapper.
* in this wrapper.
*/
public boolean verify(String hostname, javax.net.ssl.SSLSession session) {
try {
String serverName;
// Use ciphersuite to determine whether Kerberos is active.
if (session.getCipherSuite().startsWith("TLS_KRB5")) {
serverName =
HostnameChecker.getServerName(getPeerPrincipal(session));
} else { // X.509
Certificate[] serverChain = session.getPeerCertificates();
if ((serverChain == null) || (serverChain.length == 0)) {
return false;
}
if (serverChain[0] instanceof X509Certificate == false) {
return false;
}
X509Certificate serverCert = (X509Certificate)serverChain[0];
serverName = getServername(serverCert);
Certificate[] serverChain = session.getPeerCertificates();
if ((serverChain == null) || (serverChain.length == 0)) {
return false;
}
if (serverChain[0] instanceof X509Certificate == false) {
return false;
}
X509Certificate serverCert = (X509Certificate)serverChain[0];
String serverName = getServername(serverCert);
if (serverName == null) {
return false;
}
@ -143,23 +135,6 @@ class VerifierWrapper implements javax.net.ssl.HostnameVerifier {
}
}
/*
* Get the peer principal from the session
*/
private Principal getPeerPrincipal(javax.net.ssl.SSLSession session)
throws javax.net.ssl.SSLPeerUnverifiedException
{
Principal principal;
try {
principal = session.getPeerPrincipal();
} catch (AbstractMethodError e) {
// if the provider does not support it, return null, since
// we need it only for Kerberos.
principal = null;
}
return principal;
}
/*
* Extract the name of the SSL server from the certificate.
*

View File

@ -63,13 +63,12 @@ public abstract class Reader implements Readable, Closeable {
*
* <p> While the stream is open, the {@code read()}, {@code read(char[])},
* {@code read(char[], int, int)}, {@code read(Charbuffer)}, {@code
* ready())}, {@code skip(long)}, and {@code transferTo()} methods all
* behave as if end of stream has been reached. After the stream has been
* ready()}, {@code skip(long)}, and {@code transferTo()} methods all
* behave as if end of stream has been reached. After the stream has been
* closed, these methods all throw {@code IOException}.
*
* <p> The {@code markSupported()} method returns {@code false}. The
* {@code mark()} method does nothing, and the {@code reset()} method
* throws {@code IOException}.
* {@code mark()} and {@code reset()} methods throw an {@code IOException}.
*
* <p> The {@link #lock object} used to synchronize operations on the
* returned {@code Reader} is not specified.
@ -114,6 +113,12 @@ public abstract class Reader implements Readable, Closeable {
return 0;
}
@Override
public boolean ready() throws IOException {
ensureOpen();
return false;
}
@Override
public long skip(long n) throws IOException {
ensureOpen();

View File

@ -36,6 +36,8 @@ import java.nio.charset.CharacterCodingException;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.MalformedInputException;
import java.nio.charset.UnmappableCharacterException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Arrays;
import jdk.internal.HotSpotIntrinsicCandidate;
@ -607,7 +609,7 @@ class StringCoding {
dp = dp + ret;
if (ret != len) {
if (!doReplace) {
throwMalformed(sp, 1);
throwUnmappable(sp, 1);
}
char c = StringUTF16.getChar(val, sp++);
if (Character.isHighSurrogate(c) && sp < sl &&
@ -679,8 +681,8 @@ class StringCoding {
}
private static void throwMalformed(int off, int nb) {
throw new IllegalArgumentException("malformed input off : " + off +
", length : " + nb);
String msg = "malformed input off : " + off + ", length : " + nb;
throw new IllegalArgumentException(msg, new MalformedInputException(nb));
}
private static void throwMalformed(byte[] val) {
@ -689,6 +691,17 @@ class StringCoding {
throwMalformed(dp, 1);
}
private static void throwUnmappable(int off, int nb) {
String msg = "malformed input off : " + off + ", length : " + nb;
throw new IllegalArgumentException(msg, new UnmappableCharacterException(nb));
}
private static void throwUnmappable(byte[] val) {
int dp = 0;
while (dp < val.length && val[dp] >=0) { dp++; }
throwUnmappable(dp, 1);
}
private static char repl = '\ufffd';
private static Result decodeUTF8(byte[] src, int sp, int len, boolean doReplace) {
@ -919,7 +932,7 @@ class StringCoding {
if (doReplace) {
dst[dp++] = '?';
} else {
throwMalformed(sp - 1, 1); // or 2, does not matter here
throwUnmappable(sp - 1, 1); // or 2, does not matter here
}
} else {
dst[dp++] = (byte)(0xf0 | ((uc >> 18)));
@ -972,7 +985,20 @@ class StringCoding {
return new String(StringLatin1.inflate(src, 0, src.length), UTF16);
}
static String newStringNoRepl(byte[] src, Charset cs) {
static String newStringNoRepl(byte[] src, Charset cs) throws CharacterCodingException {
try {
return newStringNoRepl1(src, cs);
} catch (IllegalArgumentException e) {
//newStringNoRepl1 throws IAE with MalformedInputException or CCE as the cause
Throwable cause = e.getCause();
if (cause instanceof MalformedInputException) {
throw (MalformedInputException)cause;
}
throw (CharacterCodingException)cause;
}
}
static String newStringNoRepl1(byte[] src, Charset cs) {
if (cs == UTF_8) {
if (COMPACT_STRINGS && isASCII(src))
return new String(src, LATIN1);
@ -1023,9 +1049,22 @@ class StringCoding {
}
/*
* Throws iae, instead of replacing, if unmappable.
* Throws CCE, instead of replacing, if unmappable.
*/
static byte[] getBytesNoRepl(String s, Charset cs) {
static byte[] getBytesNoRepl(String s, Charset cs) throws CharacterCodingException {
try {
return getBytesNoRepl1(s, cs);
} catch (IllegalArgumentException e) {
//getBytesNoRepl1 throws IAE with UnmappableCharacterException or CCE as the cause
Throwable cause = e.getCause();
if (cause instanceof UnmappableCharacterException) {
throw (UnmappableCharacterException)cause;
}
throw (CharacterCodingException)cause;
}
}
static byte[] getBytesNoRepl1(String s, Charset cs) {
byte[] val = s.value();
byte coder = s.coder();
if (cs == UTF_8) {
@ -1045,7 +1084,7 @@ class StringCoding {
if (isASCII(val)) {
return val;
} else {
throwMalformed(val);
throwUnmappable(val);
}
}
}
@ -1083,7 +1122,7 @@ class StringCoding {
if (!cr.isUnderflow())
cr.throwException();
} catch (CharacterCodingException x) {
throw new Error(x);
throw new IllegalArgumentException(x);
}
return safeTrim(ba, bb.position(), isTrusted);
}

View File

@ -41,6 +41,7 @@ import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
import java.nio.charset.CharacterCodingException;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
import java.security.AccessController;
@ -59,6 +60,7 @@ import java.util.function.Supplier;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
import jdk.internal.util.StaticProperty;
import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.ServicesCatalog;
import jdk.internal.reflect.CallerSensitive;
@ -669,7 +671,16 @@ public final class System {
* {@code getProperties} operation, it may choose to permit the
* {@link #getProperty(String)} operation.
*
* @implNote In addition to the standard system properties, the system
* @apiNote
* <strong>Changing a standard system property may have unpredictable results
* unless otherwise specified.</strong>
* Property values may be cached during initialization or on first use.
* Setting a standard property after initialization using {@link #getProperties()},
* {@link #setProperties(Properties)}, {@link #setProperty(String, String)}, or
* {@link #clearProperty(String)} may not have the desired effect.
*
* @implNote
* In addition to the standard system properties, the system
* properties may include the following keys:
* <table class="striped">
* <caption style="display:none">Shows property keys and associated values</caption>
@ -736,6 +747,11 @@ public final class System {
* {@code null}, then the current set of system properties is
* forgotten.
*
* @apiNote
* <strong>Changing a standard system property may have unpredictable results
* unless otherwise specified</strong>.
* See {@linkplain #getProperties getProperties} for details.
*
* @param props the new system properties.
* @throws SecurityException if a security manager exists and its
* {@code checkPropertiesAccess} method doesn't allow access
@ -768,6 +784,11 @@ public final class System {
* properties is first created and initialized in the same manner as
* for the {@code getProperties} method.
*
* @apiNote
* <strong>Changing a standard system property may have unpredictable results
* unless otherwise specified</strong>.
* See {@linkplain #getProperties getProperties} for details.
*
* @param key the name of the system property.
* @return the string value of the system property,
* or {@code null} if there is no property with that key.
@ -837,6 +858,11 @@ public final class System {
* If no exception is thrown, the specified property is set to the given
* value.
*
* @apiNote
* <strong>Changing a standard system property may have unpredictable results
* unless otherwise specified</strong>.
* See {@linkplain #getProperties getProperties} for details.
*
* @param key the name of the system property.
* @param value the value of the system property.
* @return the previous value of the system property,
@ -875,6 +901,11 @@ public final class System {
* permission. This may result in a SecurityException being thrown.
* If no exception is thrown, the specified property is removed.
*
* @apiNote
* <strong>Changing a standard system property may have unpredictable results
* unless otherwise specified</strong>.
* See {@linkplain #getProperties getProperties} method for details.
*
* @param key the name of the system property to be removed.
* @return the previous string value of the system property,
* or {@code null} if there was no property with that key.
@ -1927,6 +1958,7 @@ public final class System {
VM.saveAndRemoveProperties(props);
lineSeparator = props.getProperty("line.separator");
StaticProperty.javaHome(); // Load StaticProperty to cache the property values
VersionProps.init();
FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
@ -2153,11 +2185,11 @@ public final class System {
return ModuleLayer.layers(loader);
}
public String newStringNoRepl(byte[] bytes, Charset cs) {
public String newStringNoRepl(byte[] bytes, Charset cs) throws CharacterCodingException {
return StringCoding.newStringNoRepl(bytes, cs);
}
public byte[] getBytesNoRepl(String s, Charset cs) {
public byte[] getBytesNoRepl(String s, Charset cs) throws CharacterCodingException {
return StringCoding.getBytesNoRepl(s, cs);
}

View File

@ -2452,12 +2452,18 @@ return mh1;
checkSymbolicClass(defc);
return mh;
}
// Treat MethodHandle.invoke and invokeExact specially.
if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
// Treat MethodHandle.invoke and invokeExact specially.
mh = findVirtualForMH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
} else if (defc == VarHandle.class && refKind == REF_invokeVirtual) {
// Treat signature-polymorphic methods on VarHandle specially.
mh = findVirtualForVH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
}
MemberName resolved = resolveOrFail(refKind, member);
mh = getDirectMethodForConstant(refKind, defc, resolved);

View File

@ -675,9 +675,21 @@ public final class SocketPermission extends Permission
private transient String cdomain, hdomain;
/**
* previously we allowed domain names to be specified in IDN ACE form
* Need to check for that and convert to Unicode
*/
private static String checkForIDN(String name) {
if (name.startsWith("xn--") || name.contains(".xn--")) {
return IDN.toUnicode(name);
} else {
return name;
}
}
private boolean match(String cname, String hname) {
String a = cname.toLowerCase();
String b = hname.toLowerCase();
String a = checkForIDN(cname.toLowerCase());
String b = checkForIDN(hname.toLowerCase());
if (a.startsWith(b) &&
((a.length() == b.length()) || (a.charAt(b.length()) == '.'))) {
return true;

View File

@ -30,10 +30,11 @@ import java.io.BufferedOutputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import jdk.internal.util.StaticProperty;
import sun.net.SocksProxy;
import sun.net.spi.DefaultProxySelector;
import sun.net.www.ParseUtil;
import sun.security.action.GetPropertyAction;
/* import org.ietf.jgss.*; */
/**
@ -178,7 +179,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
userName = pw.getUserName();
password = new String(pw.getPassword());
} else {
userName = GetPropertyAction.privilegedGetProperty("user.name");
userName = StaticProperty.userName();
}
if (userName == null)
return false;
@ -1088,7 +1089,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
userName = System.getProperty("user.name");
} catch (SecurityException se) { /* swallow Exception */ }
} else {
userName = GetPropertyAction.privilegedGetProperty("user.name");
userName = StaticProperty.userName();
}
return userName;
}

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