hotspot/src/share/vm/classfile/metadataOnStackMark.hpp
author stefank
Thu, 02 Oct 2014 10:55:36 +0200
changeset 27247 99db666dbe8e
parent 26558 b7df27df6384
child 29576 c223b0a9872e
permissions -rw-r--r--
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse Reviewed-by: mgerdin, coleenp, bdelsart
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
/*
26558
b7df27df6384 8055008: Clean up code that saves the previous versions of redefined classes
coleenp
parents: 15430
diff changeset
     2
 * Copyright (c) 2013, 2014, 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
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    25
#ifndef SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    26
#define SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP
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
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    39
// metadata during parsing, relocated methods, and methods in backtraces.
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    40
class MetadataOnStackMark : public StackObj {
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    41
  NOT_PRODUCT(static bool _is_active;)
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    42
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    43
  static volatile MetadataOnStackBuffer* _used_buffers;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    44
  static volatile MetadataOnStackBuffer* _free_buffers;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    45
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    46
  static MetadataOnStackBuffer* allocate_buffer();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    47
  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
    48
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    49
 public:
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    50
  MetadataOnStackMark(bool visit_code_cache);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    51
   ~MetadataOnStackMark();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    52
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    53
  static void record(Metadata* m, Thread* thread);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    54
  static void retire_buffer_for_thread(Thread* thread);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    55
  static bool has_buffer_for_thread(Thread* thread);
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
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    58
#endif // SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP