Mon, 04 Apr 2011 03:02:00 -0700
7032458: Zero and Shark fixes
Reviewed-by: twisti
Contributed-by: Gary Benson <gbenson@redhat.com>
twisti@2047 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
twisti@2047 | 3 | * Copyright 2008, 2009, 2010 Red Hat, Inc. |
twisti@2047 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@2047 | 5 | * |
twisti@2047 | 6 | * This code is free software; you can redistribute it and/or modify it |
twisti@2047 | 7 | * under the terms of the GNU General Public License version 2 only, as |
twisti@2047 | 8 | * published by the Free Software Foundation. |
twisti@2047 | 9 | * |
twisti@2047 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@2047 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@2047 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@2047 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@2047 | 14 | * accompanied this code). |
twisti@2047 | 15 | * |
twisti@2047 | 16 | * You should have received a copy of the GNU General Public License version |
twisti@2047 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@2047 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@2047 | 19 | * |
twisti@2047 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
twisti@2047 | 21 | * or visit www.oracle.com if you need additional information or have any |
twisti@2047 | 22 | * questions. |
twisti@2047 | 23 | * |
twisti@2047 | 24 | */ |
twisti@2047 | 25 | |
stefank@2314 | 26 | #ifndef SHARE_VM_SHARK_SHARKRUNTIME_HPP |
stefank@2314 | 27 | #define SHARE_VM_SHARK_SHARKRUNTIME_HPP |
stefank@2314 | 28 | |
stefank@2314 | 29 | #include "memory/allocation.hpp" |
stefank@2314 | 30 | #include "oops/klassOop.hpp" |
stefank@2314 | 31 | #include "runtime/thread.hpp" |
stefank@2314 | 32 | #include "shark/llvmHeaders.hpp" |
stefank@2314 | 33 | #include "shark/llvmValue.hpp" |
stefank@2314 | 34 | |
twisti@2047 | 35 | class SharkRuntime : public AllStatic { |
twisti@2047 | 36 | // VM calls |
twisti@2047 | 37 | public: |
twisti@2047 | 38 | static int find_exception_handler(JavaThread* thread, |
twisti@2047 | 39 | int* indexes, |
twisti@2047 | 40 | int num_indexes); |
twisti@2047 | 41 | |
twisti@2047 | 42 | static void monitorenter(JavaThread* thread, BasicObjectLock* lock); |
twisti@2047 | 43 | static void monitorexit(JavaThread* thread, BasicObjectLock* lock); |
twisti@2047 | 44 | |
twisti@2047 | 45 | static void new_instance(JavaThread* thread, int index); |
twisti@2047 | 46 | static void newarray(JavaThread* thread, BasicType type, int size); |
twisti@2047 | 47 | static void anewarray(JavaThread* thread, int index, int size); |
twisti@2047 | 48 | static void multianewarray(JavaThread* thread, |
twisti@2047 | 49 | int index, |
twisti@2047 | 50 | int ndims, |
twisti@2047 | 51 | int* dims); |
twisti@2047 | 52 | |
twisti@2047 | 53 | static void register_finalizer(JavaThread* thread, oop object); |
twisti@2047 | 54 | |
twisti@2047 | 55 | static void throw_ArithmeticException(JavaThread* thread, |
twisti@2047 | 56 | const char* file, |
twisti@2047 | 57 | int line); |
twisti@2047 | 58 | static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread, |
twisti@2047 | 59 | const char* file, |
twisti@2047 | 60 | int line, |
twisti@2047 | 61 | int index); |
twisti@2047 | 62 | static void throw_ClassCastException(JavaThread* thread, |
twisti@2047 | 63 | const char* file, |
twisti@2047 | 64 | int line); |
twisti@2047 | 65 | static void throw_NullPointerException(JavaThread* thread, |
twisti@2047 | 66 | const char* file, |
twisti@2047 | 67 | int line); |
twisti@2047 | 68 | |
twisti@2047 | 69 | // Helpers for VM calls |
twisti@2047 | 70 | private: |
twisti@2047 | 71 | static const SharkFrame* last_frame(JavaThread *thread) { |
twisti@2047 | 72 | return thread->last_frame().zero_sharkframe(); |
twisti@2047 | 73 | } |
twisti@2047 | 74 | static methodOop method(JavaThread *thread) { |
twisti@2047 | 75 | return last_frame(thread)->method(); |
twisti@2047 | 76 | } |
twisti@2047 | 77 | static address bcp(JavaThread *thread, int bci) { |
twisti@2047 | 78 | return method(thread)->code_base() + bci; |
twisti@2047 | 79 | } |
twisti@2047 | 80 | static int two_byte_index(JavaThread *thread, int bci) { |
twisti@2047 | 81 | return Bytes::get_Java_u2(bcp(thread, bci) + 1); |
twisti@2047 | 82 | } |
twisti@2047 | 83 | static intptr_t tos_at(JavaThread *thread, int offset) { |
twisti@2047 | 84 | return *(thread->zero_stack()->sp() + offset); |
twisti@2047 | 85 | } |
twisti@2047 | 86 | |
twisti@2047 | 87 | // Non-VM calls |
twisti@2047 | 88 | public: |
twisti@2047 | 89 | static void dump(const char *name, intptr_t value); |
twisti@2047 | 90 | static bool is_subtype_of(klassOop check_klass, klassOop object_klass); |
twisti@2047 | 91 | static int uncommon_trap(JavaThread* thread, int trap_request); |
twisti@2047 | 92 | }; |
stefank@2314 | 93 | |
stefank@2314 | 94 | #endif // SHARE_VM_SHARK_SHARKRUNTIME_HPP |