This commit is contained in:
J. Duke 2017-07-05 20:03:48 +02:00
commit 1bce75251c
197 changed files with 12334 additions and 1790 deletions
.hgtags-top-repo
common/autoconf
hotspot
.hgtags
agent/src/os/win32/windbg
src
test

@ -276,3 +276,4 @@ ea2f7981236f3812436958748ab3d26e80a35130 jdk9-b28
69a84c16d9c28e0e3d504b9c8766c24bafcd58f6 jdk9-b31
7e3512dae8e020d44399c0f1c579ff1fe3090ed6 jdk9-b32
e4ba01b726e263953ae129be37c94de6ed145b1d jdk9-b33
087b23f35631e68e950496a36fce8ccca612966a jdk9-b34

@ -48,6 +48,13 @@ BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
# Use a different Boot JDK
OLD_BOOT_JDK:=$(BOOT_JDK)
BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
BOOT_RTJAR:=@BUILD_OUTPUT@/images/j2sdk-image/jre/lib/rt.jar
BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
JAVA_CMD:=$(BOOT_JDK)/bin/java
JAVAC_CMD:=$(BOOT_JDK)/bin/javac
JAVAH_CMD:=$(BOOT_JDK)/bin/javah
JAR_CMD:=$(BOOT_JDK)/bin/jar
NATIVE2ASCII_CMD:=$(BOOT_JDK)/bin/native2ascii
JARSIGNER_CMD:=$(BOOT_JDK)/bin/jarsigner
SJAVAC_SERVER_JAVA_CMD:=$(JAVA_CMD)
SJAVAC_SERVER_JAVA:=$(subst $(OLD_BOOT_JDK),$(BOOT_JDK),$(SJAVAC_SERVER_JAVA))

@ -296,7 +296,7 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
AC_SUBST(SJAVAC_SERVER_JAVA)
if test "$MEMORY_SIZE" -gt "3000"; then
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
if test "$JVM_ARG_OK" = true; then
JVM_64BIT=true
JVM_ARG_OK=false
@ -320,7 +320,8 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
if test "$MX_VALUE" -lt "512"; then
MX_VALUE=512
fi
ADD_JVM_ARG_IF_OK([-Xms${MS_VALUE}M -Xmx${MX_VALUE}M],SJAVAC_SERVER_JAVA,[$SJAVAC_SERVER_JAVA])
ADD_JVM_ARG_IF_OK([-Xms${MS_VALUE}M -Xmx${MX_VALUE}M],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
AC_SUBST(SJAVAC_SERVER_JAVA_FLAGS)
AC_ARG_ENABLE([sjavac], [AS_HELP_STRING([--enable-sjavac],
[use sjavac to do fast incremental compiles @<:@disabled@:>@])],

@ -633,6 +633,7 @@ CCACHE
USE_PRECOMPILED_HEADER
SJAVAC_SERVER_DIR
ENABLE_SJAVAC
SJAVAC_SERVER_JAVA_FLAGS
SJAVAC_SERVER_JAVA
JAVA_TOOL_FLAGS_SMALL
JAVA_FLAGS_SMALL
@ -4327,7 +4328,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1410791401
DATE_WHEN_GENERATED=1412599039
###############################################################################
#
@ -50472,7 +50473,7 @@ fi
FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -d64"
SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64"
JVM_ARG_OK=true
else
$ECHO "Arg failed:" >&5
@ -50510,7 +50511,7 @@ fi
FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
SJAVAC_SERVER_JAVA="$SJAVAC_SERVER_JAVA -Xms${MS_VALUE}M -Xmx${MX_VALUE}M"
SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -Xms${MS_VALUE}M -Xmx${MX_VALUE}M"
JVM_ARG_OK=true
else
$ECHO "Arg failed:" >&5
@ -50519,6 +50520,7 @@ fi
fi
# Check whether --enable-sjavac was given.
if test "${enable_sjavac+set}" = set; then :
enableval=$enable_sjavac; ENABLE_SJAVAC="${enableval}"

@ -256,7 +256,8 @@ NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
BUILD_HOTSPOT=@BUILD_HOTSPOT@
# The boot jdk to use
# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
# them in sync.
BOOT_JDK:=@BOOT_JDK@
BOOT_RTJAR:=@BOOT_RTJAR@
BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
@ -453,23 +454,35 @@ JAVA_FLAGS:=@JAVA_FLAGS@
JAVA_FLAGS_BIG:=@JAVA_FLAGS_BIG@
JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@
SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@
JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
JAVA_SMALL=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
# The *_CMD variables are defined separately to be easily overridden in bootcycle-spec.gmk
# for bootcycle-images build. Make sure to keep them in sync. Do not use the *_CMD
# versions of the variables directly.
JAVA_CMD:=@JAVA@
JAVAC_CMD:=@JAVAC@
JAVAH_CMD:=@JAVAH@
JAR_CMD:=@JAR@
NATIVE2ASCII_CMD:=@NATIVE2ASCII@
JARSIGNER_CMD:=@JARSIGNER@
SJAVAC_SERVER_JAVA_CMD:=@SJAVAC_SERVER_JAVA@
# These variables are meant to be used. They are defined with = instead of := to make
# it possible to override only the *_CMD variables.
JAVA=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
JAVAC=@FIXPATH@ $(JAVAC_CMD)
JAVAH=@FIXPATH@ $(JAVAH_CMD)
JAR=@FIXPATH@ $(JAR_CMD)
NATIVE2ASCII=@FIXPATH@ $(NATIVE2ASCII_CMD) $(JAVA_TOOL_FLAGS_SMALL)
JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD)
# A specific java binary with specific options can be used to run
# the long running background sjavac servers and other long running tasks.
SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAGS)
JAVAC:=@FIXPATH@ @JAVAC@
# Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
# overriding that value by using ?=.
JAVAC_FLAGS?=@JAVAC_FLAGS@
JAVAH:=@FIXPATH@ @JAVAH@
JAR:=@FIXPATH@ @JAR@
NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@ $(JAVA_TOOL_FLAGS_SMALL)
JARSIGNER:=@FIXPATH@ @JARSIGNER@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
@ -486,10 +499,6 @@ ifndef RC_FLAGS
RC_FLAGS:=@RC_FLAGS@
endif
# A specific java binary with specific options can be used to run
# the long running background sjavac servers and other long running tasks.
SJAVAC_SERVER_JAVA:=@FIXPATH@ @SJAVAC_SERVER_JAVA@
# Tools adhering to a minimal and common standard of posix compliance.
AWK:=@AWK@
BASENAME:=@BASENAME@

@ -436,3 +436,4 @@ deb29e92f68ace2808a36ecfa18c7d61dcb645bb jdk9-b29
9f7d155d28e519f3e4645dc21cf185c25f3176ed jdk9-b31
af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32
9b3f5e4f33725f7c1d9b8e523133fe8383a54d9f jdk9-b33
821164b0131a47ca065697c7d27d8f215e608c8d jdk9-b34

@ -318,12 +318,18 @@ static bool setImageAndSymbolPath(JNIEnv* env, jobject obj) {
path = (jstring) env->GetStaticObjectField(clazz, imagePath_ID);
CHECK_EXCEPTION_(false);
if (path == NULL) {
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get imagePath field ID!", false);
}
buf = env->GetStringUTFChars(path, &isCopy);
CHECK_EXCEPTION_(false);
AutoJavaString imagePath(env, path, buf);
path = (jstring) env->GetStaticObjectField(clazz, symbolPath_ID);
CHECK_EXCEPTION_(false);
if (path == NULL) {
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get symbolPath field ID!", false);
}
buf = env->GetStringUTFChars(path, &isCopy);
CHECK_EXCEPTION_(false);
AutoJavaString symbolPath(env, path, buf);

@ -81,7 +81,7 @@ define_pd_global(intx, InitialCodeCacheSize, 2048*K); // Integral multip
define_pd_global(intx, ReservedCodeCacheSize, 256*M);
define_pd_global(intx, NonProfiledCodeHeapSize, 125*M);
define_pd_global(intx, ProfiledCodeHeapSize, 126*M);
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(intx, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags

@ -49,7 +49,7 @@ define_pd_global(bool, ResizeTLAB, true );
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(intx, NonProfiledCodeHeapSize, 13*M );
define_pd_global(intx, ProfiledCodeHeapSize, 14*M );
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx, CodeCacheMinBlockLength, 1);
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);

@ -76,7 +76,7 @@ define_pd_global(intx, InitialCodeCacheSize, 2048*K); // Integral multip
define_pd_global(intx, ReservedCodeCacheSize, 48*M);
define_pd_global(intx, NonProfiledCodeHeapSize, 21*M);
define_pd_global(intx, ProfiledCodeHeapSize, 22*M);
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(intx, CodeCacheExpansionSize, 64*K);
// Ergonomics related flags
@ -87,7 +87,7 @@ define_pd_global(intx, InitialCodeCacheSize, 1536*K); // Integral multip
define_pd_global(intx, ReservedCodeCacheSize, 32*M);
define_pd_global(intx, NonProfiledCodeHeapSize, 13*M);
define_pd_global(intx, ProfiledCodeHeapSize, 14*M);
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(intx, CodeCacheExpansionSize, 32*K);
// Ergonomics related flags
define_pd_global(uint64_t,MaxRAM, 4ULL*G);

@ -49,7 +49,7 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(intx, NonProfiledCodeHeapSize, 13*M );
define_pd_global(intx, ProfiledCodeHeapSize, 14*M );
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx, CodeCacheMinBlockLength, 1);

@ -86,7 +86,7 @@ define_pd_global(bool, OptoBundling, false);
define_pd_global(intx, ReservedCodeCacheSize, 48*M);
define_pd_global(intx, NonProfiledCodeHeapSize, 21*M);
define_pd_global(intx, ProfiledCodeHeapSize, 22*M);
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(uintx, CodeCacheMinBlockLength, 4);
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);

@ -55,7 +55,7 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
define_pd_global(intx, NonProfiledCodeHeapSize, 13*M );
define_pd_global(intx, ProfiledCodeHeapSize, 14*M );
define_pd_global(intx, NonMethodCodeHeapSize, 5*M );
define_pd_global(intx, NonNMethodCodeHeapSize, 5*M );
define_pd_global(bool, ProfileInterpreter, false);
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
define_pd_global(uintx, CodeCacheMinBlockLength, 1 );

