hotspot/src/cpu/zero/vm/frame_zero.cpp

Print this page


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


  27 #include "incls/_frame_zero.cpp.incl"
  28 
  29 #ifdef ASSERT
  30 void RegisterMap::check_location_valid() {
  31   ShouldNotCallThis();
  32 }
  33 #endif
  34 
  35 bool frame::is_interpreted_frame() const {
  36   return zeroframe()->is_interpreter_frame();
  37 }
  38 
  39 frame frame::sender_for_entry_frame(RegisterMap *map) const {
  40   assert(zeroframe()->is_entry_frame(), "wrong type of frame");
  41   assert(map != NULL, "map must be set");
  42   assert(!entry_frame_is_first(), "next Java fp must be non zero");
  43   assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(),
  44          "sender should be next Java frame");
  45   map->clear();
  46   assert(map->include_argument_oops(), "should be set by clear");
  47   return frame(sender_sp(), sp() + 1);
  48 }
  49 
  50 frame frame::sender_for_nonentry_frame(RegisterMap *map) const {
  51   assert(zeroframe()->is_interpreter_frame() ||
  52          zeroframe()->is_shark_frame() ||
  53          zeroframe()->is_fake_stub_frame(), "wrong type of frame");
  54   return frame(sender_sp(), sp() + 1);
  55 }
  56 
  57 frame frame::sender(RegisterMap* map) const {
  58   // Default is not to follow arguments; the various
  59   // sender_for_xxx methods update this accordingly.
  60   map->set_include_argument_oops(false);
  61 
  62   if (is_entry_frame())
  63     return sender_for_entry_frame(map);
  64   else
  65     return sender_for_nonentry_frame(map);
  66 }
  67 
  68 #ifdef CC_INTERP
  69 BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
  70   return get_interpreterState()->monitor_base();
  71 }
  72 
  73 BasicObjectLock* frame::interpreter_frame_monitor_end() const {
  74   return (BasicObjectLock*) get_interpreterState()->stack_base();


 155 #else
 156   return 0; // make javaVFrame::print_value work
 157 #endif // PRODUCT
 158 }
 159 
 160 intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
 161   int index = (Interpreter::expr_offset_in_bytes(offset) / wordSize);
 162   return &interpreter_frame_tos_address()[index];
 163 }
 164 
 165 void frame::zero_print_on_error(int           frame_index,
 166                                 outputStream* st,
 167                                 char*         buf,
 168                                 int           buflen) const {
 169   // Divide the buffer between the field and the value
 170   buflen >>= 1;
 171   char *fieldbuf = buf;
 172   char *valuebuf = buf + buflen;
 173 
 174   // Print each word of the frame
 175   for (intptr_t *addr = fp(); addr <= sp(); addr++) {
 176     int offset = sp() - addr;
 177 
 178     // Fill in default values, then try and improve them
 179     snprintf(fieldbuf, buflen, "word[%d]", offset);
 180     snprintf(valuebuf, buflen, PTR_FORMAT, *addr);
 181     zeroframe()->identify_word(frame_index, offset, fieldbuf, valuebuf, buflen);
 182     fieldbuf[buflen - 1] = '\0';
 183     valuebuf[buflen - 1] = '\0';
 184 
 185     // Print the result
 186     st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
 187   }
 188 }
 189 
 190 void ZeroFrame::identify_word(int   frame_index,
 191                               int   offset,
 192                               char* fieldbuf,
 193                               char* valuebuf,
 194                               int   buflen) const {
 195   switch (offset) {
 196   case next_frame_off:


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


  27 #include "incls/_frame_zero.cpp.incl"
  28 
  29 #ifdef ASSERT
  30 void RegisterMap::check_location_valid() {
  31   ShouldNotCallThis();
  32 }
  33 #endif
  34 
  35 bool frame::is_interpreted_frame() const {
  36   return zeroframe()->is_interpreter_frame();
  37 }
  38 
  39 frame frame::sender_for_entry_frame(RegisterMap *map) const {
  40   assert(zeroframe()->is_entry_frame(), "wrong type of frame");
  41   assert(map != NULL, "map must be set");
  42   assert(!entry_frame_is_first(), "next Java fp must be non zero");
  43   assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(),
  44          "sender should be next Java frame");
  45   map->clear();
  46   assert(map->include_argument_oops(), "should be set by clear");
  47   return frame(zeroframe()->next(), sender_sp());
  48 }
  49 
  50 frame frame::sender_for_nonentry_frame(RegisterMap *map) const {
  51   assert(zeroframe()->is_interpreter_frame() ||
  52          zeroframe()->is_shark_frame() ||
  53          zeroframe()->is_fake_stub_frame(), "wrong type of frame");
  54   return frame(zeroframe()->next(), sender_sp());
  55 }
  56 
  57 frame frame::sender(RegisterMap* map) const {
  58   // Default is not to follow arguments; the various
  59   // sender_for_xxx methods update this accordingly.
  60   map->set_include_argument_oops(false);
  61 
  62   if (is_entry_frame())
  63     return sender_for_entry_frame(map);
  64   else
  65     return sender_for_nonentry_frame(map);
  66 }
  67 
  68 #ifdef CC_INTERP
  69 BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
  70   return get_interpreterState()->monitor_base();
  71 }
  72 
  73 BasicObjectLock* frame::interpreter_frame_monitor_end() const {
  74   return (BasicObjectLock*) get_interpreterState()->stack_base();


 155 #else
 156   return 0; // make javaVFrame::print_value work
 157 #endif // PRODUCT
 158 }
 159 
 160 intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
 161   int index = (Interpreter::expr_offset_in_bytes(offset) / wordSize);
 162   return &interpreter_frame_tos_address()[index];
 163 }
 164 
 165 void frame::zero_print_on_error(int           frame_index,
 166                                 outputStream* st,
 167                                 char*         buf,
 168                                 int           buflen) const {
 169   // Divide the buffer between the field and the value
 170   buflen >>= 1;
 171   char *fieldbuf = buf;
 172   char *valuebuf = buf + buflen;
 173 
 174   // Print each word of the frame
 175   for (intptr_t *addr = sp(); addr <= fp(); addr++) {
 176     int offset = fp() - addr;
 177 
 178     // Fill in default values, then try and improve them
 179     snprintf(fieldbuf, buflen, "word[%d]", offset);
 180     snprintf(valuebuf, buflen, PTR_FORMAT, *addr);
 181     zeroframe()->identify_word(frame_index, offset, fieldbuf, valuebuf, buflen);
 182     fieldbuf[buflen - 1] = '\0';
 183     valuebuf[buflen - 1] = '\0';
 184 
 185     // Print the result
 186     st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
 187   }
 188 }
 189 
 190 void ZeroFrame::identify_word(int   frame_index,
 191                               int   offset,
 192                               char* fieldbuf,
 193                               char* valuebuf,
 194                               int   buflen) const {
 195   switch (offset) {
 196   case next_frame_off: