relocInfo.cpp

Go to the documentation of this file.
00001 /* Copyright 1994 - 1996, LongView Technologies L.L.C. $Revision: 1.25 $ */
00002 /* Copyright (c) 2006, Sun Microsystems, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
00006 following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
00010           disclaimer in the documentation and/or other materials provided with the distribution.
00011     * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived 
00012           from this software without specific prior written permission.
00013 
00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 
00015 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00016 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00017 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00018 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00019 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
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 

Generated on Mon Oct 9 13:37:26 2006 for Strongtalk VM by  doxygen 1.4.7