duke@435: /* trims@1907: * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: duke@435: # include "incls/_precompiled.incl" duke@435: # include "incls/_codeBlob.cpp.incl" duke@435: duke@435: unsigned int align_code_offset(int offset) { duke@435: // align the size to CodeEntryAlignment duke@435: return duke@435: ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1)) duke@435: - (int)CodeHeap::header_size(); duke@435: } duke@435: duke@435: duke@435: // This must be consistent with the CodeBlob constructor's layout actions. duke@435: unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) { duke@435: unsigned int size = header_size; duke@435: size += round_to(cb->total_relocation_size(), oopSize); duke@435: // align the size to CodeEntryAlignment duke@435: size = align_code_offset(size); twisti@2103: size += round_to(cb->total_content_size(), oopSize); duke@435: size += round_to(cb->total_oop_size(), oopSize); duke@435: return size; duke@435: } duke@435: duke@435: duke@435: // Creates a simple CodeBlob. Sets up the size of the different regions. duke@435: CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) { twisti@2103: assert(size == round_to(size, oopSize), "unaligned size"); twisti@2103: assert(locs_size == round_to(locs_size, oopSize), "unaligned size"); duke@435: assert(header_size == round_to(header_size, oopSize), "unaligned size"); duke@435: assert(!UseRelocIndex, "no space allocated for reloc index yet"); duke@435: duke@435: // Note: If UseRelocIndex is enabled, there needs to be (at least) one duke@435: // extra word for the relocation information, containing the reloc duke@435: // index table length. Unfortunately, the reloc index table imple- duke@435: // mentation is not easily understandable and thus it is not clear duke@435: // what exactly the format is supposed to be. For now, we just turn duke@435: // off the use of this table (gri 7/6/2000). duke@435: duke@435: _name = name; duke@435: _size = size; duke@435: _frame_complete_offset = frame_complete; duke@435: _header_size = header_size; duke@435: _relocation_size = locs_size; twisti@2103: _content_offset = align_code_offset(header_size + _relocation_size); twisti@2103: _code_offset = _content_offset; duke@435: _data_offset = size; duke@435: _frame_size = 0; duke@435: set_oop_maps(NULL); duke@435: } duke@435: duke@435: duke@435: // Creates a CodeBlob from a CodeBuffer. Sets up the size of the different regions, duke@435: // and copy code and relocation info. duke@435: CodeBlob::CodeBlob( duke@435: const char* name, duke@435: CodeBuffer* cb, duke@435: int header_size, duke@435: int size, duke@435: int frame_complete, duke@435: int frame_size, duke@435: OopMapSet* oop_maps duke@435: ) { twisti@2103: assert(size == round_to(size, oopSize), "unaligned size"); duke@435: assert(header_size == round_to(header_size, oopSize), "unaligned size"); duke@435: duke@435: _name = name; duke@435: _size = size; duke@435: _frame_complete_offset = frame_complete; duke@435: _header_size = header_size; duke@435: _relocation_size = round_to(cb->total_relocation_size(), oopSize); twisti@2103: _content_offset = align_code_offset(header_size + _relocation_size); twisti@2117: _code_offset = _content_offset + cb->total_offset_of(cb->insts()); twisti@2103: _data_offset = _content_offset + round_to(cb->total_content_size(), oopSize); duke@435: assert(_data_offset <= size, "codeBlob is too small"); duke@435: duke@435: cb->copy_code_and_locs_to(this); duke@435: set_oop_maps(oop_maps); duke@435: _frame_size = frame_size; duke@435: #ifdef COMPILER1 duke@435: // probably wrong for tiered duke@435: assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); duke@435: #endif // COMPILER1 duke@435: } duke@435: duke@435: duke@435: void CodeBlob::set_oop_maps(OopMapSet* p) { duke@435: // Danger Will Robinson! This method allocates a big duke@435: // chunk of memory, its your job to free it. duke@435: if (p != NULL) { duke@435: // We need to allocate a chunk big enough to hold the OopMapSet and all of its OopMaps duke@435: _oop_maps = (OopMapSet* )NEW_C_HEAP_ARRAY(unsigned char, p->heap_size()); duke@435: p->copy_to((address)_oop_maps); duke@435: } else { duke@435: _oop_maps = NULL; duke@435: } duke@435: } duke@435: duke@435: duke@435: void CodeBlob::flush() { duke@435: if (_oop_maps) { duke@435: FREE_C_HEAP_ARRAY(unsigned char, _oop_maps); duke@435: _oop_maps = NULL; duke@435: } duke@435: _comments.free(); duke@435: } duke@435: duke@435: duke@435: OopMap* CodeBlob::oop_map_for_return_address(address return_address) { twisti@2103: assert(oop_maps() != NULL, "nope"); twisti@2103: return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); duke@435: } duke@435: duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of BufferBlob duke@435: duke@435: duke@435: BufferBlob::BufferBlob(const char* name, int size) duke@435: : CodeBlob(name, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, /*locs_size:*/ 0) duke@435: {} duke@435: duke@435: BufferBlob* BufferBlob::create(const char* name, int buffer_size) { duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: duke@435: BufferBlob* blob = NULL; duke@435: unsigned int size = sizeof(BufferBlob); duke@435: // align the size to CodeEntryAlignment duke@435: size = align_code_offset(size); duke@435: size += round_to(buffer_size, oopSize); duke@435: assert(name != NULL, "must provide a name"); duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: blob = new (size) BufferBlob(name, size); duke@435: } duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb) duke@435: : CodeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL) duke@435: {} duke@435: duke@435: BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) { duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: duke@435: BufferBlob* blob = NULL; duke@435: unsigned int size = allocation_size(cb, sizeof(BufferBlob)); duke@435: assert(name != NULL, "must provide a name"); duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: blob = new (size) BufferBlob(name, size, cb); duke@435: } duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: void* BufferBlob::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: return p; duke@435: } duke@435: duke@435: duke@435: void BufferBlob::free( BufferBlob *blob ) { duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: CodeCache::free((CodeBlob*)blob); duke@435: } duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: } duke@435: twisti@1734: twisti@1734: //---------------------------------------------------------------------------------------------------- twisti@1734: // Implementation of AdapterBlob twisti@1734: never@2018: AdapterBlob::AdapterBlob(int size, CodeBuffer* cb) : never@2018: BufferBlob("I2C/C2I adapters", size, cb) { never@2018: CodeCache::commit(this); never@2018: } never@2018: twisti@1734: AdapterBlob* AdapterBlob::create(CodeBuffer* cb) { twisti@1734: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock twisti@1734: twisti@1734: AdapterBlob* blob = NULL; twisti@1734: unsigned int size = allocation_size(cb, sizeof(AdapterBlob)); twisti@1734: { twisti@1734: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); twisti@1734: blob = new (size) AdapterBlob(size, cb); twisti@1734: } twisti@1734: // Track memory usage statistic after releasing CodeCache_lock twisti@1734: MemoryService::track_code_cache_memory_usage(); twisti@1734: twisti@1734: return blob; duke@435: } duke@435: twisti@1734: twisti@1734: //---------------------------------------------------------------------------------------------------- twisti@1734: // Implementation of MethodHandlesAdapterBlob twisti@1734: twisti@1734: MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) { twisti@1734: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock twisti@1734: twisti@1734: MethodHandlesAdapterBlob* blob = NULL; twisti@1734: unsigned int size = sizeof(MethodHandlesAdapterBlob); twisti@1734: // align the size to CodeEntryAlignment twisti@1734: size = align_code_offset(size); twisti@1734: size += round_to(buffer_size, oopSize); twisti@1734: { twisti@1734: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); twisti@1734: blob = new (size) MethodHandlesAdapterBlob(size); twisti@1734: } twisti@1734: // Track memory usage statistic after releasing CodeCache_lock twisti@1734: MemoryService::track_code_cache_memory_usage(); twisti@1734: twisti@1734: return blob; twisti@1734: } twisti@1734: twisti@1734: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of RuntimeStub duke@435: duke@435: RuntimeStub::RuntimeStub( duke@435: const char* name, duke@435: CodeBuffer* cb, duke@435: int size, duke@435: int frame_complete, duke@435: int frame_size, duke@435: OopMapSet* oop_maps, duke@435: bool caller_must_gc_arguments duke@435: ) duke@435: : CodeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps) duke@435: { duke@435: _caller_must_gc_arguments = caller_must_gc_arguments; duke@435: } duke@435: duke@435: duke@435: RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name, duke@435: CodeBuffer* cb, duke@435: int frame_complete, duke@435: int frame_size, duke@435: OopMapSet* oop_maps, duke@435: bool caller_must_gc_arguments) duke@435: { duke@435: RuntimeStub* stub = NULL; duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: unsigned int size = allocation_size(cb, sizeof(RuntimeStub)); duke@435: stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments); duke@435: } duke@435: duke@435: // Do not hold the CodeCache lock during name formatting. duke@435: if (stub != NULL) { duke@435: char stub_id[256]; duke@435: jio_snprintf(stub_id, sizeof(stub_id), "RuntimeStub - %s", stub_name); duke@435: if (PrintStubCode) { duke@435: tty->print_cr("Decoding %s " INTPTR_FORMAT, stub_id, stub); twisti@2103: Disassembler::decode(stub->code_begin(), stub->code_end()); duke@435: } twisti@2103: Forte::register_stub(stub_id, stub->code_begin(), stub->code_end()); duke@435: duke@435: if (JvmtiExport::should_post_dynamic_code_generated()) { twisti@2103: JvmtiExport::post_dynamic_code_generated(stub_name, stub->code_begin(), stub->code_end()); duke@435: } duke@435: } duke@435: duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return stub; duke@435: } duke@435: duke@435: duke@435: void* RuntimeStub::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: if (!p) fatal("Initial size of CodeCache is too small"); duke@435: return p; duke@435: } duke@435: duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of DeoptimizationBlob duke@435: duke@435: DeoptimizationBlob::DeoptimizationBlob( duke@435: CodeBuffer* cb, duke@435: int size, duke@435: OopMapSet* oop_maps, duke@435: int unpack_offset, duke@435: int unpack_with_exception_offset, duke@435: int unpack_with_reexecution_offset, duke@435: int frame_size duke@435: ) duke@435: : SingletonBlob("DeoptimizationBlob", cb, sizeof(DeoptimizationBlob), size, frame_size, oop_maps) duke@435: { duke@435: _unpack_offset = unpack_offset; duke@435: _unpack_with_exception = unpack_with_exception_offset; duke@435: _unpack_with_reexecution = unpack_with_reexecution_offset; duke@435: #ifdef COMPILER1 duke@435: _unpack_with_exception_in_tls = -1; duke@435: #endif duke@435: } duke@435: duke@435: duke@435: DeoptimizationBlob* DeoptimizationBlob::create( duke@435: CodeBuffer* cb, duke@435: OopMapSet* oop_maps, duke@435: int unpack_offset, duke@435: int unpack_with_exception_offset, duke@435: int unpack_with_reexecution_offset, duke@435: int frame_size) duke@435: { duke@435: DeoptimizationBlob* blob = NULL; duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: unsigned int size = allocation_size(cb, sizeof(DeoptimizationBlob)); duke@435: blob = new (size) DeoptimizationBlob(cb, duke@435: size, duke@435: oop_maps, duke@435: unpack_offset, duke@435: unpack_with_exception_offset, duke@435: unpack_with_reexecution_offset, duke@435: frame_size); duke@435: } duke@435: duke@435: // Do not hold the CodeCache lock during name formatting. duke@435: if (blob != NULL) { duke@435: char blob_id[256]; twisti@2103: jio_snprintf(blob_id, sizeof(blob_id), "DeoptimizationBlob@" PTR_FORMAT, blob->code_begin()); duke@435: if (PrintStubCode) { duke@435: tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); twisti@2103: Disassembler::decode(blob->code_begin(), blob->code_end()); duke@435: } twisti@2103: Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); duke@435: duke@435: if (JvmtiExport::should_post_dynamic_code_generated()) { twisti@2103: JvmtiExport::post_dynamic_code_generated("DeoptimizationBlob", blob->code_begin(), blob->code_end()); duke@435: } duke@435: } duke@435: duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: void* DeoptimizationBlob::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: if (!p) fatal("Initial size of CodeCache is too small"); duke@435: return p; duke@435: } duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of UncommonTrapBlob duke@435: duke@435: #ifdef COMPILER2 duke@435: UncommonTrapBlob::UncommonTrapBlob( duke@435: CodeBuffer* cb, duke@435: int size, duke@435: OopMapSet* oop_maps, duke@435: int frame_size duke@435: ) duke@435: : SingletonBlob("UncommonTrapBlob", cb, sizeof(UncommonTrapBlob), size, frame_size, oop_maps) duke@435: {} duke@435: duke@435: duke@435: UncommonTrapBlob* UncommonTrapBlob::create( duke@435: CodeBuffer* cb, duke@435: OopMapSet* oop_maps, duke@435: int frame_size) duke@435: { duke@435: UncommonTrapBlob* blob = NULL; duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: unsigned int size = allocation_size(cb, sizeof(UncommonTrapBlob)); duke@435: blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size); duke@435: } duke@435: duke@435: // Do not hold the CodeCache lock during name formatting. duke@435: if (blob != NULL) { duke@435: char blob_id[256]; twisti@2103: jio_snprintf(blob_id, sizeof(blob_id), "UncommonTrapBlob@" PTR_FORMAT, blob->code_begin()); duke@435: if (PrintStubCode) { duke@435: tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); twisti@2103: Disassembler::decode(blob->code_begin(), blob->code_end()); duke@435: } twisti@2103: Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); duke@435: duke@435: if (JvmtiExport::should_post_dynamic_code_generated()) { twisti@2103: JvmtiExport::post_dynamic_code_generated("UncommonTrapBlob", blob->code_begin(), blob->code_end()); duke@435: } duke@435: } duke@435: duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: void* UncommonTrapBlob::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: if (!p) fatal("Initial size of CodeCache is too small"); duke@435: return p; duke@435: } duke@435: #endif // COMPILER2 duke@435: duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of ExceptionBlob duke@435: duke@435: #ifdef COMPILER2 duke@435: ExceptionBlob::ExceptionBlob( duke@435: CodeBuffer* cb, duke@435: int size, duke@435: OopMapSet* oop_maps, duke@435: int frame_size duke@435: ) duke@435: : SingletonBlob("ExceptionBlob", cb, sizeof(ExceptionBlob), size, frame_size, oop_maps) duke@435: {} duke@435: duke@435: duke@435: ExceptionBlob* ExceptionBlob::create( duke@435: CodeBuffer* cb, duke@435: OopMapSet* oop_maps, duke@435: int frame_size) duke@435: { duke@435: ExceptionBlob* blob = NULL; duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: unsigned int size = allocation_size(cb, sizeof(ExceptionBlob)); duke@435: blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size); duke@435: } duke@435: duke@435: // We do not need to hold the CodeCache lock during name formatting duke@435: if (blob != NULL) { duke@435: char blob_id[256]; twisti@2103: jio_snprintf(blob_id, sizeof(blob_id), "ExceptionBlob@" PTR_FORMAT, blob->code_begin()); duke@435: if (PrintStubCode) { duke@435: tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); twisti@2103: Disassembler::decode(blob->code_begin(), blob->code_end()); duke@435: } twisti@2103: Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); duke@435: duke@435: if (JvmtiExport::should_post_dynamic_code_generated()) { twisti@2103: JvmtiExport::post_dynamic_code_generated("ExceptionBlob", blob->code_begin(), blob->code_end()); duke@435: } duke@435: } duke@435: duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: void* ExceptionBlob::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: if (!p) fatal("Initial size of CodeCache is too small"); duke@435: return p; duke@435: } duke@435: #endif // COMPILER2 duke@435: duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Implementation of SafepointBlob duke@435: duke@435: SafepointBlob::SafepointBlob( duke@435: CodeBuffer* cb, duke@435: int size, duke@435: OopMapSet* oop_maps, duke@435: int frame_size duke@435: ) duke@435: : SingletonBlob("SafepointBlob", cb, sizeof(SafepointBlob), size, frame_size, oop_maps) duke@435: {} duke@435: duke@435: duke@435: SafepointBlob* SafepointBlob::create( duke@435: CodeBuffer* cb, duke@435: OopMapSet* oop_maps, duke@435: int frame_size) duke@435: { duke@435: SafepointBlob* blob = NULL; duke@435: ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock duke@435: { duke@435: MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); duke@435: unsigned int size = allocation_size(cb, sizeof(SafepointBlob)); duke@435: blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size); duke@435: } duke@435: duke@435: // We do not need to hold the CodeCache lock during name formatting. duke@435: if (blob != NULL) { duke@435: char blob_id[256]; twisti@2103: jio_snprintf(blob_id, sizeof(blob_id), "SafepointBlob@" PTR_FORMAT, blob->code_begin()); duke@435: if (PrintStubCode) { duke@435: tty->print_cr("Decoding %s " INTPTR_FORMAT, blob_id, blob); twisti@2103: Disassembler::decode(blob->code_begin(), blob->code_end()); duke@435: } twisti@2103: Forte::register_stub(blob_id, blob->code_begin(), blob->code_end()); duke@435: duke@435: if (JvmtiExport::should_post_dynamic_code_generated()) { twisti@2103: JvmtiExport::post_dynamic_code_generated("SafepointBlob", blob->code_begin(), blob->code_end()); duke@435: } duke@435: } duke@435: duke@435: // Track memory usage statistic after releasing CodeCache_lock duke@435: MemoryService::track_code_cache_memory_usage(); duke@435: duke@435: return blob; duke@435: } duke@435: duke@435: duke@435: void* SafepointBlob::operator new(size_t s, unsigned size) { duke@435: void* p = CodeCache::allocate(size); duke@435: if (!p) fatal("Initial size of CodeCache is too small"); duke@435: return p; duke@435: } duke@435: duke@435: duke@435: //---------------------------------------------------------------------------------------------------- duke@435: // Verification and printing duke@435: duke@435: void CodeBlob::verify() { duke@435: ShouldNotReachHere(); duke@435: } duke@435: bobv@2036: void CodeBlob::print_on(outputStream* st) const { bobv@2036: st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this); bobv@2036: st->print_cr("Framesize: %d", _frame_size); duke@435: } duke@435: duke@435: void CodeBlob::print_value_on(outputStream* st) const { duke@435: st->print_cr("[CodeBlob]"); duke@435: } duke@435: duke@435: void BufferBlob::verify() { duke@435: // unimplemented duke@435: } duke@435: bobv@2036: void BufferBlob::print_on(outputStream* st) const { bobv@2036: CodeBlob::print_on(st); bobv@2036: print_value_on(st); duke@435: } duke@435: duke@435: void BufferBlob::print_value_on(outputStream* st) const { duke@435: st->print_cr("BufferBlob (" INTPTR_FORMAT ") used for %s", this, name()); duke@435: } duke@435: duke@435: void RuntimeStub::verify() { duke@435: // unimplemented duke@435: } duke@435: bobv@2036: void RuntimeStub::print_on(outputStream* st) const { bobv@2036: CodeBlob::print_on(st); bobv@2036: st->print("Runtime Stub (" INTPTR_FORMAT "): ", this); bobv@2036: st->print_cr(name()); bobv@2036: Disassembler::decode((CodeBlob*)this, st); duke@435: } duke@435: duke@435: void RuntimeStub::print_value_on(outputStream* st) const { duke@435: st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name()); duke@435: } duke@435: duke@435: void SingletonBlob::verify() { duke@435: // unimplemented duke@435: } duke@435: bobv@2036: void SingletonBlob::print_on(outputStream* st) const { bobv@2036: CodeBlob::print_on(st); bobv@2036: st->print_cr(name()); bobv@2036: Disassembler::decode((CodeBlob*)this, st); duke@435: } duke@435: duke@435: void SingletonBlob::print_value_on(outputStream* st) const { duke@435: st->print_cr(name()); duke@435: } duke@435: duke@435: void DeoptimizationBlob::print_value_on(outputStream* st) const { duke@435: st->print_cr("Deoptimization (frame not available)"); duke@435: }