< prev index next >

src/share/vm/shark/sharkRuntime.cpp

Print this page




  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "runtime/atomic.inline.hpp"
  28 #include "runtime/biasedLocking.hpp"
  29 #include "runtime/deoptimization.hpp"
  30 #include "runtime/thread.hpp"
  31 #include "shark/llvmHeaders.hpp"
  32 #include "shark/sharkRuntime.hpp"
  33 #ifdef TARGET_ARCH_zero
  34 # include "stack_zero.inline.hpp"
  35 #endif
  36 
  37 using namespace llvm;
  38 
  39 JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
  40                                                     int*        indexes,
  41                                                     int         num_indexes))
  42   constantPoolHandle pool(thread, method(thread)->constants());
  43   KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
  44 
  45   for (int i = 0; i < num_indexes; i++) {
  46     Klass* tmp = pool->klass_at(indexes[i], CHECK_0);
  47     KlassHandle chk_klass(thread, tmp);
  48 
  49     if (exc_klass() == chk_klass())
  50       return i;
  51 
  52     if (exc_klass()->is_subtype_of(chk_klass()))
  53       return i;
  54   }
  55 
  56   return -1;
  57 JRT_END
  58 
  59 JRT_ENTRY(void, SharkRuntime::monitorenter(JavaThread*      thread,
  60                                            BasicObjectLock* lock))
  61   if (PrintBiasedLockingStatistics)
  62     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
  63 


 168                                                        int         line))
 169   Exceptions::_throw_msg(
 170     thread, file, line,
 171     vmSymbols::java_lang_ClassCastException(),
 172     "");
 173 JRT_END
 174 
 175 JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
 176                                                          const char* file,
 177                                                          int         line))
 178   Exceptions::_throw_msg(
 179     thread, file, line,
 180     vmSymbols::java_lang_NullPointerException(),
 181     "");
 182 JRT_END
 183 
 184 // Non-VM calls
 185 // Nothing in these must ever GC!
 186 
 187 void SharkRuntime::dump(const char *name, intptr_t value) {
 188   oop valueOop = (oop) value;
 189   tty->print("%s = ", name);
 190   if (valueOop->is_oop(true))
 191     valueOop->print_on(tty);
 192   else if (value >= ' ' && value <= '~')
 193     tty->print("'%c' (%d)", value, value);
 194   else
 195     tty->print("%p", value);
 196   tty->print_cr("");
 197 }
 198 
 199 bool SharkRuntime::is_subtype_of(Klass* check_klass, Klass* object_klass) {
 200   return object_klass->is_subtype_of(check_klass);
 201 }
 202 
 203 int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) {
 204   Thread *THREAD = thread;
 205 
 206   // In C2, uncommon_trap_blob creates a frame, so all the various
 207   // deoptimization functions expect to find the frame of the method
 208   // being deopted one frame down on the stack.  We create a dummy




  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "runtime/atomic.inline.hpp"
  28 #include "runtime/biasedLocking.hpp"
  29 #include "runtime/deoptimization.hpp"
  30 #include "runtime/thread.hpp"
  31 #include "shark/llvmHeaders.hpp"
  32 #include "shark/sharkRuntime.hpp"
  33 #ifdef TARGET_ARCH_zero
  34 # include "stack_zero.inline.hpp"
  35 #endif
  36 
  37 using namespace llvm;
  38 
  39 JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
  40                                                     int*        indexes,
  41                                                     int         num_indexes))
  42   constantPoolHandle pool(thread, method(thread)->constants());
  43   KlassHandle exc_klass(thread, (oop((void*) tos_at(thread, 0)))->klass());
  44 
  45   for (int i = 0; i < num_indexes; i++) {
  46     Klass* tmp = pool->klass_at(indexes[i], CHECK_0);
  47     KlassHandle chk_klass(thread, tmp);
  48 
  49     if (exc_klass() == chk_klass())
  50       return i;
  51 
  52     if (exc_klass()->is_subtype_of(chk_klass()))
  53       return i;
  54   }
  55 
  56   return -1;
  57 JRT_END
  58 
  59 JRT_ENTRY(void, SharkRuntime::monitorenter(JavaThread*      thread,
  60                                            BasicObjectLock* lock))
  61   if (PrintBiasedLockingStatistics)
  62     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
  63 


 168                                                        int         line))
 169   Exceptions::_throw_msg(
 170     thread, file, line,
 171     vmSymbols::java_lang_ClassCastException(),
 172     "");
 173 JRT_END
 174 
 175 JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
 176                                                          const char* file,
 177                                                          int         line))
 178   Exceptions::_throw_msg(
 179     thread, file, line,
 180     vmSymbols::java_lang_NullPointerException(),
 181     "");
 182 JRT_END
 183 
 184 // Non-VM calls
 185 // Nothing in these must ever GC!
 186 
 187 void SharkRuntime::dump(const char *name, intptr_t value) {
 188   oop valueOop = oop((void*) value);
 189   tty->print("%s = ", name);
 190   if (valueOop->is_oop(true))
 191     valueOop->print_on(tty);
 192   else if (value >= ' ' && value <= '~')
 193     tty->print("'%c' (%d)", value, value);
 194   else
 195     tty->print("%p", value);
 196   tty->print_cr("");
 197 }
 198 
 199 bool SharkRuntime::is_subtype_of(Klass* check_klass, Klass* object_klass) {
 200   return object_klass->is_subtype_of(check_klass);
 201 }
 202 
 203 int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) {
 204   Thread *THREAD = thread;
 205 
 206   // In C2, uncommon_trap_blob creates a frame, so all the various
 207   // deoptimization functions expect to find the frame of the method
 208   // being deopted one frame down on the stack.  We create a dummy


< prev index next >