This commit is contained in:
Jesper Wilhelmsson 2018-07-14 02:14:54 +02:00
commit 4fc510cc89
101 changed files with 777 additions and 346 deletions

View File

@ -495,4 +495,5 @@ e1b3def126240d5433902f3cb0e91a4c27f6db50 jdk-11+18
9816d7cc655e53ba081f938b656e31971b8f097a jdk-11+20
14708e1acdc3974f4539027cbbcfa6d69f83cf51 jdk-11+21
00b16d0457e43d23f6ca5ade6b243edce62750a0 jdk-12+1
9937ef7499dcd7673714517fd5e450410c14ba4e jdk-11+22
69b438908512d3dfef5852c6a843a5778333a309 jdk-12+2

View File

@ -500,7 +500,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
# Enable features depending on variant.
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_minimal="compiler1 minimal serialgc $JVM_FEATURES $JVM_FEATURES_link_time_opt"
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"

View File

@ -1015,7 +1015,7 @@ ExecuteWithLog = \
$(call LogCmdlines, Exececuting: [$(strip $2)]) \
$(call MakeDir, $(dir $(strip $1))) \
$(call WriteFile, $2, $(strip $1).cmdline) \
( $(strip $2) > >($(TEE) $(strip $1).log) 2> >($(TEE) $(strip $1).log >&2) || \
( $(RM) $(strip $1).log && $(strip $2) > >($(TEE) -a $(strip $1).log) 2> >($(TEE) -a $(strip $1).log >&2) || \
( exitcode=$(DOLLAR)? && \
$(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).log && \
$(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(OUTPUTDIR)/%,%,$(strip $1))).cmdline && \

View File

@ -27,7 +27,7 @@
# Build tools needed for the JFR source code generation
JFR_TOOLS_SRCDIR := $(TOPDIR)/make/src/classes
JFR_TOOLS_OUTPUTDIR := $(OUTPUTDIR)/buildtools/tools_classes
JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/buildtools/tools_classes
$(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
JAVAC := $(JAVAC), \

View File

@ -470,8 +470,8 @@ int VM_Version_Ext::cpu_extended_brand_string(char* const buf, size_t buf_len) {
}
size_t VM_Version_Ext::cpu_write_support_string(char* const buf, size_t buf_len) {
assert(buf != NULL, "buffer is NULL!");
assert(buf_len > 0, "buffer len not enough!");
guarantee(buf != NULL, "buffer is NULL!");
guarantee(buf_len > 0, "buffer len not enough!");
unsigned int flag = 0;
unsigned int fi = 0;
@ -481,8 +481,7 @@ size_t VM_Version_Ext::cpu_write_support_string(char* const buf, size_t buf_len)
#define WRITE_TO_BUF(string) \
{ \
int res = jio_snprintf(&buf[written], buf_len - written, "%s%s", prefix, string); \
if (res < 0 || (size_t) res >= buf_len - 1) { \
buf[buf_len-1] = '\0'; \
if (res < 0) { \
return buf_len - 1; \
} \
written += res; \
@ -592,7 +591,7 @@ int VM_Version_Ext::cpu_detailed_description(char* const buf, size_t buf_len) {
_cpuid_info.ext_cpuid1_edx);
if (outputLen < 0 || (size_t) outputLen >= buf_len - 1) {
buf[buf_len-1] = '\0';
if (buf_len > 0) { buf[buf_len-1] = '\0'; }
return OS_ERR;
}

View File

@ -63,6 +63,7 @@ class VM_Version_Ext : public VM_Version {
static bool cpu_is_em64t(void);
static bool is_netburst(void);
// Returns bytes written excluding termninating null byte.
static size_t cpu_write_support_string(char* const buf, size_t buf_len);
static void resolve_cpu_information_details(void);
static jlong max_qualified_cpu_freq_from_brand_string(void);

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@ -1444,6 +1444,7 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) {
case Op_CMoveVF:
if (vlen != 8)
ret_value = false;
break;
case Op_CMoveVD:
if (vlen != 4)
ret_value = false;

View File

@ -2093,7 +2093,9 @@ void os::get_summary_os_info(char* buf, size_t buflen) {
// special case for debian
if (file_exists("/etc/debian_version")) {
strncpy(buf, "Debian ", buflen);
parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
if (buflen > 7) {
parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
}
} else {
strncpy(buf, "Linux", buflen);
}
@ -2805,8 +2807,8 @@ int os::numa_get_group_id() {
}
int os::Linux::get_existing_num_nodes() {
size_t node;
size_t highest_node_number = Linux::numa_max_node();
int node;
int highest_node_number = Linux::numa_max_node();
int num_nodes = 0;
// Get the total number of nodes in the system including nodes without memory.
@ -2819,14 +2821,14 @@ int os::Linux::get_existing_num_nodes() {
}
size_t os::numa_get_leaf_groups(int *ids, size_t size) {
size_t highest_node_number = Linux::numa_max_node();
int highest_node_number = Linux::numa_max_node();
size_t i = 0;
// Map all node ids in which is possible to allocate memory. Also nodes are
// Map all node ids in which it is possible to allocate memory. Also nodes are
// not always consecutively available, i.e. available from 0 to the highest
// node number.
for (size_t node = 0; node <= highest_node_number; node++) {
if (Linux::isnode_in_configured_nodes(node)) {
for (int node = 0; node <= highest_node_number; node++) {
if (Linux::isnode_in_configured_nodes((unsigned int)node)) {
ids[i++] = node;
}
}

View File

@ -534,15 +534,14 @@ static char* get_user_name_slow(int vmid, int nspid, TRAPS) {
// directory search
char* oldest_user = NULL;
time_t oldest_ctime = 0;
char buffer[TMP_BUFFER_LEN];
char buffer[MAXPATHLEN + 1];
int searchpid;
char* tmpdirname = (char *)os::get_temp_directory();
assert(strlen(tmpdirname) == 4, "No longer using /tmp - update buffer size");
if (nspid == -1) {
searchpid = vmid;
}
else {
} else {
jio_snprintf(buffer, MAXPATHLEN, "/proc/%d/root%s", vmid, tmpdirname);
tmpdirname = buffer;
searchpid = nspid;

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
@ -543,14 +543,18 @@ void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
}
// Identify index position among ideal operands
intptr_t index = _last_opcode;
const char *indexStr = node ? node->_opType : (char *) " ";
index = (intptr_t)_idealIndex[indexStr];
intptr_t index = _last_opcode;
const char *indexStr = node ? node->_opType : (char *) " ";
index = (intptr_t)_idealIndex[indexStr];
if (index == 0) {
fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
assert(0, "fatal error");
}
if (node == NULL) {
fprintf(stderr, "error: node is NULL\n");
assert(0, "fatal error");
}
// Build MatchLists for children
// Check each child for an internal operand name, and use that name
// for the parent's matchlist entry if it exists

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ void Chunk::chop() {
while( k ) {
Chunk *tmp = k->_next;
// clear out this chunk (to detect allocation bugs)
memset(k, 0xBAADBABE, k->_len);
memset(k, 0xBE, k->_len);
free(k); // Free chunk (was malloc'd)
k = tmp;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -502,9 +502,11 @@ class dfa_shared_preds {
case '"': // such as: #line 10 "myfile.ad"\n mypredicate
return true;
case '|':
if( prev != pred && *(prev-1) == '|' ) return true;
if (prev != pred && *(prev-1) == '|') return true;
break;
case '&':
if( prev != pred && *(prev-1) == '&' ) return true;
if (prev != pred && *(prev-1) == '&') return true;
break;
default:
return false;
}
@ -717,21 +719,21 @@ const char *Expr::compute_external(const Expr *c1, const Expr *c2) {
// Preserve use of external name which has a zero value
if( c1->_external_name != NULL ) {
sprintf( string_buffer, "%s", c1->as_string());
sprintf(string_buffer, "%s", c1->as_string());
if( !c2->is_zero() ) {
strcat( string_buffer, "+");
strcat( string_buffer, c2->as_string());
strncat(string_buffer, "+", STRING_BUFFER_LENGTH);
strncat(string_buffer, c2->as_string(), STRING_BUFFER_LENGTH);
}
result = strdup(string_buffer);
}
else if( c2->_external_name != NULL ) {
if( !c1->is_zero() ) {
sprintf( string_buffer, "%s", c1->as_string());
strcat( string_buffer, " + ");
sprintf(string_buffer, "%s", c1->as_string());
strncat(string_buffer, " + ", STRING_BUFFER_LENGTH);
} else {
string_buffer[0] = '\0';
}
strcat( string_buffer, c2->_external_name );
strncat(string_buffer, c2->_external_name, STRING_BUFFER_LENGTH);
result = strdup(string_buffer);
}
return result;
@ -741,8 +743,8 @@ const char *Expr::compute_expr(const Expr *c1, const Expr *c2) {
if( !c1->is_zero() ) {
sprintf( string_buffer, "%s", c1->_expr);
if( !c2->is_zero() ) {
strcat( string_buffer, "+");
strcat( string_buffer, c2->_expr);
strncat(string_buffer, "+", STRING_BUFFER_LENGTH);
strncat(string_buffer, c2->_expr, STRING_BUFFER_LENGTH);
}
}
else if( !c2->is_zero() ) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -95,8 +95,11 @@ void FileBuff::file_error(int flag, int linenum, const char *fmt, ...)
va_start(args, fmt);
switch (flag) {
case 0: _AD._warnings += _AD.emit_msg(0, flag, linenum, fmt, args);
break;
case 1: _AD._syntax_errs += _AD.emit_msg(0, flag, linenum, fmt, args);
break;
case 2: _AD._semantic_errs += _AD.emit_msg(0, flag, linenum, fmt, args);
break;
default: assert(0, ""); break;
}
va_end(args);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3634,7 +3634,7 @@ int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, Matc
&& (is_load_from_memory(mRule2->_opType) == data_type) // reg vs. (load memory)
&& (name_left != NULL) // NOT (load)
&& (name_right == NULL) ) { // NOT (load memory foo)
const Form *form2_left = name_left ? globals[name_left] : NULL;
const Form *form2_left = globals[name_left];
if( form2_left && form2_left->is_cisc_mem(globals) ) {
cisc_spillable = Is_cisc_spillable;
operand = _name;
@ -3645,7 +3645,7 @@ int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, Matc
}
}
// Detect reg vs memory
else if( form->is_cisc_reg(globals) && form2->is_cisc_mem(globals) ) {
else if (form->is_cisc_reg(globals) && form2 != NULL && form2->is_cisc_mem(globals)) {
cisc_spillable = Is_cisc_spillable;
operand = _name;
reg_type = _result;
@ -3710,8 +3710,12 @@ int MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* regi
}
// Check right operands: recursive walk to identify reg->mem operand
if( (_rChild == NULL) && (mRule2->_rChild == NULL) ) {
right_spillable = Maybe_cisc_spillable;
if (_rChild == NULL) {
if (mRule2->_rChild == NULL) {
right_spillable = Maybe_cisc_spillable;
} else {
assert(0, "_rChild should not be NULL");
}
} else {
right_spillable = _rChild->cisc_spill_match(globals, registers, mRule2->_rChild, operand, reg_type);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -142,7 +142,7 @@ int main(int argc, char *argv[])
const char *base = strip_ext(strdup(argv[i]));
char *temp = base_plus_suffix("dfa_",base);
AD._DFA_file._name = base_plus_suffix(temp,".cpp");
delete temp;
delete[] temp;
temp = base_plus_suffix("ad_",base);
AD._CPP_file._name = base_plus_suffix(temp,".cpp");
AD._CPP_CLONE_file._name = base_plus_suffix(temp,"_clone.cpp");
@ -153,13 +153,13 @@ int main(int argc, char *argv[])
AD._CPP_PEEPHOLE_file._name = base_plus_suffix(temp,"_peephole.cpp");
AD._CPP_PIPELINE_file._name = base_plus_suffix(temp,"_pipeline.cpp");
AD._HPP_file._name = base_plus_suffix(temp,".hpp");
delete temp;
delete[] temp;
temp = base_plus_suffix("adGlobals_",base);
AD._VM_file._name = base_plus_suffix(temp,".hpp");
delete temp;
delete[] temp;
temp = base_plus_suffix("bugs_",base);
AD._bug_file._name = base_plus_suffix(temp,".out");
delete temp;
delete[] temp;
} // End of files vs options...
} // End of while have command line arguments

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1936,6 +1936,7 @@ public:
_AD.syntax_err( _ins_encode._linenum,
"Parameter %s not passed to enc_class %s from instruct %s.\n",
rep_var, _encoding._name, _inst._ident);
assert(false, "inst_rep_var == NULL, cannot continue.");
}
// Check if instruction's actual parameter is a local name in the instruction
@ -1976,8 +1977,8 @@ public:
}
else {
// Check for unimplemented functionality before hard failure
assert( strcmp(opc->_ident,"label")==0, "Unimplemented() Label");
assert( false, "ShouldNotReachHere()");
assert(opc != NULL && strcmp(opc->_ident, "label") == 0, "Unimplemented Label");
assert(false, "ShouldNotReachHere()");
}
} // done checking which operand this is.
} else {
@ -2450,8 +2451,8 @@ private:
}
else {
// Check for unimplemented functionality before hard failure
assert( strcmp(opc->_ident,"label")==0, "Unimplemented() Label");
assert( false, "ShouldNotReachHere()");
assert(opc != NULL && strcmp(opc->_ident, "label") == 0, "Unimplemented Label");
assert(false, "ShouldNotReachHere()");
}
// all done
}
@ -3305,9 +3306,11 @@ void ArchDesc::defineClasses(FILE *fp) {
// Output the definitions for machine node specific pipeline data
_machnodes.reset();
for ( ; (machnode = (MachNodeForm*)_machnodes.iter()) != NULL; ) {
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %sNode::pipeline() const { return (&pipeline_class_%03d); }\n",
machnode->_ident, ((class PipeClassForm *)_pipeline->_classdict[machnode->_machnode_pipe])->_num);
if (_pipeline != NULL) {
for ( ; (machnode = (MachNodeForm*)_machnodes.iter()) != NULL; ) {
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %sNode::pipeline() const { return (&pipeline_class_%03d); }\n",
machnode->_ident, ((class PipeClassForm *)_pipeline->_classdict[machnode->_machnode_pipe])->_num);
}
}
fprintf(_CPP_PIPELINE_file._fp, "\n");
@ -3315,13 +3318,15 @@ void ArchDesc::defineClasses(FILE *fp) {
// Output the definitions for instruction pipeline static data references
_instructions.reset();
for ( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
if (instr->_ins_pipe && _pipeline->_classlist.search(instr->_ins_pipe)) {
fprintf(_CPP_PIPELINE_file._fp, "\n");
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*sNode::pipeline_class() { return (&pipeline_class_%03d); }\n",
max_ident_len, instr->_ident, ((class PipeClassForm *)_pipeline->_classdict[instr->_ins_pipe])->_num);
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*sNode::pipeline() const { return (&pipeline_class_%03d); }\n",
max_ident_len, instr->_ident, ((class PipeClassForm *)_pipeline->_classdict[instr->_ins_pipe])->_num);
if (_pipeline != NULL) {
for ( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
if (instr->_ins_pipe && _pipeline->_classlist.search(instr->_ins_pipe)) {
fprintf(_CPP_PIPELINE_file._fp, "\n");
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*sNode::pipeline_class() { return (&pipeline_class_%03d); }\n",
max_ident_len, instr->_ident, ((class PipeClassForm *)_pipeline->_classdict[instr->_ins_pipe])->_num);
fprintf(_CPP_PIPELINE_file._fp, "const Pipeline * %*sNode::pipeline() const { return (&pipeline_class_%03d); }\n",
max_ident_len, instr->_ident, ((class PipeClassForm *)_pipeline->_classdict[instr->_ins_pipe])->_num);
}
}
}
}

View File

@ -549,7 +549,7 @@ void AOTCodeHeap::link_global_lib_symbols() {
_lib_symbols_initialized = true;
CollectedHeap* heap = Universe::heap();
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_card_table_address", address, ci_card_table_address());
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_card_table_address", address, (BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) ? ci_card_table_address() : NULL));
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_heap_top_address", address, (heap->supports_inline_contig_alloc() ? heap->top_addr() : NULL));
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_heap_end_address", address, (heap->supports_inline_contig_alloc() ? heap->end_addr() : NULL));
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_polling_page", address, os::get_polling_page());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -187,7 +187,7 @@ void CodeBuffer::freeze_section(CodeSection* cs) {
cs->_limit = new_limit;
cs->_locs_limit = new_locs_limit;
cs->_frozen = true;
if (!next_cs->is_allocated() && !next_cs->is_frozen()) {
if (next_cs != NULL && !next_cs->is_allocated() && !next_cs->is_frozen()) {
// Give remaining buffer space to the following section.
next_cs->initialize(new_limit, old_limit - new_limit);
next_cs->initialize_shared_locs(new_locs_limit,
@ -494,10 +494,13 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
// Compute initial padding; assign it to the previous non-empty guy.
// Cf. figure_expanded_capacities.
csize_t padding = cs->align_at_start(buf_offset) - buf_offset;
if (padding != 0) {
buf_offset += padding;
assert(prev_dest_cs != NULL, "sanity");
prev_dest_cs->_limit += padding;
if (prev_dest_cs != NULL) {
if (padding != 0) {
buf_offset += padding;
prev_dest_cs->_limit += padding;
}
} else {
guarantee(padding == 0, "In first iteration no padding should be needed.");
}
#ifdef ASSERT
if (prev_cs != NULL && prev_cs->is_frozen() && n < (SECT_LIMIT - 1)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1386,7 +1386,7 @@ void SubstitutionResolver::block_do(BlockBegin* block) {
n->values_do(this);
// need to remove this instruction from the instruction stream
if (n->subst() != n) {
assert(last != NULL, "must have last");
guarantee(last != NULL, "must have last");
last->set_next(n->next());
} else {
last = n;

View File

@ -2311,7 +2311,9 @@ void LIRGenerator::do_TableSwitch(TableSwitch* x) {
if (compilation()->env()->comp_level() == CompLevel_full_profile && UseSwitchProfiling) {
ciMethod* method = x->state()->scope()->method();
ciMethodData* md = method->method_data_or_null();
assert(md != NULL, "Sanity");
ciProfileData* data = md->bci_to_data(x->state()->bci());
assert(data != NULL, "must have profiling data");
assert(data->is_MultiBranchData(), "bad profile data?");
int default_count_offset = md->byte_offset_of_slot(data, MultiBranchData::default_count_offset());
LIR_Opr md_reg = new_register(T_METADATA);
@ -2367,7 +2369,9 @@ void LIRGenerator::do_LookupSwitch(LookupSwitch* x) {
if (compilation()->env()->comp_level() == CompLevel_full_profile && UseSwitchProfiling) {
ciMethod* method = x->state()->scope()->method();
ciMethodData* md = method->method_data_or_null();
assert(md != NULL, "Sanity");
ciProfileData* data = md->bci_to_data(x->state()->bci());
assert(data != NULL, "must have profiling data");
assert(data->is_MultiBranchData(), "bad profile data?");
int default_count_offset = md->byte_offset_of_slot(data, MultiBranchData::default_count_offset());
LIR_Opr md_reg = new_register(T_METADATA);
@ -3076,6 +3080,7 @@ void LIRGenerator::profile_arguments(ProfileCall* x) {
if (compilation()->profile_arguments()) {
int bci = x->bci_of_invoke();
ciMethodData* md = x->method()->method_data_or_null();
assert(md != NULL, "Sanity");
ciProfileData* data = md->bci_to_data(bci);
if (data != NULL) {
if ((data->is_CallTypeData() && data->as_CallTypeData()->has_arguments()) ||
@ -3212,6 +3217,7 @@ void LIRGenerator::do_ProfileCall(ProfileCall* x) {
void LIRGenerator::do_ProfileReturnType(ProfileReturnType* x) {
int bci = x->bci_of_invoke();
ciMethodData* md = x->method()->method_data_or_null();
assert(md != NULL, "Sanity");
ciProfileData* data = md->bci_to_data(bci);
if (data != NULL) {
assert(data->is_CallTypeData() || data->is_VirtualCallTypeData(), "wrong profile data type");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3954,7 +3954,7 @@ void MoveResolver::resolve_mappings() {
if (!processed_interval) {
// no move could be processed because there is a cycle in the move list
// (e.g. r1 -> r2, r2 -> r1), so one interval must be spilled to memory
assert(spill_candidate != -1, "no interval in register for spilling found");
guarantee(spill_candidate != -1, "no interval in register for spilling found");
// create a new spill interval and assign a stack slot to it
Interval* from_interval = _mapping_from.at(spill_candidate);
@ -6301,7 +6301,8 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) {
assert(prev_branch->cond() == prev_cmp->condition(), "should be the same");
}
}
assert(prev_cmp != NULL, "should have found comp instruction for branch");
// Guarantee because it is dereferenced below.
guarantee(prev_cmp != NULL, "should have found comp instruction for branch");
if (prev_branch->block() == code->at(i + 1) && prev_branch->info() == NULL) {
TRACE_LINEAR_SCAN(3, tty->print_cr("Negating conditional branch and deleting unconditional branch at end of block B%d", block->block_id()));

View File

@ -387,7 +387,8 @@ ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle
entry->set_is_patched();
if (log_is_enabled(Trace, module, patch)) {
ResourceMark rm;
log_trace(module, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
log_trace(module, patch)("Marked module %s as patched from --patch-module",
name != NULL ? name->as_C_string() : UNNAMED_MODULE);
}
}

View File

@ -1364,18 +1364,18 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
// notify a class loaded from shared object
ClassLoadingService::notify_class_loaded(ik, true /* shared class */);
}
ik->set_has_passed_fingerprint_check(false);
if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik);
uint64_t cds_fp = ik->get_stored_fingerprint();
if (aot_fp != 0 && aot_fp == cds_fp) {
// This class matches with a class saved in an AOT library
ik->set_has_passed_fingerprint_check(true);
} else {
ResourceMark rm;
log_info(class, fingerprint)("%s : expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
ik->set_has_passed_fingerprint_check(false);
if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik);
uint64_t cds_fp = ik->get_stored_fingerprint();
if (aot_fp != 0 && aot_fp == cds_fp) {
// This class matches with a class saved in an AOT library
ik->set_has_passed_fingerprint_check(true);
} else {
ResourceMark rm;
log_info(class, fingerprint)("%s : expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
}
}
}
return ik;

View File

@ -766,10 +766,11 @@ bool SystemDictionaryShared::add_verification_constraint(Klass* k, Symbol* name,
SharedDictionaryEntry* entry = ((SharedDictionary*)(k->class_loader_data()->dictionary()))->find_entry_for(k);
ResourceMark rm;
// Lambda classes are not archived and will be regenerated at runtime.
if (entry == NULL && strstr(k->name()->as_C_string(), "Lambda$") != NULL) {
if (entry == NULL) {
guarantee(strstr(k->name()->as_C_string(), "Lambda$") != NULL,
"class should be in dictionary before being verified");
return true;
}
assert(entry != NULL, "class should be in dictionary before being verified");
entry->add_verification_constraint(name, from_name, from_field_is_protected,
from_is_array, from_is_object);
if (entry->is_builtin()) {

View File

@ -719,7 +719,8 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
ResourceMark rm(THREAD);
LogStream ls(lt);
current_frame.print_on(&ls);
lt.print("offset = %d, opcode = %s", bci, Bytecodes::name(opcode));
lt.print("offset = %d, opcode = %s", bci,
opcode == Bytecodes::_illegal ? "illegal" : Bytecodes::name(opcode));
}
// Make sure wide instruction is in correct format

View File

@ -1363,22 +1363,22 @@ void CodeCache::report_codemem_full(int code_blob_type, bool print) {
const char *msg1 = msg1_stream.as_string();
const char *msg2 = msg2_stream.as_string();
log_warning(codecache)(msg1);
log_warning(codecache)(msg2);
warning(msg1);
warning(msg2);
log_warning(codecache)("%s", msg1);
log_warning(codecache)("%s", msg2);
warning("%s", msg1);
warning("%s", msg2);
} else {
const char *msg1 = "CodeCache is full. Compiler has been disabled.";
const char *msg2 = "Try increasing the code cache size using -XX:ReservedCodeCacheSize=";
log_warning(codecache)(msg1);
log_warning(codecache)(msg2);
warning(msg1);
warning(msg2);
log_warning(codecache)("%s", msg1);
log_warning(codecache)("%s", msg2);
warning("%s", msg1);
warning("%s", msg2);
}
ResourceMark rm;
stringStream s;
// Dump code cache into a buffer before locking the tty,
// Dump code cache into a buffer before locking the tty.
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
print_summary(&s);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -217,14 +217,17 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
file->print_raw_cr("'>");
size_t nr; // number read into buf from partial log
// In case of unsuccessful completion, read returns -1.
ssize_t bytes_read;
// Copy data up to the end of the last <event> element:
julong to_read = log->_file_end;
while (to_read > 0) {
if (to_read < (julong)buflen)
nr = (size_t)to_read;
else nr = buflen;
nr = read(partial_fd, buf, (int)nr);
if (nr <= 0) break;
bytes_read = read(partial_fd, buf, (int)nr);
if (bytes_read <= 0) break;
nr = bytes_read;
to_read -= (julong)nr;
file->write(buf, nr);
}
@ -232,7 +235,8 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
// Copy any remaining data inside a quote:
bool saw_slop = false;
int end_cdata = 0; // state machine [0..2] watching for too many "]]"
while ((nr = read(partial_fd, buf, buflen-1)) > 0) {
while ((bytes_read = read(partial_fd, buf, buflen-1)) > 0) {
nr = bytes_read;
buf[buflen-1] = '\0';
if (!saw_slop) {
file->print_raw_cr("<fragment>");

View File

@ -124,7 +124,7 @@ bool Disassembler::load_library() {
_decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
os::dll_lookup(_library, decode_instructions_virtual_name));
}
if (_decode_instructions_virtual == NULL) {
if (_decode_instructions_virtual == NULL && _library != NULL) {
// could not spot in new version, try old version
_decode_instructions = CAST_TO_FN_PTR(Disassembler::decode_func,
os::dll_lookup(_library, decode_instructions_name));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -484,7 +484,7 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) {
while (block == NULL && t > 0) {
block = _block_map->at(--t);
}
assert( block != NULL, "invalid bytecode index; must be instruction index" );
guarantee(block != NULL, "invalid bytecode index; must be instruction index");
assert(bci >= block->start_bci() && bci < block->limit_bci(), "block must contain bci.");
answer = block->get_liveness_at(method(), bci);

View File

@ -571,14 +571,14 @@ bool OopMap::equals(const OopMap* other) const {
const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
ImmutableOopMapPair* pairs = get_pairs();
ImmutableOopMapPair* last = NULL;
for (int i = 0; i < _count; ++i) {
int i;
for (i = 0; i < _count; ++i) {
if (pairs[i].pc_offset() >= pc_offset) {
last = &pairs[i];
break;
}
}
ImmutableOopMapPair* last = &pairs[i];
assert(last->pc_offset() == pc_offset, "oopmap not found");
return last->get_from(this);

View File

@ -236,6 +236,8 @@ int AOTOopRecorder::find_index(Metadata* h) {
JVMCIKlassHandle klass(THREAD);
oop result = NULL;
guarantee(h != NULL,
"If DebugInformationRecorder::describe_scope passes NULL oldCount == newCount must hold.");
if (h->is_klass()) {
klass = (Klass*) h;
result = CompilerToVM::get_jvmci_type(klass, CATCH);

View File

@ -349,7 +349,9 @@ C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlon
klass = *((Klass**) (intptr_t) (base_address + offset));
} else {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false"));
err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s",
base_object != NULL ? base_object->klass()->external_name() : "null",
offset, compressed ? "true" : "false"));
}
assert (klass == NULL || klass->is_klass(), "invalid read");
oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL);

View File

@ -262,7 +262,9 @@ void LogOutput::update_config_string(const size_t on_level[LogLevel::Count]) {
while (n_deviates > 0) {
size_t prev_deviates = n_deviates;
int max_score = 0;
const LogSelection* best_selection = NULL;
guarantee(n_selections > 0, "Cannot find maximal selection.");
const LogSelection* best_selection = &selections[0];
for (size_t i = 0; i < n_selections; i++) {
// Give the selection a score based on how many deviating tag sets it selects (with correct level)
@ -287,13 +289,12 @@ void LogOutput::update_config_string(const size_t on_level[LogLevel::Count]) {
// Pick the selection with the best score, or in the case of a tie, the one with fewest tags
if (score > max_score ||
(score == max_score && best_selection != NULL && selections[i].ntags() < best_selection->ntags())) {
(score == max_score && selections[i].ntags() < best_selection->ntags())) {
max_score = score;
best_selection = &selections[i];
}
}
assert(best_selection != NULL, "must always find a maximal selection");
add_to_config_string(*best_selection);
// Remove all deviates that this selection covered

View File

@ -631,7 +631,9 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
si->_read_only = read_only;
si->_allow_exec = allow_exec;
si->_crc = ClassLoader::crc32(0, base, (jint)size);
write_bytes_aligned(base, (int)size);
if (base != NULL) {
write_bytes_aligned(base, (int)size);
}
}
// Write out the given archive heap memory regions. GC code combines multiple

View File

@ -1260,7 +1260,9 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
tty->print_cr("Please increase MaxMetaspaceSize (currently " SIZE_FORMAT " bytes).", MaxMetaspaceSize);
vm_exit(1);
}
report_metadata_oome(loader_data, word_size, type, mdtype, CHECK_NULL);
report_metadata_oome(loader_data, word_size, type, mdtype, THREAD);
assert(HAS_PENDING_EXCEPTION, "sanity");
return NULL;
}
// Zero initialize.

View File

@ -70,6 +70,18 @@ ReservedSpace::ReservedSpace(size_t size, size_t alignment,
initialize(size, alignment, large, NULL, executable);
}
ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment,
bool special, bool executable) : _fd_for_heap(-1) {
assert((size % os::vm_allocation_granularity()) == 0,
"size not allocation aligned");
_base = base;
_size = size;
_alignment = alignment;
_noaccess_prefix = 0;
_special = special;
_executable = executable;
}
// Helper method
static void unmap_or_release_memory(char* base, size_t size, bool is_file_mapped) {
if (is_file_mapped) {
@ -218,20 +230,6 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large,
}
}
ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment,
bool special, bool executable) {
assert((size % os::vm_allocation_granularity()) == 0,
"size not allocation aligned");
_base = base;
_size = size;
_alignment = alignment;
_noaccess_prefix = 0;
_special = special;
_executable = executable;
}
ReservedSpace ReservedSpace::first_part(size_t partition_size, size_t alignment,
bool split, bool realloc) {
assert(partition_size <= size(), "partition failed");

View File

@ -366,6 +366,9 @@ Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
if (!forward_ctl->is_top()) {
// copy forward
mem = start_mem_dest;
uint alias_idx_src = phase->C->get_alias_index(atp_src);
uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
bool same_alias = (alias_idx_src == alias_idx_dest);
if (count > 0) {
Node* v = LoadNode::make(*phase, forward_ctl, start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
@ -376,7 +379,7 @@ Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
v = LoadNode::make(*phase, forward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
v = LoadNode::make(*phase, forward_ctl, same_alias ? mem : start_mem_src, next_src, atp_src, value_type, copy_type, MemNode::unordered);
v = phase->transform(v);
mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
mem = phase->transform(mem);
@ -408,18 +411,21 @@ Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase,
if (!backward_ctl->is_top()) {
// copy backward
mem = start_mem_dest;
uint alias_idx_src = phase->C->get_alias_index(atp_src);
uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
bool same_alias = (alias_idx_src == alias_idx_dest);
if (count > 0) {
for (int i = count-1; i >= 1; i--) {
Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
Node* v = LoadNode::make(*phase, backward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
Node* v = LoadNode::make(*phase, backward_ctl, same_alias ? mem : start_mem_src, next_src, atp_src, value_type, copy_type, MemNode::unordered);
v = phase->transform(v);
mem = StoreNode::make(*phase, backward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
mem = phase->transform(mem);
}
Node* v = LoadNode::make(*phase, backward_ctl, mem, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
Node* v = LoadNode::make(*phase, backward_ctl, same_alias ? mem : start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
v = phase->transform(v);
mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
mem = phase->transform(mem);
@ -659,7 +665,8 @@ bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTra
c = bs->step_over_gc_barrier(c);
CallNode* call = NULL;
if (c != NULL && c->is_Region()) {
guarantee(c != NULL, "step_over_gc_barrier failed, there must be something to step to.");
if (c->is_Region()) {
for (uint i = 1; i < c->req(); i++) {
if (c->in(i) != NULL) {
Node* n = c->in(i)->in(0);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -520,10 +520,10 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
caller_bci, inline_msg);
if (C->print_inlining()) {
C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg);
if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
if (Verbose && callee_method) {
guarantee(callee_method != NULL, "would crash in post_inlining_event");
if (Verbose) {
const InlineTree *top = this;
while( top->caller_tree() != NULL ) { top = top->caller_tree(); }
while (top->caller_tree() != NULL) { top = top->caller_tree(); }
//tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
}
}

View File

@ -759,6 +759,7 @@ bool CallNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
}
}
}
guarantee(dest != NULL, "Call had only one ptr in, broken IR!");
if (!dest->is_top() && may_modify_arraycopy_helper(phase->type(dest)->is_oopptr(), t_oop, phase)) {
return true;
}

View File

@ -4049,9 +4049,9 @@ void Compile::ConstantTable::emit(CodeBuffer& cb) {
int Compile::ConstantTable::find_offset(Constant& con) const {
int idx = _constants.find(con);
assert(idx != -1, "constant must be in constant table");
guarantee(idx != -1, "constant must be in constant table");
int offset = _constants.at(idx).offset();
assert(offset != -1, "constant table not emitted yet?");
guarantee(offset != -1, "constant table not emitted yet?");
return offset;
}

View File

@ -1263,6 +1263,7 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_Stack &stack) {
Node* use = self->fast_out(i);
LCA = raise_LCA_above_use(LCA, use, self, this);
}
guarantee(LCA != NULL, "There must be a LCA");
} // (Hide defs of imax, i from rest of block.)
// Place temps in the block of their use. This isn't a

View File

@ -387,6 +387,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
} else {
assert( 0, "do not know how to handle this guy" );
}
guarantee(proj != NULL, "sanity");
Node *proj_path_data, *proj_path_ctrl;
if( proj->Opcode() == Op_IfTrue ) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -319,7 +319,7 @@ void IndexSet::initialize(uint max_elements) {
if (_max_blocks <= preallocated_block_list_size) {
_blocks = _preallocated_block_list;
} else {
_blocks = (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks);
_blocks = (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock*) * _max_blocks);
}
for (uint i = 0; i < _max_blocks; i++) {
set_block(i, &_empty_block);
@ -343,7 +343,7 @@ void IndexSet::initialize(uint max_elements, Arena *arena) {
if (_max_blocks <= preallocated_block_list_size) {
_blocks = _preallocated_block_list;
} else {
_blocks = (IndexSet::BitBlock**) arena->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks);
_blocks = (IndexSet::BitBlock**) arena->Amalloc_4(sizeof(IndexSet::BitBlock*) * _max_blocks);
}
for (uint i = 0; i < _max_blocks; i++) {
set_block(i, &_empty_block);

View File

@ -646,7 +646,7 @@ Node* PhaseCFG::select(
}
} // End of for all ready nodes in worklist
assert(idx >= 0, "index should be set");
guarantee(idx >= 0, "index should be set");
Node *n = worklist[(uint)idx]; // Get the winner
worklist.map((uint)idx, worklist.pop()); // Compress worklist

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -684,6 +684,7 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl,
Node* max_idx_expr = NULL;
const TypeInt* idx_type = TypeInt::INT;
if ((stride > 0) == (scale > 0) == upper) {
guarantee(limit != NULL, "sanity");
if (TraceLoopPredicate) {
if (limit->is_Con()) {
predString->print("(%d ", con_limit);

View File

@ -768,11 +768,12 @@ bool IdealLoopTree::policy_unroll(PhaseIdealLoop *phase) {
Node *init_n = cl->init_trip();
Node *limit_n = cl->limit();
int stride_con = cl->stride_con();
if (limit_n == NULL) return false; // We will dereference it below.
// Non-constant bounds.
// Protect against over-unrolling when init or/and limit are not constant
// (so that trip_count's init value is maxint) but iv range is known.
if (init_n == NULL || !init_n->is_Con() ||
limit_n == NULL || !limit_n->is_Con()) {
if (init_n == NULL || !init_n->is_Con() || !limit_n->is_Con()) {
Node* phi = cl->phi();
if (phi != NULL) {
assert(phi->is_Phi() && phi->in(0) == _head, "Counted loop should have iv phi.");

View File

@ -2154,6 +2154,7 @@ bool PhaseMacroExpand::eliminate_locking_node(AbstractLockNode *alock) {
Node* mem = alock->in(TypeFunc::Memory);
Node* ctrl = alock->in(TypeFunc::Control);
guarantee(ctrl != NULL, "missing control projection, cannot replace_node() with NULL");
extract_call_projections(alock);
// There are 2 projections from the lock. The lock node will
@ -2188,8 +2189,7 @@ bool PhaseMacroExpand::eliminate_locking_node(AbstractLockNode *alock) {
}
// Seach for MemBarReleaseLock node and delete it also.
if (alock->is_Unlock() && ctrl != NULL && ctrl->is_Proj() &&
ctrl->in(0)->is_MemBar()) {
if (alock->is_Unlock() && ctrl->is_Proj() && ctrl->in(0)->is_MemBar()) {
MemBarNode* membar = ctrl->in(0)->as_MemBar();
assert(membar->Opcode() == Op_MemBarReleaseLock &&
mem->is_Proj() && membar == mem->in(0), "");

View File

@ -370,10 +370,10 @@ Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) {
if (mem != old_mem) {
set_req(MemNode::Memory, mem);
if (can_reshape && old_mem->outcnt() == 0) {
igvn->_worklist.push(old_mem);
if (can_reshape && old_mem->outcnt() == 0 && igvn != NULL) {
igvn->_worklist.push(old_mem);
}
if (phase->type( mem ) == Type::TOP) return NodeSentinel;
if (phase->type(mem) == Type::TOP) return NodeSentinel;
return this;
}
@ -825,7 +825,7 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP
}
break;
default:
// ShouldNotReachHere(); ???
ShouldNotReachHere();
break;
}
assert(load != NULL, "LoadNode should have been created");

View File

@ -1689,9 +1689,10 @@ Compile::locate_node_notes(GrowableArray<Node_Notes*>* arr,
int block_idx = (idx >> _log2_node_notes_block_size);
int grow_by = (block_idx - (arr == NULL? 0: arr->length()));
if (grow_by >= 0) {
if (!can_grow) return NULL;
if (!can_grow) return NULL;
grow_node_notes(arr, grow_by + 1);
}
if (arr == NULL) return NULL;
// (Every element of arr is a sub-array of length _node_notes_block_size.)
return arr->at(block_idx) + (idx & (_node_notes_block_size-1));
}

View File

@ -1424,7 +1424,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
// See if this instruction has a delay slot
if (valid_bundle_info(n) && node_bundling(n)->use_unconditional_delay()) {
assert(delay_slot != NULL, "expecting delay slot node");
guarantee(delay_slot != NULL, "expecting delay slot node");
// Back up 1 instruction
cb->set_insts_end(cb->insts_end() - Pipeline::instr_unit_size());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1823,7 +1823,7 @@ void Parse::merge_memory_edges(MergeMemNode* n, int pnum, bool nophi) {
// Instead, wire the new split into a MergeMem on the backedge.
// The optimizer will sort it out, slicing the phi.
if (remerge == NULL) {
assert(base != NULL, "");
guarantee(base != NULL, "");
assert(base->in(0) != NULL, "should not be xformed away");
remerge = MergeMemNode::make(base->in(pnum));
gvn().set_type(remerge, Type::MEMORY);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -683,7 +683,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
if( needs_phi ) {
// create a new phi node and insert it into the block
// type is taken from left over pointer to a predecessor
assert(n3,"No non-NULL reaching DEF for a Phi");
guarantee(n3, "No non-NULL reaching DEF for a Phi");
phi = new PhiNode(b->head(), n3->bottom_type());
// initialize the Reaches entry for this LRG
Reachblock[slidx] = phi;

View File

@ -1608,7 +1608,12 @@ NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCount
}
int bci = jvms->bci();
if (bci < 0) bci = 0;
st.print("%s.%s@%d", m->holder()->name()->as_utf8(), m->name()->as_utf8(), bci);
if (m != NULL) {
st.print("%s.%s", m->holder()->name()->as_utf8(), m->name()->as_utf8());
} else {
st.print("no method");
}
st.print("@%d", bci);
// To print linenumbers instead of bci use: m->line_number_from_bci(bci)
}
NamedCounter* c;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -252,17 +252,16 @@ const Type* Type::make_from_constant(ciConstant constant, bool require_constant,
ciObject* oop_constant = constant.as_object();
if (oop_constant->is_null_object()) {
con_type = Type::get_zero_type(T_OBJECT);
} else if (require_constant || oop_constant->should_be_constant()) {
} else {
guarantee(require_constant || oop_constant->should_be_constant(), "con_type must get computed");
con_type = TypeOopPtr::make_from_constant(oop_constant, require_constant);
if (con_type != NULL) {
if (Compile::current()->eliminate_boxing() && is_autobox_cache) {
con_type = con_type->is_aryptr()->cast_to_autobox_cache(true);
}
if (stable_dimension > 0) {
assert(FoldStableValues, "sanity");
assert(!con_type->is_zero_type(), "default value for stable field");
con_type = con_type->is_aryptr()->cast_to_stable(true, stable_dimension);
}
if (Compile::current()->eliminate_boxing() && is_autobox_cache) {
con_type = con_type->is_aryptr()->cast_to_autobox_cache(true);
}
if (stable_dimension > 0) {
assert(FoldStableValues, "sanity");
assert(!con_type->is_zero_type(), "default value for stable field");
con_type = con_type->is_aryptr()->cast_to_stable(true, stable_dimension);
}
}
if (is_narrow_oop) {

View File

@ -1219,7 +1219,7 @@ VM_GetMultipleStackTraces::fill_frames(jthread jt, JavaThread *thr, oop thread_o
}
infop->state = state;
if (thr != NULL || (state & JVMTI_THREAD_STATE_ALIVE) != 0) {
if (thr != NULL && (state & JVMTI_THREAD_STATE_ALIVE) != 0) {
infop->frame_buffer = NEW_RESOURCE_ARRAY(jvmtiFrameInfo, max_frame_count());
env()->get_stack_trace(thr, 0, max_frame_count(),
infop->frame_buffer, &(infop->frame_count));

View File

@ -2044,7 +2044,7 @@ Deoptimization::update_method_data_from_interpreter(MethodData* trap_mdo, int tr
bool ignore_maybe_prior_recompile;
assert(!reason_is_speculate(reason), "reason speculate only used by compiler");
// JVMCI uses the total counts to determine if deoptimizations are happening too frequently -> do not adjust total counts
bool update_total_counts = JVMCI_ONLY(false) NOT_JVMCI(true);
bool update_total_counts = true JVMCI_ONLY( && !UseJVMCICompiler);
query_update_method_data(trap_mdo, trap_bci,
(DeoptReason)reason,
update_total_counts,

View File

@ -939,6 +939,10 @@ JVMFlag* JVMFlag::fuzzy_match(const char* name, size_t length, bool allow_locked
}
}
if (match == NULL) {
return NULL;
}
if (!(match->is_unlocked() || match->is_unlocker())) {
if (!allow_locked) {
return NULL;

View File

@ -266,8 +266,9 @@ CompileTask* SimpleThresholdPolicy::select_task(CompileQueue* compile_queue) {
max_method = max_task->method();
}
if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
&& is_method_profiled(max_method)) {
if (max_task != NULL && max_task->comp_level() == CompLevel_full_profile &&
TieredStopAtLevel > CompLevel_full_profile &&
max_method != NULL && is_method_profiled(max_method)) {
max_task->set_comp_level(CompLevel_limited_profile);
if (PrintTieredEvents) {
print_event(UPDATE_IN_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level());

View File

@ -79,7 +79,7 @@ static void print_flag_error_message_if_needed(JVMFlag::Error error, const char*
case JVMFlag::NON_WRITABLE:
buffer_concat(buffer, "flag is not writeable."); break;
case JVMFlag::OUT_OF_BOUNDS:
print_flag_error_message_bounds(name, buffer); break;
if (name != NULL) { print_flag_error_message_bounds(name, buffer); } break;
case JVMFlag::VIOLATES_CONSTRAINT:
buffer_concat(buffer, "value violates its flag's constraint."); break;
case JVMFlag::INVALID_FLAG:

View File

@ -531,7 +531,8 @@ void fileStream::write(const char* s, size_t len) {
long fileStream::fileSize() {
long size = -1;
if (_file != NULL) {
long pos = ::ftell(_file);
long pos = ::ftell(_file);
if (pos < 0) return pos;
if (::fseek(_file, 0, SEEK_END) == 0) {
size = ::ftell(_file);
}

View File

@ -207,43 +207,24 @@ class Bits { // package-private
assert cnt >= 0 && reservedMem >= 0 && totalCap >= 0;
}
// -- Monitoring of direct buffer usage --
static {
// setup access to this package in SharedSecrets
SharedSecrets.setJavaNioAccess(
new JavaNioAccess() {
@Override
public JavaNioAccess.BufferPool getDirectBufferPool() {
return new JavaNioAccess.BufferPool() {
@Override
public String getName() {
return "direct";
}
@Override
public long getCount() {
return Bits.COUNT.get();
}
@Override
public long getTotalCapacity() {
return Bits.TOTAL_CAPACITY.get();
}
@Override
public long getMemoryUsed() {
return Bits.RESERVED_MEMORY.get();
}
};
}
@Override
public ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob) {
return new DirectByteBuffer(addr, cap, ob);
}
@Override
public void truncate(Buffer buf) {
buf.truncate();
}
});
}
static final JavaNioAccess.BufferPool BUFFER_POOL = new JavaNioAccess.BufferPool() {
@Override
public String getName() {
return "direct";
}
@Override
public long getCount() {
return Bits.COUNT.get();
}
@Override
public long getTotalCapacity() {
return Bits.TOTAL_CAPACITY.get();
}
@Override
public long getMemoryUsed() {
return Bits.RESERVED_MEMORY.get();
}
};
// These numbers represent the point at which we have empirically
// determined that the average cost of a JNI call exceeds the expense

View File

@ -26,6 +26,8 @@
package java.nio;
import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.JavaNioAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.Unsafe;
import java.util.Spliterator;
@ -707,4 +709,23 @@ public abstract class Buffer {
throw new IndexOutOfBoundsException();
}
static {
// setup access to this package in SharedSecrets
SharedSecrets.setJavaNioAccess(
new JavaNioAccess() {
@Override
public JavaNioAccess.BufferPool getDirectBufferPool() {
return Bits.BUFFER_POOL;
}
@Override
public ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob) {
return new DirectByteBuffer(addr, cap, ob);
}
@Override
public void truncate(Buffer buf) {
buf.truncate();
}
});
}
}

View File

@ -194,10 +194,9 @@ public class SharedSecrets {
public static JavaNioAccess getJavaNioAccess() {
if (javaNioAccess == null) {
// Ensure java.nio.ByteOrder is initialized; we know that
// this class initializes java.nio.Bits that provides the
// Ensure java.nio.Buffer is initialized, which provides the
// shared secret.
unsafe.ensureClassInitialized(java.nio.ByteOrder.class);
unsafe.ensureClassInitialized(java.nio.Buffer.class);
}
return javaNioAccess;
}

View File

@ -333,7 +333,6 @@ public class VerifyAccess {
* @return whether they are in the same package
*/
public static boolean isSamePackage(Class<?> class1, Class<?> class2) {
assert(!class1.isArray() && !class2.isArray());
if (class1 == class2)
return true;
if (class1.getClassLoader() != class2.getClassLoader())

View File

@ -73,12 +73,20 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
boolean withDefaultCertPathConstraints) {
AlgorithmConstraints configuredConstraints = null;
if (socket != null) {
HandshakeContext hc =
((SSLSocketImpl)socket).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
// Note that the KeyManager or TrustManager implementation may be
// not implemented in the same provider as SSLSocket/SSLEngine.
// Please check the instance before casting to use SSLSocketImpl.
if (socket instanceof SSLSocketImpl) {
HandshakeContext hc =
((SSLSocketImpl)socket).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
} else {
configuredConstraints = null;
}
} else {
configuredConstraints = null;
configuredConstraints =
socket.getSSLParameters().getAlgorithmConstraints();
}
}
this.userSpecifiedConstraints = configuredConstraints;
@ -90,12 +98,20 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints {
boolean withDefaultCertPathConstraints) {
AlgorithmConstraints configuredConstraints = null;
if (engine != null) {
HandshakeContext hc =
((SSLEngineImpl)engine).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
// Note that the KeyManager or TrustManager implementation may be
// not implemented in the same provider as SSLSocket/SSLEngine.
// Please check the instance before casting to use SSLEngineImpl.
if (engine instanceof SSLEngineImpl) {
HandshakeContext hc =
((SSLEngineImpl)engine).conContext.handshakeContext;
if (hc != null) {
configuredConstraints = hc.sslConfig.algorithmConstraints;
} else {
configuredConstraints = null;
}
} else {
configuredConstraints = null;
configuredConstraints =
engine.getSSLParameters().getAlgorithmConstraints();
}
}
this.userSpecifiedConstraints = configuredConstraints;

View File

@ -130,7 +130,8 @@ public class CLDRTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
// Fill in for the empty names.
// English names are prefilled for performance.
if (locale.getLanguage() != "en") {
if (!locale.equals(Locale.ENGLISH) &&
!locale.equals(Locale.US)) {
for (int zoneIndex = 0; zoneIndex < ret.length; zoneIndex++) {
deriveFallbackNames(ret[zoneIndex], locale);
}

View File

@ -378,7 +378,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Either java.awt.Frame or java.awt.Dialog can be resizable, however java.awt.Window is never resizable
{
final boolean resizable = isFrame ? ((Frame)target).isResizable() : (isDialog ? ((Dialog)target).isResizable() : false);
final boolean resizable = isTargetResizable() && isNativelyFocusableWindow();
styleBits = SET(styleBits, RESIZABLE, resizable);
if (!resizable) {
styleBits = SET(styleBits, ZOOMABLE, false);
@ -482,6 +482,16 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
return styleBits;
}
private boolean isTargetResizable() {
if (target instanceof Frame) {
return ((Frame)target).isResizable();
} else if (target instanceof Dialog) {
return ((Dialog)target).isResizable();
}
return false;
}
// this is the counter-point to -[CWindow _nativeSetStyleBit:]
private void setStyleBits(final int mask, final boolean value) {
execute(ptr -> nativeSetNSWindowStyleBits(ptr, mask, value ? mask : 0));
@ -676,10 +686,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// Manage the extended state when showing
if (visible) {
/* Frame or Dialog should be set property WINDOW_FULLSCREENABLE to true if the
Frame or Dialog is resizable.
Frame or Dialog is resizable and focusable.
**/
final boolean resizable = (target instanceof Frame) ? ((Frame)target).isResizable() :
((target instanceof Dialog) ? ((Dialog)target).isResizable() : false);
final boolean resizable = isTargetResizable() && isNativelyFocusableWindow();
if (resizable) {
setCanFullscreen(true);
}
@ -814,9 +823,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void setResizable(final boolean resizable) {
setCanFullscreen(resizable);
setStyleBits(RESIZABLE, resizable);
setStyleBits(ZOOMABLE, resizable);
final boolean windowResizable = resizable && isNativelyFocusableWindow();
setCanFullscreen(windowResizable);
setStyleBits(RESIZABLE, windowResizable);
setStyleBits(ZOOMABLE, windowResizable);
}
@Override
@ -858,8 +868,8 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
@Override
public void updateFocusableWindowState() {
final boolean isFocusable = isNativelyFocusableWindow();
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN | RESIZABLE, isFocusable); // set bits at once
setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN | RESIZABLE,
(isNativelyFocusableWindow() && isTargetResizable()));
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,13 +24,41 @@
*/
package javax.swing.text.html;
import java.awt.*;
import java.awt.Rectangle;
import java.awt.Image;
import java.awt.Container;
import java.awt.Color;
import java.awt.Shape;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.image.ImageObserver;
import java.net.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Dictionary;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import javax.swing.Icon;
import javax.swing.UIManager;
import javax.swing.SwingUtilities;
import javax.swing.text.JTextComponent;
import javax.swing.text.StyledDocument;
import javax.swing.text.View;
import javax.swing.text.AttributeSet;
import javax.swing.text.Element;
import javax.swing.text.ViewFactory;
import javax.swing.text.Position;
import javax.swing.text.Segment;
import javax.swing.text.Highlighter;
import javax.swing.text.LayeredHighlighter;
import javax.swing.text.AbstractDocument;
import javax.swing.text.Document;
import javax.swing.text.BadLocationException;
import javax.swing.event.DocumentEvent;
/**
* View of an Image, intended to support the HTML &lt;IMG&gt; tag.
@ -744,12 +772,22 @@ public class ImageView extends View {
// anything that might cause the image to be loaded, and thus the
// ImageHandler to be called.
newWidth = getIntAttr(HTML.Attribute.WIDTH, -1);
newHeight = getIntAttr(HTML.Attribute.HEIGHT, -1);
if (newWidth > 0) {
newState |= WIDTH_FLAG;
if (newHeight <= 0) {
newHeight = newWidth;
newState |= HEIGHT_FLAG;
}
}
newHeight = getIntAttr(HTML.Attribute.HEIGHT, -1);
if (newHeight > 0) {
newState |= HEIGHT_FLAG;
if (newWidth <= 0) {
newWidth = newHeight;
newState |= WIDTH_FLAG;
}
}
if (newWidth <= 0) {

View File

@ -69,13 +69,15 @@ public class XDHKeyAgreement extends KeyAgreementSpi {
initImpl(key);
// the private key parameters must match params
XECParameters xecParams = XECParameters.get(
InvalidAlgorithmParameterException::new, params);
if (!xecParams.oidEquals(this.ops.getParameters())) {
throw new InvalidKeyException(
"Incorrect private key parameters"
);
// the private key parameters must match params, if present
if (params != null) {
XECParameters xecParams = XECParameters.get(
InvalidAlgorithmParameterException::new, params);
if (!xecParams.oidEquals(this.ops.getParameters())) {
throw new InvalidKeyException(
"Incorrect private key parameters"
);
}
}
}
@ -171,7 +173,9 @@ public class XDHKeyAgreement extends KeyAgreementSpi {
throw new IllegalStateException("Not initialized correctly");
}
return secret.clone();
byte[] result = secret;
secret = null;
return result;
}
@Override
@ -189,7 +193,8 @@ public class XDHKeyAgreement extends KeyAgreementSpi {
}
System.arraycopy(this.secret, 0, sharedSecret, offset, secretLen);
return secret.length;
secret = null;
return secretLen;
}
@Override

View File

@ -83,7 +83,7 @@ public class AArch64AtomicMove {
if (AArch64LIRFlagsVersioned.useLSE(masm.target.arch)) {
Register expected = asRegister(expectedValue);
masm.mov(size, result, expected);
masm.cas(size, expected, newVal, address, true /* acquire */, true /* release */);
masm.cas(size, result, newVal, address, true /* acquire */, true /* release */);
AArch64Compare.gpCompare(masm, resultValue, expectedValue);
} else {
// We could avoid using a scratch register here, by reusing resultValue for the

View File

@ -423,6 +423,21 @@ public class HelpWriter extends HtmlDocletWriter {
ul.addContent(htmlTree);
}
// Search
Content searchHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
contents.getContent("doclet.help.search.head"));
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(searchHead)
: HtmlTree.LI(HtmlStyle.blockList, searchHead);
Content searchBody = contents.getContent("doclet.help.search.body");
Content searchPara = HtmlTree.P(searchBody);
htmlTree.addContent(searchPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
divContent.addContent(new HtmlTree(HtmlTag.HR));
Content footnote = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase,

View File

@ -192,6 +192,10 @@ doclet.help.annotation_type.declaration=\
Annotation Type Declaration
doclet.help.annotation_type.description=\
Annotation Type Description
doclet.help.search.head=Search
doclet.help.search.body=You can search for definitions of modules, packages, types, fields, methods \
and other terms defined in the API, using some or all of the name. "Camel-case" abbreviations \
are supported: for example, "InpStr" will find "InputStream" and "InputStreamReader".
doclet.ClassUse_Packages.that.use.0=Packages that use {0}
doclet.ClassUse_Uses.of.0.in.1=Uses of {0} in {1}

View File

@ -91,7 +91,7 @@ public class FormatData_ja extends ParallelListResourceBundle {
"\u5927\u6b63", // Taisho
"\u662d\u548c", // Showa
"\u5e73\u6210", // Heisei
"\u65b0\u5143\u53f7", // NewEra
"\u5143\u53f7", // NewEra
};
final String[] rocEras = {
"\u6c11\u56fd\u524d",

View File

@ -154,7 +154,7 @@ public class JavaTimeSupplementary_ja extends OpenListResourceBundle {
"\u5927\u6b63",
"\u662d\u548c",
"\u5e73\u6210",
"\u65b0\u5143\u53f7", // NewEra
"\u5143\u53f7", // NewEra
};
final String[] sharedJavaTimeShortEras = {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -95,6 +95,7 @@ static inline char* read_line(FILE* fp) {
int buflen = 512;
char* buf = NEW_RESOURCE_ARRAY(char, buflen);
long pos = ftell(fp);
if (pos < 0) return NULL;
char* ret = fgets(buf, buflen, fp);
while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -60,7 +60,7 @@ TEST(Metachunk, basic) {
// Check sizes
EXPECT_EQ(metachunk->size(), metachunk->word_size());
EXPECT_EQ(pointer_delta(metachunk->end(), metachunk->bottom(),
sizeof (MetaWord*)),
sizeof (MetaWord)),
metachunk->word_size());
// Check usage

View File

@ -81,7 +81,6 @@ runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCCMSTest.java 8205643 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatArrayCorrectnessTest.java 8205541 generic-all
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatRateTest.java 8205652 generic-all

View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 2018, Red Hat, Inc. All rights reserved.
* 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 8200282
* @summary arraycopy converted as a series of loads/stores uses wrong slice for loads
*
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,ACasLoadsStoresBadMem::not_inlined ACasLoadsStoresBadMem
*
*/
public class ACasLoadsStoresBadMem {
public static void main(String[] args) {
int[] dst = new int[5];
for (int i = 0; i < 20_000; i++) {
test1(dst, 1);
for (int j = 1; j < 5; j++) {
if (dst[j] != j) {
throw new RuntimeException("Bad copy ");
}
}
}
}
private static void test1(int[] dst, int dstPos) {
int[] src = new int[4];
not_inlined();
src[0] = 1;
src[1] = 2;
src[2] = 3;
src[3] = 4;
System.arraycopy(src, 0, dst, dstPos, 4);
}
private static void not_inlined() {
}
}

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 8062950
* @requires vm.flavor == "server"
* @key regression
* @library /test/lib
* @run driver compiler.c2.Test8062950

View File

@ -25,6 +25,7 @@
* @test
* @bug 8193130 8203915
* @summary Bad graph when unrolled loop bounds conflicts with range checks
* @requires vm.flavor == "server"
*
* @run main/othervm IterationSplitPredicateInconsistency
* @run main/othervm -XX:-UseLoopPredicate IterationSplitPredicateInconsistency

View File

@ -25,6 +25,7 @@
* @test
* @bug 8187822
* @summary C2 conditonal move optimization might create broken graph
* @requires vm.flavor == "server"
* @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestCMovSplitThruPhi::not_inlined -XX:CompileOnly=TestCMovSplitThruPhi::test -XX:-LoopUnswitching TestCMovSplitThruPhi
*
*/

View File

@ -25,6 +25,7 @@
* @test
* @bug 8196294
* @summary when loop strip is enabled, LoopStripMiningIterShortLoop should be not null
* @requires vm.flavor == "server"
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* java.management

View File

@ -117,22 +117,15 @@ public class TestTypeProfiling {
}
// should deoptimize for speculative type check
// Intepreter will also add actual type check trap information into MDO
// when it throw ClassCastException
if (!deoptimize(method, src_obj)) {
throw new RuntimeException(method.getName() + " is not deoptimized");
}
// compile again
WHITE_BOX.enqueueMethodForCompilation(method, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
if (!WHITE_BOX.isMethodCompiled(method)) {
throw new RuntimeException(method.getName() + " is not recompiled");
}
// should deoptimize for actual type check
if (!deoptimize(method, src_obj)) {
throw new RuntimeException(method.getName() + " is not deoptimized (should deoptimize for actual type check)");
}
// compile once again
// c2 will generate throw instead of uncommon trap because
// actual type check trap information is present in MDO
WHITE_BOX.enqueueMethodForCompilation(method, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
if (!WHITE_BOX.isMethodCompiled(method)) {
throw new RuntimeException(method.getName() + " is not recompiled");

View File

@ -25,6 +25,7 @@
* @test
* @bug 8201367
* @summary RPO walk of counted loop block doesn't properly order loads
* @requires vm.flavor == "server"
*
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseCountedLoopSafepoints TestUnexpectedLoadOrdering
*

View File

@ -25,13 +25,38 @@
* @test
* @bug 8193373
* @summary Test reading ELF info direct from underlaying file
* @requires (os.family == "linux")
* @requires (os.family == "linux") & (os.arch != "ppc64")
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail TestElfDirectRead
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
-XX:NativeMemoryTracking=detail TestElfDirectRead
*/
// This test intentionally disables caching of Elf sections during symbol lookup
// with WhiteBox.disableElfSectionCache(). On platforms which do not use file
// descriptors instead of plain function pointers this slows down the lookup just a
// little bit, because all the symbols from an Elf file are still read consecutively
// after one 'fseek()' call. But on platforms with file descriptors like ppc64
// big-endian, we get two 'fseek()' calls for each symbol read from the Elf file
// because reading the file descriptor table is nested inside the loop which reads
// the symbols. This really trashes the I/O system and considerable slows down the
// test, so we need an extra long timeout setting.
/*
* @test
* @bug 8193373
* @summary Test reading ELF info direct from underlaying file
* @requires (os.family == "linux") & (os.arch == "ppc64")
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
-XX:NativeMemoryTracking=detail TestElfDirectRead
*/
import jdk.test.lib.process.ProcessTools;

View File

@ -23,9 +23,13 @@
package MyPackage;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
/** API for handling the underlying heap sampling monitoring system. */
public class HeapMonitor {
private static int[][] arrays;
@ -56,7 +60,7 @@ public class HeapMonitor {
int sum = 0;
List<Frame> frames = new ArrayList<Frame>();
allocate(frames);
frames.add(new Frame("allocate", "()Ljava/util/List;", "HeapMonitor.java", 58));
frames.add(new Frame("allocate", "()Ljava/util/List;", "HeapMonitor.java", 62));
return frames;
}
@ -65,8 +69,8 @@ public class HeapMonitor {
for (int j = 0; j < allocationIterations; j++) {
sum += actuallyAllocate();
}
frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 93));
frames.add(new Frame("allocate", "(Ljava/util/List;)V", "HeapMonitor.java", 66));
frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 97));
frames.add(new Frame("allocate", "(Ljava/util/List;)V", "HeapMonitor.java", 70));
}
public static List<Frame> repeatAllocate(int max) {
@ -74,7 +78,7 @@ public class HeapMonitor {
for (int i = 0; i < max; i++) {
frames = allocate();
}
frames.add(new Frame("repeatAllocate", "(I)Ljava/util/List;", "HeapMonitor.java", 75));
frames.add(new Frame("repeatAllocate", "(I)Ljava/util/List;", "HeapMonitor.java", 79));
return frames;
}
@ -152,14 +156,42 @@ public class HeapMonitor {
}
public native static int sampledEvents();
public native static boolean obtainedEvents(Frame[] frames);
public native static boolean garbageContains(Frame[] frames);
public native static boolean obtainedEvents(Frame[] frames, boolean checkLines);
public native static boolean garbageContains(Frame[] frames, boolean checkLines);
public native static boolean eventStorageIsEmpty();
public native static void resetEventStorage();
public native static int getEventStorageElementCount();
public native static void forceGarbageCollection();
public native static boolean enableVMEvents();
private static boolean getCheckLines() {
boolean checkLines = true;
// Do not check lines for Graal since it is not always "precise" with BCIs at uncommon traps.
try {
HotSpotDiagnosticMXBean bean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
VMOption enableJVMCI = bean.getVMOption("EnableJVMCI");
VMOption useJVMCICompiler = bean.getVMOption("UseJVMCICompiler");
String compiler = System.getProperty("jvmci.Compiler");
checkLines = !(enableJVMCI.getValue().equals("true")
&& useJVMCICompiler.getValue().equals("true") && compiler.equals("graal"));
} catch (Exception e) {
// NOP.
}
return checkLines;
}
public static boolean obtainedEvents(Frame[] frames) {
return obtainedEvents(frames, getCheckLines());
}
public static boolean garbageContains(Frame[] frames) {
return garbageContains(frames, getCheckLines());
}
public static boolean statsHaveExpectedNumberSamples(int expected, int acceptedErrorPercentage) {
double actual = getEventStorageElementCount();
double diffPercentage = Math.abs(actual - expected) / expected;

View File

@ -28,6 +28,7 @@ package MyPackage;
* @summary Verifies the JVMTI Heap Monitor Statistics using CMS GC
* @build Frame HeapMonitor
* @requires vm.gc == "ConcMarkSweep" | vm.gc == "null"
* @requires !vm.graal.enabled
* @compile HeapMonitorGCCMSTest.java
* @run main/othervm/native -agentlib:HeapMonitorTest -XX:+UseConcMarkSweepGC MyPackage.HeapMonitorGCTest
*/

View File

@ -26,11 +26,13 @@ package MyPackage;
import java.util.ArrayList;
import java.util.List;
// Graal is not tested here due to Graal not supporting DisableIntrinsic.
/**
* @test
* @summary Verifies that when the VM event is sent, sampled events are also collected.
* @build Frame HeapMonitor
* @compile HeapMonitorVMEventsTest.java
* @requires !vm.graal.enabled
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions
* -XX:DisableIntrinsic=_clone
* -agentlib:HeapMonitorTest MyPackage.HeapMonitorVMEventsTest

View File

@ -208,6 +208,7 @@ static jboolean check_sample_content(JNIEnv* env,
ObjectTrace* trace,
ExpectedContentFrame *expected,
size_t expected_count,
jboolean check_lines,
int print_out_comparisons) {
jvmtiFrameInfo* frames;
size_t i;
@ -224,6 +225,7 @@ static jboolean check_sample_content(JNIEnv* env,
char *name = NULL, *signature = NULL, *file_name = NULL;
jclass declaring_class;
int line_number;
jboolean differ;
jvmtiError err;
if (bci < 0 && expected[i].line_number != -1) {
@ -258,23 +260,21 @@ static jboolean check_sample_content(JNIEnv* env,
return FALSE;
}
differ = (strcmp(name, expected[i].name) ||
strcmp(signature, expected[i].signature) ||
strcmp(file_name, expected[i].file_name) ||
(check_lines && line_number != expected[i].line_number));
if (print_out_comparisons) {
fprintf(stderr, "\tComparing:\n");
fprintf(stderr, "\tComparing: (check_lines: %d)\n", check_lines);
fprintf(stderr, "\t\tNames: %s and %s\n", name, expected[i].name);
fprintf(stderr, "\t\tSignatures: %s and %s\n", signature, expected[i].signature);
fprintf(stderr, "\t\tFile name: %s and %s\n", file_name, expected[i].file_name);
fprintf(stderr, "\t\tLines: %d and %d\n", line_number, expected[i].line_number);
fprintf(stderr, "\t\tResult is %d\n",
(strcmp(name, expected[i].name) ||
strcmp(signature, expected[i].signature) ||
strcmp(file_name, expected[i].file_name) ||
line_number != expected[i].line_number));
fprintf(stderr, "\t\tResult is %d\n", differ);
}
if (strcmp(name, expected[i].name) ||
strcmp(signature, expected[i].signature) ||
strcmp(file_name, expected[i].file_name) ||
line_number != expected[i].line_number) {
if (differ) {
return FALSE;
}
}
@ -388,14 +388,15 @@ static double event_storage_get_average_rate(EventStorage* storage) {
static jboolean event_storage_contains(JNIEnv* env,
EventStorage* storage,
ExpectedContentFrame* frames,
size_t size) {
size_t size,
jboolean check_lines) {
int i;
event_storage_lock(storage);
fprintf(stderr, "Checking storage count %d\n", storage->live_object_count);
for (i = 0; i < storage->live_object_count; i++) {
ObjectTrace* trace = storage->live_objects[i];
if (check_sample_content(env, trace, frames, size, PRINT_OUT)) {
if (check_sample_content(env, trace, frames, size, check_lines, PRINT_OUT)) {
event_storage_unlock(storage);
return TRUE;
}
@ -407,7 +408,8 @@ static jboolean event_storage_contains(JNIEnv* env,
static jboolean event_storage_garbage_contains(JNIEnv* env,
EventStorage* storage,
ExpectedContentFrame* frames,
size_t size) {
size_t size,
jboolean check_lines) {
int i;
event_storage_lock(storage);
fprintf(stderr, "Checking garbage storage count %d\n",
@ -419,7 +421,7 @@ static jboolean event_storage_garbage_contains(JNIEnv* env,
continue;
}
if (check_sample_content(env, trace, frames, size, PRINT_OUT)) {
if (check_sample_content(env, trace, frames, size, check_lines, PRINT_OUT)) {
event_storage_unlock(storage);
return TRUE;
}
@ -876,7 +878,9 @@ Java_MyPackage_HeapMonitor_disableSamplingEvents(JNIEnv* env, jclass cls) {
}
JNIEXPORT jboolean JNICALL
Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls, jobjectArray frames) {
Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls,
jobjectArray frames,
jboolean check_lines) {
jboolean result;
jsize size = (*env)->GetArrayLength(env, frames);
ExpectedContentFrame *native_frames = malloc(size * sizeof(*native_frames));
@ -886,14 +890,17 @@ Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls, jobjectArray
}
fill_native_frames(env, frames, native_frames, size);
result = event_storage_contains(env, &global_event_storage, native_frames, size);
result = event_storage_contains(env, &global_event_storage, native_frames,
size, check_lines);
free(native_frames), native_frames = NULL;
return result;
}
JNIEXPORT jboolean JNICALL
Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls, jobjectArray frames) {
Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls,
jobjectArray frames,
jboolean check_lines) {
jboolean result;
jsize size = (*env)->GetArrayLength(env, frames);
ExpectedContentFrame *native_frames = malloc(size * sizeof(*native_frames));
@ -903,7 +910,8 @@ Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls, jobjectArray
}
fill_native_frames(env, frames, native_frames, size);
result = event_storage_garbage_contains(env, &global_event_storage, native_frames, size);
result = event_storage_garbage_contains(env, &global_event_storage,
native_frames, size, check_lines);
free(native_frames), native_frames = NULL;
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,10 +32,13 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @library ../share
* @run main/othervm -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcCauseTest02
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies
-XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcCauseTest02
*/
import utils.*;
// This test produces more than 90_000 classes until it eats up ~70% of the 128M meta space.
// We turn off VerifyDependencies because it slows down the test considerably in debug builds.
public class GcCauseTest02 {
public static void main(String[] args) throws Exception {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,10 +32,13 @@
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @library ../share
* @run main/othervm -XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcTest02
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies
-XX:+UsePerfData -XX:MaxNewSize=4m -XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=128M GcTest02
*/
import utils.*;
// This test produces more than 90_000 classes until it eats up ~70% of the 128M meta space.
// We turn off VerifyDependencies because it slows down the test considerably in debug builds.
public class GcTest02 {
public static void main(String[] args) throws Exception {

View File

@ -520,6 +520,7 @@ java/lang/management/MemoryMXBean/Pending.java 8158837 generic-
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all
java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8081652 generic-all
java/lang/management/ThreadMXBean/AllThreadIds.java 8131745 generic-all
############################################################################

View File

@ -24,7 +24,7 @@
/*
@test
@key headful
@bug 4980161 7158623
@bug 4980161 7158623 8204860
@summary Setting focusable window state to false makes the maximized frame resizable
@compile UnfocusableMaximizedFrameResizablity.java
@run main UnfocusableMaximizedFrameResizablity
@ -36,29 +36,84 @@ import java.awt.Rectangle;
import java.awt.AWTException;
import java.awt.event.InputEvent;
import java.awt.Robot;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class UnfocusableMaximizedFrameResizablity {
private static Frame frame;
private static JFrame jframe;
private static Robot robot;
private static boolean isProgInterruption = false;
private static Thread mainThread = null;
private static int sleepTime = 300000;
private static void createAndShowFrame() {
private static void createAndShowFrame() throws Exception {
//The MAXIMIZED_BOTH state is not supported by the toolkit. Nothing to test.
if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
return;
}
frame = new Frame("Unfocusable frame");
//Case 1: Setting frame resizable to true followed by focusable to false
frame = createFrame("Resizable Unfocusable frame");
frame.setResizable(true);
frame.setFocusableWindowState(false);
tryToResizeFrame(frame);
//Case 2: Setting frame focusable to false followed by resizable to true
frame = createFrame("Unfocusable Resizable frame");
frame.setFocusableWindowState(false);
frame.setResizable(true);
tryToResizeFrame(frame);
//Case 3: Testing JFrame fullscreen behaviour only on Mac OS
if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
SwingUtilities.invokeAndWait(new Runnable() {
Override
public void run() {
jframe = createJFrame("Unfocusable Resizable JFrame");
jframe.setFocusableWindowState(false);
jframe.setResizable(true);
Object prop1 = jframe.getRootPane().getClientProperty("apple.awt.fullscreenable");
jframe.setVisible(false);
jframe.setVisible(true);
Object prop2 = jframe.getRootPane().getClientProperty("apple.awt.fullscreenable");
if((prop1 != null && prop2 != null) && (!prop1.equals(prop2))) {
jframe.dispose();
cleanup();
throw new RuntimeException("Non-focusable resizable JFrame is fullscreenable!!");
}
}
});
}
cleanup();
}
private static JFrame createJFrame(String title) {
JFrame jframe = new JFrame(title);
jframe.setMaximizedBounds(new Rectangle(0, 0, 300, 300));
jframe.setSize(200, 200);
jframe.setVisible(true);
jframe.setExtendedState(Frame.MAXIMIZED_BOTH);
return jframe;
}
private static Frame createFrame(String title) {
Frame frame = new Frame(title);
frame.setMaximizedBounds(new Rectangle(0, 0, 300, 300));
frame.setSize(200, 200);
frame.setVisible(true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setFocusableWindowState(false);
return frame;
}
private static void tryToResizeFrame(Frame frame) {
try {
robot = new Robot();
} catch (AWTException e) {
@ -89,16 +144,16 @@ public class UnfocusableMaximizedFrameResizablity {
cleanup();
throw new RuntimeException("The maximized unfocusable frame can be resized.");
}
cleanup();
frame.dispose();
}
private static void cleanup() {
frame.dispose();
isProgInterruption = true;
mainThread.interrupt();
}
public static void main(String args[]) throws InterruptedException {
public static void main(String args[]) throws Exception {
mainThread = Thread.currentThread();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/
/* @test
* @bug 8150782 8207027
* @compile TestAccessClass.java TestCls.java
* @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestAccessClass
*/
@ -54,11 +55,17 @@ public class TestAccessClass {
}
@Test
public void returnsSameClass() throws IllegalAccessException, ClassNotFoundException {
public void returnsSameClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
Class<?> aClass = lookup().accessClass(Class1.class);
assertEquals(Class1.class, aClass);
}
@Test
public void returnsSameArrayClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
Class<?> aClass = lookup().accessClass(Class1[].class);
assertEquals(Class1[].class, aClass);
}
@DataProvider
Object[][] illegalAccessAccess() {
return new Object[][] {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
*/
/* @test
* @bug 8150782 8207027
* @compile TestFindClass.java TestCls.java
* @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestFindClass
*/
@ -56,11 +57,17 @@ public class TestFindClass {
}
@Test
public void returnsRequestedClass() throws IllegalAccessException, ClassNotFoundException {
public void returnsRequestedClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
Class<?> aClass = lookup().findClass(PACKAGE_PREFIX + "TestFindClass$Class1");
assertEquals(Class1.class, aClass);
}
@Test
public void returnsRequestedArrayClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
Class<?> aClass = lookup().findClass("[L" + PACKAGE_PREFIX + "TestFindClass$Class1;");
assertEquals(Class1[].class, aClass);
}
@Test(expectedExceptions = {ClassNotFoundException.class})
public void classNotFoundExceptionTest() throws IllegalAccessException, ClassNotFoundException {
lookup().findClass(PACKAGE_PREFIX + "TestFindClass$NonExistent");

View File

@ -28,6 +28,7 @@
*/
import java.io.IOException;
import java.nio.channels.ClosedSelectorException;
import java.nio.channels.Pipe;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@ -44,9 +45,14 @@ public class RegisterDuringSelect {
@Override
public Void call() throws IOException {
for (;;) {
sel.select();
try {
sel.select();
} catch (ClosedSelectorException ignore) {
return null;
}
if (sel.isOpen()) {
barrier.arriveAndAwaitAdvance();
System.out.println("selectLoop advanced ...");
} else {
// closed
return null;
@ -107,3 +113,4 @@ public class RegisterDuringSelect {
}
}

View File

@ -49,7 +49,7 @@ import org.testng.annotations.Test;
/*
* @test
* @bug 8081022 8151876 8166875 8189784
* @bug 8081022 8151876 8166875 8189784 8206980
* @key randomness
*/
@ -156,12 +156,15 @@ public class TestZoneTextPrinterParser extends AbstractTestPrinterParser {
{"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Pacific/Honolulu", "HST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Halifax", "AST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Juneau", "AKDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Pacific/Honolulu", "HST", none, Locale.ENGLISH, TextStyle.SHORT},
{"America/Halifax", "AST", none, Locale.ENGLISH, TextStyle.SHORT},
{"Z", "Z", none, Locale.ENGLISH, TextStyle.SHORT},
{"Z", "Z", none, Locale.US, TextStyle.SHORT},
{"Z", "Z", none, Locale.CANADA, TextStyle.SHORT},
};
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8202088
* @bug 8202088 8207152
* @summary Test the localized Japanese new era name (May 1st. 2019-)
* is retrieved no matter CLDR provider contains the name or not.
* @modules jdk.localedata
@ -51,7 +51,7 @@ public class JapaneseEraNameTest {
Object[][] names() {
return new Object[][] {
// type, locale, name
{ LONG, JAPAN, "\u65b0\u5143\u53f7" }, // NewEra
{ LONG, JAPAN, "\u5143\u53f7" }, // NewEra
{ LONG, US, "NewEra" },
{ SHORT, JAPAN, "N" },
{ SHORT, US, "N" },

View File

@ -24,7 +24,7 @@
/**
* @test
* @key headful
* @bug 8195095
* @bug 8195095 8206238
* @summary Tests if Images are scaled correctly in JEditorPane.
* @run main ImageViewTest
*/
@ -40,22 +40,16 @@ import javax.swing.WindowConstants;
public class ImageViewTest {
private static final int WIDTH = 200;
private static final int HEIGHT = 200;
private static JFrame f;
private static JEditorPane editorPane1;
private static JEditorPane editorPane2;
private static JEditorPane editorPane3;
private static JEditorPane editorPane4;
private static void test(Robot r, JEditorPane editorPane) throws Exception {
private static void test(Robot r, JEditorPane editorPane,
final int WIDTH, final int HEIGHT ) throws Exception {
SwingUtilities.invokeAndWait(() -> {
f = new JFrame();
editorPane.setEditable(false);
f.add(editorPane);
f.setSize(220,240);
f.setSize(WIDTH + 20, HEIGHT + 40);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
@ -109,34 +103,78 @@ public class ImageViewTest {
Robot r = new Robot();
final JEditorPane[] editorPanes = new JEditorPane[11];
SwingUtilities.invokeAndWait(() -> {
editorPane1 = new JEditorPane("text/html",
editorPanes[0] = new JEditorPane("text/html",
"<img height=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPane2 = new JEditorPane("text/html",
editorPanes[1] = new JEditorPane("text/html",
"<img width=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPane3 = new JEditorPane("text/html",
editorPanes[2] = new JEditorPane("text/html",
"<img width=\"200\" height=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPane4 = new JEditorPane("text/html",
editorPanes[3] = new JEditorPane("text/html",
"<img src=\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[4] = new JEditorPane("text/html",
"<img width=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[5] = new JEditorPane("text/html",
"<img height=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[6] = new JEditorPane("text/html",
"<img width=\"100\" height=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[7] = new JEditorPane("text/html",
"<img width=\"50\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[8] = new JEditorPane("text/html",
"<img height=\"50\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[9] = new JEditorPane("text/html",
"<img width=\"300\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
editorPanes[10] = new JEditorPane("text/html",
"<img height=\"300\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\"");
});
r.waitForIdle();
System.out.println("Test with only height set to 200");
test(r, editorPane1);
test(r, editorPanes[0], 200, 200);
System.out.println("Test with only width set to 200");
test(r, editorPane2);
test(r, editorPanes[1], 200, 200);
System.out.println("Test with none of them set");
test(r, editorPane3);
System.out.println("Test with both of them set");
test(r, editorPanes[2], 200, 200);
System.out.println("Test with both of them set to 200");
test(r, editorPane4);
System.out.println("Test with none of them set to 200");
test(r, editorPanes[3], 200, 200);
System.out.println("Test with only width set to 100");
test(r, editorPanes[4], 100, 100);
System.out.println("Test with only height set to 100");
test(r, editorPanes[5], 100, 100);
System.out.println("Test with both width and height set to 100");
test(r, editorPanes[6], 100, 100);
System.out.println("Test with only width set to 50");
test(r, editorPanes[7], 50, 50);
System.out.println("Test with only height set to 50");
test(r, editorPanes[8], 50, 50);
System.out.println("Test with only width set to 300");
test(r, editorPanes[9], 300, 300);
System.out.println("Test with only height set to 300");
test(r, editorPanes[10], 300, 300);
System.out.println("Test Passed.");
}

View File

@ -24,7 +24,7 @@
/**
* @test
* @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774
* @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
* @requires java.runtime.name ~= "OpenJDK.*"
* @summary Check root CA entries in cacerts file
*/
@ -42,7 +42,7 @@ public class VerifyCACerts {
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
private static final int COUNT = 83;
private static final int COUNT = 90;
// map of cert alias to SHA-256 fingerprint
private static final Map<String, String> FINGERPRINT_MAP
@ -214,6 +214,20 @@ public class VerifyCACerts {
"03:76:AB:1D:54:C5:F9:80:3C:E4:B2:E2:01:A0:EE:7E:EF:7B:57:B6:36:E8:A9:3C:9B:8D:48:60:C9:6F:5F:A7");
put("affirmtrustpremiumeccca [jdk]",
"BD:71:FD:F6:DA:97:E4:CF:62:D1:64:7A:DD:25:81:B0:7D:79:AD:F8:39:7E:B4:EC:BA:9C:5E:84:88:82:14:23");
put("deutschetelekomrootca2 [jdk]",
"B6:19:1A:50:D0:C3:97:7F:7D:A9:9B:CD:AA:C8:6A:22:7D:AE:B9:67:9E:C7:0B:A3:B0:C9:D9:22:71:C1:70:D3");
put("ttelesecglobalrootclass3ca [jdk]",
"FD:73:DA:D3:1C:64:4F:F1:B4:3B:EF:0C:CD:DA:96:71:0B:9C:D9:87:5E:CA:7E:31:70:7A:F3:E9:6D:52:2B:BD");
put("ttelesecglobalrootclass2ca [jdk]",
"91:E2:F5:78:8D:58:10:EB:A7:BA:58:73:7D:E1:54:8A:8E:CA:CD:01:45:98:BC:0B:14:3E:04:1B:17:05:25:52");
put("starfieldservicesrootg2ca [jdk]",
"56:8D:69:05:A2:C8:87:08:A4:B3:02:51:90:ED:CF:ED:B1:97:4A:60:6A:13:C6:E5:29:0F:CB:2A:E6:3E:DA:B5");
put("globalsignca [jdk]",
"EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99");
put("globalsignr3ca [jdk]",
"CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B");
put("globalsigneccrootcar5 [jdk]",
"17:9F:BC:14:8A:3D:D0:0F:D2:4E:A1:34:58:CC:43:BF:A7:F5:9C:81:82:D7:83:A5:13:F6:EB:EC:10:0C:89:24");
}
};

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