mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8227633: avoid comparing this pointers to NULL
Reviewed-by: coleenp, mdoerr
This commit is contained in:
parent
a91f9c4c7e
commit
39b7b5bbf9
3 changed files with 23 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1513,7 +1513,7 @@ Predicate *InstructForm::build_predicate() {
|
||||||
|
|
||||||
MatchNode *mnode =
|
MatchNode *mnode =
|
||||||
strcmp(_matrule->_opType, "Set") ? _matrule : _matrule->_rChild;
|
strcmp(_matrule->_opType, "Set") ? _matrule : _matrule->_rChild;
|
||||||
mnode->count_instr_names(names);
|
if (mnode != NULL) mnode->count_instr_names(names);
|
||||||
|
|
||||||
uint first = 1;
|
uint first = 1;
|
||||||
// Start with the predicate supplied in the .ad file.
|
// Start with the predicate supplied in the .ad file.
|
||||||
|
@ -1726,26 +1726,25 @@ bool Opcode::print_opcode(FILE *fp, Opcode::opcode_type desired_opcode) {
|
||||||
const char *description = NULL;
|
const char *description = NULL;
|
||||||
const char *value = NULL;
|
const char *value = NULL;
|
||||||
// Check if user provided any opcode definitions
|
// Check if user provided any opcode definitions
|
||||||
if( this != NULL ) {
|
// Update 'value' if user provided a definition in the instruction
|
||||||
// Update 'value' if user provided a definition in the instruction
|
switch (desired_opcode) {
|
||||||
switch (desired_opcode) {
|
case PRIMARY:
|
||||||
case PRIMARY:
|
description = "primary()";
|
||||||
description = "primary()";
|
if( _primary != NULL) { value = _primary; }
|
||||||
if( _primary != NULL) { value = _primary; }
|
break;
|
||||||
break;
|
case SECONDARY:
|
||||||
case SECONDARY:
|
description = "secondary()";
|
||||||
description = "secondary()";
|
if( _secondary != NULL ) { value = _secondary; }
|
||||||
if( _secondary != NULL ) { value = _secondary; }
|
break;
|
||||||
break;
|
case TERTIARY:
|
||||||
case TERTIARY:
|
description = "tertiary()";
|
||||||
description = "tertiary()";
|
if( _tertiary != NULL ) { value = _tertiary; }
|
||||||
if( _tertiary != NULL ) { value = _tertiary; }
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
assert( false, "ShouldNotReachHere();");
|
||||||
assert( false, "ShouldNotReachHere();");
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != NULL) {
|
if (value != NULL) {
|
||||||
fprintf(fp, "(%s /*%s*/)", value, description);
|
fprintf(fp, "(%s /*%s*/)", value, description);
|
||||||
}
|
}
|
||||||
|
@ -3413,7 +3412,6 @@ const char *MatchNode::reduce_left(FormDict &globals) const {
|
||||||
// Count occurrences of operands names in the leaves of the instruction
|
// Count occurrences of operands names in the leaves of the instruction
|
||||||
// match rule.
|
// match rule.
|
||||||
void MatchNode::count_instr_names( Dict &names ) {
|
void MatchNode::count_instr_names( Dict &names ) {
|
||||||
if( this == NULL ) return;
|
|
||||||
if( _lChild ) _lChild->count_instr_names(names);
|
if( _lChild ) _lChild->count_instr_names(names);
|
||||||
if( _rChild ) _rChild->count_instr_names(names);
|
if( _rChild ) _rChild->count_instr_names(names);
|
||||||
if( !_lChild && !_rChild ) {
|
if( !_lChild && !_rChild ) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2377,7 +2377,7 @@ private:
|
||||||
_processing_noninput = false;
|
_processing_noninput = false;
|
||||||
// A replacement variable, originally '$'
|
// A replacement variable, originally '$'
|
||||||
if ( Opcode::as_opcode_type(rep_var) != Opcode::NOT_AN_OPCODE ) {
|
if ( Opcode::as_opcode_type(rep_var) != Opcode::NOT_AN_OPCODE ) {
|
||||||
if (!_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(rep_var) )) {
|
if ((_inst._opcode == NULL) || !_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(rep_var) )) {
|
||||||
// Missing opcode
|
// Missing opcode
|
||||||
_AD.syntax_err( _inst._linenum,
|
_AD.syntax_err( _inst._linenum,
|
||||||
"Missing $%s opcode definition in %s, used by encoding %s\n",
|
"Missing $%s opcode definition in %s, used by encoding %s\n",
|
||||||
|
@ -2433,7 +2433,7 @@ private:
|
||||||
else if( Opcode::as_opcode_type(inst_rep_var) != Opcode::NOT_AN_OPCODE ) {
|
else if( Opcode::as_opcode_type(inst_rep_var) != Opcode::NOT_AN_OPCODE ) {
|
||||||
// else check if "primary", "secondary", "tertiary"
|
// else check if "primary", "secondary", "tertiary"
|
||||||
assert( _constant_status == LITERAL_ACCESSED, "Must be processing a literal constant parameter");
|
assert( _constant_status == LITERAL_ACCESSED, "Must be processing a literal constant parameter");
|
||||||
if (!_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(inst_rep_var) )) {
|
if ((_inst._opcode == NULL) || !_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(inst_rep_var) )) {
|
||||||
// Missing opcode
|
// Missing opcode
|
||||||
_AD.syntax_err( _inst._linenum,
|
_AD.syntax_err( _inst._linenum,
|
||||||
"Missing $%s opcode definition in %s\n",
|
"Missing $%s opcode definition in %s\n",
|
||||||
|
|
|
@ -43,7 +43,6 @@ const VectorSet *Set::asVectorSet() const { assert(0); return NULL; }
|
||||||
// The caller must deallocate the string.
|
// The caller must deallocate the string.
|
||||||
char *Set::setstr() const
|
char *Set::setstr() const
|
||||||
{
|
{
|
||||||
if( this == NULL ) return os::strdup("{no set}");
|
|
||||||
Set &set = clone(); // Virtually copy the basic set.
|
Set &set = clone(); // Virtually copy the basic set.
|
||||||
set.Sort(); // Sort elements for in-order retrieval
|
set.Sort(); // Sort elements for in-order retrieval
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue