src/share/vm/shark/sharkRuntime.hpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 









  26 class SharkRuntime : public AllStatic {
  27   // VM calls
  28  public:
  29   static int find_exception_handler(JavaThread* thread,
  30                                     int*        indexes,
  31                                     int         num_indexes);
  32 
  33   static void monitorenter(JavaThread* thread, BasicObjectLock* lock);
  34   static void monitorexit(JavaThread* thread, BasicObjectLock* lock);
  35 
  36   static void new_instance(JavaThread* thread, int index);
  37   static void newarray(JavaThread* thread, BasicType type, int size);
  38   static void anewarray(JavaThread* thread, int index, int size);
  39   static void multianewarray(JavaThread* thread,
  40                              int         index,
  41                              int         ndims,
  42                              int*        dims);
  43 
  44   static void register_finalizer(JavaThread* thread, oop object);
  45 


  64   }
  65   static methodOop method(JavaThread *thread) {
  66     return last_frame(thread)->method();
  67   }
  68   static address bcp(JavaThread *thread, int bci) {
  69     return method(thread)->code_base() + bci;
  70   }
  71   static int two_byte_index(JavaThread *thread, int bci) {
  72     return Bytes::get_Java_u2(bcp(thread, bci) + 1);
  73   }
  74   static intptr_t tos_at(JavaThread *thread, int offset) {
  75     return *(thread->zero_stack()->sp() + offset);
  76   }
  77 
  78   // Non-VM calls
  79  public:
  80   static void dump(const char *name, intptr_t value);
  81   static bool is_subtype_of(klassOop check_klass, klassOop object_klass);
  82   static int uncommon_trap(JavaThread* thread, int trap_request);
  83 };


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef SHARE_VM_SHARK_SHARKRUNTIME_HPP
  27 #define SHARE_VM_SHARK_SHARKRUNTIME_HPP
  28 
  29 #include "memory/allocation.hpp"
  30 #include "oops/klassOop.hpp"
  31 #include "runtime/thread.hpp"
  32 #include "shark/llvmHeaders.hpp"
  33 #include "shark/llvmValue.hpp"
  34 
  35 class SharkRuntime : public AllStatic {
  36   // VM calls
  37  public:
  38   static int find_exception_handler(JavaThread* thread,
  39                                     int*        indexes,
  40                                     int         num_indexes);
  41 
  42   static void monitorenter(JavaThread* thread, BasicObjectLock* lock);
  43   static void monitorexit(JavaThread* thread, BasicObjectLock* lock);
  44 
  45   static void new_instance(JavaThread* thread, int index);
  46   static void newarray(JavaThread* thread, BasicType type, int size);
  47   static void anewarray(JavaThread* thread, int index, int size);
  48   static void multianewarray(JavaThread* thread,
  49                              int         index,
  50                              int         ndims,
  51                              int*        dims);
  52 
  53   static void register_finalizer(JavaThread* thread, oop object);
  54 


  73   }
  74   static methodOop method(JavaThread *thread) {
  75     return last_frame(thread)->method();
  76   }
  77   static address bcp(JavaThread *thread, int bci) {
  78     return method(thread)->code_base() + bci;
  79   }
  80   static int two_byte_index(JavaThread *thread, int bci) {
  81     return Bytes::get_Java_u2(bcp(thread, bci) + 1);
  82   }
  83   static intptr_t tos_at(JavaThread *thread, int offset) {
  84     return *(thread->zero_stack()->sp() + offset);
  85   }
  86 
  87   // Non-VM calls
  88  public:
  89   static void dump(const char *name, intptr_t value);
  90   static bool is_subtype_of(klassOop check_klass, klassOop object_klass);
  91   static int uncommon_trap(JavaThread* thread, int trap_request);
  92 };
  93 
  94 #endif // SHARE_VM_SHARK_SHARKRUNTIME_HPP