twisti@2047: /* coleenp@4037: * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. twisti@2047: * Copyright 2008, 2009, 2010 Red Hat, Inc. twisti@2047: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. twisti@2047: * twisti@2047: * This code is free software; you can redistribute it and/or modify it twisti@2047: * under the terms of the GNU General Public License version 2 only, as twisti@2047: * published by the Free Software Foundation. twisti@2047: * twisti@2047: * This code is distributed in the hope that it will be useful, but WITHOUT twisti@2047: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or twisti@2047: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License twisti@2047: * version 2 for more details (a copy is included in the LICENSE file that twisti@2047: * accompanied this code). twisti@2047: * twisti@2047: * You should have received a copy of the GNU General Public License version twisti@2047: * 2 along with this work; if not, write to the Free Software Foundation, twisti@2047: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. twisti@2047: * twisti@2047: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA twisti@2047: * or visit www.oracle.com if you need additional information or have any twisti@2047: * questions. twisti@2047: * twisti@2047: */ twisti@2047: stefank@2314: #ifndef SHARE_VM_SHARK_SHARKRUNTIME_HPP stefank@2314: #define SHARE_VM_SHARK_SHARKRUNTIME_HPP stefank@2314: stefank@2314: #include "memory/allocation.hpp" stefank@2314: #include "runtime/thread.hpp" stefank@2314: #include "shark/llvmHeaders.hpp" stefank@2314: #include "shark/llvmValue.hpp" stefank@2314: twisti@2047: class SharkRuntime : public AllStatic { twisti@2047: // VM calls twisti@2047: public: twisti@2047: static int find_exception_handler(JavaThread* thread, twisti@2047: int* indexes, twisti@2047: int num_indexes); twisti@2047: twisti@2047: static void monitorenter(JavaThread* thread, BasicObjectLock* lock); twisti@2047: static void monitorexit(JavaThread* thread, BasicObjectLock* lock); twisti@2047: twisti@2047: static void new_instance(JavaThread* thread, int index); twisti@2047: static void newarray(JavaThread* thread, BasicType type, int size); twisti@2047: static void anewarray(JavaThread* thread, int index, int size); twisti@2047: static void multianewarray(JavaThread* thread, twisti@2047: int index, twisti@2047: int ndims, twisti@2047: int* dims); twisti@2047: twisti@2047: static void register_finalizer(JavaThread* thread, oop object); twisti@2047: twisti@2047: static void throw_ArithmeticException(JavaThread* thread, twisti@2047: const char* file, twisti@2047: int line); twisti@2047: static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread, twisti@2047: const char* file, twisti@2047: int line, twisti@2047: int index); twisti@2047: static void throw_ClassCastException(JavaThread* thread, twisti@2047: const char* file, twisti@2047: int line); twisti@2047: static void throw_NullPointerException(JavaThread* thread, twisti@2047: const char* file, twisti@2047: int line); twisti@2047: twisti@2047: // Helpers for VM calls twisti@2047: private: twisti@2047: static const SharkFrame* last_frame(JavaThread *thread) { twisti@2047: return thread->last_frame().zero_sharkframe(); twisti@2047: } coleenp@4037: static Method* method(JavaThread *thread) { twisti@2047: return last_frame(thread)->method(); twisti@2047: } twisti@2047: static address bcp(JavaThread *thread, int bci) { twisti@2047: return method(thread)->code_base() + bci; twisti@2047: } twisti@2047: static int two_byte_index(JavaThread *thread, int bci) { twisti@2047: return Bytes::get_Java_u2(bcp(thread, bci) + 1); twisti@2047: } twisti@2047: static intptr_t tos_at(JavaThread *thread, int offset) { twisti@2047: return *(thread->zero_stack()->sp() + offset); twisti@2047: } twisti@2047: twisti@2047: // Non-VM calls twisti@2047: public: twisti@2047: static void dump(const char *name, intptr_t value); coleenp@4037: static bool is_subtype_of(Klass* check_klass, Klass* object_klass); twisti@2047: static int uncommon_trap(JavaThread* thread, int trap_request); twisti@2047: }; stefank@2314: stefank@2314: #endif // SHARE_VM_SHARK_SHARKRUNTIME_HPP