src/hotspot/share/classfile/metadataOnStackMark.cpp
author lfoltan
Mon, 21 Oct 2019 13:13:16 -0400
changeset 58722 cba8afa5cfed
parent 54669 ad45b3802d4e
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
/*
54150
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
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
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    25
#include "precompiled.hpp"
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    26
#include "classfile/metadataOnStackMark.hpp"
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    27
#include "code/codeCache.hpp"
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    28
#include "compiler/compileBroker.hpp"
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    29
#include "oops/metadata.hpp"
21519
72e63a0dbda2 8026946: JvmtiEnv::SetBreakpoint and JvmtiEnv::ClearBreakpoint should use MethodHandle
coleenp
parents: 15430
diff changeset
    30
#include "prims/jvmtiImpl.hpp"
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    31
#include "runtime/synchronizer.hpp"
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    32
#include "runtime/thread.hpp"
21735
379ba90c3dc4 8027630: SIGSEGV in const char*Klass::external_name()
sla
parents: 21519
diff changeset
    33
#include "services/threadService.hpp"
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    34
#include "utilities/chunkedList.hpp"
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    35
#if INCLUDE_JVMCI
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 54355
diff changeset
    36
#include "jvmci/jvmci.hpp"
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    37
#endif
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    38
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    39
MetadataOnStackBuffer* MetadataOnStackMark::_used_buffers = NULL;
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    40
MetadataOnStackBuffer* MetadataOnStackMark::_free_buffers = NULL;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    41
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    42
MetadataOnStackBuffer* MetadataOnStackMark::_current_buffer = NULL;
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    43
NOT_PRODUCT(bool MetadataOnStackMark::_is_active = false;)
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    44
54150
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    45
class MetadataOnStackClosure : public MetadataClosure {
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    46
  void do_metadata(Metadata* m) { Metadata::mark_on_stack(m); }
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    47
};
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    48
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    49
// Walk metadata on the stack and mark it so that redefinition doesn't delete
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    50
// it.  Class unloading only deletes in-error class files, methods created by
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    51
// the relocator and dummy constant pools.  None of these appear anywhere except
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    52
// in metadata Handles.
54355
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    53
MetadataOnStackMark::MetadataOnStackMark(bool walk_all_metadata, bool redefinition_walk) {
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    54
  assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    55
  assert(_used_buffers == NULL, "sanity check");
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    56
  assert(!_is_active, "MetadataOnStackMarks do not nest");
54355
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    57
  assert(!redefinition_walk || walk_all_metadata,
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    58
         "walk_all_metadata must be true for redefinition_walk");
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    59
  NOT_PRODUCT(_is_active = true;)
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    60
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    61
  Threads::metadata_handles_do(Metadata::mark_on_stack);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    62
54355
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    63
  if (walk_all_metadata) {
54150
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    64
    MetadataOnStackClosure md_on_stack;
5529640c5f67 8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents: 47216
diff changeset
    65
    Threads::metadata_do(&md_on_stack);
54355
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    66
    if (redefinition_walk) {
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    67
      // We have to walk the whole code cache during redefinition.
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    68
      CodeCache::metadata_do(&md_on_stack);
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    69
    } else {
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    70
      CodeCache::old_nmethods_do(&md_on_stack);
f226ab0b7f21 8221183: Avoid code cache walk in MetadataOnStackMark
coleenp
parents: 54150
diff changeset
    71
    }
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    72
    CompileBroker::mark_on_stack();
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    73
    JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    74
    ThreadService::metadata_do(Metadata::mark_on_stack);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    75
#if INCLUDE_JVMCI
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 54355
diff changeset
    76
    JVMCI::metadata_do(Metadata::mark_on_stack);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    77
#endif
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    78
  }
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    79
}
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    80
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    81
MetadataOnStackMark::~MetadataOnStackMark() {
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    82
  assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    83
  // Unmark everything that was marked.   Can't do the same walk because
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    84
  // redefine classes messes up the code cache so the set of methods
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    85
  // might not be the same.
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    86
  retire_current_buffer();
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    87
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    88
  MetadataOnStackBuffer* buffer = _used_buffers;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    89
  while (buffer != NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    90
    // Clear on stack state for all metadata.
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    91
    size_t size = buffer->size();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    92
    for (size_t i  = 0; i < size; i++) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    93
      Metadata* md = buffer->at(i);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    94
      md->set_on_stack(false);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    95
    }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    96
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    97
    MetadataOnStackBuffer* next = buffer->next_used();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    98
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    99
    // Move the buffer to the free list.
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   100
    buffer->clear();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   101
    buffer->set_next_used(NULL);
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   102
    buffer->set_next_free(_free_buffers);
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   103
    _free_buffers = buffer;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   104
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   105
    // Step to next used buffer.
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   106
    buffer = next;
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   107
  }
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   108
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   109
  _used_buffers = NULL;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   110
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   111
  NOT_PRODUCT(_is_active = false;)
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   112
}
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   113
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   114
void MetadataOnStackMark::retire_buffer(MetadataOnStackBuffer* buffer) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   115
  if (buffer == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   116
    return;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   117
  }
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   118
  buffer->set_next_used(_used_buffers);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   119
  _used_buffers = buffer;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   120
}
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   121
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   122
// Current buffer is full or we're ready to walk them, add it to the used list.
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   123
void MetadataOnStackMark::retire_current_buffer() {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   124
  retire_buffer(_current_buffer);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   125
  _current_buffer = NULL;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   126
}
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   127
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   128
// Get buffer off free list.
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   129
MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   130
  MetadataOnStackBuffer* allocated = _free_buffers;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   131
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   132
  if (allocated != NULL) {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   133
    _free_buffers = allocated->next_free();
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   134
  }
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   135
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   136
  if (allocated == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   137
    allocated = new MetadataOnStackBuffer();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   138
  }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   139
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 29576
diff changeset
   140
  assert(!allocated->is_full(), "Should not be full: " PTR_FORMAT, p2i(allocated));
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   141
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   142
  return allocated;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   143
}
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   144
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   145
// Record which objects are marked so we can unmark the same objects.
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   146
void MetadataOnStackMark::record(Metadata* m) {
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   147
  assert(_is_active, "metadata on stack marking is active");
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   148
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   149
  MetadataOnStackBuffer* buffer = _current_buffer;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   150
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   151
  if (buffer != NULL && buffer->is_full()) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   152
    retire_buffer(buffer);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   153
    buffer = NULL;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   154
  }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   155
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   156
  if (buffer == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   157
    buffer = allocate_buffer();
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   158
    _current_buffer = buffer;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   159
  }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   160
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   161
  buffer->push(m);
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   162
}