src/hotspot/share/prims/resolvedMethodTable.hpp
author stefank
Wed, 10 Apr 2019 15:41:04 +0200
changeset 54511 fbfcebad8e66
parent 53924 09cba396916f
child 54574 7b74bbe5085b
permissions -rw-r--r--
8221393: ResolvedMethodTable too small for StackWalking applications Reviewed-by: coleenp, rehn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51567
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     4
 *
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     8
 *
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    13
 * accompanied this code).
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    14
 *
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    18
 *
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    21
 * questions.
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    22
 *
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    23
 */
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51567
diff changeset
    25
#ifndef SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51567
diff changeset
    26
#define SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    27
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    28
#include "gc/shared/oopStorage.hpp"
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    29
#include "gc/shared/oopStorageParState.hpp"
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    30
#include "memory/allocation.hpp"
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    31
#include "oops/symbol.hpp"
49818
e57e6addb978 8201505: Use WeakHandle for ProtectionDomainCacheTable and ResolvedMethodTable
coleenp
parents: 48615
diff changeset
    32
#include "oops/weakHandle.hpp"
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    33
#include "utilities/concurrentHashTable.hpp"
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    34
#include "utilities/hashtable.hpp"
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    35
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    36
class ResolvedMethodTable;
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    37
class ResolvedMethodTableConfig;
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    38
typedef ConcurrentHashTable<WeakHandle<vm_resolved_method_table_data>, ResolvedMethodTableConfig, mtClass> ResolvedMethodTableHash;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    39
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    40
class ResolvedMethodTable : public AllStatic {
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    41
  static ResolvedMethodTableHash* _local_table;
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    42
  static size_t                   _current_size;
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 49818
diff changeset
    43
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    44
  static OopStorage*              _weak_handles;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    45
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    46
  static volatile bool            _has_work;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    47
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    48
  static volatile size_t          _items_count;
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    49
  static volatile size_t          _uncleaned_items_count;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    50
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    51
public:
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    52
  // Initialization
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    53
  static void create_table();
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    54
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    55
  static size_t table_size();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    56
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    57
  // Lookup and inserts
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    58
  static oop find_method(const Method* method);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    59
  static oop add_method(const Method* method, Handle rmethod_name);
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    60
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    61
  // Callbacks
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    62
  static void item_added();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    63
  static void item_removed();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    64
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    65
  // Cleaning
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    66
  static bool has_work();
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    67
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    68
  // GC Support - Backing storage for the oop*s
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    69
  static OopStorage* weak_storage();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    70
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    71
  // Cleaning and table management
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    72
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    73
  static double get_load_factor();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    74
  static double get_dead_factor();
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 49818
diff changeset
    75
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    76
  static void check_concurrent_work();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    77
  static void trigger_concurrent_work();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    78
  static void do_concurrent_work(JavaThread* jt);
51567
0c4f2b26849e 8209844: MemberNameLeak.java fails when ResolvedMethod entry is not removed
pchilanomate
parents: 51472
diff changeset
    79
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    80
  static void grow(JavaThread* jt);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    81
  static void clean_dead_entries(JavaThread* jt);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    82
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    83
  // GC Notification
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    84
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    85
  // Must be called before a parallel walk where objects might die.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    86
  static void reset_dead_counter();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    87
  // After the parallel walk this method must be called to trigger
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    88
  // cleaning. Note it might trigger a resize instead.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    89
  static void finish_dead_counter();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    90
  // If GC uses ParState directly it should add the number of cleared
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    91
  // entries to this method.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    92
  static void inc_dead_counter(size_t ndead);
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    93
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    94
  // JVMTI Support - It is called at safepoint only for RedefineClasses
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    95
  JVMTI_ONLY(static void adjust_method_entries(bool * trace_name_printed);)
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    96
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    97
  // Debugging
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    98
  static size_t items_count();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    99
  static size_t verify_and_compare_entries();
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
   100
};
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
   101
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51567
diff changeset
   102
#endif // SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP