mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8292312: Work around memset() called operator new
Reviewed-by: dcubed
This commit is contained in:
parent
964aac28fe
commit
2edd550105
3 changed files with 5 additions and 4 deletions
|
@ -78,7 +78,7 @@ void ObjectMonitorsHashtable::add_entry(void* key, ObjectMonitor* om) {
|
||||||
ObjectMonitorsHashtable::PtrList* list = get_entry(key);
|
ObjectMonitorsHashtable::PtrList* list = get_entry(key);
|
||||||
if (list == nullptr) {
|
if (list == nullptr) {
|
||||||
// Create new list and add it to the hash table:
|
// 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);
|
add_entry(key, list);
|
||||||
}
|
}
|
||||||
list->add(om); // Add the ObjectMonitor to the 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.
|
* 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
|
||||||
|
@ -66,7 +66,7 @@ class ObjectMonitorsHashtable {
|
||||||
// ResourceHashtable is passed to various functions and populated in
|
// ResourceHashtable is passed to various functions and populated in
|
||||||
// different places so we allocate it using C_HEAP to make it immune
|
// different places so we allocate it using C_HEAP to make it immune
|
||||||
// from any ResourceMarks that happen to be in the code paths.
|
// 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();
|
~ObjectMonitorsHashtable();
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define SHARE_UTILITIES_RESOURCEHASH_HPP
|
#define SHARE_UTILITIES_RESOURCEHASH_HPP
|
||||||
|
|
||||||
#include "memory/allocation.hpp"
|
#include "memory/allocation.hpp"
|
||||||
|
#include "utilities/globalDefinitions.hpp"
|
||||||
#include "utilities/numberSeq.hpp"
|
#include "utilities/numberSeq.hpp"
|
||||||
#include "utilities/tableStatistics.hpp"
|
#include "utilities/tableStatistics.hpp"
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ class FixedResourceHashtableStorage : public ResourceObj {
|
||||||
|
|
||||||
Node* _table[TABLE_SIZE];
|
Node* _table[TABLE_SIZE];
|
||||||
protected:
|
protected:
|
||||||
FixedResourceHashtableStorage() : _table() {}
|
FixedResourceHashtableStorage() { memset(_table, 0, sizeof(_table)); }
|
||||||
~FixedResourceHashtableStorage() = default;
|
~FixedResourceHashtableStorage() = default;
|
||||||
|
|
||||||
constexpr unsigned table_size() const {
|
constexpr unsigned table_size() const {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue