hotspot/src/share/vm/classfile/metadataOnStackMark.cpp
author mchung
Mon, 23 Nov 2015 12:44:43 -0800
changeset 34253 ba3946143842
parent 33198 b37ad9fbf681
child 38133 78b95467b9f1
permissions -rw-r--r--
8140450: Implement JEP 259: Stack-Walking API Reviewed-by: coleenp, dfuchs, bchristi, psandoz, sspitsyn Contributed-by: Mandy Chung <mandy.chung@oracle.com>, Brent Christian <brent.christian@oracle.com>, Daniel Fuchs <daniel.fuchs@oracle.com>, Hamlin Li <huaming.li@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
/*
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
     2
 * Copyright (c) 2013, 2015, 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
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    36
#include "jvmci/jvmciRuntime.hpp"
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
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    45
// 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
    46
// 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
    47
// 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
    48
// in metadata Handles.
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    49
MetadataOnStackMark::MetadataOnStackMark(bool redefinition_walk) {
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    50
  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
    51
  assert(_used_buffers == NULL, "sanity check");
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    52
  assert(!_is_active, "MetadataOnStackMarks do not nest");
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    53
  NOT_PRODUCT(_is_active = true;)
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    54
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    55
  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
    56
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    57
  if (redefinition_walk) {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    58
    Threads::metadata_do(Metadata::mark_on_stack);
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    59
    CodeCache::alive_nmethods_do(nmethod::mark_on_stack);
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    60
    CompileBroker::mark_on_stack();
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    61
    JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    62
    ThreadService::metadata_do(Metadata::mark_on_stack);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    63
#if INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    64
    JVMCIRuntime::metadata_do(Metadata::mark_on_stack);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 29576
diff changeset
    65
#endif
25492
d27050bdfb04 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 25491
diff changeset
    66
  }
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    67
}
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    68
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    69
MetadataOnStackMark::~MetadataOnStackMark() {
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    70
  assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    71
  // 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
    72
  // 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
    73
  // might not be the same.
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    74
  retire_current_buffer();
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    75
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    76
  MetadataOnStackBuffer* buffer = _used_buffers;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    77
  while (buffer != NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    78
    // 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
    79
    size_t size = buffer->size();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    80
    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
    81
      Metadata* md = buffer->at(i);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    82
      md->set_on_stack(false);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    83
    }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    84
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    85
    MetadataOnStackBuffer* next = buffer->next_used();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    86
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    87
    // 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
    88
    buffer->clear();
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    89
    buffer->set_next_used(NULL);
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
    90
    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
    91
    _free_buffers = buffer;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    92
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    93
    // Step to next used buffer.
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    94
    buffer = next;
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    95
  }
27247
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
  _used_buffers = NULL;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
    98
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
    99
  NOT_PRODUCT(_is_active = false;)
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   100
}
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   101
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   102
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
   103
  if (buffer == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   104
    return;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   105
  }
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   106
  buffer->set_next_used(_used_buffers);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   107
  _used_buffers = buffer;
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
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   110
// 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
   111
void MetadataOnStackMark::retire_current_buffer() {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   112
  retire_buffer(_current_buffer);
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   113
  _current_buffer = NULL;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   114
}
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   115
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   116
// 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
   117
MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   118
  MetadataOnStackBuffer* allocated = _free_buffers;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   119
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   120
  if (allocated != NULL) {
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   121
    _free_buffers = allocated->next_free();
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   122
  }
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   123
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   124
  if (allocated == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   125
    allocated = new MetadataOnStackBuffer();
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
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 29576
diff changeset
   128
  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
   129
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   130
  return allocated;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   131
}
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   132
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   133
// 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
   134
void MetadataOnStackMark::record(Metadata* m) {
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   135
  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
   136
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   137
  MetadataOnStackBuffer* buffer = _current_buffer;
27247
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
  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
   140
    retire_buffer(buffer);
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   141
    buffer = NULL;
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   142
  }
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
  if (buffer == NULL) {
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   145
    buffer = allocate_buffer();
29576
c223b0a9872e 8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents: 27247
diff changeset
   146
    _current_buffer = buffer;
27247
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   147
  }
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   148
99db666dbe8e 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 26558
diff changeset
   149
  buffer->push(m);
15430
7c35f12cf1e5 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
   150
}