8292312: Work around memset() called operator new

Reviewed-by: dcubed
This commit is contained in:
Ioi Lam 2022-08-19 03:05:13 +00:00
parent 964aac28fe
commit 2edd550105
3 changed files with 5 additions and 4 deletions
src/hotspot/share

@ -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.

@ -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
@ -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();

@ -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"
@ -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 {