2842N/A/*
2842N/A * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
2842N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2842N/A *
2842N/A * This code is free software; you can redistribute it and/or modify it
2842N/A * under the terms of the GNU General Public License version 2 only, as
2842N/A * published by the Free Software Foundation.
2842N/A *
2842N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2842N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2842N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2842N/A * version 2 for more details (a copy is included in the LICENSE file that
2842N/A * accompanied this code).
2842N/A *
2842N/A * You should have received a copy of the GNU General Public License version
2842N/A * 2 along with this work; if not, write to the Free Software Foundation,
2842N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2842N/A *
2842N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2842N/A * or visit www.oracle.com if you need additional information or have any
2842N/A * questions.
2842N/A *
2842N/A */
2842N/A
2842N/A/* This file is auto-generated */
2842N/A#include "JvmOffsetsIndex.h"
2842N/A
2842N/A#define DEBUG
2842N/A
2842N/A#ifdef DEBUG
2842N/A#define MARK_LINE this->line = __LINE__
2842N/A#else
2842N/A#define MARK_LINE
2842N/A#endif
2842N/A
2842N/A#ifdef _LP64
2842N/A#define STACK_BIAS 0x7ff
2842N/A#define pointer uint64_t
2842N/A#else
2842N/A#define STACK_BIAS 0
2842N/A#define pointer uint32_t
2842N/A#endif
2842N/A
2842N/Aextern pointer __JvmOffsets;
2842N/A
2842N/Aextern pointer __1cJCodeCacheF_heap_;
2842N/Aextern pointer __1cIUniverseP_methodKlassObj_;
2842N/Aextern pointer __1cIUniverseO_collectedHeap_;
2842N/Aextern pointer __1cIUniverseL_narrow_oop_;
2842N/A#ifdef _LP64
2842N/Aextern pointer UseCompressedOops;
2842N/A#endif
2842N/A
2842N/Aextern pointer __1cHnmethodG__vtbl_;
2842N/Aextern pointer __1cKBufferBlobG__vtbl_;
2842N/A
2842N/A#define copyin_ptr(ADDR) *(pointer*) copyin((pointer) (ADDR), sizeof(pointer))
2842N/A#define copyin_uchar(ADDR) *(uchar_t*) copyin((pointer) (ADDR), sizeof(uchar_t))
2842N/A#define copyin_uint16(ADDR) *(uint16_t*) copyin((pointer) (ADDR), sizeof(uint16_t))
2842N/A#define copyin_uint32(ADDR) *(uint32_t*) copyin((pointer) (ADDR), sizeof(uint32_t))
2842N/A#define copyin_int32(ADDR) *(int32_t*) copyin((pointer) (ADDR), sizeof(int32_t))
2842N/A#define copyin_uint8(ADDR) *(uint8_t*) copyin((pointer) (ADDR), sizeof(uint8_t))
2842N/A
2842N/A#define SAME(x) x
2842N/A#define copyin_offset(JVM_CONST) JVM_CONST = \
2842N/A copyin_int32(JvmOffsetsPtr + SAME(IDX_)JVM_CONST * sizeof(int32_t))
2842N/A
2842N/Aint init_done;
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A{
2842N/A MARK_LINE;
2842N/A this->done = 0;
2842N/A /*
2842N/A * TBD:
2842N/A * Here we initialize init_done, otherwise jhelper does not work.
2842N/A * Therefore, copyin_offset() statements work multiple times now.
2842N/A * There is a hope we could avoid it in the future, and so,
2842N/A * this initialization can be removed.
2842N/A */
2842N/A init_done = 0;
2842N/A this->error = (char *) NULL;
2842N/A this->result = (char *) NULL;
2842N/A this->methodOop = 0;
2842N/A this->codecache = 0;
2842N/A this->klass = (pointer) NULL;
2842N/A this->vtbl = (pointer) NULL;
2842N/A this->suffix = '\0';
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A{
2842N/A MARK_LINE;
2842N/A /* Initialization of JvmOffsets constants */
2842N/A JvmOffsetsPtr = (pointer) &``__JvmOffsets;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!init_done && !this->done/
2842N/A{
2842N/A MARK_LINE;
2842N/A init_done = 1;
2842N/A
2842N/A copyin_offset(COMPILER);
2842N/A copyin_offset(OFFSET_CollectedHeap_reserved);
2842N/A copyin_offset(OFFSET_MemRegion_start);
2842N/A copyin_offset(OFFSET_MemRegion_word_size);
2842N/A copyin_offset(SIZE_HeapWord);
2842N/A
2842N/A copyin_offset(OFFSET_interpreter_frame_method);
2842N/A copyin_offset(OFFSET_Klass_name);
2842N/A copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
2842N/A
2842N/A copyin_offset(OFFSET_HeapBlockHeader_used);
2842N/A copyin_offset(OFFSET_oopDesc_metadata);
2842N/A
2842N/A copyin_offset(OFFSET_Symbol_length);
2842N/A copyin_offset(OFFSET_Symbol_body);
2842N/A
2842N/A copyin_offset(OFFSET_methodOopDesc_constMethod);
2842N/A copyin_offset(OFFSET_methodOopDesc_constants);
2842N/A copyin_offset(OFFSET_constMethodOopDesc_name_index);
2842N/A copyin_offset(OFFSET_constMethodOopDesc_signature_index);
2842N/A
2842N/A copyin_offset(OFFSET_CodeHeap_memory);
2842N/A copyin_offset(OFFSET_CodeHeap_segmap);
2842N/A copyin_offset(OFFSET_CodeHeap_log2_segment_size);
2842N/A
2842N/A copyin_offset(OFFSET_VirtualSpace_low);
2842N/A copyin_offset(OFFSET_VirtualSpace_high);
2842N/A
2842N/A copyin_offset(OFFSET_CodeBlob_name);
2842N/A
2842N/A copyin_offset(OFFSET_nmethod_method);
2842N/A copyin_offset(SIZE_HeapBlockHeader);
2842N/A copyin_offset(SIZE_oopDesc);
2842N/A copyin_offset(SIZE_constantPoolOopDesc);
2842N/A
2842N/A copyin_offset(OFFSET_NarrowOopStruct_base);
2842N/A copyin_offset(OFFSET_NarrowOopStruct_shift);
2842N/A
2842N/A /*
2842N/A * The PC to translate is in arg0.
2842N/A */
2842N/A this->pc = arg0;
2842N/A
2842N/A /*
2842N/A * The methodOopPtr is in %l2 on SPARC. This can be found at
2842N/A * offset 8 from the frame pointer on 32-bit processes.
2842N/A */
2842N/A#if defined(__sparc)
2842N/A this->methodOopPtr = copyin_ptr(arg1 + 2 * sizeof(pointer) + STACK_BIAS);
2842N/A#elif defined(__i386) || defined(__amd64)
2842N/A this->methodOopPtr = copyin_ptr(arg1 + OFFSET_interpreter_frame_method);
2842N/A#else
2842N/A#error "Don't know architecture"
2842N/A#endif
2842N/A
2842N/A this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
2842N/A this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
2842N/A
2842N/A /* Reading volatile values */
2842N/A#ifdef _LP64
2842N/A this->Use_Compressed_Oops = copyin_uint8(&``UseCompressedOops);
2842N/A#else
2842N/A this->Use_Compressed_Oops = 0;
2842N/A#endif
2842N/A
2842N/A this->Universe_narrow_oop_base = copyin_ptr(&``__1cIUniverseL_narrow_oop_ +
2842N/A OFFSET_NarrowOopStruct_base);
2842N/A this->Universe_narrow_oop_shift = copyin_int32(&``__1cIUniverseL_narrow_oop_ +
2842N/A OFFSET_NarrowOopStruct_shift);
2842N/A
2842N/A this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address +
2842N/A OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
2842N/A
2842N/A this->CodeCache_high = copyin_ptr(this->CodeCache_heap_address +
2842N/A OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_high);
2842N/A
2842N/A this->CodeCache_segmap_low = copyin_ptr(this->CodeCache_heap_address +
2842N/A OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_low);
2842N/A
2842N/A this->CodeCache_segmap_high = copyin_ptr(this->CodeCache_heap_address +
2842N/A OFFSET_CodeHeap_segmap + OFFSET_VirtualSpace_high);
2842N/A
2842N/A this->CodeHeap_log2_segment_size = copyin_uint32(
2842N/A this->CodeCache_heap_address + OFFSET_CodeHeap_log2_segment_size);
2842N/A
2842N/A /*
2842N/A * Get Java heap bounds
2842N/A */
2842N/A this->Universe_collectedHeap = copyin_ptr(&``__1cIUniverseO_collectedHeap_);
2842N/A this->heap_start = copyin_ptr(this->Universe_collectedHeap +
2842N/A OFFSET_CollectedHeap_reserved +
2842N/A OFFSET_MemRegion_start);
2842N/A this->heap_size = SIZE_HeapWord *
2842N/A copyin_ptr(this->Universe_collectedHeap +
2842N/A OFFSET_CollectedHeap_reserved +
2842N/A OFFSET_MemRegion_word_size
2842N/A );
2842N/A this->heap_end = this->heap_start + this->heap_size;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done &&
2842N/Athis->CodeCache_low <= this->pc && this->pc < this->CodeCache_high/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->codecache = 1;
2842N/A
2842N/A /*
2842N/A * Find start.
2842N/A */
2842N/A this->segment = (this->pc - this->CodeCache_low) >>
2842N/A this->CodeHeap_log2_segment_size;
2842N/A this->block = this->CodeCache_segmap_low;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A "second";
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A this->segment = this->segment - this->tag;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A this->segment = this->segment - this->tag;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A this->segment = this->segment - this->tag;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A this->segment = this->segment - this->tag;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->tag = copyin_uchar(this->block + this->segment);
2842N/A this->segment = this->segment - this->tag;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && this->tag > 0/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->error = "<couldn't find start>";
2842N/A this->done = 1;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->block = this->CodeCache_low +
2842N/A (this->segment << this->CodeHeap_log2_segment_size);
2842N/A this->used = copyin_uint32(this->block + OFFSET_HeapBlockHeader_used);
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache && !this->used/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->error = "<block not in use>";
2842N/A this->done = 1;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->start = this->block + SIZE_HeapBlockHeader;
2842N/A this->vtbl = copyin_ptr(this->start);
2842N/A
2842N/A this->nmethod_vtbl = (pointer) &``__1cHnmethodG__vtbl_;
2842N/A this->BufferBlob_vtbl = (pointer) &``__1cKBufferBlobG__vtbl_;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->vtbl == this->nmethod_vtbl/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->methodOopPtr = copyin_ptr(this->start + OFFSET_nmethod_method);
2842N/A this->suffix = '*';
2842N/A this->methodOop = 1;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->vtbl == this->BufferBlob_vtbl/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->vtbl == this->BufferBlob_vtbl &&
2842N/Athis->Use_Compressed_Oops == 0 &&
2842N/Athis->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_metadata);
2842N/A this->methodOop = this->klass == this->Universe_methodKlassOop;
2842N/A this->done = !this->methodOop;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->vtbl == this->BufferBlob_vtbl &&
2842N/Athis->Use_Compressed_Oops != 0 &&
2842N/Athis->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
2842N/A{
2842N/A MARK_LINE;
2842N/A /*
2842N/A * Read compressed pointer and decode heap oop, same as oop.inline.hpp
2842N/A */
2842N/A this->cklass = copyin_uint32(this->methodOopPtr + OFFSET_oopDesc_metadata);
2842N/A this->klass = (uint64_t)((uintptr_t)this->Universe_narrow_oop_base +
2842N/A ((uintptr_t)this->cklass << this->Universe_narrow_oop_shift));
2842N/A this->methodOop = this->klass == this->Universe_methodKlassOop;
2842N/A this->done = !this->methodOop;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && !this->methodOop/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->name = copyin_ptr(this->start + OFFSET_CodeBlob_name);
2842N/A this->result = this->name != 0 ? copyinstr(this->name) : "<CodeBlob>";
2842N/A this->done = 1;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->methodOop/
2842N/A{
2842N/A MARK_LINE;
2842N/A this->constMethod = copyin_ptr(this->methodOopPtr +
2842N/A OFFSET_methodOopDesc_constMethod);
2842N/A
2842N/A this->nameIndex = copyin_uint16(this->constMethod +
2842N/A OFFSET_constMethodOopDesc_name_index);
2842N/A
2842N/A this->signatureIndex = copyin_uint16(this->constMethod +
2842N/A OFFSET_constMethodOopDesc_signature_index);
2842N/A
2842N/A this->constantPool = copyin_ptr(this->methodOopPtr +
2842N/A OFFSET_methodOopDesc_constants);
2842N/A
2842N/A this->nameSymbol = copyin_ptr(this->constantPool +
2842N/A this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
2842N/A
2842N/A this->nameSymbolLength = copyin_uint16(this->nameSymbol +
2842N/A OFFSET_Symbol_length);
2842N/A
2842N/A this->signatureSymbol = copyin_ptr(this->constantPool +
2842N/A this->signatureIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
2842N/A
2842N/A this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
2842N/A OFFSET_Symbol_length);
2842N/A
2842N/A this->klassPtr = copyin_ptr(this->constantPool +
2842N/A OFFSET_constantPoolOopDesc_pool_holder);
2842N/A
2842N/A this->klassSymbol = copyin_ptr(this->klassPtr +
2842N/A OFFSET_Klass_name + SIZE_oopDesc);
2842N/A
2842N/A this->klassSymbolLength = copyin_uint16(this->klassSymbol +
2842N/A OFFSET_Symbol_length);
2842N/A
2842N/A /*
2842N/A * Enough for three strings, plus the '.', plus the trailing '\0'.
2842N/A */
2842N/A this->result = (char *) alloca(this->klassSymbolLength +
2842N/A this->nameSymbolLength +
2842N/A this->signatureSymbolLength + 2 + 1);
2842N/A
2842N/A copyinto(this->klassSymbol + OFFSET_Symbol_body,
2842N/A this->klassSymbolLength, this->result);
2842N/A
2842N/A /*
2842N/A * Add the '.' between the class and the name.
2842N/A */
2842N/A this->result[this->klassSymbolLength] = '.';
2842N/A
2842N/A copyinto(this->nameSymbol + OFFSET_Symbol_body,
2842N/A this->nameSymbolLength,
2842N/A this->result + this->klassSymbolLength + 1);
2842N/A
2842N/A copyinto(this->signatureSymbol + OFFSET_Symbol_body,
2842N/A this->signatureSymbolLength,
2842N/A this->result + this->klassSymbolLength +
2842N/A this->nameSymbolLength + 1);
2842N/A
2842N/A /*
2842N/A * Now we need to add a trailing '\0' and possibly a tag character.
2842N/A */
2842N/A this->result[this->klassSymbolLength + 1 +
2842N/A this->nameSymbolLength +
2842N/A this->signatureSymbolLength] = this->suffix;
2842N/A this->result[this->klassSymbolLength + 2 +
2842N/A this->nameSymbolLength +
2842N/A this->signatureSymbolLength] = '\0';
2842N/A
2842N/A this->done = 1;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/this->done && this->error == (char *) NULL/
2842N/A{
2842N/A this->result;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/this->done && this->error != (char *) NULL/
2842N/A{
2842N/A this->error;
2842N/A}
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done && this->codecache/
2842N/A{
2842N/A this->done = 1;
2842N/A "error";
2842N/A}
2842N/A
2842N/A
2842N/Adtrace:helper:ustack:
2842N/A/!this->done/
2842N/A{
2842N/A NULL;
2842N/A}