00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 # include "incls/_precompiled.incl"
00025
00026 #ifdef DELTA_COMPILER
00027
00028 # include "incls/_relocInfo.cpp.incl"
00029
00030 relocInfo::relocInfo(int t, int off) {
00031 assert(0 <= t && t < (1 << reloc_type_width), "wrong type");
00032 assert(off <= nthMask(reloc_offset_width), "offset out off bounds");
00033 _value = (t << reloc_offset_width) | off;
00034 }
00035
00036
00037 int relocInfo::print(nmethod* m, int last_offset) {
00038 if (!isValid()) return 0;
00039 int current_offset = offset() + last_offset;
00040 int* addr = (int*) (m->insts() + current_offset);
00041 printIndent();
00042 if (isOop()) {
00043 std->print("embedded oop @0x%lx = ", addr);
00044 oop(*addr)->print_value();
00045 } else {
00046 assert(isCall(), "must be a call");
00047 char* target = (char*) (*addr + (int) addr + oopSize);
00048 if (isIC()) {
00049 std->print("inline cache @0x%lx", addr);
00050 } else if (isPrimitive()) {
00051 std->print("primitive call @0x%lx = ", addr);
00052 primitive_desc* pd = primitives::lookup((fntype) target);
00053 if (pd != NULL) {
00054 std->print("(%s)", pd->name());
00055 } else {
00056 std->print("runtime routine");
00057 }
00058 } else if (isDLL()) {
00059 std->print("DLL call @0x%lx = ", addr);
00060 } else if (isUncommonTrap()) {
00061 std->print("uncommon trap @0x%lx", addr);
00062 } else {
00063 std->print("run-time call @0x%lx", addr);
00064 }
00065 }
00066 return current_offset;
00067 }
00068
00069 relocIterator::relocIterator(const nmethod* nm) {
00070 current = nm->locs()-1;
00071 end = nm->locsEnd();
00072 addr = nm->insts();
00073 }
00074
00075 bool relocIterator::wasUncommonTrapExecuted() const {
00076 assert(current->isUncommonTrap(), "not an uncommon branch");
00077 return callDestination() == (char*)StubRoutines::used_uncommon_trap_entry();
00078 }
00079
00080 bool relocIterator::is_position_dependent() const {
00081 switch (type()) {
00082 case relocInfo::ic_type:
00083 case relocInfo::prim_type:
00084 case relocInfo::uncommon_type:
00085 case relocInfo::runtime_call_type:
00086 case relocInfo::internal_word_type:
00087 case relocInfo::dll_type:
00088 return true;
00089 }
00090 return false;
00091 }
00092
00093
00094 #endif
00095