src/hotspot/share/prims/resolvedMethodTable.hpp
author coleenp
Thu, 16 May 2019 07:09:17 -0400
changeset 54896 ea619918de95
parent 54574 7b74bbe5085b
child 57828 35db8fba55f9
permissions -rw-r--r--
8223956: Make SymbolTable and StringTable AllStatic Summary: Removed superfluous and confusing _the_table pointer. Reviewed-by: gziemski, 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 "memory/allocation.hpp"
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    30
#include "oops/symbol.hpp"
49818
e57e6addb978 8201505: Use WeakHandle for ProtectionDomainCacheTable and ResolvedMethodTable
coleenp
parents: 48615
diff changeset
    31
#include "oops/weakHandle.hpp"
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    32
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    33
class ResolvedMethodTable;
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    34
class ResolvedMethodTableConfig;
46505
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 : public AllStatic {
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    37
  static OopStorage*              _weak_handles;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    38
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    39
  static volatile bool            _has_work;
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    40
public:
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    41
  // Initialization
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    42
  static void create_table();
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    43
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    44
  static size_t table_size();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    45
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    46
  // Lookup and inserts
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    47
  static oop find_method(const Method* method);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    48
  static oop add_method(const Method* method, Handle rmethod_name);
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    49
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    50
  // Callbacks
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    51
  static void item_added();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    52
  static void item_removed();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    53
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    54
  // Cleaning
54896
ea619918de95 8223956: Make SymbolTable and StringTable AllStatic
coleenp
parents: 54574
diff changeset
    55
  static bool has_work() { return _has_work; }
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    56
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    57
  // GC Support - Backing storage for the oop*s
54896
ea619918de95 8223956: Make SymbolTable and StringTable AllStatic
coleenp
parents: 54574
diff changeset
    58
  static OopStorage* weak_storage() { return _weak_handles; }
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    59
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    60
  // Cleaning and table management
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    61
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    62
  static double get_load_factor();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    63
  static double get_dead_factor();
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 49818
diff changeset
    64
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    65
  static void check_concurrent_work();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    66
  static void trigger_concurrent_work();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    67
  static void do_concurrent_work(JavaThread* jt);
51567
0c4f2b26849e 8209844: MemberNameLeak.java fails when ResolvedMethod entry is not removed
pchilanomate
parents: 51472
diff changeset
    68
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    69
  static void grow(JavaThread* jt);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    70
  static void clean_dead_entries(JavaThread* jt);
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    71
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    72
  // GC Notification
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    73
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    74
  // Must be called before a parallel walk where objects might die.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    75
  static void reset_dead_counter();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    76
  // After the parallel walk this method must be called to trigger
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    77
  // cleaning. Note it might trigger a resize instead.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    78
  static void finish_dead_counter();
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    79
  // 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
    80
  // entries to this method.
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    81
  static void inc_dead_counter(size_t ndead);
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    82
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    83
  // JVMTI Support - It is called at safepoint only for RedefineClasses
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    84
  JVMTI_ONLY(static void adjust_method_entries(bool * trace_name_printed);)
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    85
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    86
  // Debugging
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53924
diff changeset
    87
  static size_t items_count();
54574
7b74bbe5085b 8222558: Rework ResolvedMethodTable verification
stefank
parents: 54511
diff changeset
    88
  static void verify();
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    89
};
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents:
diff changeset
    90
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51567
diff changeset
    91
#endif // SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP