src/hotspot/share/classfile/metadataOnStackMark.hpp
author lfoltan
Mon, 21 Oct 2019 13:13:16 -0400
changeset 58722 cba8afa5cfed
parent 54355 f226ab0b7f21
permissions -rw-r--r--
8231844: Enhance type signature characters in classfile_constants.h and improve the JVM to use type signature characters more consistently Summary: Increase the use of type signature constants instead of hard coded characters within the JVM. Reviewed-by: coleenp, dholmes, fparain Contributed-by: lois.foltan@oracle.com, john.r.rose@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
     2
 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     4
 *
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     8
 *
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    13
 * accompanied this code).
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    14
 *
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    18
 *
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    21
 * questions.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    22
 *
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    23
 */
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    25
#ifndef SHARE_CLASSFILE_METADATAONSTACKMARK_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    26
#define SHARE_CLASSFILE_METADATAONSTACKMARK_HPP
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    27
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    28
#include "memory/allocation.hpp"
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    29
#include "utilities/chunkedList.hpp"
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    30
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    31
class Metadata;
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    32
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    33
typedef ChunkedList<Metadata*, mtInternal> MetadataOnStackBuffer;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    34
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    35
// Helper class to mark and unmark metadata used on the stack as either handles
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    36
// or executing methods, so that it can't be deleted during class redefinition
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    37
// and class unloading.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    38
// This is also used for other things that can be deallocated, like class
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    39
// metadata during parsing if errors occur, relocated methods, and temporary
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    40
// constant pools.
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    41
class MetadataOnStackMark : public StackObj {
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    42
  NOT_PRODUCT(static bool _is_active;)
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    43
  static MetadataOnStackBuffer* _used_buffers;
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    44
  static MetadataOnStackBuffer* _free_buffers;
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    45
  static MetadataOnStackBuffer* _current_buffer;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    46
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    47
  static MetadataOnStackBuffer* allocate_buffer();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    48
  static void retire_buffer(MetadataOnStackBuffer* buffer);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    49
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    50
 public:
54355
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 53244
diff changeset
    51
  MetadataOnStackMark(bool walk_all_metadata, bool redefinition_walk);
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    52
   ~MetadataOnStackMark();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    53
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    54
  static void record(Metadata* m);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    55
  static void retire_current_buffer();
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    56
};
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    57
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 47216
diff changeset
    58
#endif // SHARE_CLASSFILE_METADATAONSTACKMARK_HPP