@ -1,5 +1,5 @@
//
// Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@ -969,23 +969,22 @@ OperandForm *ArchDesc::constructOperand(const char *ident,
void ArchDesc::initBaseOpTypes() {
// Create OperandForm and assign type for each opcode.
for (int i = 1; i < _last_machine_leaf; ++i) {
char *ident = (char *)NodeClassNames[i];
char *ident = (char *)NodeClassNames[i];
constructOperand(ident, true);
}
// Create InstructForm and assign type for each ideal instruction.
for ( int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
char *ident = (char *)NodeClassNames[j];
if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
!strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
!strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
!strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
!strcmp(ident, "Bool") ) {
for (int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
char *ident = (char *)NodeClassNames[j];
if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
!strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
!strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
!strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
!strcmp(ident, "Bool")) {
constructOperand(ident, true);
}
else {
InstructForm *insForm = new InstructForm(ident, true);
// insForm->_opcode = nextUserOpType(ident);
_globalNames.Insert(ident,insForm);
} else {
InstructForm *insForm = new InstructForm(ident, true);
// insForm->_opcode = nextUserOpType(ident);
_globalNames.Insert(ident, insForm);
addForm(insForm);
}
}
@ -1038,6 +1037,9 @@ void ArchDesc::initBaseOpTypes() {
ident = "TEMP";
eForm = new Effect(ident);
_globalNames.Insert(ident, eForm);
ident = "TEMP_DEF";
eForm = new Effect(ident);
_globalNames.Insert(ident, eForm);
ident = "CALL";
eForm = new Effect(ident);
_globalNames.Insert(ident, eForm);
@ -1050,8 +1052,8 @@ void ArchDesc::initBaseOpTypes() {
const char *idealName = NodeClassNames[idealIndex];
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
}
for ( idealIndex = _last_machine_leaf+1;
idealIndex < _last_opcode; ++idealIndex) {
for (idealIndex = _last_machine_leaf+1;
idealIndex < _last_opcode; ++idealIndex) {
const char *idealName = NodeClassNames[idealIndex];
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
}

@ -1816,15 +1816,16 @@ void InsEncode::output(FILE *fp) {
//------------------------------Effect-----------------------------------------
static int effect_lookup(const char *name) {
if(!strcmp(name, "USE")) return Component::USE;
if(!strcmp(name, "DEF")) return Component::DEF;
if(!strcmp(name, "USE_DEF")) return Component::USE_DEF;
if(!strcmp(name, "KILL")) return Component::KILL;
if(!strcmp(name, "USE_KILL")) return Component::USE_KILL;
if(!strcmp(name, "TEMP")) return Component::TEMP;
if(!strcmp(name, "INVALID")) return Component::INVALID;
if(!strcmp(name, "CALL")) return Component::CALL;
assert( false,"Invalid effect name specified\n");
if (!strcmp(name, "USE")) return Component::USE;
if (!strcmp(name, "DEF")) return Component::DEF;
if (!strcmp(name, "USE_DEF")) return Component::USE_DEF;
if (!strcmp(name, "KILL")) return Component::KILL;
if (!strcmp(name, "USE_KILL")) return Component::USE_KILL;
if (!strcmp(name, "TEMP")) return Component::TEMP;
if (!strcmp(name, "TEMP_DEF")) return Component::TEMP_DEF;
if (!strcmp(name, "INVALID")) return Component::INVALID;
if (!strcmp(name, "CALL")) return Component::CALL;
assert(false,"Invalid effect name specified\n");
return Component::INVALID;
}
@ -1836,6 +1837,7 @@ const char *Component::getUsedefName() {
case Component::USE_KILL: return "USE_KILL"; break;
case Component::KILL: return "KILL"; break;
case Component::TEMP: return "TEMP"; break;
case Component::TEMP_DEF: return "TEMP_DEF"; break;
case Component::DEF: return "DEF"; break;
case Component::CALL: return "CALL"; break;
default: assert(false, "unknown effect");

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -910,13 +910,16 @@ public:
public:
// Implementation depends upon working bit intersection and union.
enum use_def_enum {
INVALID = 0x0,
USE = 0x1,
DEF = 0x2, USE_DEF = 0x3,
KILL = 0x4, USE_KILL = 0x5,
INVALID = 0x0,
USE = 0x1,
DEF = 0x2,
USE_DEF = USE | DEF,
KILL = 0x4,
USE_KILL = USE | KILL,
SYNTHETIC = 0x8,
TEMP = USE | SYNTHETIC,
CALL = 0x10
TEMP = USE | SYNTHETIC,
TEMP_DEF = TEMP | DEF,
CALL = 0x10
};
};

@ -1715,13 +1715,14 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
bool declared_def = false;
bool declared_kill = false;
while( (comp = node->_components.iter()) != NULL ) {
while ((comp = node->_components.iter()) != NULL) {
// Lookup register class associated with operand type
Form *form = (Form*)_globalNames[comp->_type];
assert( form, "component type must be a defined form");
OperandForm *op = form->is_operand();
Form *form = (Form*)_globalNames[comp->_type];
assert(form, "component type must be a defined form");
OperandForm *op = form->is_operand();
if (comp->is(Component::TEMP)) {
if (comp->is(Component::TEMP) ||
comp->is(Component::TEMP_DEF)) {
fprintf(fp, " // TEMP %s\n", comp->_name);
if (!declared_def) {
// Define the variable "def" to hold new MachProjNodes
@ -1750,7 +1751,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
declared_kill = true;
}
assert( op, "Support additional KILLS for base operands");
assert(op, "Support additional KILLS for base operands");
const char *regmask = reg_mask(*op);
const char *ideal_type = op->ideal_type(_globalNames, _register);

@ -38,17 +38,18 @@
typedef enum {
_t_compile,
_t_setup,
_t_buildIR,
_t_optimize_blocks,
_t_optimize_null_checks,
_t_rangeCheckElimination,
_t_emit_lir,
_t_linearScan,
_t_lirGeneration,
_t_lir_schedule,
_t_codeemit,
_t_codeinstall,
_t_setup,
_t_buildIR,
_t_hir_parse,
_t_gvn,
_t_optimize_blocks,
_t_optimize_null_checks,
_t_rangeCheckElimination,
_t_emit_lir,
_t_linearScan,
_t_lirGeneration,
_t_codeemit,
_t_codeinstall,
max_phase_timers
} TimerName;
@ -56,13 +57,14 @@ static const char * timer_name[] = {
"compile",
"setup",
"buildIR",
"parse_hir",
"gvn",
"optimize_blocks",
"optimize_null_checks",
"rangeCheckElimination",
"emit_lir",
"linearScan",
"lirGeneration",
"lir_schedule",
"codeemit",
"codeinstall"
};
@ -144,7 +146,10 @@ void Compilation::build_hir() {
log->stamp();
log->end_head();
}
_hir = new IR(this, method(), osr_bci());
{
PhaseTraceTime timeit(_t_hir_parse);
_hir = new IR(this, method(), osr_bci());
}
if (log) log->done("parse");
if (!_hir->is_valid()) {
bailout("invalid parsing");
@ -189,6 +194,7 @@ void Compilation::build_hir() {
if (UseGlobalValueNumbering) {
// No resource mark here! LoopInvariantCodeMotion can allocate ValueStack objects.
PhaseTraceTime timeit(_t_gvn);
int instructions = Instruction::number_of_instructions();
GlobalValueNumbering gvn(_hir);
assert(instructions == Instruction::number_of_instructions(),
@ -419,8 +425,12 @@ void Compilation::install_code(int frame_size) {
void Compilation::compile_method() {
// setup compilation
initialize();
{
PhaseTraceTime timeit(_t_setup);
// setup compilation
initialize();
}
if (!method()->can_be_compiled()) {
// Prevent race condition 6328518.
@ -615,24 +625,54 @@ ciKlass* Compilation::cha_exact_type(ciType* type) {
}
void Compilation::print_timers() {
// tty->print_cr(" Native methods : %6.3f s, Average : %2.3f", CompileBroker::_t_native_compilation.seconds(), CompileBroker::_t_native_compilation.seconds() / CompileBroker::_total_native_compile_count);
float total = timers[_t_setup].seconds() + timers[_t_buildIR].seconds() + timers[_t_emit_lir].seconds() + timers[_t_lir_schedule].seconds() + timers[_t_codeemit].seconds() + timers[_t_codeinstall].seconds();
tty->print_cr(" C1 Compile Time: %7.3f s", timers[_t_compile].seconds());
tty->print_cr(" Setup time: %7.3f s", timers[_t_setup].seconds());
{
tty->print_cr(" Build HIR: %7.3f s", timers[_t_buildIR].seconds());
tty->print_cr(" Parse: %7.3f s", timers[_t_hir_parse].seconds());
tty->print_cr(" Optimize blocks: %7.3f s", timers[_t_optimize_blocks].seconds());
tty->print_cr(" GVN: %7.3f s", timers[_t_gvn].seconds());
tty->print_cr(" Null checks elim: %7.3f s", timers[_t_optimize_null_checks].seconds());
tty->print_cr(" Range checks elim: %7.3f s", timers[_t_rangeCheckElimination].seconds());
tty->print_cr(" Detailed C1 Timings");
tty->print_cr(" Setup time: %6.3f s (%4.1f%%)", timers[_t_setup].seconds(), (timers[_t_setup].seconds() / total) * 100.0);
tty->print_cr(" Build IR: %6.3f s (%4.1f%%)", timers[_t_buildIR].seconds(), (timers[_t_buildIR].seconds() / total) * 100.0);
float t_optimizeIR = timers[_t_optimize_blocks].seconds() + timers[_t_optimize_null_checks].seconds();
tty->print_cr(" Optimize: %6.3f s (%4.1f%%)", t_optimizeIR, (t_optimizeIR / total) * 100.0);
tty->print_cr(" RCE: %6.3f s (%4.1f%%)", timers[_t_rangeCheckElimination].seconds(), (timers[_t_rangeCheckElimination].seconds() / total) * 100.0);
tty->print_cr(" Emit LIR: %6.3f s (%4.1f%%)", timers[_t_emit_lir].seconds(), (timers[_t_emit_lir].seconds() / total) * 100.0);
tty->print_cr(" LIR Gen: %6.3f s (%4.1f%%)", timers[_t_lirGeneration].seconds(), (timers[_t_lirGeneration].seconds() / total) * 100.0);
tty->print_cr(" Linear Scan: %6.3f s (%4.1f%%)", timers[_t_linearScan].seconds(), (timers[_t_linearScan].seconds() / total) * 100.0);
NOT_PRODUCT(LinearScan::print_timers(timers[_t_linearScan].seconds()));
tty->print_cr(" LIR Schedule: %6.3f s (%4.1f%%)", timers[_t_lir_schedule].seconds(), (timers[_t_lir_schedule].seconds() / total) * 100.0);
tty->print_cr(" Code Emission: %6.3f s (%4.1f%%)", timers[_t_codeemit].seconds(), (timers[_t_codeemit].seconds() / total) * 100.0);
tty->print_cr(" Code Installation: %6.3f s (%4.1f%%)", timers[_t_codeinstall].seconds(), (timers[_t_codeinstall].seconds() / total) * 100.0);
tty->print_cr(" Instruction Nodes: %6d nodes", totalInstructionNodes);
double other = timers[_t_buildIR].seconds() -
(timers[_t_hir_parse].seconds() +
timers[_t_optimize_blocks].seconds() +
timers[_t_gvn].seconds() +
timers[_t_optimize_null_checks].seconds() +
timers[_t_rangeCheckElimination].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
}
{
tty->print_cr(" Emit LIR: %7.3f s", timers[_t_emit_lir].seconds());
tty->print_cr(" LIR Gen: %7.3f s", timers[_t_lirGeneration].seconds());
tty->print_cr(" Linear Scan: %7.3f s", timers[_t_linearScan].seconds());
NOT_PRODUCT(LinearScan::print_timers(timers[_t_linearScan].seconds()));
double other = timers[_t_emit_lir].seconds() -
(timers[_t_lirGeneration].seconds() +
timers[_t_linearScan].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
}
tty->print_cr(" Code Emission: %7.3f s", timers[_t_codeemit].seconds());
tty->print_cr(" Code Installation: %7.3f s", timers[_t_codeinstall].seconds());
double other = timers[_t_compile].seconds() -
(timers[_t_setup].seconds() +
timers[_t_buildIR].seconds() +
timers[_t_emit_lir].seconds() +
timers[_t_codeemit].seconds() +
timers[_t_codeinstall].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
NOT_PRODUCT(LinearScan::print_statistics());
}

@ -580,7 +580,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
oop obj = cpool->resolved_references()->obj_at(cache_index);
if (obj != NULL) {
ciObject* ciobj = get_object(obj);
return ciConstant(T_OBJECT, ciobj);
if (ciobj->is_array()) {
return ciConstant(T_ARRAY, ciobj);
} else {
assert(ciobj->is_instance(), "should be an instance");
return ciConstant(T_OBJECT, ciobj);
}
}
index = cpool->object_to_cp_index(cache_index);
}
@ -607,8 +612,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
}
}
ciObject* constant = get_object(string);
assert (constant->is_instance(), "must be an instance, or not? ");
return ciConstant(T_OBJECT, constant);
if (constant->is_array()) {
return ciConstant(T_ARRAY, constant);
} else {
assert (constant->is_instance(), "must be an instance, or not? ");
return ciConstant(T_OBJECT, constant);
}
} else if (tag.is_klass() || tag.is_unresolved_klass()) {
// 4881222: allow ldc to take a class type
ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);

@ -730,7 +730,7 @@ void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) {
if (obj->is_null_object()) {
push_null();
} else {
assert(obj->is_instance(), "must be java_mirror of klass");
assert(obj->is_instance() || obj->is_array(), "must be java_mirror of klass");
push_object(obj->klass());
}
} else {

@ -636,6 +636,7 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
}
// set the classLoader field in the java_lang_Class instance
assert(class_loader() == k->class_loader(), "should be same");
set_class_loader(mirror(), class_loader());
// Setup indirection from klass->mirror last

@ -496,77 +496,65 @@ void SymbolTable::dump(outputStream* st) {
void SymbolTable::print_histogram() {
MutexLocker ml(SymbolTable_lock);
const int results_length = 100;
int results[results_length];
int counts[results_length];
int sizes[results_length];
int i,j;
// initialize results to zero
for (j = 0; j < results_length; j++) {
results[j] = 0;
counts[j] = 0;
sizes[j] = 0;
}
int total = 0;
int max_symbols = 0;
int out_of_range = 0;
int memory_total = 0;
int count = 0;
int total_size = 0;
int total_count = 0;
int total_length = 0;
int max_length = 0;
int out_of_range_count = 0;
int out_of_range_size = 0;
for (i = 0; i < the_table()->table_size(); i++) {
HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
for ( ; p != NULL; p = p->next()) {
memory_total += p->literal()->size();
count++;
int counter = p->literal()->utf8_length();
total += counter;
if (counter < results_length) {
results[counter]++;
int size = p->literal()->size();
int len = p->literal()->utf8_length();
if (len < results_length) {
counts[len]++;
sizes[len] += size;
} else {
out_of_range++;
out_of_range_count++;
out_of_range_size += size;
}
max_symbols = MAX2(max_symbols, counter);
total_count++;
total_size += size;
total_length += len;
max_length = MAX2(max_length, len);
}
}
tty->print_cr("Symbol Table:");
tty->print_cr("Total number of symbols %5d", count);
tty->print_cr("Total size in memory %5dK",
(memory_total*HeapWordSize)/1024);
tty->print_cr("Total counted %5d", _symbols_counted);
tty->print_cr("Total removed %5d", _symbols_removed);
tty->print_cr("Symbol Table Histogram:");
tty->print_cr(" Total number of symbols %7d", total_count);
tty->print_cr(" Total size in memory %7dK",
(total_size*HeapWordSize)/1024);
tty->print_cr(" Total counted %7d", _symbols_counted);
tty->print_cr(" Total removed %7d", _symbols_removed);
if (_symbols_counted > 0) {
tty->print_cr("Percent removed %3.2f",
tty->print_cr(" Percent removed %3.2f",
((float)_symbols_removed/(float)_symbols_counted)* 100);
}
tty->print_cr("Reference counts %5d", Symbol::_total_count);
tty->print_cr("Symbol arena size %5d used %5d",
arena()->size_in_bytes(), arena()->used());
tty->print_cr("Histogram of symbol length:");
tty->print_cr("%8s %5d", "Total ", total);
tty->print_cr("%8s %5d", "Maximum", max_symbols);
tty->print_cr("%8s %3.2f", "Average",
((float) total / (float) the_table()->table_size()));
tty->print_cr("%s", "Histogram:");
tty->print_cr(" %s %29s", "Length", "Number chains that length");
tty->print_cr(" Reference counts %7d", Symbol::_total_count);
tty->print_cr(" Symbol arena used %7dK", arena()->used()/1024);
tty->print_cr(" Symbol arena size %7dK", arena()->size_in_bytes()/1024);
tty->print_cr(" Total symbol length %7d", total_length);
tty->print_cr(" Maximum symbol length %7d", max_length);
tty->print_cr(" Average symbol length %7.2f", ((float) total_length / (float) total_count));
tty->print_cr(" Symbol length histogram:");
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
for (i = 0; i < results_length; i++) {
if (results[i] > 0) {
tty->print_cr("%6d %10d", i, results[i]);
if (counts[i] > 0) {
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*HeapWordSize)/1024);
}
}
if (Verbose) {
int line_length = 70;
tty->print_cr("%s %30s", " Length", "Number chains that length");
for (i = 0; i < results_length; i++) {
if (results[i] > 0) {
tty->print("%4d", i);
for (j = 0; (j < results[i]) && (j < line_length); j++) {
tty->print("%1s", "*");
}
if (j == line_length) {
tty->print("%1s", "+");
}
tty->cr();
}
}
}
tty->print_cr(" %s %d: %d\n", "Number chains longer than",
results_length, out_of_range);
tty->print_cr(" >=%6d %10d %10dK\n", results_length,
out_of_range_count, (out_of_range_size*HeapWordSize)/1024);
}
void SymbolTable::print() {

@ -2273,12 +2273,14 @@ methodHandle SystemDictionary::find_method_handle_intrinsic(vmIntrinsics::ID iid
spe = NULL;
// Must create lots of stuff here, but outside of the SystemDictionary lock.
m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
methodHandle(), CompileThreshold, "MH", CHECK_(empty));
// Check if we need to have compiled code but we don't.
if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
"out of space in CodeCache for method handle intrinsic", empty);
if (!Arguments::is_interpreter_only()) {
// Generate a compiled form of the MH intrinsic.
AdapterHandlerLibrary::create_native_wrapper(m);
// Check if have the compiled code.
if (!m->has_compiled_code()) {
THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
"out of space in CodeCache for method handle intrinsic", empty);
}
}
// Now grab the lock. We might have to throw away the new method,
// if a racing thread has managed to install one at the same time.

@ -406,13 +406,20 @@ class ClassVerifier : public StackObj {
}
// Keep a list of temporary symbols created during verification because
// their reference counts need to be decrememented when the verifier object
// their reference counts need to be decremented when the verifier object
// goes out of scope. Since these symbols escape the scope in which they're
// created, we can't use a TempNewSymbol.
Symbol* create_temporary_symbol(
const Symbol* s, int begin, int end, TRAPS);
Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS);
Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
Symbol* create_temporary_symbol(Symbol* s) {
// This version just updates the reference count and saves the symbol to be
// dereferenced later.
s->increment_refcount();
_symbols->push(s);
return s;
}
TypeOrigin ref_ctx(const char* str, TRAPS);
};
@ -425,10 +432,8 @@ inline int ClassVerifier::change_sig_to_verificationType(
case T_ARRAY:
{
Symbol* name = sig_type->as_symbol(CHECK_0);
// Create another symbol to save as signature stream unreferences
// this symbol.
Symbol* name_copy =
create_temporary_symbol(name, 0, name->utf8_length(), CHECK_0);
// Create another symbol to save as signature stream unreferences this symbol.
Symbol* name_copy = create_temporary_symbol(name);
assert(name_copy == name, "symbols don't match");
*inference_type =
VerificationType::reference_type(name_copy);

@ -230,7 +230,7 @@ BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
}
void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
return CodeCache::allocate(size, CodeBlobType::NonMethod, is_critical);
return CodeCache::allocate(size, CodeBlobType::NonNMethod, is_critical);
}
void BufferBlob::free(BufferBlob *blob) {
@ -336,14 +336,14 @@ RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
if (!p) fatal("Initial size of CodeCache is too small");
return p;
}
// operator new shared by all singletons:
void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
if (!p) fatal("Initial size of CodeCache is too small");
return p;
}

@ -36,7 +36,7 @@ struct CodeBlobType {
enum {
MethodNonProfiled = 0, // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
MethodProfiled = 1, // Execution level 2 and 3 (profiled) nmethods
NonMethod = 2, // Non-methods like Buffers, Adapters and Runtime Stubs
NonNMethod = 2, // Non-nmethods like Buffers, Adapters and Runtime Stubs
All = 3, // All types (No code cache segmentation)
NumTypes = 4 // Number of CodeBlobTypes
};

@ -158,23 +158,23 @@ void CodeCache::initialize_heaps() {
#endif
// Calculate default CodeHeap sizes if not set by user
if (!FLAG_IS_CMDLINE(NonMethodCodeHeapSize) && !FLAG_IS_CMDLINE(ProfiledCodeHeapSize)
if (!FLAG_IS_CMDLINE(NonNMethodCodeHeapSize) && !FLAG_IS_CMDLINE(ProfiledCodeHeapSize)
&& !FLAG_IS_CMDLINE(NonProfiledCodeHeapSize)) {
// Increase default NonMethodCodeHeapSize to account for compiler buffers
FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, NonMethodCodeHeapSize + code_buffers_size);
// Increase default NonNMethodCodeHeapSize to account for compiler buffers
FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, NonNMethodCodeHeapSize + code_buffers_size);
// Check if we have enough space for the non-method code heap
if (ReservedCodeCacheSize > NonMethodCodeHeapSize) {
// Use the default value for NonMethodCodeHeapSize and one half of the
// Check if we have enough space for the non-nmethod code heap
if (ReservedCodeCacheSize > NonNMethodCodeHeapSize) {
// Use the default value for NonNMethodCodeHeapSize and one half of the
// remaining size for non-profiled methods and one half for profiled methods
size_t remaining_size = ReservedCodeCacheSize - NonMethodCodeHeapSize;
size_t remaining_size = ReservedCodeCacheSize - NonNMethodCodeHeapSize;
size_t profiled_size = remaining_size / 2;
size_t non_profiled_size = remaining_size - profiled_size;
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, profiled_size);
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, non_profiled_size);
} else {
// Use all space for the non-method heap and set other heaps to minimal size
FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, ReservedCodeCacheSize - os::vm_page_size() * 2);
// Use all space for the non-nmethod heap and set other heaps to minimal size
FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, ReservedCodeCacheSize - os::vm_page_size() * 2);
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, os::vm_page_size());
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, os::vm_page_size());
}
@ -185,21 +185,21 @@ void CodeCache::initialize_heaps() {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize + ProfiledCodeHeapSize);
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0);
}
// We do not need the non-profiled CodeHeap, use all space for the non-method CodeHeap
// We do not need the non-profiled CodeHeap, use all space for the non-nmethod CodeHeap
if(!heap_available(CodeBlobType::MethodNonProfiled)) {
FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, NonMethodCodeHeapSize + NonProfiledCodeHeapSize);
FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, NonNMethodCodeHeapSize + NonProfiledCodeHeapSize);
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 0);
}
// Make sure we have enough space for VM internal code
uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace;
if (NonMethodCodeHeapSize < (min_code_cache_size + code_buffers_size)) {
vm_exit_during_initialization("Not enough space in non-method code heap to run VM.");
if (NonNMethodCodeHeapSize < (min_code_cache_size + code_buffers_size)) {
vm_exit_during_initialization("Not enough space in non-nmethod code heap to run VM.");
}
guarantee(NonProfiledCodeHeapSize + ProfiledCodeHeapSize + NonMethodCodeHeapSize <= ReservedCodeCacheSize, "Size check");
guarantee(NonProfiledCodeHeapSize + ProfiledCodeHeapSize + NonNMethodCodeHeapSize <= ReservedCodeCacheSize, "Size check");
// Align reserved sizes of CodeHeaps
size_t non_method_size = ReservedCodeSpace::allocation_align_size_up(NonMethodCodeHeapSize);
size_t non_method_size = ReservedCodeSpace::allocation_align_size_up(NonNMethodCodeHeapSize);
size_t profiled_size = ReservedCodeSpace::allocation_align_size_up(ProfiledCodeHeapSize);
size_t non_profiled_size = ReservedCodeSpace::allocation_align_size_up(NonProfiledCodeHeapSize);
@ -213,7 +213,7 @@ void CodeCache::initialize_heaps() {
// ---------- high -----------
// Non-profiled nmethods
// Profiled nmethods
// Non-methods
// Non-nmethods
// ---------- low ------------
ReservedCodeSpace rs = reserve_heap_memory(non_profiled_size + profiled_size + non_method_size);
ReservedSpace non_method_space = rs.first_part(non_method_size);
@ -221,12 +221,12 @@ void CodeCache::initialize_heaps() {
ReservedSpace profiled_space = rest.first_part(profiled_size);
ReservedSpace non_profiled_space = rest.last_part(profiled_size);
// Non-methods (stubs, adapters, ...)
add_heap(non_method_space, "non-methods", init_non_method_size, CodeBlobType::NonMethod);
// Non-nmethods (stubs, adapters, ...)
add_heap(non_method_space, "CodeHeap 'non-nmethods'", init_non_method_size, CodeBlobType::NonNMethod);
// Tier 2 and tier 3 (profiled) methods
add_heap(profiled_space, "profiled nmethods", init_profiled_size, CodeBlobType::MethodProfiled);
add_heap(profiled_space, "CodeHeap 'profiled nmethods'", init_profiled_size, CodeBlobType::MethodProfiled);
// Tier 1 and tier 4 (non-profiled) methods and native methods
add_heap(non_profiled_space, "non-profiled nmethods", init_non_profiled_size, CodeBlobType::MethodNonProfiled);
add_heap(non_profiled_space, "CodeHeap 'non-profiled nmethods'", init_non_profiled_size, CodeBlobType::MethodNonProfiled);
}
ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size) {
@ -257,13 +257,13 @@ bool CodeCache::heap_available(int code_blob_type) {
} else if ((Arguments::mode() == Arguments::_int) ||
(TieredStopAtLevel == CompLevel_none)) {
// Interpreter only: we don't need any method code heaps
return (code_blob_type == CodeBlobType::NonMethod);
return (code_blob_type == CodeBlobType::NonNMethod);
} else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) {
// Tiered compilation: use all code heaps
return (code_blob_type < CodeBlobType::All);
} else {
// No TieredCompilation: we only need the non-method and non-profiled code heap
return (code_blob_type == CodeBlobType::NonMethod) ||
// No TieredCompilation: we only need the non-nmethod and non-profiled code heap
return (code_blob_type == CodeBlobType::NonNMethod) ||
(code_blob_type == CodeBlobType::MethodNonProfiled);
}
}
@ -347,16 +347,16 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool is_critical) {
CodeBlob* cb = NULL;
// Get CodeHeap for the given CodeBlobType
CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
assert (heap != NULL, "heap is null");
CodeHeap* heap = get_code_heap(code_blob_type);
assert(heap != NULL, "heap is null");
while (true) {
cb = (CodeBlob*)heap->allocate(size, is_critical);
if (cb != NULL) break;
if (!heap->expand_by(CodeCacheExpansionSize)) {
// Expansion failed
if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonMethod)) {
// Fallback solution: Store non-method code in the non-profiled code heap
if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonNMethod)) {
// Fallback solution: Store non-nmethod code in the non-profiled code heap
return allocate(size, CodeBlobType::MethodNonProfiled, is_critical);
}
return NULL;
@ -364,9 +364,9 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool is_critical) {
if (PrintCodeCacheExtension) {
ResourceMark rm;
if (SegmentedCodeCache) {
tty->print("Code heap '%s'", heap->name());
tty->print("%s", heap->name());
} else {
tty->print("Code cache");
tty->print("CodeCache");
}
tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
(intptr_t)heap->low_boundary(), (intptr_t)heap->high(),
@ -734,6 +734,11 @@ size_t CodeCache::capacity() {
return cap;
}
size_t CodeCache::unallocated_capacity(int code_blob_type) {
CodeHeap* heap = get_code_heap(code_blob_type);
return (heap != NULL) ? heap->unallocated_capacity() : 0;
}
size_t CodeCache::unallocated_capacity() {
size_t unallocated_cap = 0;
FOR_ALL_HEAPS(heap) {
@ -820,7 +825,7 @@ void CodeCache::initialize() {
} else {
// Use a single code heap
ReservedCodeSpace rs = reserve_heap_memory(ReservedCodeCacheSize);
add_heap(rs, "Code heap", InitialCodeCacheSize, CodeBlobType::All);
add_heap(rs, "CodeCache", InitialCodeCacheSize, CodeBlobType::All);
}
// Initialize ICache flush mechanism
@ -1000,13 +1005,14 @@ void CodeCache::verify() {
// A CodeHeap is full. Print out warning and report event.
void CodeCache::report_codemem_full(int code_blob_type, bool print) {
// Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
CodeHeap* heap = get_code_heap(code_blob_type);
assert(heap != NULL, "heap is null");
if (!heap->was_full() || print) {
// Not yet reported for this heap, report
heap->report_full();
if (SegmentedCodeCache) {
warning("CodeHeap for %s is full. Compiler has been disabled.", CodeCache::get_code_heap_name(code_blob_type));
warning("%s is full. Compiler has been disabled.", CodeCache::get_code_heap_name(code_blob_type));
warning("Try increasing the code heap size using -XX:%s=",
(code_blob_type == CodeBlobType::MethodNonProfiled) ? "NonProfiledCodeHeapSize" : "ProfiledCodeHeapSize");
} else {
@ -1090,7 +1096,7 @@ void CodeCache::print_internals() {
int i = 0;
FOR_ALL_HEAPS(heap) {
if (SegmentedCodeCache && Verbose) {
tty->print_cr("-- Code heap '%s' --", (*heap)->name());
tty->print_cr("-- %s --", (*heap)->name());
}
FOR_ALL_BLOBS(cb, *heap) {
total++;
@ -1239,7 +1245,7 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
CodeHeap* heap = (*heap_iterator);
size_t total = (heap->high_boundary() - heap->low_boundary());
if (SegmentedCodeCache) {
st->print("CodeHeap '%s':", heap->name());
st->print("%s:", heap->name());
} else {
st->print("CodeCache:");
}

@ -41,14 +41,14 @@
// The CodeCache consists of one or more CodeHeaps, each of which contains
// CodeBlobs of a specific CodeBlobType. Currently heaps for the following
// types are available:
// - Non-methods: Non-methods like Buffers, Adapters and Runtime Stubs
// - Non-nmethods: Non-nmethods like Buffers, Adapters and Runtime Stubs
// - Profiled nmethods: nmethods that are profiled, i.e., those
// executed at level 2 or 3
// - Non-Profiled nmethods: nmethods that are not profiled, i.e., those
// executed at level 1 or 4 and native methods
// - All: Used for code of all types if code cache segmentation is disabled.
//
// In the rare case of the non-method code heap getting full, non-method code
// In the rare case of the non-nmethod code heap getting full, non-nmethod code
// will be stored in the non-profiled code heap as a fallback solution.
//
// Depending on the availability of compilers and TieredCompilation there
@ -100,7 +100,7 @@ class CodeCache : AllStatic {
static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
static CodeHeap* get_code_heap(CodeBlob* cb); // Returns the CodeHeap for the given CodeBlob
static CodeHeap* get_code_heap(int code_blob_type); // Returns the CodeHeap for the given CodeBlobType
static bool heap_available(int code_blob_type); // Returns true if a CodeHeap for the given CodeBlobType is available
static bool heap_available(int code_blob_type); // Returns true if an own CodeHeap for the given CodeBlobType is available
static ReservedCodeSpace reserve_heap_memory(size_t size); // Reserves one continuous chunk of memory for the CodeHeaps
// Iteration
@ -175,11 +175,9 @@ class CodeCache : AllStatic {
static address high_bound() { return _high_bound; }
// Profiling
static size_t capacity(int code_blob_type) { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->capacity() : 0; }
static size_t capacity();
static size_t unallocated_capacity(int code_blob_type) { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->unallocated_capacity() : 0; }
static size_t unallocated_capacity(int code_blob_type);
static size_t unallocated_capacity();
static size_t max_capacity(int code_blob_type) { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->max_capacity() : 0; }
static size_t max_capacity();
static bool is_full(int* code_blob_type);

@ -155,6 +155,14 @@ address CompiledIC::stub_address() const {
return _ic_call->destination();
}
// Clears the IC stub if the compiled IC is in transition state
void CompiledIC::clear_ic_stub() {
if (is_in_transition_state()) {
ICStub* stub = ICStub_from_destination_address(stub_address());
stub->clear();
}
}
//-----------------------------------------------------------------------------
// High-level access to an inline cache. Guaranteed to be MT-safe.
@ -333,10 +341,7 @@ void CompiledIC::set_to_clean() {
if (safe_transition) {
// Kill any leftover stub we might have too
if (is_in_transition_state()) {
ICStub* old_stub = ICStub_from_destination_address(stub_address());
old_stub->clear();
}
clear_ic_stub();
if (is_optimized()) {
set_ic_destination(entry);
} else {

@ -216,6 +216,7 @@ class CompiledIC: public ResourceObj {
//
void set_to_clean(); // Can only be called during a safepoint operation
void set_to_monomorphic(CompiledICInfo& info);
void clear_ic_stub();
// Returns true if successful and false otherwise. The call can fail if memory
// allocation in the code cache fails.

@ -567,12 +567,16 @@ void Dependencies::print_dependency(DepType dept, GrowableArray<DepArgument>* ar
what = "object ";
}
tty->print(" %s = %s", what, (put_star? "*": ""));
if (arg.is_klass())
if (arg.is_klass()) {
tty->print("%s", ((Klass*)arg.metadata_value())->external_name());
else if (arg.is_method())
} else if (arg.is_method()) {
((Method*)arg.metadata_value())->print_value();
else
} else if (arg.is_oop()) {
arg.oop_value()->print_value_on(tty);
} else {
ShouldNotReachHere(); // Provide impl for this type.
}
tty->cr();
}
if (witness != NULL) {
@ -609,7 +613,11 @@ void Dependencies::DepStream::print_dependency(Klass* witness, bool verbose) {
int nargs = argument_count();
GrowableArray<DepArgument>* args = new GrowableArray<DepArgument>(nargs);
for (int j = 0; j < nargs; j++) {
args->push(argument(j));
if (type() == call_site_target_value) {
args->push(argument_oop(j));
} else {
args->push(argument(j));
}
}
int argslen = args->length();
Dependencies::print_dependency(type(), args, witness);

@ -1130,6 +1130,18 @@ void nmethod::clear_inline_caches() {
}
}
// Clear ICStubs of all compiled ICs
void nmethod::clear_ic_stubs() {
assert_locked_or_safepoint(CompiledIC_lock);
RelocIterator iter(this);
while(iter.next()) {
if (iter.type() == relocInfo::virtual_call_type) {
CompiledIC* ic = CompiledIC_at(&iter);
ic->clear_ic_stub();
}
}
}
void nmethod::cleanup_inline_caches() {

@ -577,6 +577,7 @@ public:
// Inline cache support
void clear_inline_caches();
void clear_ic_stubs();
void cleanup_inline_caches();
bool inlinecache_check_contains(address addr) const {
return (addr >= code_begin() && addr < verified_entry_point());

@ -63,7 +63,7 @@ void* VtableStub::operator new(size_t size, int code_size) throw() {
// If changing the name, update the other file accordingly.
BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
if (blob == NULL) {
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return NULL;
}
_chunk = blob->content_begin();

@ -137,6 +137,8 @@ PerfVariable* CompileBroker::_perf_last_invalidated_type = NULL;
elapsedTimer CompileBroker::_t_total_compilation;
elapsedTimer CompileBroker::_t_osr_compilation;
elapsedTimer CompileBroker::_t_standard_compilation;
elapsedTimer CompileBroker::_t_invalidated_compilation;
elapsedTimer CompileBroker::_t_bailedout_compilation;
int CompileBroker::_total_bailout_count = 0;
int CompileBroker::_total_invalidated_count = 0;
@ -2236,6 +2238,11 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
// _perf variables are production performance counters which are
// updated regardless of the setting of the CITime and CITimeEach flags
//
// account all time, including bailouts and failures in this counter;
// C1 and C2 counters are counting both successful and unsuccessful compiles
_t_total_compilation.add(time);
if (!success) {
_total_bailout_count++;
if (UsePerfData) {
@ -2243,6 +2250,7 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
_perf_last_failed_type->set_value(counters->compile_type());
_perf_total_bailout_count->inc();
}
_t_bailedout_compilation.add(time);
} else if (code == NULL) {
if (UsePerfData) {
_perf_last_invalidated_method->set_value(counters->current_method());
@ -2250,14 +2258,13 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
_perf_total_invalidated_count->inc();
}
_total_invalidated_count++;
_t_invalidated_compilation.add(time);
} else {
// Compilation succeeded
// update compilation ticks - used by the implementation of
// java.lang.management.CompilationMBean
_perf_total_compilation->inc(time.ticks());
_t_total_compilation.add(time);
_peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;
if (CITime) {
@ -2325,37 +2332,47 @@ const char* CompileBroker::compiler_name(int comp_level) {
void CompileBroker::print_times() {
tty->cr();
tty->print_cr("Accumulated compiler times (for compiled methods only)");
tty->print_cr("------------------------------------------------");
tty->print_cr("Accumulated compiler times");
tty->print_cr("----------------------------------------------------------");
//0000000000111111111122222222223333333333444444444455555555556666666666
//0123456789012345678901234567890123456789012345678901234567890123456789
tty->print_cr(" Total compilation time : %6.3f s", CompileBroker::_t_total_compilation.seconds());
tty->print_cr(" Standard compilation : %6.3f s, Average : %2.3f",
tty->print_cr(" Total compilation time : %7.3f s", CompileBroker::_t_total_compilation.seconds());
tty->print_cr(" Standard compilation : %7.3f s, Average : %2.3f s",
CompileBroker::_t_standard_compilation.seconds(),
CompileBroker::_t_standard_compilation.seconds() / CompileBroker::_total_standard_compile_count);
tty->print_cr(" On stack replacement : %6.3f s, Average : %2.3f", CompileBroker::_t_osr_compilation.seconds(), CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count);
tty->print_cr(" Bailed out compilation : %7.3f s, Average : %2.3f s",
CompileBroker::_t_bailedout_compilation.seconds(),
CompileBroker::_t_bailedout_compilation.seconds() / CompileBroker::_total_bailout_count);
tty->print_cr(" On stack replacement : %7.3f s, Average : %2.3f s",
CompileBroker::_t_osr_compilation.seconds(),
CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count);
tty->print_cr(" Invalidated : %7.3f s, Average : %2.3f s",
CompileBroker::_t_invalidated_compilation.seconds(),
CompileBroker::_t_invalidated_compilation.seconds() / CompileBroker::_total_invalidated_count);
AbstractCompiler *comp = compiler(CompLevel_simple);
if (comp != NULL) {
tty->cr();
comp->print_timers();
}
comp = compiler(CompLevel_full_optimization);
if (comp != NULL) {
tty->cr();
comp->print_timers();
}
tty->cr();
tty->print_cr(" Total compiled methods : %6d methods", CompileBroker::_total_compile_count);
tty->print_cr(" Standard compilation : %6d methods", CompileBroker::_total_standard_compile_count);
tty->print_cr(" On stack replacement : %6d methods", CompileBroker::_total_osr_compile_count);
tty->print_cr(" Total compiled methods : %8d methods", CompileBroker::_total_compile_count);
tty->print_cr(" Standard compilation : %8d methods", CompileBroker::_total_standard_compile_count);
tty->print_cr(" On stack replacement : %8d methods", CompileBroker::_total_osr_compile_count);
int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled;
tty->print_cr(" Total compiled bytecodes : %6d bytes", tcb);
tty->print_cr(" Standard compilation : %6d bytes", CompileBroker::_sum_standard_bytes_compiled);
tty->print_cr(" On stack replacement : %6d bytes", CompileBroker::_sum_osr_bytes_compiled);
tty->print_cr(" Total compiled bytecodes : %8d bytes", tcb);
tty->print_cr(" Standard compilation : %8d bytes", CompileBroker::_sum_standard_bytes_compiled);
tty->print_cr(" On stack replacement : %8d bytes", CompileBroker::_sum_osr_bytes_compiled);
int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds());
tty->print_cr(" Average compilation speed: %6d bytes/s", bps);
tty->print_cr(" Average compilation speed : %8d bytes/s", bps);
tty->cr();
tty->print_cr(" nmethod code size : %6d bytes", CompileBroker::_sum_nmethod_code_size);
tty->print_cr(" nmethod total size : %6d bytes", CompileBroker::_sum_nmethod_size);
tty->print_cr(" nmethod code size : %8d bytes", CompileBroker::_sum_nmethod_code_size);
tty->print_cr(" nmethod total size : %8d bytes", CompileBroker::_sum_nmethod_size);
}
// Debugging output for failure

@ -322,6 +322,8 @@ class CompileBroker: AllStatic {
static elapsedTimer _t_total_compilation;
static elapsedTimer _t_osr_compilation;
static elapsedTimer _t_standard_compilation;
static elapsedTimer _t_invalidated_compilation;
static elapsedTimer _t_bailedout_compilation;
static int _total_compile_count;
static int _total_bailout_count;

@ -128,9 +128,7 @@ void ConcurrentG1Refine::worker_threads_do(ThreadClosure * tc) {
}
uint ConcurrentG1Refine::thread_num() {
uint n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads
: ParallelGCThreads;
return MAX2<uint>(n_threads, 1);
return G1ConcRefinementThreads;
}
void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {

@ -262,12 +262,12 @@
"Percentage (0-100) of the heap size to use as default " \
" maximum young gen size.") \
\
experimental(uintx, G1MixedGCLiveThresholdPercent, 65, \
experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \
"Threshold for regions to be considered for inclusion in the " \
"collection set of mixed GCs. " \
"Regions with live bytes exceeding this will not be collected.") \
\
product(uintx, G1HeapWastePercent, 10, \
product(uintx, G1HeapWastePercent, 5, \
"Amount of space, expressed as a percentage of the heap size, " \
"that G1 is willing not to collect to avoid expensive GCs.") \
\

@ -1077,7 +1077,7 @@ IRT_END
address SignatureHandlerLibrary::set_handler_blob() {
BufferBlob* handler_blob = BufferBlob::create("native signature handlers", blob_size);
if (handler_blob == NULL) {
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return NULL;
}
address handler = handler_blob->code_begin();

@ -817,7 +817,11 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation(
assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock");
do {
MetaWord* result = NULL;
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
if (result != NULL) {
return result;
}
if (GC_locker::is_active_and_needs_gc()) {
// If the GC_locker is active, just expand and allocate.
// If that does not succeed, wait if this thread is not

@ -171,7 +171,8 @@ class CodeHeap : public CHeapObj<mtCode> {
size_t unallocated_capacity() const { return max_capacity() - allocated_capacity(); }
// Returns true if the CodeHeap contains CodeBlobs of the given type
bool accepts(int code_blob_type) const { return (_code_blob_type == code_blob_type); }
bool accepts(int code_blob_type) const { return (_code_blob_type == CodeBlobType::All) ||
(_code_blob_type == code_blob_type); }
int code_blob_type() const { return _code_blob_type; }
// Debugging / Profiling

@ -1415,10 +1415,31 @@ size_t MetaspaceGC::capacity_until_GC() {
return value;
}
size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
assert_is_size_aligned(v, Metaspace::commit_alignment());
return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
size_t capacity_until_GC = (size_t) _capacity_until_GC;
size_t new_value = capacity_until_GC + v;
if (new_value < capacity_until_GC) {
// The addition wrapped around, set new_value to aligned max value.
new_value = align_size_down(max_uintx, Metaspace::commit_alignment());
}
intptr_t expected = (intptr_t) capacity_until_GC;
intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected);
if (expected != actual) {
return false;
}
if (new_cap_until_GC != NULL) {
*new_cap_until_GC = new_value;
}
if (old_cap_until_GC != NULL) {
*old_cap_until_GC = capacity_until_GC;
}
return true;
}
size_t MetaspaceGC::dec_capacity_until_GC(size_t v) {
@ -1518,7 +1539,10 @@ void MetaspaceGC::compute_new_size() {
expand_bytes = align_size_up(expand_bytes, Metaspace::commit_alignment());
// Don't expand unless it's significant
if (expand_bytes >= MinMetaspaceExpansion) {
size_t new_capacity_until_GC = MetaspaceGC::inc_capacity_until_GC(expand_bytes);
size_t new_capacity_until_GC = 0;
bool succeeded = MetaspaceGC::inc_capacity_until_GC(expand_bytes, &new_capacity_until_GC);
assert(succeeded, "Should always succesfully increment HWM when at safepoint");
Metaspace::tracer()->report_gc_threshold(capacity_until_GC,
new_capacity_until_GC,
MetaspaceGCThresholdUpdater::ComputeNewSize);
@ -3321,19 +3345,29 @@ MetaWord* Metaspace::expand_and_allocate(size_t word_size, MetadataType mdtype)
size_t delta_bytes = MetaspaceGC::delta_capacity_until_GC(word_size * BytesPerWord);
assert(delta_bytes > 0, "Must be");
size_t after_inc = MetaspaceGC::inc_capacity_until_GC(delta_bytes);
size_t before = 0;
size_t after = 0;
MetaWord* res;
bool incremented;
// capacity_until_GC might be updated concurrently, must calculate previous value.
size_t before_inc = after_inc - delta_bytes;
// Each thread increments the HWM at most once. Even if the thread fails to increment
// the HWM, an allocation is still attempted. This is because another thread must then
// have incremented the HWM and therefore the allocation might still succeed.
do {
incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before);
res = allocate(word_size, mdtype);
} while (!incremented && res == NULL);
tracer()->report_gc_threshold(before_inc, after_inc,
MetaspaceGCThresholdUpdater::ExpandAndAllocate);
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
" to " SIZE_FORMAT, before_inc, after_inc);
if (incremented) {
tracer()->report_gc_threshold(before, after,
MetaspaceGCThresholdUpdater::ExpandAndAllocate);
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
" to " SIZE_FORMAT, before, after);
}
}
return allocate(word_size, mdtype);
return res;
}
// Space allocated in the Metaspace. This may

@ -87,6 +87,7 @@ class Metaspace : public CHeapObj<mtClass> {
friend class VM_CollectForMetadataAllocation;
friend class MetaspaceGC;
friend class MetaspaceAux;
friend class CollectorPolicy;
public:
enum MetadataType {
@ -144,6 +145,8 @@ class Metaspace : public CHeapObj<mtClass> {
// allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
MetaWord* allocate(size_t word_size, MetadataType mdtype);
MetaWord* expand_and_allocate(size_t size, MetadataType mdtype);
// Virtual Space lists for both classes and other metadata
static VirtualSpaceList* _space_list;
static VirtualSpaceList* _class_space_list;
@ -234,9 +237,6 @@ class Metaspace : public CHeapObj<mtClass> {
bool read_only, MetaspaceObj::Type type, TRAPS);
void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
MetaWord* expand_and_allocate(size_t size,
MetadataType mdtype);
static bool contains(const void* ptr);
void dump(outputStream* const out) const;
@ -407,7 +407,9 @@ class MetaspaceGC : AllStatic {
static void post_initialize();
static size_t capacity_until_GC();
static size_t inc_capacity_until_GC(size_t v);
static bool inc_capacity_until_GC(size_t v,
size_t* new_cap_until_GC = NULL,
size_t* old_cap_until_GC = NULL);
static size_t dec_capacity_until_GC(size_t v);
static bool should_concurrent_collect() { return _should_concurrent_collect; }

@ -92,7 +92,7 @@ void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_kl
ResourceMark rm(THREAD);
k->initialize_supers(super_klass(), CHECK);
k->vtable()->initialize_vtable(false, CHECK);
java_lang_Class::create_mirror(k, Handle(NULL), Handle(NULL), CHECK);
java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
}
GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {

@ -555,7 +555,7 @@ static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* work
// Collect GC mask info - where are all the OOPs?
void Compile::BuildOopMaps() {
NOT_PRODUCT( TracePhase t3("bldOopMaps", &_t_buildOopMaps, TimeCompiler); )
TracePhase tp("bldOopMaps", &timers[_t_buildOopMaps]);
// Can't resource-mark because I need to leave all those OopMaps around,
// or else I need to resource-mark some arena other than the default.
// ResourceMark rm; // Reclaim all OopFlows when done

@ -590,9 +590,6 @@
product(intx, TypeProfileMajorReceiverPercent, 90, \
"% of major receiver type to all profiled receivers") \
\
notproduct(bool, TimeCompiler2, false, \
"detailed time the compiler (requires +TimeCompiler)") \
\
diagnostic(bool, PrintIntrinsics, false, \
"prints attempted and successful inlining of intrinsics") \
\

@ -147,7 +147,7 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
void C2Compiler::print_timers() {
// do nothing
Compile::print_timers();
}
int C2Compiler::initial_code_buffer_size() {

@ -879,7 +879,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
call_does_dispatch, vtable_index); // out-parameters
// We lack profiling at this call but type speculation may
// provide us with a type
speculative_receiver_type = receiver_type->speculative_type();
speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
}
CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");

@ -209,7 +209,7 @@ PhaseChaitin::PhaseChaitin(uint unique, PhaseCFG &cfg, Matcher &matcher)
, _trace_spilling(TraceSpilling || C->method_has_option("TraceSpilling"))
#endif
{
NOT_PRODUCT( Compile::TracePhase t3("ctorChaitin", &_t_ctorChaitin, TimeCompiler); )
Compile::TracePhase tp("ctorChaitin", &timers[_t_ctorChaitin]);
_high_frequency_lrg = MIN2(double(OPTO_LRG_HIGH_FREQ), _cfg.get_outer_loop_frequency());
@ -295,6 +295,8 @@ int PhaseChaitin::clone_projs(Block* b, uint idx, Node* orig, Node* copy, uint&
// Renumber the live ranges to compact them. Makes the IFG smaller.
void PhaseChaitin::compact() {
Compile::TracePhase tp("chaitinCompact", &timers[_t_chaitinCompact]);
// Current the _uf_map contains a series of short chains which are headed
// by a self-cycle. All the chains run from big numbers to little numbers.
// The Find() call chases the chains & shortens them for the next Find call.
@ -369,7 +371,7 @@ void PhaseChaitin::Register_Allocate() {
#endif
{
NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
_live = NULL; // Mark live as being not available
rm.reset_to_mark(); // Reclaim working storage
IndexSet::reset_memory(C, &live_arena);
@ -386,7 +388,7 @@ void PhaseChaitin::Register_Allocate() {
// at all the GC points, and "stretches" the live range of any base pointer
// to the GC point.
if (stretch_base_pointer_live_ranges(&live_arena)) {
NOT_PRODUCT(Compile::TracePhase t3("computeLive (sbplr)", &_t_computeLive, TimeCompiler);)
Compile::TracePhase tp("computeLive (sbplr)", &timers[_t_computeLive]);
// Since some live range stretched, I need to recompute live
_live = NULL;
rm.reset_to_mark(); // Reclaim working storage
@ -399,17 +401,19 @@ void PhaseChaitin::Register_Allocate() {
// Create the interference graph using virtual copies
build_ifg_virtual(); // Include stack slots this time
// The IFG is/was triangular. I am 'squaring it up' so Union can run
// faster. Union requires a 'for all' operation which is slow on the
// triangular adjacency matrix (quick reminder: the IFG is 'sparse' -
// meaning I can visit all the Nodes neighbors less than a Node in time
// O(# of neighbors), but I have to visit all the Nodes greater than a
// given Node and search them for an instance, i.e., time O(#MaxLRG)).
_ifg->SquareUp();
// Aggressive (but pessimistic) copy coalescing.
// This pass works on virtual copies. Any virtual copies which are not
// coalesced get manifested as actual copies
{
// The IFG is/was triangular. I am 'squaring it up' so Union can run
// faster. Union requires a 'for all' operation which is slow on the
// triangular adjacency matrix (quick reminder: the IFG is 'sparse' -
// meaning I can visit all the Nodes neighbors less than a Node in time
// O(# of neighbors), but I have to visit all the Nodes greater than a
// given Node and search them for an instance, i.e., time O(#MaxLRG)).
_ifg->SquareUp();
Compile::TracePhase tp("chaitinCoalesce1", &timers[_t_chaitinCoalesce1]);
PhaseAggressiveCoalesce coalesce(*this);
coalesce.coalesce_driver();
@ -424,7 +428,7 @@ void PhaseChaitin::Register_Allocate() {
// After aggressive coalesce, attempt a first cut at coloring.
// To color, we need the IFG and for that we need LIVE.
{
NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
_live = NULL;
rm.reset_to_mark(); // Reclaim working storage
IndexSet::reset_memory(C, &live_arena);
@ -462,7 +466,7 @@ void PhaseChaitin::Register_Allocate() {
compact(); // Compact LRGs; return new lower max lrg
{
NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
_live = NULL;
rm.reset_to_mark(); // Reclaim working storage
IndexSet::reset_memory(C, &live_arena);
@ -476,6 +480,7 @@ void PhaseChaitin::Register_Allocate() {
_ifg->Compute_Effective_Degree();
// Only do conservative coalescing if requested
if (OptoCoalesce) {
Compile::TracePhase tp("chaitinCoalesce2", &timers[_t_chaitinCoalesce2]);
// Conservative (and pessimistic) copy coalescing of those spills
PhaseConservativeCoalesce coalesce(*this);
// If max live ranges greater than cutoff, don't color the stack.
@ -531,7 +536,7 @@ void PhaseChaitin::Register_Allocate() {
// Nuke the live-ness and interference graph and LiveRanGe info
{
NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
_live = NULL;
rm.reset_to_mark(); // Reclaim working storage
IndexSet::reset_memory(C, &live_arena);
@ -549,6 +554,7 @@ void PhaseChaitin::Register_Allocate() {
// Only do conservative coalescing if requested
if (OptoCoalesce) {
Compile::TracePhase tp("chaitinCoalesce3", &timers[_t_chaitinCoalesce3]);
// Conservative (and pessimistic) copy coalescing
PhaseConservativeCoalesce coalesce(*this);
// Check for few live ranges determines how aggressive coalesce is.
@ -1054,6 +1060,7 @@ void PhaseChaitin::set_was_low() {
// Compute cost/area ratio, in case we spill. Build the lo-degree list.
void PhaseChaitin::cache_lrg_info( ) {
Compile::TracePhase tp("chaitinCacheLRG", &timers[_t_chaitinCacheLRG]);
for (uint i = 1; i < _lrg_map.max_lrg_id(); i++) {
LRG &lrg = lrgs(i);
@ -1137,6 +1144,7 @@ void PhaseChaitin::Pre_Simplify( ) {
// Simplify the IFG by removing LRGs of low degree.
void PhaseChaitin::Simplify( ) {
Compile::TracePhase tp("chaitinSimplify", &timers[_t_chaitinSimplify]);
while( 1 ) { // Repeat till simplified it all
// May want to explore simplifying lo_degree before _lo_stk_degree.
@ -1384,6 +1392,8 @@ OptoReg::Name PhaseChaitin::choose_color( LRG &lrg, int chunk ) {
// everything going back is guaranteed a color. Select that color. If some
// hi-degree LRG cannot get a color then we record that we must spill.
uint PhaseChaitin::Select( ) {
Compile::TracePhase tp("chaitinSelect", &timers[_t_chaitinSelect]);
uint spill_reg = LRG::SPILL_REG;
_max_reg = OptoReg::Name(0); // Past max register used
while( _simplified ) {
@ -1577,7 +1587,7 @@ void PhaseChaitin::fixup_spills() {
// This function does only cisc spill work.
if( !UseCISCSpill ) return;
NOT_PRODUCT( Compile::TracePhase t3("fixupSpills", &_t_fixupSpills, TimeCompiler); )
Compile::TracePhase tp("fixupSpills", &timers[_t_fixupSpills]);
// Grab the Frame Pointer
Node *fp = _cfg.get_root_block()->head()->in(1)->in(TypeFunc::FramePtr);

@ -535,7 +535,7 @@ void Compile::init_scratch_buffer_blob(int const_size) {
if (scratch_buffer_blob() == NULL) {
// Let CompilerBroker disable further compilations.
record_failure("Not enough space for scratch buffer in CodeCache");
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return;
}
}
@ -667,16 +667,18 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
C = this;
CompileWrapper cw(this);
#ifndef PRODUCT
if (TimeCompiler2) {
if (CITimeVerbose) {
tty->print(" ");
target->holder()->name()->print();
tty->print(".");
target->print_short_name();
tty->print(" ");
}
TraceTime t1("Total compilation time", &_t_totalCompilation, TimeCompiler, TimeCompiler2);
TraceTime t2(NULL, &_t_methodCompilation, TimeCompiler, false);
TraceTime t1("Total compilation time", &_t_totalCompilation, CITime, CITimeVerbose);
TraceTime t2(NULL, &_t_methodCompilation, CITime, false);
#ifndef PRODUCT
bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly");
if (!print_opto_assembly) {
bool print_assembly = (PrintAssembly || _method->should_print_assembly());
@ -726,7 +728,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
print_inlining_init();
{ // Scope for timing the parser
TracePhase t3("parse", &_t_parser, true);
TracePhase tp("parse", &timers[_t_parser]);
// Put top into the hash table ASAP.
initial_gvn()->transform_no_reclaim(top());
@ -888,8 +890,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
record_method_not_compilable("+OptoNoExecute"); // Flag as failed
return;
}
TracePhase t2("install_code", &_t_registerMethod, TimeCompiler);
#endif
TracePhase tp("install_code", &timers[_t_registerMethod]);
if (is_osr_compilation()) {
_code_offsets.set_value(CodeOffsets::Verified_Entry, 0);
@ -977,9 +979,10 @@ Compile::Compile( ciEnv* ci_env,
_interpreter_frame_size(0) {
C = this;
TraceTime t1(NULL, &_t_totalCompilation, CITime, false);
TraceTime t2(NULL, &_t_stubCompilation, CITime, false);
#ifndef PRODUCT
TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false);
TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false);
set_print_assembly(PrintFrameConverterAssembly);
set_parsed_irreducible_loop(false);
#endif
@ -1949,30 +1952,38 @@ void Compile::inline_incrementally_one(PhaseIterGVN& igvn) {
for_igvn()->clear();
gvn->replace_with(&igvn);
int i = 0;
for (; i <_late_inlines.length() && !inlining_progress(); i++) {
CallGenerator* cg = _late_inlines.at(i);
_late_inlines_pos = i+1;
cg->do_late_inline();
if (failing()) return;
{
TracePhase tp("incrementalInline_inline", &timers[_t_incrInline_inline]);
int i = 0;
for (; i <_late_inlines.length() && !inlining_progress(); i++) {
CallGenerator* cg = _late_inlines.at(i);
_late_inlines_pos = i+1;
cg->do_late_inline();
if (failing()) return;
}
int j = 0;
for (; i < _late_inlines.length(); i++, j++) {
_late_inlines.at_put(j, _late_inlines.at(i));
}
_late_inlines.trunc_to(j);
}
int j = 0;
for (; i < _late_inlines.length(); i++, j++) {
_late_inlines.at_put(j, _late_inlines.at(i));
}
_late_inlines.trunc_to(j);
{
TracePhase tp("incrementalInline_pru", &timers[_t_incrInline_pru]);
ResourceMark rm;
PhaseRemoveUseless pru(gvn, for_igvn());
}
igvn = PhaseIterGVN(gvn);
{
TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
igvn = PhaseIterGVN(gvn);
}
}
// Perform incremental inlining until bound on number of live nodes is reached
void Compile::inline_incrementally(PhaseIterGVN& igvn) {
TracePhase tp("incrementalInline", &timers[_t_incrInline]);
PhaseGVN* gvn = initial_gvn();
set_inlining_incrementally(true);
@ -1983,6 +1994,7 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) {
TracePhase tp("incrementalInline_ideal", &timers[_t_incrInline_ideal]);
// PhaseIdealLoop is expensive so we only try it once we are
// out of live nodes and we only try it again if the previous
// helped got the number of nodes down significantly
@ -2001,7 +2013,10 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
if (failing()) return;
igvn.optimize();
{
TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
igvn.optimize();
}
if (failing()) return;
}
@ -2018,13 +2033,16 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
if (failing()) return;
{
TracePhase tp("incrementalInline_pru", &timers[_t_incrInline_pru]);
ResourceMark rm;
PhaseRemoveUseless pru(initial_gvn(), for_igvn());
}
igvn = PhaseIterGVN(gvn);
igvn.optimize();
{
TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
igvn = PhaseIterGVN(gvn);
igvn.optimize();
}
}
set_inlining_incrementally(false);
@ -2034,7 +2052,7 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
//------------------------------Optimize---------------------------------------
// Given a graph, optimize it.
void Compile::Optimize() {
TracePhase t1("optimizer", &_t_optimizer, true);
TracePhase tp("optimizer", &timers[_t_optimizer]);
#ifndef PRODUCT
if (env()->break_at_compile()) {
@ -2060,7 +2078,7 @@ void Compile::Optimize() {
_modified_nodes = new (comp_arena()) Unique_Node_List(comp_arena());
#endif
{
NOT_PRODUCT( TracePhase t2("iterGVN", &_t_iterGVN, TimeCompiler); )
TracePhase tp("iterGVN", &timers[_t_iterGVN]);
igvn.optimize();
}
@ -2068,17 +2086,13 @@ void Compile::Optimize() {
if (failing()) return;
{
NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
inline_incrementally(igvn);
}
inline_incrementally(igvn);
print_method(PHASE_INCREMENTAL_INLINE, 2);
if (failing()) return;
if (eliminate_boxing()) {
NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
// Inline valueOf() methods now.
inline_boxing_calls(igvn);
@ -2105,7 +2119,7 @@ void Compile::Optimize() {
if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
if (has_loops()) {
// Cleanup graph (remove dead nodes).
TracePhase t2("idealLoop", &_t_idealLoop, true);
TracePhase tp("idealLoop", &timers[_t_idealLoop]);
PhaseIdealLoop ideal_loop( igvn, false, true );
if (major_progress()) print_method(PHASE_PHASEIDEAL_BEFORE_EA, 2);
if (failing()) return;
@ -2121,7 +2135,7 @@ void Compile::Optimize() {
if (failing()) return;
if (congraph() != NULL && macro_count() > 0) {
NOT_PRODUCT( TracePhase t2("macroEliminate", &_t_macroEliminate, TimeCompiler); )
TracePhase tp("macroEliminate", &timers[_t_macroEliminate]);
PhaseMacroExpand mexp(igvn);
mexp.eliminate_macro_nodes();
igvn.set_delay_transform(false);
@ -2140,7 +2154,7 @@ void Compile::Optimize() {
loop_opts_cnt = num_loop_opts();
if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) {
{
TracePhase t2("idealLoop", &_t_idealLoop, true);
TracePhase tp("idealLoop", &timers[_t_idealLoop]);
PhaseIdealLoop ideal_loop( igvn, true );
loop_opts_cnt--;
if (major_progress()) print_method(PHASE_PHASEIDEALLOOP1, 2);
@ -2148,7 +2162,7 @@ void Compile::Optimize() {
}
// Loop opts pass if partial peeling occurred in previous pass
if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) {
TracePhase t3("idealLoop", &_t_idealLoop, true);
TracePhase tp("idealLoop", &timers[_t_idealLoop]);
PhaseIdealLoop ideal_loop( igvn, false );
loop_opts_cnt--;
if (major_progress()) print_method(PHASE_PHASEIDEALLOOP2, 2);
@ -2156,14 +2170,14 @@ void Compile::Optimize() {
}
// Loop opts pass for loop-unrolling before CCP
if(major_progress() && (loop_opts_cnt > 0)) {
TracePhase t4("idealLoop", &_t_idealLoop, true);
TracePhase tp("idealLoop", &timers[_t_idealLoop]);
PhaseIdealLoop ideal_loop( igvn, false );
loop_opts_cnt--;
if (major_progress()) print_method(PHASE_PHASEIDEALLOOP3, 2);
}
if (!failing()) {
// Verify that last round of loop opts produced a valid graph
NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )
TracePhase tp("idealLoopVerify", &timers[_t_idealLoopVerify]);
PhaseIdealLoop::verify(igvn);
}
}
@ -2173,7 +2187,7 @@ void Compile::Optimize() {
PhaseCCP ccp( &igvn );
assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)");
{
TracePhase t2("ccp", &_t_ccp, true);
TracePhase tp("ccp", &timers[_t_ccp]);
ccp.do_transform();
}
print_method(PHASE_CPP1, 2);
@ -2182,7 +2196,7 @@ void Compile::Optimize() {
// Iterative Global Value Numbering, including ideal transforms
{
NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); )
TracePhase tp("iterGVN2", &timers[_t_iterGVN2]);
igvn = ccp;
igvn.optimize();
}
@ -2196,7 +2210,7 @@ void Compile::Optimize() {
if(loop_opts_cnt > 0) {
debug_only( int cnt = 0; );
while(major_progress() && (loop_opts_cnt > 0)) {
TracePhase t2("idealLoop", &_t_idealLoop, true);
TracePhase tp("idealLoop", &timers[_t_idealLoop]);
assert( cnt++ < 40, "infinite cycle in loop optimization" );
PhaseIdealLoop ideal_loop( igvn, true);
loop_opts_cnt--;
@ -2208,12 +2222,12 @@ void Compile::Optimize() {
{
// Verify that all previous optimizations produced a valid graph
// at least to this point, even if no loop optimizations were done.
NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )
TracePhase tp("idealLoopVerify", &timers[_t_idealLoopVerify]);
PhaseIdealLoop::verify(igvn);
}
{
NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); )
TracePhase tp("macroExpand", &timers[_t_macroExpand]);
PhaseMacroExpand mex(igvn);
if (mex.expand_macro_nodes()) {
assert(failing(), "must bail out w/ explicit message");
@ -2227,7 +2241,7 @@ void Compile::Optimize() {
process_print_inlining();
// A method with only infinite loops has no edges entering loops from root
{
NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); )
TracePhase tp("graphReshape", &timers[_t_graphReshaping]);
if (final_graph_reshaping()) {
assert(failing(), "must bail out w/ explicit message");
return;
@ -2258,7 +2272,7 @@ void Compile::Code_Gen() {
Matcher matcher;
_matcher = &matcher;
{
TracePhase t2("matcher", &_t_matcher, true);
TracePhase tp("matcher", &timers[_t_matcher]);
matcher.match();
}
// In debug mode can dump m._nodes.dump() for mapping of ideal to machine
@ -2275,7 +2289,7 @@ void Compile::Code_Gen() {
PhaseCFG cfg(node_arena(), root(), matcher);
_cfg = &cfg;
{
NOT_PRODUCT( TracePhase t2("scheduler", &_t_scheduler, TimeCompiler); )
TracePhase tp("scheduler", &timers[_t_scheduler]);
bool success = cfg.do_global_code_motion();
if (!success) {
return;
@ -2289,7 +2303,7 @@ void Compile::Code_Gen() {
PhaseChaitin regalloc(unique(), cfg, matcher);
_regalloc = &regalloc;
{
TracePhase t2("regalloc", &_t_registerAllocation, true);
TracePhase tp("regalloc", &timers[_t_registerAllocation]);
// Perform register allocation. After Chaitin, use-def chains are
// no longer accurate (at spill code) and so must be ignored.
// Node->LRG->reg mappings are still accurate.
@ -2306,7 +2320,7 @@ void Compile::Code_Gen() {
// are not adding any new instructions. If any basic block is empty, we
// can now safely remove it.
{
NOT_PRODUCT( TracePhase t2("blockOrdering", &_t_blockOrdering, TimeCompiler); )
TracePhase tp("blockOrdering", &timers[_t_blockOrdering]);
cfg.remove_empty_blocks();
if (do_freq_based_layout()) {
PhaseBlockLayout layout(cfg);
@ -2318,22 +2332,20 @@ void Compile::Code_Gen() {
// Apply peephole optimizations
if( OptoPeephole ) {
NOT_PRODUCT( TracePhase t2("peephole", &_t_peephole, TimeCompiler); )
TracePhase tp("peephole", &timers[_t_peephole]);
PhasePeephole peep( _regalloc, cfg);
peep.do_transform();
}
// Do late expand if CPU requires this.
if (Matcher::require_postalloc_expand) {
NOT_PRODUCT(TracePhase t2c("postalloc_expand", &_t_postalloc_expand, true));
TracePhase tp("postalloc_expand", &timers[_t_postalloc_expand]);
cfg.postalloc_expand(_regalloc);
}
// Convert Nodes to instruction bits in a buffer
{
// %%%% workspace merge brought two timers together for one job
TracePhase t2a("output", &_t_output, true);
NOT_PRODUCT( TraceTime t2b(NULL, &_t_codeGeneration, TimeCompiler, false); )
TraceTime tp("output", &timers[_t_output], CITime);
Output();
}
@ -3538,11 +3550,11 @@ void Compile::record_failure(const char* reason) {
_root = NULL; // flush the graph, too
}
Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
: TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
_phase_name(name), _dolog(dolog)
Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator)
: TraceTime(name, accumulator, CITime, CITimeVerbose),
_phase_name(name), _dolog(CITimeVerbose)
{
if (dolog) {
if (_dolog) {
C = Compile::current();
_log = C->log();
} else {

@ -97,10 +97,10 @@ class Compile : public Phase {
AliasIdxRaw = 3 // hard-wired index for TypeRawPtr::BOTTOM
};
// Variant of TraceTime(NULL, &_t_accumulator, TimeCompiler);
// Integrated with logging. If logging is turned on, and dolog is true,
// Variant of TraceTime(NULL, &_t_accumulator, CITime);
// Integrated with logging. If logging is turned on, and CITimeVerbose is true,
// then brackets are put into the log, with time stamps and node counts.
// (The time collection itself is always conditionalized on TimeCompiler.)
// (The time collection itself is always conditionalized on CITime.)
class TracePhase : public TraceTime {
private:
Compile* C;
@ -108,7 +108,7 @@ class Compile : public Phase {
const char* _phase_name;
bool _dolog;
public:
TracePhase(const char* name, elapsedTimer* accumulator, bool dolog);
TracePhase(const char* name, elapsedTimer* accumulator);
~TracePhase();
};

@ -82,7 +82,7 @@ bool ConnectionGraph::has_candidates(Compile *C) {
}
void ConnectionGraph::do_analysis(Compile *C, PhaseIterGVN *igvn) {
Compile::TracePhase t2("escapeAnalysis", &Phase::_t_escapeAnalysis, true);
Compile::TracePhase tp("escapeAnalysis", &Phase::timers[Phase::_t_escapeAnalysis]);
ResourceMark rm;
// Add ConP#NULL and ConN#NULL nodes before ConnectionGraph construction
@ -117,7 +117,7 @@ bool ConnectionGraph::compute_escape() {
GrowableArray<FieldNode*> oop_fields_worklist;
DEBUG_ONLY( GrowableArray<Node*> addp_worklist; )
{ Compile::TracePhase t3("connectionGraph", &Phase::_t_connectionGraph, true);
{ Compile::TracePhase tp("connectionGraph", &Phase::timers[Phase::_t_connectionGraph]);
// 1. Populate Connection Graph (CG) with PointsTo nodes.
ideal_nodes.map(C->live_nodes(), NULL); // preallocate space
@ -2839,6 +2839,13 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
continue;
}
}
const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
if (t == NULL)
continue; // not a TypeOopPtr
if (!t->klass_is_exact())
continue; // not an unique type
if (alloc->is_Allocate()) {
// Set the scalar_replaceable flag for allocation
// so it could be eliminated.
@ -2857,10 +2864,7 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
// - not determined to be ineligible by escape analysis
set_map(alloc, n);
set_map(n, alloc);
const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
if (t == NULL)
continue; // not a TypeOopPtr
const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni);
const TypeOopPtr* tinst = t->cast_to_instance_id(ni);
igvn->hash_delete(n);
igvn->set_type(n, tinst);
n->raise_bottom_type(tinst);

@ -306,6 +306,7 @@ void PhaseChaitin::interfere_with_live(uint lid, IndexSet* liveout) {
// at this point can end up in bad places). Copies I re-insert later I have
// more opportunity to insert them in low-frequency locations.
void PhaseChaitin::build_ifg_virtual( ) {
Compile::TracePhase tp("buildIFG_virt", &timers[_t_buildIFGvirtual]);
// For all blocks (in any order) do...
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
@ -739,7 +740,7 @@ void PhaseChaitin::adjust_high_pressure_index(Block* b, uint& block_hrp_index, P
* low to high register pressure transition within the block (if any).
*/
uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) {
NOT_PRODUCT(Compile::TracePhase t3("buildIFG", &_t_buildIFGphysical, TimeCompiler);)
Compile::TracePhase tp("buildIFG", &timers[_t_buildIFGphysical]);
uint must_spill = 0;
for (uint i = 0; i < _cfg.number_of_blocks(); i++) {

@ -1166,7 +1166,7 @@ CodeBuffer* Compile::init_buffer(uint* blk_starts) {
// Have we run out of code space?
if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
C->record_failure("CodeCache is full");
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return NULL;
}
// Configure the code buffer.
@ -1491,7 +1491,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
C->record_failure("CodeCache is full");
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return;
}
@ -1648,7 +1648,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
// One last check for failed CodeBuffer::expand:
if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
C->record_failure("CodeCache is full");
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return;
}
@ -1887,7 +1887,7 @@ void Compile::ScheduleAndBundle() {
if (max_vector_size() > 8)
return;
NOT_PRODUCT( TracePhase t2("isched", &_t_instrSched, TimeCompiler); )
TracePhase tp("isched", &timers[_t_instrSched]);
// Create a data structure for all the scheduling information
Scheduling scheduling(Thread::current()->resource_area(), *this);

@ -528,7 +528,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses)
methods_parsed++;
#ifndef PRODUCT
// add method size here to guarantee that inlined methods are added too
if (TimeCompiler)
if (CITime)
_total_bytes_compiled += method()->code_size();
show_parse_info();

@ -30,56 +30,14 @@
#include "opto/node.hpp"
#include "opto/phase.hpp"
#ifndef PRODUCT
int Phase::_total_bytes_compiled = 0;
elapsedTimer Phase::_t_totalCompilation;
elapsedTimer Phase::_t_methodCompilation;
elapsedTimer Phase::_t_stubCompilation;
#endif
// The next timers used for LogCompilation
elapsedTimer Phase::_t_parser;
elapsedTimer Phase::_t_optimizer;
elapsedTimer Phase::_t_escapeAnalysis;
elapsedTimer Phase::_t_connectionGraph;
elapsedTimer Phase::_t_idealLoop;
elapsedTimer Phase::_t_ccp;
elapsedTimer Phase::_t_matcher;
elapsedTimer Phase::_t_registerAllocation;
elapsedTimer Phase::_t_output;
#ifndef PRODUCT
elapsedTimer Phase::_t_graphReshaping;
elapsedTimer Phase::_t_scheduler;
elapsedTimer Phase::_t_blockOrdering;
elapsedTimer Phase::_t_macroEliminate;
elapsedTimer Phase::_t_macroExpand;
elapsedTimer Phase::_t_peephole;
elapsedTimer Phase::_t_postalloc_expand;
elapsedTimer Phase::_t_codeGeneration;
elapsedTimer Phase::_t_registerMethod;
elapsedTimer Phase::_t_temporaryTimer1;
elapsedTimer Phase::_t_temporaryTimer2;
elapsedTimer Phase::_t_idealLoopVerify;
// Subtimers for _t_optimizer
elapsedTimer Phase::_t_iterGVN;
elapsedTimer Phase::_t_iterGVN2;
elapsedTimer Phase::_t_incrInline;
// Subtimers for _t_registerAllocation
elapsedTimer Phase::_t_ctorChaitin;
elapsedTimer Phase::_t_buildIFGphysical;
elapsedTimer Phase::_t_computeLive;
elapsedTimer Phase::_t_regAllocSplit;
elapsedTimer Phase::_t_postAllocCopyRemoval;
elapsedTimer Phase::_t_fixupSpills;
// Subtimers for _t_output
elapsedTimer Phase::_t_instrSched;
elapsedTimer Phase::_t_buildOopMaps;
#endif
// The counters to use for LogCompilation
elapsedTimer Phase::timers[max_phase_timers];
//------------------------------Phase------------------------------------------
Phase::Phase( PhaseNumber pnum ) : _pnum(pnum), C( pnum == Compiler ? NULL : Compile::current()) {
@ -89,93 +47,132 @@ Phase::Phase( PhaseNumber pnum ) : _pnum(pnum), C( pnum == Compiler ? NULL : Com
CompileBroker::maybe_block();
}
#ifndef PRODUCT
static const double minimum_reported_time = 0.0001; // seconds
static const double expected_method_compile_coverage = 0.97; // %
static const double minimum_meaningful_method_compile = 2.00; // seconds
void Phase::print_timers() {
tty->print_cr ("Accumulated compiler times:");
tty->print_cr ("---------------------------");
tty->print_cr (" Total compilation: %3.3f sec.", Phase::_t_totalCompilation.seconds());
tty->print (" method compilation : %3.3f sec", Phase::_t_methodCompilation.seconds());
tty->print ("/%d bytes",_total_bytes_compiled);
tty->print_cr (" (%3.0f bytes per sec) ", Phase::_total_bytes_compiled / Phase::_t_methodCompilation.seconds());
tty->print_cr (" stub compilation : %3.3f sec.", Phase::_t_stubCompilation.seconds());
tty->print_cr (" Phases:");
tty->print_cr (" parse : %3.3f sec", Phase::_t_parser.seconds());
tty->print_cr (" optimizer : %3.3f sec", Phase::_t_optimizer.seconds());
if( Verbose || WizardMode ) {
tty->print_cr (" C2 Compile Time: %7.3f s", Phase::_t_totalCompilation.seconds());
tty->print_cr (" Parse: %7.3f s", timers[_t_parser].seconds());
{
tty->print_cr (" Optimize: %7.3f s", timers[_t_optimizer].seconds());
if (DoEscapeAnalysis) {
// EA is part of Optimizer.
tty->print_cr (" escape analysis: %3.3f sec", Phase::_t_escapeAnalysis.seconds());
tty->print_cr (" connection graph: %3.3f sec", Phase::_t_connectionGraph.seconds());
tty->print_cr (" macroEliminate : %3.3f sec", Phase::_t_macroEliminate.seconds());
tty->print_cr (" Escape Analysis: %7.3f s", timers[_t_escapeAnalysis].seconds());
tty->print_cr (" Conn Graph: %7.3f s", timers[_t_connectionGraph].seconds());
tty->print_cr (" Macro Eliminate: %7.3f s", timers[_t_macroEliminate].seconds());
}
tty->print_cr (" GVN 1: %7.3f s", timers[_t_iterGVN].seconds());
{
tty->print_cr (" Incremental Inline: %7.3f s", timers[_t_incrInline].seconds());
tty->print_cr (" IdealLoop: %7.3f s", timers[_t_incrInline_ideal].seconds());
tty->print_cr (" IGVN: %7.3f s", timers[_t_incrInline_igvn].seconds());
tty->print_cr (" Inline: %7.3f s", timers[_t_incrInline_inline].seconds());
tty->print_cr (" Prune Useless: %7.3f s", timers[_t_incrInline_pru].seconds());
double other = timers[_t_incrInline].seconds() -
(timers[_t_incrInline_ideal].seconds() +
timers[_t_incrInline_igvn].seconds() +
timers[_t_incrInline_inline].seconds() +
timers[_t_incrInline_pru].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
}
tty->print_cr (" IdealLoop: %7.3f s", timers[_t_idealLoop].seconds());
tty->print_cr (" IdealLoop Verify: %7.3f s", timers[_t_idealLoopVerify].seconds());
tty->print_cr (" Cond Const Prop: %7.3f s", timers[_t_ccp].seconds());
tty->print_cr (" GVN 2: %7.3f s", timers[_t_iterGVN2].seconds());
tty->print_cr (" Macro Expand: %7.3f s", timers[_t_macroExpand].seconds());
tty->print_cr (" Graph Reshape: %7.3f s", timers[_t_graphReshaping].seconds());
double other = timers[_t_optimizer].seconds() -
(timers[_t_escapeAnalysis].seconds() +
timers[_t_iterGVN].seconds() +
timers[_t_incrInline].seconds() +
timers[_t_idealLoop].seconds() +
timers[_t_idealLoopVerify].seconds() +
timers[_t_ccp].seconds() +
timers[_t_iterGVN2].seconds() +
timers[_t_macroExpand].seconds() +
timers[_t_graphReshaping].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
tty->print_cr (" iterGVN : %3.3f sec", Phase::_t_iterGVN.seconds());
tty->print_cr (" incrInline : %3.3f sec", Phase::_t_incrInline.seconds());
tty->print_cr (" idealLoop : %3.3f sec", Phase::_t_idealLoop.seconds());
tty->print_cr (" idealLoopVerify: %3.3f sec", Phase::_t_idealLoopVerify.seconds());
tty->print_cr (" ccp : %3.3f sec", Phase::_t_ccp.seconds());
tty->print_cr (" iterGVN2 : %3.3f sec", Phase::_t_iterGVN2.seconds());
tty->print_cr (" macroExpand : %3.3f sec", Phase::_t_macroExpand.seconds());
tty->print_cr (" graphReshape : %3.3f sec", Phase::_t_graphReshaping.seconds());
double optimizer_subtotal = Phase::_t_iterGVN.seconds() + Phase::_t_iterGVN2.seconds() +
Phase::_t_escapeAnalysis.seconds() + Phase::_t_macroEliminate.seconds() +
Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() +
Phase::_t_macroExpand.seconds() + Phase::_t_graphReshaping.seconds();
double percent_of_optimizer = ((optimizer_subtotal == 0.0) ? 0.0 : (optimizer_subtotal / Phase::_t_optimizer.seconds() * 100.0));
tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", optimizer_subtotal, percent_of_optimizer);
}
tty->print_cr (" matcher : %3.3f sec", Phase::_t_matcher.seconds());
tty->print_cr (" scheduler : %3.3f sec", Phase::_t_scheduler.seconds());
tty->print_cr (" regalloc : %3.3f sec", Phase::_t_registerAllocation.seconds());
if( Verbose || WizardMode ) {
tty->print_cr (" ctorChaitin : %3.3f sec", Phase::_t_ctorChaitin.seconds());
tty->print_cr (" buildIFG : %3.3f sec", Phase::_t_buildIFGphysical.seconds());
tty->print_cr (" computeLive : %3.3f sec", Phase::_t_computeLive.seconds());
tty->print_cr (" regAllocSplit : %3.3f sec", Phase::_t_regAllocSplit.seconds());
tty->print_cr (" postAllocCopyRemoval: %3.3f sec", Phase::_t_postAllocCopyRemoval.seconds());
tty->print_cr (" fixupSpills : %3.3f sec", Phase::_t_fixupSpills.seconds());
double regalloc_subtotal = Phase::_t_ctorChaitin.seconds() +
Phase::_t_buildIFGphysical.seconds() + Phase::_t_computeLive.seconds() +
Phase::_t_regAllocSplit.seconds() + Phase::_t_fixupSpills.seconds() +
Phase::_t_postAllocCopyRemoval.seconds();
double percent_of_regalloc = ((regalloc_subtotal == 0.0) ? 0.0 : (regalloc_subtotal / Phase::_t_registerAllocation.seconds() * 100.0));
tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", regalloc_subtotal, percent_of_regalloc);
tty->print_cr (" Matcher: %7.3f s", timers[_t_matcher].seconds());
tty->print_cr (" Scheduler: %7.3f s", timers[_t_scheduler].seconds());
{
tty->print_cr (" Regalloc: %7.3f s", timers[_t_registerAllocation].seconds());
tty->print_cr (" Ctor Chaitin: %7.3f s", timers[_t_ctorChaitin].seconds());
tty->print_cr (" Build IFG (virt): %7.3f s", timers[_t_buildIFGvirtual].seconds());
tty->print_cr (" Build IFG (phys): %7.3f s", timers[_t_buildIFGphysical].seconds());
tty->print_cr (" Compute Liveness: %7.3f s", timers[_t_computeLive].seconds());
tty->print_cr (" Regalloc Split: %7.3f s", timers[_t_regAllocSplit].seconds());
tty->print_cr (" Postalloc Copy Rem: %7.3f s", timers[_t_postAllocCopyRemoval].seconds());
tty->print_cr (" Fixup Spills: %7.3f s", timers[_t_fixupSpills].seconds());
tty->print_cr (" Compact: %7.3f s", timers[_t_chaitinCompact].seconds());
tty->print_cr (" Coalesce 1: %7.3f s", timers[_t_chaitinCoalesce1].seconds());
tty->print_cr (" Coalesce 2: %7.3f s", timers[_t_chaitinCoalesce2].seconds());
tty->print_cr (" Coalesce 3: %7.3f s", timers[_t_chaitinCoalesce3].seconds());
tty->print_cr (" Cache LRG: %7.3f s", timers[_t_chaitinCacheLRG].seconds());
tty->print_cr (" Simplify: %7.3f s", timers[_t_chaitinSimplify].seconds());
tty->print_cr (" Select: %7.3f s", timers[_t_chaitinSelect].seconds());
double other = timers[_t_registerAllocation].seconds() -
(timers[_t_ctorChaitin].seconds() +
timers[_t_buildIFGvirtual].seconds() +
timers[_t_buildIFGphysical].seconds() +
timers[_t_computeLive].seconds() +
timers[_t_regAllocSplit].seconds() +
timers[_t_postAllocCopyRemoval].seconds() +
timers[_t_fixupSpills].seconds() +
timers[_t_chaitinCompact].seconds() +
timers[_t_chaitinCoalesce1].seconds() +
timers[_t_chaitinCoalesce2].seconds() +
timers[_t_chaitinCoalesce3].seconds() +
timers[_t_chaitinCacheLRG].seconds() +
timers[_t_chaitinSimplify].seconds() +
timers[_t_chaitinSelect].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
}
tty->print_cr (" blockOrdering : %3.3f sec", Phase::_t_blockOrdering.seconds());
tty->print_cr (" peephole : %3.3f sec", Phase::_t_peephole.seconds());
tty->print_cr (" Block Ordering: %7.3f s", timers[_t_blockOrdering].seconds());
tty->print_cr (" Peephole: %7.3f s", timers[_t_peephole].seconds());
if (Matcher::require_postalloc_expand) {
tty->print_cr (" postalloc_expand: %3.3f sec", Phase::_t_postalloc_expand.seconds());
tty->print_cr (" Postalloc Expand: %7.3f s", timers[_t_postalloc_expand].seconds());
}
tty->print_cr (" codeGen : %3.3f sec", Phase::_t_codeGeneration.seconds());
tty->print_cr (" install_code : %3.3f sec", Phase::_t_registerMethod.seconds());
tty->print_cr (" -------------- : ----------");
double phase_subtotal = Phase::_t_parser.seconds() +
Phase::_t_optimizer.seconds() + Phase::_t_graphReshaping.seconds() +
Phase::_t_matcher.seconds() + Phase::_t_scheduler.seconds() +
Phase::_t_registerAllocation.seconds() + Phase::_t_blockOrdering.seconds() +
Phase::_t_codeGeneration.seconds() + Phase::_t_registerMethod.seconds();
double percent_of_method_compile = ((phase_subtotal == 0.0) ? 0.0 : phase_subtotal / Phase::_t_methodCompilation.seconds()) * 100.0;
// counters inside Compile::CodeGen include time for adapters and stubs
// so phase-total can be greater than 100%
tty->print_cr (" total : %3.3f sec, %3.2f %%", phase_subtotal, percent_of_method_compile);
tty->print_cr (" Code Emission: %7.3f s", timers[_t_output].seconds());
tty->print_cr (" Insn Scheduling: %7.3f s", timers[_t_instrSched].seconds());
tty->print_cr (" Build OOP maps: %7.3f s", timers[_t_buildOopMaps].seconds());
tty->print_cr (" Code Installation: %7.3f s", timers[_t_registerMethod].seconds());
assert( percent_of_method_compile > expected_method_compile_coverage ||
phase_subtotal < minimum_meaningful_method_compile,
"Must account for method compilation");
if( timers[_t_temporaryTimer1].seconds() > 0 ) {
tty->cr();
tty->print_cr (" Temp Timer 1: %7.3f s", timers[_t_temporaryTimer1].seconds());
}
if( timers[_t_temporaryTimer2].seconds() > 0 ) {
tty->cr();
tty->print_cr (" Temp Timer 2: %7.3f s", timers[_t_temporaryTimer2].seconds());
}
double other = Phase::_t_totalCompilation.seconds() -
(timers[_t_parser].seconds() +
timers[_t_optimizer].seconds() +
timers[_t_matcher].seconds() +
timers[_t_scheduler].seconds() +
timers[_t_registerAllocation].seconds() +
timers[_t_blockOrdering].seconds() +
timers[_t_peephole].seconds() +
timers[_t_postalloc_expand].seconds() +
timers[_t_output].seconds() +
timers[_t_registerMethod].seconds() +
timers[_t_temporaryTimer1].seconds() +
timers[_t_temporaryTimer2].seconds());
if (other > 0) {
tty->print_cr(" Other: %7.3f s", other);
}
if( Phase::_t_temporaryTimer1.seconds() > minimum_reported_time ) {
tty->cr();
tty->print_cr (" temporaryTimer1: %3.3f sec", Phase::_t_temporaryTimer1.seconds());
}
if( Phase::_t_temporaryTimer2.seconds() > minimum_reported_time ) {
tty->cr();
tty->print_cr (" temporaryTimer2: %3.3f sec", Phase::_t_temporaryTimer2.seconds());
}
tty->print_cr (" output : %3.3f sec", Phase::_t_output.seconds());
tty->print_cr (" isched : %3.3f sec", Phase::_t_instrSched.seconds());
tty->print_cr (" bldOopMaps : %3.3f sec", Phase::_t_buildOopMaps.seconds());
}
#endif

@ -60,63 +60,65 @@ public:
Peephole, // Apply peephole optimizations
last_phase
};
enum PhaseTraceId {
_t_parser,
_t_optimizer,
_t_escapeAnalysis,
_t_connectionGraph,
_t_macroEliminate,
_t_iterGVN,
_t_incrInline,
_t_incrInline_ideal,
_t_incrInline_igvn,
_t_incrInline_pru,
_t_incrInline_inline,
_t_idealLoop,
_t_idealLoopVerify,
_t_ccp,
_t_iterGVN2,
_t_macroExpand,
_t_graphReshaping,
_t_matcher,
_t_scheduler,
_t_registerAllocation,
_t_ctorChaitin,
_t_buildIFGvirtual,
_t_buildIFGphysical,
_t_computeLive,
_t_regAllocSplit,
_t_postAllocCopyRemoval,
_t_fixupSpills,
_t_chaitinCompact,
_t_chaitinCoalesce1,
_t_chaitinCoalesce2,
_t_chaitinCoalesce3,
_t_chaitinCacheLRG,
_t_chaitinSimplify,
_t_chaitinSelect,
_t_blockOrdering,
_t_peephole,
_t_postalloc_expand,
_t_output,
_t_instrSched,
_t_buildOopMaps,
_t_registerMethod,
_t_temporaryTimer1,
_t_temporaryTimer2,
max_phase_timers
};
static elapsedTimer timers[max_phase_timers];
protected:
enum PhaseNumber _pnum; // Phase number (for stat gathering)
#ifndef PRODUCT
static int _total_bytes_compiled;
// accumulated timers
static elapsedTimer _t_totalCompilation;
static elapsedTimer _t_methodCompilation;
static elapsedTimer _t_stubCompilation;
#endif
// The next timers used for LogCompilation
static elapsedTimer _t_parser;
static elapsedTimer _t_optimizer;
public:
// ConnectionGraph can't be Phase since it is used after EA done.
static elapsedTimer _t_escapeAnalysis;
static elapsedTimer _t_connectionGraph;
protected:
static elapsedTimer _t_idealLoop;
static elapsedTimer _t_ccp;
static elapsedTimer _t_matcher;
static elapsedTimer _t_registerAllocation;
static elapsedTimer _t_output;
#ifndef PRODUCT
static elapsedTimer _t_graphReshaping;
static elapsedTimer _t_scheduler;
static elapsedTimer _t_blockOrdering;
static elapsedTimer _t_macroEliminate;
static elapsedTimer _t_macroExpand;
static elapsedTimer _t_peephole;
static elapsedTimer _t_postalloc_expand;
static elapsedTimer _t_codeGeneration;
static elapsedTimer _t_registerMethod;
static elapsedTimer _t_temporaryTimer1;
static elapsedTimer _t_temporaryTimer2;
static elapsedTimer _t_idealLoopVerify;
// Subtimers for _t_optimizer
static elapsedTimer _t_iterGVN;
static elapsedTimer _t_iterGVN2;
static elapsedTimer _t_incrInline;
// Subtimers for _t_registerAllocation
static elapsedTimer _t_ctorChaitin;
static elapsedTimer _t_buildIFGphysical;
static elapsedTimer _t_computeLive;
static elapsedTimer _t_regAllocSplit;
static elapsedTimer _t_postAllocCopyRemoval;
static elapsedTimer _t_fixupSpills;
// Subtimers for _t_output
static elapsedTimer _t_instrSched;
static elapsedTimer _t_buildOopMaps;
#endif
// Generate a subtyping check. Takes as input the subtype and supertype.
// Returns 2 values: sets the default control() to the true path and
@ -131,9 +133,7 @@ public:
Compile * C;
Phase( PhaseNumber pnum );
#ifndef PRODUCT
static void print_timers();
#endif
};
#endif // SHARE_VM_OPTO_PHASE_HPP

@ -403,7 +403,7 @@ bool PhaseChaitin::eliminate_copy_of_constant(Node* val, Node* n,
// When we see a use from a reg-reg Copy, we will attempt to use the copy's
// source directly and make the copy go dead.
void PhaseChaitin::post_allocate_copy_removal() {
NOT_PRODUCT( Compile::TracePhase t3("postAllocCopyRemoval", &_t_postAllocCopyRemoval, TimeCompiler); )
Compile::TracePhase tp("postAllocCopyRemoval", &timers[_t_postAllocCopyRemoval]);
ResourceMark rm;
// Need a mapping from basic block Node_Lists. We need a Node_List to

@ -468,7 +468,7 @@ bool PhaseChaitin::prompt_use( Block *b, uint lidx ) {
// Else, hoist LRG back up to register only (ie - split is also DEF)
// We will compute a new maxlrg as we go
uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
NOT_PRODUCT( Compile::TracePhase t3("regAllocSplit", &_t_regAllocSplit, TimeCompiler); )
Compile::TracePhase tp("regAllocSplit", &timers[_t_regAllocSplit]);
// Free thread local resources used by this method on exit.
ResourceMark rm(split_arena);

@ -820,6 +820,33 @@ WB_ENTRY(void, WB_FreeMetaspace(JNIEnv* env, jobject wb, jobject class_loader, j
MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr);
WB_END
WB_ENTRY(jlong, WB_IncMetaspaceCapacityUntilGC(JNIEnv* env, jobject wb, jlong inc))
if (inc < 0) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("WB_IncMetaspaceCapacityUntilGC: inc is negative: " JLONG_FORMAT, inc));
}
jlong max_size_t = (jlong) ((size_t) -1);
if (inc > max_size_t) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("WB_IncMetaspaceCapacityUntilGC: inc does not fit in size_t: " JLONG_FORMAT, inc));
}
size_t new_cap_until_GC = 0;
size_t aligned_inc = align_size_down((size_t) inc, Metaspace::commit_alignment());
bool success = MetaspaceGC::inc_capacity_until_GC(aligned_inc, &new_cap_until_GC);
if (!success) {
THROW_MSG_0(vmSymbols::java_lang_IllegalStateException(),
"WB_IncMetaspaceCapacityUntilGC: could not increase capacity until GC "
"due to contention with another thread");
}
return (jlong) new_cap_until_GC;
WB_END
WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
return (jlong) MetaspaceGC::capacity_until_GC();
WB_END
//Some convenience methods to deal with objects from java
int WhiteBox::offset_for_field(const char* field_name, oop object,
Symbol* signature_symbol) {
@ -991,6 +1018,8 @@ static JNINativeMethod methods[] = {
CC"(Ljava/lang/ClassLoader;J)J", (void*)&WB_AllocateMetaspace },
{CC"freeMetaspace",
CC"(Ljava/lang/ClassLoader;JJ)V", (void*)&WB_FreeMetaspace },
{CC"incMetaspaceCapacityUntilGC", CC"(J)J", (void*)&WB_IncMetaspaceCapacityUntilGC },
{CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC },
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
{CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
(void*)&WB_GetNMethod },

@ -1152,20 +1152,22 @@ void Arguments::set_tiered_flags() {
if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
// Multiply sizes by 5 but fix NonMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
}
// Check consistency of code heap sizes
if ((NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
vm_exit(1);
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
// Multiply sizes by 5 but fix NonNMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
}
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
}
// Check consistency of code heap sizes
if ((NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
vm_exit(1);
}
}
}
if (!UseInterpreter) { // -Xcomp
@ -1690,13 +1692,18 @@ void Arguments::set_g1_gc_flags() {
#ifdef COMPILER1
FastTLABRefill = false;
#endif
FLAG_SET_DEFAULT(ParallelGCThreads,
Abstract_VM_Version::parallel_worker_threads());
FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
if (ParallelGCThreads == 0) {
FLAG_SET_DEFAULT(ParallelGCThreads,
Abstract_VM_Version::parallel_worker_threads());
assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
}
#if INCLUDE_ALL_GCS
if (G1ConcRefinementThreads == 0) {
FLAG_SET_DEFAULT(G1ConcRefinementThreads, ParallelGCThreads);
}
#endif
// MarkStackSize will be set (if it hasn't been set by the user)
// when concurrent marking is initialized.
// Its value will be based upon the number of parallel marking threads.
@ -2502,17 +2509,17 @@ bool Arguments::check_vm_args_consistency() {
"Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
(2*G)/M);
status = false;
} else if (NonMethodCodeHeapSize < min_code_cache_size){
} else if (NonNMethodCodeHeapSize < min_code_cache_size){
jio_fprintf(defaultStream::error_stream(),
"Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonMethodCodeHeapSize/K,
"Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
min_code_cache_size/K);
status = false;
} else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
&& (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
} else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
&& (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
jio_fprintf(defaultStream::error_stream(),
"Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
(NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
status = false;
}
@ -2938,17 +2945,17 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
// -XX:NonMethodCodeHeapSize=
} else if (match_option(option, "-XX:NonMethodCodeHeapSize=", &tail)) {
julong long_NonMethodCodeHeapSize = 0;
// -XX:NonNMethodCodeHeapSize=
} else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
julong long_NonNMethodCodeHeapSize = 0;
ArgsRange errcode = parse_memory_size(tail, &long_NonMethodCodeHeapSize, 1);
ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
if (errcode != arg_in_range) {
jio_fprintf(defaultStream::error_stream(),
"Invalid maximum non-method code heap size: %s.\n", option->optionString);
"Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
return JNI_EINVAL;
}
FLAG_SET_CMDLINE(uintx, NonMethodCodeHeapSize, (uintx)long_NonMethodCodeHeapSize);
FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize);
// -XX:ProfiledCodeHeapSize=
} else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
julong long_ProfiledCodeHeapSize = 0;

@ -188,7 +188,7 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
define_pd_global(intx, ReservedCodeCacheSize, 32*M);
define_pd_global(intx, NonProfiledCodeHeapSize, 0);
define_pd_global(intx, ProfiledCodeHeapSize, 0);
define_pd_global(intx, NonMethodCodeHeapSize, 32*M);
define_pd_global(intx, NonNMethodCodeHeapSize, 32*M);
define_pd_global(intx, CodeCacheExpansionSize, 32*K);
define_pd_global(intx, CodeCacheMinBlockLength, 1);
@ -2487,6 +2487,9 @@ class CommandLineFlags {
product(bool, CITime, false, \
"collect timing information for compilation") \
\
develop(bool, CITimeVerbose, false, \
"be more verbose in compilation timings") \
\
develop(bool, CITimeEach, false, \
"display timing information after each successful compilation") \
\
@ -2574,9 +2577,6 @@ class CommandLineFlags {
product(bool, UseTypeProfile, true, \
"Check interpreter profile for historically monomorphic calls") \
\
notproduct(bool, TimeCompiler, false, \
"Time the compiler") \
\
diagnostic(bool, PrintInlining, false, \
"Print inlining optimizations") \
\
@ -3370,8 +3370,8 @@ class CommandLineFlags {
product_pd(uintx, ProfiledCodeHeapSize, \
"Size of code heap with profiled methods (in bytes)") \
\
product_pd(uintx, NonMethodCodeHeapSize, \
"Size of code heap with non-methods (in bytes)") \
product_pd(uintx, NonNMethodCodeHeapSize, \
"Size of code heap with non-nmethods (in bytes)") \
\
product(uintx, CodeCacheMinimumFreeSpace, 500*K, \
"When less than X space left, we stop compiling") \

@ -272,9 +272,6 @@ void print_statistics() {
print_method_profiling_data();
if (TimeCompiler) {
COMPILER2_PRESENT(Compile::print_timers();)
}
if (TimeCompilationPolicy) {
CompilationPolicy::policy()->print_time();
}

@ -2422,7 +2422,7 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
// Ought to log this but compile log is only per compile thread
// and we're some non descript Java thread.
MutexUnlocker mu(AdapterHandlerLibrary_lock);
CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
return NULL; // Out of CodeCache space
}
entry->relocate(new_adapter->content_begin());

@ -543,6 +543,10 @@ int NMethodSweeper::process_nmethod(nmethod *nm) {
if (PrintMethodFlushing && Verbose) {
tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm);
}
// Clear ICStubs to prevent back patching stubs of zombie or unloaded
// nmethods during the next safepoint (see ICStub::finalize).
MutexLocker cl(CompiledIC_lock);
nm->clear_ic_stubs();
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
_zombified_count++;

@ -140,11 +140,6 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
return NULL;
}
// Check malloc size, size has to <= MAX_MALLOC_SIZE. This is only possible on 32-bit
// systems, when malloc size >= 1GB, but is is safe to assume it won't happen.
if (size > MAX_MALLOC_SIZE) {
fatal("Should not use malloc for big memory block, use virtual memory instead");
}
// Uses placement global new operator to initialize malloc header
switch(level) {
case NMT_off:
@ -154,10 +149,12 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
break;
}
case NMT_summary: {
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
header = ::new (malloc_base) MallocHeader(size, flags);
break;
}
case NMT_detail: {
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
header = ::new (malloc_base) MallocHeader(size, flags, stack);
break;
}

@ -342,9 +342,9 @@ bool BitMap::set_union_with_result(BitMap other) {
bm_word_t* other_map = other.map();
idx_t size = size_in_words();
for (idx_t index = 0; index < size; index++) {
idx_t temp = map(index) | other_map[index];
changed = changed || (temp != map(index));
map()[index] = temp;
idx_t temp = dest_map[index] | other_map[index];
changed = changed || (temp != dest_map[index]);
dest_map[index] = temp;
}
return changed;
}
@ -407,10 +407,10 @@ bool BitMap::is_full() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
if (*word != (bm_word_t) AllBits) return false;
if (*word != ~(bm_word_t)0) return false;
word++;
}
return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits;
return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0;
}
@ -418,10 +418,10 @@ bool BitMap::is_empty() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
if (*word != (bm_word_t) NoBits) return false;
if (*word != 0) return false;
word++;
}
return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits;
return rest == 0 || (*word & right_n_bits((int)rest)) == 0;
}
void BitMap::clear_large() {
@ -441,7 +441,7 @@ bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) {
offset < rightOffset && index < endIndex;
offset = (++index) << LogBitsPerWord) {
idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) {
for (; offset < rightOffset && rest != 0; offset++) {
if (rest & 1) {
if (!blk->do_bit(offset)) return false;
// resample at each closure application
@ -468,7 +468,7 @@ void BitMap::init_pop_count_table() {
(intptr_t) NULL_WORD);
if (res != NULL_WORD) {
guarantee( _pop_count_table == (void*) res, "invariant" );
FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal);
FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
}
}
}

@ -80,7 +80,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
// Set a word to a specified value or to all ones; clear a word.
void set_word (idx_t word, bm_word_t val) { _map[word] = val; }
void set_word (idx_t word) { set_word(word, ~(uintptr_t)0); }
void set_word (idx_t word) { set_word(word, ~(bm_word_t)0); }
void clear_word(idx_t word) { _map[word] = 0; }
// Utilities for ranges of bits. Ranges are half-open [beg, end).

@ -130,7 +130,7 @@ inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) {
inline void BitMap::set_range_of_words(idx_t beg, idx_t end) {
bm_word_t* map = _map;
for (idx_t i = beg; i < end; ++i) map[i] = ~(uintptr_t)0;
for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0;
}
@ -172,8 +172,8 @@ BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const {
// check bits including and to the _left_ of offset's position
idx_t pos = bit_in_word(res_offset);
idx_t res = map(index) >> pos;
if (res != (uintptr_t)NoBits) {
bm_word_t res = map(index) >> pos;
if (res != 0) {
// find the position of the 1-bit
for (; !(res & 1); res_offset++) {
res = res >> 1;
@ -207,7 +207,7 @@ BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const {
// skip over all word length 0-bit runs
for (index++; index < r_index; index++) {
res = map(index);
if (res != (uintptr_t)NoBits) {
if (res != 0) {
// found a 1, return the offset
for (res_offset = bit_index(index); !(res & 1); res_offset++) {
res = res >> 1;
@ -235,9 +235,9 @@ BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const {
// check bits including and to the _left_ of offset's position
idx_t pos = res_offset & (BitsPerWord - 1);
idx_t res = (map(index) >> pos) | left_n_bits((int)pos);
bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos);
if (res != (uintptr_t)AllBits) {
if (res != ~(bm_word_t)0) {
// find the position of the 0-bit
for (; res & 1; res_offset++) {
res = res >> 1;
@ -248,7 +248,7 @@ BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const {
// skip over all word length 1-bit runs
for (index++; index < r_index; index++) {
res = map(index);
if (res != (uintptr_t)AllBits) {
if (res != ~(bm_word_t)0) {
// found a 0, return the offset
for (res_offset = index << LogBitsPerWord; res & 1;
res_offset++) {
@ -277,8 +277,8 @@ BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset,
idx_t res_offset = l_offset;
// check bits including and to the _left_ of offset's position
idx_t res = map(index) >> bit_in_word(res_offset);
if (res != (uintptr_t)NoBits) {
bm_word_t res = map(index) >> bit_in_word(res_offset);
if (res != 0) {
// find the position of the 1-bit
for (; !(res & 1); res_offset++) {
res = res >> 1;
@ -290,7 +290,7 @@ BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset,
// skip over all word length 0-bit runs
for (index++; index < r_index; index++) {
res = map(index);
if (res != (uintptr_t)NoBits) {
if (res != 0) {
// found a 1, return the offset
for (res_offset = bit_index(index); !(res & 1); res_offset++) {
res = res >> 1;
@ -321,11 +321,11 @@ BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const {
}
inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t));
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t));
}
inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t));
memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
}
inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const {

@ -259,8 +259,8 @@ ifdef CONCURRENCY
EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
endif
# Default JTREG to run (win32 script works for everybody)
JTREG = $(JT_HOME)/win32/bin/jtreg
# Default JTREG to run
JTREG = $(JT_HOME)/bin/jtreg
# Only run automatic tests
JTREG_BASIC_OPTIONS += -a
@ -321,6 +321,17 @@ PHONY_LIST += hotspot_clienttest clienttest
################################################################
# minimaltest (make sure various basic java minimal options work)
hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME)
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
PHONY_LIST += hotspot_minimaltest minimaltest
################################################################
# servertest (make sure various basic java server options work)
hotspot_servertest servertest: prep $(PRODUCT_HOME)

@ -61,7 +61,6 @@ jdk = \
# can be resolved in some cases by using tools from the compile-jdk.
#
needs_jdk = \
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \
gc/metaspace/TestMetaspacePerfCounters.java \
gc/metaspace/TestPerfCountersAndMemoryPools.java \
@ -134,6 +133,13 @@ needs_compact3 = \
gc/metaspace/TestMetaspaceMemoryPool.java \
gc/arguments/TestDynMinHeapFreeRatio.java \
gc/arguments/TestDynMaxHeapFreeRatio.java \
gc/g1/TestShrinkAuxiliaryData00.java \
gc/g1/TestShrinkAuxiliaryData05.java \
gc/g1/TestShrinkAuxiliaryData10.java \
gc/g1/TestShrinkAuxiliaryData15.java \
gc/g1/TestShrinkAuxiliaryData20.java \
gc/g1/TestShrinkAuxiliaryData25.java \
gc/g1/TestShrinkAuxiliaryData30.java \
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
serviceability/threads/TestFalseDeadLock.java \
@ -198,7 +204,6 @@ needs_compact2 =
compact1_minimal = \
serviceability/ \
compiler/ \
testlibrary/ \
testlibrary_tests/ \
sanity/ \
runtime/ \
@ -214,14 +219,13 @@ compact1_minimal = \
#
needs_g1gc = \
compiler/regalloc/C1ObjectSpillInLogicOp.java \
gc/8000311/Test8000311.java \
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
gc/TestSystemGC.java \
gc/arguments/TestAlignmentToUseLargePages.java \
gc/arguments/TestG1HeapRegionSize.java \
gc/arguments/TestG1HeapSizeFlags.java \
gc/arguments/TestMaxHeapSizeTools.java \
gc/arguments/TestMaxNewSize.java \
gc/arguments/TestParallelGCThreads.java \
gc/arguments/TestUseCompressedOopsErgo.java \
gc/class_unloading/TestG1ClassUnloadingHWM.java \
gc/g1/ \
@ -249,6 +253,7 @@ needs_parallelgc = \
gc/arguments/TestAlignmentToUseLargePages.java \
gc/arguments/TestMaxNewSize.java \
gc/arguments/TestMinInitialErgonomics.java \
gc/arguments/TestParallelGCThreads.java \
gc/arguments/TestUseCompressedOopsErgo.java \
gc/metaspace/TestMetaspacePerfCounters.java \
gc/parallelScavenge/ \
@ -263,6 +268,7 @@ needs_cmsgc = \
gc/arguments/TestAlignmentToUseLargePages.java \
gc/arguments/TestCMSHeapSizeFlags.java \
gc/arguments/TestMaxNewSize.java \
gc/arguments/TestParallelGCThreads.java \
gc/arguments/TestUseCompressedOopsErgo.java \
gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
gc/concurrentMarkSweep/ \
@ -490,6 +496,7 @@ hotspot_compiler_3 = \
compiler/uncommontrap/TestStackBangMonitorOwned.java \
compiler/uncommontrap/TestStackBangRbp.java \
compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
hotspot_compiler_closed = \
closed/compiler/4292742/Test.java \
@ -584,7 +591,8 @@ hotspot_runtime_closed = \
sanity/ExecuteInternalVMTests.java
hotspot_serviceability = \
sanity/ExecuteInternalVMTests.java
sanity/ExecuteInternalVMTests.java \
serviceability/dcmd/compiler
hotspot_all = \
:hotspot_compiler_1 \

@ -25,7 +25,7 @@
* @test TestIntegerComparison
* @bug 8043284 8042786
* @summary "Tests optimizations of signed and unsigned integer comparison."
* @run main/othervm -server -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
* @run main/othervm -Xcomp -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
*/
public class TestIntegerComparison {
/**

@ -32,7 +32,7 @@ import com.oracle.java.testlibrary.*;
*/
public class CheckSegmentedCodeCache {
// Code heap names
private static final String NON_METHOD = "CodeHeap 'non-methods'";
private static final String NON_METHOD = "CodeHeap 'non-nmethods'";
private static final String PROFILED = "CodeHeap 'profiled nmethods'";
private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'";
@ -40,7 +40,7 @@ public class CheckSegmentedCodeCache {
OutputAnalyzer out = new OutputAnalyzer(pb.start());
if (enabled) {
try {
// Non-method code heap should be always available with the segmented code cache
// Non-nmethod code heap should be always available with the segmented code cache
out.shouldContain(NON_METHOD);
} catch (RuntimeException e) {
// TieredCompilation is disabled in a client VM
@ -111,14 +111,14 @@ public class CheckSegmentedCodeCache {
"-XX:+PrintCodeCache", "-version");
verifyCodeHeapNotExists(pb, PROFILED);
// Fails with too small non-method code heap size
pb = ProcessTools.createJavaProcessBuilder("-XX:NonMethodCodeHeapSize=100K");
failsWith(pb, "Invalid NonMethodCodeHeapSize");
// Fails with too small non-nmethod code heap size
pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K");
failsWith(pb, "Invalid NonNMethodCodeHeapSize");
// Fails if code heap sizes do not add up
pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
"-XX:ReservedCodeCacheSize=10M",
"-XX:NonMethodCodeHeapSize=5M",
"-XX:NonNMethodCodeHeapSize=5M",
"-XX:ProfiledCodeHeapSize=5M",
"-XX:NonProfiledCodeHeapSize=5M");
failsWith(pb, "Invalid code heap sizes");
@ -127,6 +127,6 @@ public class CheckSegmentedCodeCache {
pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
"-XX:ReservedCodeCacheSize=1700K",
"-XX:InitialCodeCacheSize=100K");
failsWith(pb, "Not enough space in non-method code heap to run VM");
failsWith(pb, "Not enough space in non-nmethod code heap to run VM");
}
}

@ -25,7 +25,7 @@
* @test
* @bug 8032207
* @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI
* @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
* @run main/othervm -Xbatch -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
*
*/
public class LoadWithMask {

@ -25,7 +25,7 @@
* @test
* @bug 8031743
* @summary loadI2L_immI broken for negative memory values
* @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
* @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
*
*/
public class LoadWithMask2 {

@ -0,0 +1,62 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8059556
* @run main/othervm -Xbatch NullConstantReceiver
*/
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public class NullConstantReceiver {
static final MethodHandle target;
static {
try {
target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
public void test() {}
static void run() throws Throwable {
target.invokeExact((NullConstantReceiver) null);
}
public static void main(String[] args) throws Throwable {
for (int i = 0; i<15000; i++) {
try {
run();
} catch (NullPointerException e) {
// expected
continue;
}
throw new AssertionError("NPE wasn't thrown");
}
System.out.println("TEST PASSED");
}
}

@ -0,0 +1,125 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8058828
* @run main/bootclasspath -Xbatch VMAnonymousClasses
*/
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import sun.misc.Unsafe;
import java.lang.invoke.ConstantCallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;
import java.lang.invoke.VolatileCallSite;
public class VMAnonymousClasses {
static final String TEST_METHOD_NAME = "constant";
static final Unsafe UNSAFE = Unsafe.getUnsafe();
static int getConstantPoolSize(byte[] classFile) {
// The first few bytes:
// u4 magic;
// u2 minor_version;
// u2 major_version;
// u2 constant_pool_count;
return ((classFile[8] & 0xFF) << 8) | (classFile[9] & 0xFF);
}
static void test(Object value) throws ReflectiveOperationException {
System.out.printf("Test: %s", value != null ? value.getClass() : "null");
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, "Test", null, "java/lang/Object", null);
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, TEST_METHOD_NAME, "()Ljava/lang/Object;", null, null);
String placeholder = "CONSTANT";
int index = cw.newConst(placeholder);
mv.visitLdcInsn(placeholder);
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
byte[] classFile = cw.toByteArray();
Object[] cpPatches = new Object[getConstantPoolSize(classFile)];
cpPatches[index] = value;
Class<?> test = UNSAFE.defineAnonymousClass(VMAnonymousClasses.class, classFile, cpPatches);
Object expectedResult = (value != null) ? value : placeholder;
for (int i = 0; i<15000; i++) {
Object result = test.getMethod(TEST_METHOD_NAME).invoke(null);
if (result != expectedResult) {
throw new AssertionError(String.format("Wrong value returned: %s != %s", value, result));
}
}
System.out.println(" PASSED");
}
public static void main(String[] args) throws ReflectiveOperationException {
// Objects
test(new Object());
test("TEST");
test(new VMAnonymousClasses());
test(null);
// Class
test(String.class);
// Arrays
test(new boolean[0]);
test(new byte[0]);
test(new char[0]);
test(new short[0]);
test(new int[0]);
test(new long[0]);
test(new float[0]);
test(new double[0]);
test(new Object[0]);
// Multi-dimensional arrays
test(new byte[0][0]);
test(new Object[0][0]);
// MethodHandle-related
MethodType mt = MethodType.methodType(void.class, String[].class);
MethodHandle mh = MethodHandles.lookup().findStatic(VMAnonymousClasses.class, "main", mt);
test(mt);
test(mh);
test(new ConstantCallSite(mh));
test(new MutableCallSite(MethodType.methodType(void.class)));
test(new VolatileCallSite(MethodType.methodType(void.class)));
System.out.println("TEST PASSED");
}
}

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableBoolean$DefaultStaticValue
* java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableBoolean
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableByte$DefaultStaticValue
* java/lang/invoke/TestStableByte$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableByte
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableChar$DefaultStaticValue
* java/lang/invoke/TestStableChar$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableChar
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableDouble$DefaultStaticValue
* java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableDouble
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableFloat$DefaultStaticValue
* java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableFloat
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableInt$DefaultStaticValue
* java/lang/invoke/TestStableInt$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableInt
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableLong$DefaultStaticValue
* java/lang/invoke/TestStableLong$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableLong
*/
package java.lang.invoke;

@ -54,44 +54,32 @@
* java/lang/invoke/TestStableObject$DefaultStaticValue
* java/lang/invoke/TestStableObject$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableObject
*/
package java.lang.invoke;

@ -53,44 +53,32 @@
* java/lang/invoke/TestStableShort$DefaultStaticValue
* java/lang/invoke/TestStableShort$ObjectArrayLowerDim2
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:-TieredCompilation
* -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
*
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:+FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
* @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
* -client -XX:-TieredCompilation
* -XX:-FoldStableValues
* -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
* java.lang.invoke.TestStableShort
*/
package java.lang.invoke;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,9 +27,7 @@
* @bug 8026775
* @summary Uncommon trap blob did not bang all the stack shadow pages
*
* @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation UncommonTrapStackBang
* @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation UncommonTrapStackBang
*
* @run main/othervm UncommonTrapStackBang
*
* Note: This test does not reproduce the problem with absolute
* certainty. Empirically the bug reproduces on Windows some 80+% of

@ -0,0 +1,97 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestG1ConcRefinementThreads
* @key gc
* @bug 8047976
* @summary Tests argument processing for G1ConcRefinementThreads
* @library /testlibrary
*/
import com.oracle.java.testlibrary.*;
import java.util.*;
import java.util.regex.*;
public class TestG1ConcRefinementThreads {
static final int AUTO_SELECT_THREADS_COUNT = 0;
static final int PASSED_THREADS_COUNT = 11;
public static void main(String args[]) throws Exception {
// default case
runG1ConcRefinementThreadsTest(
new String[]{}, // automatically selected
AUTO_SELECT_THREADS_COUNT /* use default setting */);
// zero setting case
runG1ConcRefinementThreadsTest(
new String[]{"-XX:G1ConcRefinementThreads=0"}, // automatically selected
AUTO_SELECT_THREADS_COUNT /* set to zero */);
// non-zero sestting case
runG1ConcRefinementThreadsTest(
new String[]{"-XX:G1ConcRefinementThreads="+Integer.toString(PASSED_THREADS_COUNT)},
PASSED_THREADS_COUNT);
}
private static void runG1ConcRefinementThreadsTest(String[] passedOpts,
int expectedValue) throws Exception {
List<String> vmOpts = new ArrayList<>();
if (passedOpts.length > 0) {
Collections.addAll(vmOpts, passedOpts);
}
Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
String stdout = output.getStdout();
checkG1ConcRefinementThreadsConsistency(stdout, expectedValue);
}
private static void checkG1ConcRefinementThreadsConsistency(String output, int expectedValue) {
int actualValue = getIntValue("G1ConcRefinementThreads", output);
if (expectedValue == 0) {
// If expectedValue is automatically selected, set it same as ParallelGCThreads.
expectedValue = getIntValue("ParallelGCThreads", output);
}
if (expectedValue != actualValue) {
throw new RuntimeException(
"Actual G1ConcRefinementThreads(" + Integer.toString(actualValue)
+ ") is not equal to expected value(" + Integer.toString(expectedValue) + ")");
}
}
public static int getIntValue(String flag, String where) {
Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
if (!m.find()) {
throw new RuntimeException("Could not find value for flag " + flag + " in output string");
}
String match = m.group();
return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
}
}

@ -0,0 +1,64 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test TestParallelGCThreads
* @key gc
* @bug 8059527
* @summary Tests argument processing for ParallelGCThreads
* @library /testlibrary
* @run driver TestParallelGCThreads
*/
import com.oracle.java.testlibrary.*;
public class TestParallelGCThreads {
public static void main(String args[]) throws Exception {
// For each parallel collector (G1, Parallel, ParNew/CMS)
for (String gc : new String[] {"G1", "Parallel", "ConcMarkSweep"}) {
// Make sure the VM does not allow ParallelGCThreads set to 0
String[] flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=0", "-XX:+PrintFlagsFinal", "-version"};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(1);
// Do some basic testing to ensure the flag updates the count
for (long i = 1; i <= 3; i++) {
flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=" + i, "-XX:+PrintFlagsFinal", "-version"};
long count = getParallelGCThreadCount(flags);
Asserts.assertEQ(count, i, "Specifying ParallelGCThreads=" + i + " for " + gc + "GC does not set the thread count properly!");
}
}
}
public static long getParallelGCThreadCount(String flags[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
String stdout = output.getStdout();
return FlagsValue.getFlagLongValue("ParallelGCThreads", stdout);
}
}

@ -0,0 +1,286 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import static com.oracle.java.testlibrary.Asserts.assertLessThanOrEqual;
import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.Platform;
import com.oracle.java.testlibrary.ProcessTools;
import com.oracle.java.testlibrary.Utils;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import sun.misc.Unsafe;
public class TestShrinkAuxiliaryData {
private final static String[] initialOpts = new String[]{
"-XX:MinHeapFreeRatio=10",
"-XX:MaxHeapFreeRatio=11",
"-XX:+UseG1GC",
"-XX:G1HeapRegionSize=1m",
"-XX:+PrintGCDetails"
};
private final int RSetCacheSize;
protected TestShrinkAuxiliaryData(int RSetCacheSize) {
this.RSetCacheSize = RSetCacheSize;
}
protected void test() throws Exception {
ArrayList<String> vmOpts = new ArrayList();
Collections.addAll(vmOpts, initialOpts);
int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
if (maxCacheSize < RSetCacheSize) {
System.out.format("Skiping test for %d cache size due max cache size %d",
RSetCacheSize, maxCacheSize
);
return;
}
printTestInfo(maxCacheSize);
vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(
ShrinkAuxiliaryDataTest.prohibitedVmOptions)));
// for 32 bits ObjectAlignmentInBytes is not a option
if (Platform.is32bit()) {
ArrayList<String> vmOptsWithoutAlign = new ArrayList(vmOpts);
vmOptsWithoutAlign.add(ShrinkAuxiliaryDataTest.class.getName());
performTest(vmOptsWithoutAlign);
return;
}
for (int alignment = 3; alignment <= 8; alignment++) {
ArrayList<String> vmOptsWithAlign = new ArrayList(vmOpts);
vmOptsWithAlign.add("-XX:ObjectAlignmentInBytes="
+ (int) Math.pow(2, alignment));
vmOptsWithAlign.add(ShrinkAuxiliaryDataTest.class.getName());
performTest(vmOptsWithAlign);
}
}
private void performTest(List<String> opts) throws Exception {
ProcessBuilder pb
= ProcessTools.createJavaProcessBuilder(
opts.toArray(new String[opts.size()])
);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
}
private void printTestInfo(int maxCacheSize) {
DecimalFormat grouped = new DecimalFormat("000,000");
DecimalFormatSymbols formatSymbols = grouped.getDecimalFormatSymbols();
formatSymbols.setGroupingSeparator(' ');
grouped.setDecimalFormatSymbols(formatSymbols);
System.out.format("Test will use %s bytes of memory of %s available%n"
+ "Available memory is %s with %d bytes pointer size - can save %s pointers%n"
+ "Max cache size: 2^%d = %s elements%n",
grouped.format(ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
grouped.format(Runtime.getRuntime().freeMemory()),
grouped.format(Runtime.getRuntime().freeMemory()
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
Unsafe.ADDRESS_SIZE,
grouped.format((Runtime.getRuntime().freeMemory()
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest())
/ Unsafe.ADDRESS_SIZE),
maxCacheSize,
grouped.format((int) Math.pow(2, maxCacheSize))
);
}
/**
* Detects maximum possible size of G1ConcRSLogCacheSize available for
* current process based on maximum available process memory size
*
* @return power of two
*/
private static int getMaxCacheSize() {
long availableMemory = Runtime.getRuntime().freeMemory()
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest() - 1l;
if (availableMemory <= 0) {
return 0;
}
long availablePointersCount = availableMemory / Unsafe.ADDRESS_SIZE;
return (63 - (int) Long.numberOfLeadingZeros(availablePointersCount));
}
static class ShrinkAuxiliaryDataTest {
public static void main(String[] args) throws IOException {
int iterateCount = DEFAULT_ITERATION_COUNT;
if (args.length > 0) {
try {
iterateCount = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
//num_iterate remains default
}
}
new ShrinkAuxiliaryDataTest().test(iterateCount);
}
class GarbageObject {
private final List<byte[]> payload = new ArrayList();
private final List<GarbageObject> ref = new LinkedList();
public GarbageObject(int size) {
payload.add(new byte[size]);
}
public void addRef(GarbageObject g) {
ref.add(g);
}
public void mutate() {
if (!payload.isEmpty() && payload.get(0).length > 0) {
payload.get(0)[0] = (byte) (Math.random() * Byte.MAX_VALUE);
}
}
}
private final List<GarbageObject> garbage = new ArrayList();
public void test(int num_iterate) throws IOException {
allocate();
link();
mutate();
deallocate();
MemoryUsage muBeforeHeap
= ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
MemoryUsage muBeforeNonHeap
= ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
for (int i = 0; i < num_iterate; i++) {
allocate();
link();
mutate();
deallocate();
}
System.gc();
MemoryUsage muAfterHeap
= ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
MemoryUsage muAfterNonHeap
= ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
assertLessThanOrEqual(muAfterHeap.getCommitted(), muBeforeHeap.getCommitted(),
String.format("heap decommit failed - after > before: %d > %d",
muAfterHeap.getCommitted(), muBeforeHeap.getCommitted()
)
);
if (muAfterHeap.getCommitted() < muBeforeHeap.getCommitted()) {
assertLessThanOrEqual(muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted(),
String.format("non-heap decommit failed - after > before: %d > %d",
muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted()
)
);
}
}
private void allocate() {
for (int r = 0; r < REGIONS_TO_ALLOCATE; r++) {
for (int i = 0; i < NUM_OBJECTS_PER_REGION; i++) {
GarbageObject g = new GarbageObject(REGION_SIZE
/ NUM_OBJECTS_PER_REGION);
garbage.add(g);
}
}
}
/**
* Iterate through all allocated objects, and link to objects in another
* regions
*/
private void link() {
for (int ig = 0; ig < garbage.size(); ig++) {
int regionNumber = ig / NUM_OBJECTS_PER_REGION;
for (int i = 0; i < NUM_LINKS; i++) {
int regionToLink;
do {
regionToLink = (int) (Math.random()
* REGIONS_TO_ALLOCATE);
} while (regionToLink == regionNumber);
// get random garbage object from random region
garbage.get(ig).addRef(garbage.get(regionToLink
* NUM_OBJECTS_PER_REGION + (int) (Math.random()
* NUM_OBJECTS_PER_REGION)));
}
}
}
private void mutate() {
for (int ig = 0; ig < garbage.size(); ig++) {
garbage.get(ig).mutate();
}
}
private void deallocate() {
garbage.clear();
System.gc();
}
static long getMemoryUsedByTest() {
return REGIONS_TO_ALLOCATE * REGION_SIZE;
}
private static final int REGION_SIZE = 1024 * 1024;
private static final int DEFAULT_ITERATION_COUNT = 1; // iterate main scenario
private static final int REGIONS_TO_ALLOCATE = 5;
private static final int NUM_OBJECTS_PER_REGION = 10;
private static final int NUM_LINKS = 20; // how many links create for each object
private static final String[] prohibitedVmOptions = {
// remove this when @requires option will be on duty
"-XX:\\+UseParallelGC",
"-XX:\\+UseSerialGC",
"-XX:\\+UseConcMarkSweepGC",
"-XX:\\+UseParallelOldGC",
"-XX:\\+UseParNewGC",
"-Xconcgc",
"-Xincgc"
};
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,21 +22,17 @@
*/
/**
* @test Test8000311
* @key gc
* @bug 8000311
* @summary G1: ParallelGCThreads==0 broken
* @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311
* @author filipp.zhinkin@oracle.com
* @test TestShrinkAuxiliaryData00
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
* @run driver/timeout=720 TestShrinkAuxiliaryData00
*/
public class TestShrinkAuxiliaryData00 {
import java.util.*;
public class Test8000311 {
public static void main(String args[]) {
for(int i = 0; i<100; i++) {
byte[] garbage = new byte[1000];
System.gc();
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(0).test();
}
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData05
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
* @run driver/timeout=720 TestShrinkAuxiliaryData05
*/
public class TestShrinkAuxiliaryData05 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(5).test();
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData10
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
* @run driver/timeout=720 TestShrinkAuxiliaryData10
*/
public class TestShrinkAuxiliaryData10 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(10).test();
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData15
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
* @run driver/timeout=720 TestShrinkAuxiliaryData15
*/
public class TestShrinkAuxiliaryData15 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(15).test();
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData20
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
* @run driver/timeout=720 TestShrinkAuxiliaryData20
*/
public class TestShrinkAuxiliaryData20 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(20).test();
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData25
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
* @run driver/timeout=720 TestShrinkAuxiliaryData25
*/
public class TestShrinkAuxiliaryData25 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(25).test();
}
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestShrinkAuxiliaryData30
* @bug 8038423
* @summary Checks that decommitment occurs for JVM with different
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
* @library /testlibrary /testlibrary/whitebox
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
* @run driver/timeout=720 TestShrinkAuxiliaryData30
*/
public class TestShrinkAuxiliaryData30 {
public static void main(String[] args) throws Exception {
new TestShrinkAuxiliaryData(30).test();
}
}

@ -0,0 +1,59 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @key gc
* @bug 8049831
* @library /testlibrary /testlibrary/whitebox
* @build TestCapacityUntilGCWrapAround
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCapacityUntilGCWrapAround
*/
import sun.hotspot.WhiteBox;
import com.oracle.java.testlibrary.Asserts;
import com.oracle.java.testlibrary.Platform;
public class TestCapacityUntilGCWrapAround {
private static long MB = 1024 * 1024;
private static long GB = 1024 * MB;
private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms
public static void main(String[] args) {
if (Platform.is32bit()) {
WhiteBox wb = WhiteBox.getWhiteBox();
long before = wb.metaspaceCapacityUntilGC();
// Now force possible overflow of capacity_until_GC.
long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT);
Asserts.assertGTE(after, before,
"Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before);
Asserts.assertLTE(after, MAX_UINT,
"Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after);
}
}
}

@ -0,0 +1,45 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @key regression
* @bug 8058927
* @summary Make sure array class has the right class loader
* @run main ShowClassLoader
*/
public class ShowClassLoader {
public static void main(String[] args) {
Object[] oa = new Object[0];
ShowClassLoader[] sa = new ShowClassLoader[0];
System.out.println("Classloader for Object[] is " + oa.getClass().getClassLoader());
System.out.println("Classloader for SCL[] is " + sa.getClass().getClassLoader() );
if (sa.getClass().getClassLoader() == null) {
throw new RuntimeException("Wrong class loader");
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -21,34 +21,34 @@
* questions.
*/
/* @test TestG1ZeroPGCTJcmdThreadPrint
* @key gc
* @bug 8005875
* @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875
/*
* @test
* @bug 8058818
* @library /testlibrary
* @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint
* @build UnsafeMallocLimit2
* @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2
*/
import com.oracle.java.testlibrary.*;
import sun.misc.Unsafe;
public class TestG1ZeroPGCTJcmdThreadPrint {
public static void main(String args[]) throws Exception {
public class UnsafeMallocLimit2 {
// Grab the pid from the current java process
String pid = Integer.toString(ProcessTools.getProcessId());
// Create a ProcessBuilder
ProcessBuilder pb = new ProcessBuilder();
// Run jcmd <pid> Thread.print
pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
// There shouldn't be a work gang for concurrent marking.
output.shouldNotContain("G1 Parallel Marking Threads");
// Make sure we didn't crash
output.shouldHaveExitValue(0);
}
public static void main(String args[]) throws Exception {
if (Platform.is32bit()) {
Unsafe unsafe = Utils.getUnsafe();
try {
// Allocate greater than MALLOC_MAX and likely won't fail to allocate,
// so it hits the NMT code that asserted.
// Test that this doesn't cause an assertion with NMT off.
// The option above overrides if all the tests are run with NMT on.
unsafe.allocateMemory(0x40000000);
System.out.println("Allocation succeeded");
} catch (OutOfMemoryError e) {
System.out.println("Allocation failed");
}
} else {
System.out.println("Test only valid on 32-bit platforms");
}
}
}

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