1 /*
2 * Copyright (c) 1999, 2012, 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 #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;
|
1 /*
2 * Copyright (c) 1999, 2016, 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 #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 #include "utilities/macros.hpp"
34 #ifdef ZERO
35 # include "stack_zero.inline.hpp"
36 #endif
37
38 using namespace llvm;
39
40 JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
41 int* indexes,
42 int num_indexes))
43 constantPoolHandle pool(thread, method(thread)->constants());
44 KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
45
46 for (int i = 0; i < num_indexes; i++) {
47 Klass* tmp = pool->klass_at(indexes[i], CHECK_0);
48 KlassHandle chk_klass(thread, tmp);
49
50 if (exc_klass() == chk_klass())
51 return i;
52
53 if (exc_klass()->is_subtype_of(chk_klass()))
54 return i;
|