< prev index next >

src/hotspot/share/interpreter/oopMapCache.cpp

Print this page

  1 /*
  2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

577 // This is called after GC threads are done and nothing is accessing the old_entries
578 // list, so no synchronization needed.
579 void OopMapCache::cleanup_old_entries() {
580   OopMapCacheEntry* entry = _old_entries;
581   _old_entries = NULL;
582   while (entry != NULL) {
583     if (log_is_enabled(Debug, interpreter, oopmap)) {
584       ResourceMark rm;
585       log_debug(interpreter, oopmap)("cleanup entry %s at bci %d",
586                           entry->method()->name_and_sig_as_C_string(), entry->bci());
587     }
588     OopMapCacheEntry* next = entry->_next;
589     entry->flush();
590     FREE_C_HEAP_OBJ(entry);
591     entry = next;
592   }
593 }
594 
595 void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, InterpreterOopMap* entry) {
596   // Due to the invariants above it's tricky to allocate a temporary OopMapCacheEntry on the stack
597   OopMapCacheEntry* tmp = NEW_C_HEAP_ARRAY(OopMapCacheEntry, 1, mtClass);
598   tmp->initialize();
599   tmp->fill(method, bci);
600   entry->resource_copy(tmp);
601   FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp);
602 }

  1 /*
  2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

577 // This is called after GC threads are done and nothing is accessing the old_entries
578 // list, so no synchronization needed.
579 void OopMapCache::cleanup_old_entries() {
580   OopMapCacheEntry* entry = _old_entries;
581   _old_entries = NULL;
582   while (entry != NULL) {
583     if (log_is_enabled(Debug, interpreter, oopmap)) {
584       ResourceMark rm;
585       log_debug(interpreter, oopmap)("cleanup entry %s at bci %d",
586                           entry->method()->name_and_sig_as_C_string(), entry->bci());
587     }
588     OopMapCacheEntry* next = entry->_next;
589     entry->flush();
590     FREE_C_HEAP_OBJ(entry);
591     entry = next;
592   }
593 }
594 
595 void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, InterpreterOopMap* entry) {
596   // Due to the invariants above it's tricky to allocate a temporary OopMapCacheEntry on the stack
597   OopMapCacheEntry* tmp = NEW_C_HEAP_OBJ(OopMapCacheEntry, mtClass);
598   tmp->initialize();
599   tmp->fill(method, bci);
600   entry->resource_copy(tmp);
601   FREE_C_HEAP_OBJ(tmp);
602 }
< prev index next >