src/share/vm/shark/sharkRuntime.cpp

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 #include "incls/_precompiled.incl"
  27 #include "incls/_sharkRuntime.cpp.incl"








  28 
  29 using namespace llvm;
  30 
  31 JRT_ENTRY(int, SharkRuntime::find_exception_handler(JavaThread* thread,
  32                                                     int*        indexes,
  33                                                     int         num_indexes))
  34   constantPoolHandle pool(thread, method(thread)->constants());
  35   KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass());
  36 
  37   for (int i = 0; i < num_indexes; i++) {
  38     klassOop tmp = pool->klass_at(indexes[i], CHECK_0);
  39     KlassHandle chk_klass(thread, tmp);
  40 
  41     if (exc_klass() == chk_klass())
  42       return i;
  43 
  44     if (exc_klass()->klass_part()->is_subtype_of(chk_klass()))
  45       return i;
  46   }
  47 


   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 #include "precompiled.hpp"
  27 #include "oops/klassOop.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     klassOop 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()->klass_part()->is_subtype_of(chk_klass()))
  53       return i;
  54   }
  55