Skip to content
Permalink
Browse files

Automatic merge of jdk:master into master

  • Loading branch information
duke
duke committed Jul 7, 2020
2 parents 153cbc4 + 485194c commit 669c582fd28704129a0c96ce559d2f6635f3681b
@@ -65,9 +65,7 @@ void ShenandoahBarrierSetC2State::add_enqueue_barrier(ShenandoahEnqueueBarrierNo
}

void ShenandoahBarrierSetC2State::remove_enqueue_barrier(ShenandoahEnqueueBarrierNode * n) {
if (_enqueue_barriers->contains(n)) {
_enqueue_barriers->remove(n);
}
_enqueue_barriers->remove_if_existing(n);
}

int ShenandoahBarrierSetC2State::load_reference_barriers_count() const {
@@ -667,23 +667,20 @@ class Compile : public Phase {
assert(!_macro_nodes->contains(n), "duplicate entry in expand list");
_macro_nodes->append(n);
}
void remove_macro_node(Node * n) {
// this function may be called twice for a node so check
// that the node is in the array before attempting to remove it
if (_macro_nodes->contains(n))
_macro_nodes->remove(n);
void remove_macro_node(Node* n) {
// this function may be called twice for a node so we can only remove it
// if it's still existing.
_macro_nodes->remove_if_existing(n);
// remove from _predicate_opaqs list also if it is there
if (predicate_count() > 0 && _predicate_opaqs->contains(n)){
_predicate_opaqs->remove(n);
if (predicate_count() > 0) {
_predicate_opaqs->remove_if_existing(n);
}
}
void add_expensive_node(Node * n);
void remove_expensive_node(Node * n) {
if (_expensive_nodes->contains(n)) {
_expensive_nodes->remove(n);
}
void add_expensive_node(Node* n);
void remove_expensive_node(Node* n) {
_expensive_nodes->remove_if_existing(n);
}
void add_predicate_opaq(Node * n) {
void add_predicate_opaq(Node* n) {
assert(!_predicate_opaqs->contains(n), "duplicate entry in predicate opaque1");
assert(_macro_nodes->contains(n), "should have already been in macro list");
_predicate_opaqs->append(n);
@@ -692,9 +689,7 @@ class Compile : public Phase {
// Range check dependent CastII nodes that can be removed after loop optimizations
void add_range_check_cast(Node* n);
void remove_range_check_cast(Node* n) {
if (_range_check_casts->contains(n)) {
_range_check_casts->remove(n);
}
_range_check_casts->remove_if_existing(n);
}
Node* range_check_cast_node(int idx) const { return _range_check_casts->at(idx); }
int range_check_cast_count() const { return _range_check_casts->length(); }
@@ -703,9 +698,7 @@ class Compile : public Phase {

void add_opaque4_node(Node* n);
void remove_opaque4_node(Node* n) {
if (_opaque4_nodes->contains(n)) {
_opaque4_nodes->remove(n);
}
_opaque4_nodes->remove_if_existing(n);
}
Node* opaque4_node(int idx) const { return _opaque4_nodes->at(idx); }
int opaque4_count() const { return _opaque4_nodes->length(); }
@@ -137,12 +137,7 @@ class JvmtiPendingMonitors : public AllStatic {

// Return false if monitor is not found in the list.
static bool exit(JvmtiRawMonitor* monitor) {
if (monitors()->contains(monitor)) {
monitors()->remove(monitor);
return true;
} else {
return false;
}
return monitors()->remove_if_existing(monitor);
}

static void transition_raw_monitors();
@@ -207,21 +207,31 @@ class GrowableArrayView : public GrowableArrayBase {
return -1;
}

// Order preserving remove operations.

void remove(const E& elem) {
// Assuming that element does exist.
bool removed = remove_if_existing(elem);
if (removed) return;
ShouldNotReachHere();
}

bool remove_if_existing(const E& elem) {
// Returns TRUE if elem is removed.
for (int i = 0; i < _len; i++) {
if (_data[i] == elem) {
for (int j = i + 1; j < _len; j++) _data[j-1] = _data[j];
_len--;
return;
remove_at(i);
return true;
}
}
ShouldNotReachHere();
return false;
}

// The order is preserved.
void remove_at(int index) {
assert(0 <= index && index < _len, "illegal index");
for (int j = index + 1; j < _len; j++) _data[j-1] = _data[j];
for (int j = index + 1; j < _len; j++) {
_data[j-1] = _data[j];
}
_len--;
}

0 comments on commit 669c582

Please sign in to comment.