Skip to content

Commit

Permalink
8292312: Work around memset() called operator new
Browse files Browse the repository at this point in the history
Reviewed-by: dcubed
  • Loading branch information
iklam committed Aug 19, 2022
1 parent 964aac2 commit 2edd550
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/synchronizer.cpp
Expand Up @@ -78,7 +78,7 @@ void ObjectMonitorsHashtable::add_entry(void* key, ObjectMonitor* om) {
ObjectMonitorsHashtable::PtrList* list = get_entry(key);
if (list == nullptr) {
// Create new list and add it to the hash table:
list = new (ResourceObj::C_HEAP, mtThread) ObjectMonitorsHashtable::PtrList();
list = new (ResourceObj::C_HEAP, mtThread) ObjectMonitorsHashtable::PtrList;
add_entry(key, list);
}
list->add(om); // Add the ObjectMonitor to the list.
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/synchronizer.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022, 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
Expand Down Expand Up @@ -66,7 +66,7 @@ class ObjectMonitorsHashtable {
// ResourceHashtable is passed to various functions and populated in
// different places so we allocate it using C_HEAP to make it immune
// from any ResourceMarks that happen to be in the code paths.
ObjectMonitorsHashtable() : _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable()), _key_count(0), _om_count(0) {}
ObjectMonitorsHashtable() : _ptrs(new (ResourceObj::C_HEAP, mtThread) PtrTable), _key_count(0), _om_count(0) {}

~ObjectMonitorsHashtable();

Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/utilities/resourceHash.hpp
Expand Up @@ -26,6 +26,7 @@
#define SHARE_UTILITIES_RESOURCEHASH_HPP

#include "memory/allocation.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/numberSeq.hpp"
#include "utilities/tableStatistics.hpp"

Expand Down Expand Up @@ -289,7 +290,7 @@ class FixedResourceHashtableStorage : public ResourceObj {

Node* _table[TABLE_SIZE];
protected:
FixedResourceHashtableStorage() : _table() {}
FixedResourceHashtableStorage() { memset(_table, 0, sizeof(_table)); }
~FixedResourceHashtableStorage() = default;

constexpr unsigned table_size() const {
Expand Down

1 comment on commit 2edd550

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.