annotate graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExceptionHandler.java @ 21644:2c6802ac343c

Use graph builder plugin instead of node intrinsic for guarding non-null in snippets.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 01 Jun 2015 22:12:57 +0200
parents 48c1ebd24120
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19507
diff changeset
23 package com.oracle.jvmci.meta;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
25 import java.util.*;
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
28 * Represents an exception handler within the bytecodes.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 */
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
30 public final class ExceptionHandler {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
31
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
32 private final int startBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
33 private final int endBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
34 private final int handlerBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
35 private final int catchTypeCPI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
36 private final JavaType catchType;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
37
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
38 /**
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
39 * Creates a new exception handler with the specified ranges.
19507
1cde96b96673 Fixed code format issues.
Roland Schatz <roland.schatz@oracle.com>
parents: 14160
diff changeset
40 *
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
41 * @param startBCI the start index of the protected range
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
42 * @param endBCI the end index of the protected range
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
43 * @param catchBCI the index of the handler
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
44 * @param catchTypeCPI the index of the throwable class in the constant pool
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
45 * @param catchType the type caught by this exception handler
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
46 */
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
47 public ExceptionHandler(int startBCI, int endBCI, int catchBCI, int catchTypeCPI, JavaType catchType) {
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
48 this.startBCI = startBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
49 this.endBCI = endBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
50 this.handlerBCI = catchBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
51 this.catchTypeCPI = catchTypeCPI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
52 this.catchType = catchType;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
53 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
56 * Returns the start bytecode index of the protected range of this handler.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
58 public int getStartBCI() {
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
59 return startBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
60 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
63 * Returns the end bytecode index of the protected range of this handler.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
65 public int getEndBCI() {
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
66 return endBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
67 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
70 * Returns the bytecode index of the handler block of this handler.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
72 public int getHandlerBCI() {
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
73 return handlerBCI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
74 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
77 * Returns the index into the constant pool representing the type of exception caught by this
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
78 * handler.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 */
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
80 public int catchTypeCPI() {
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
81 return catchTypeCPI;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
82 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 * Checks whether this handler catches all exceptions.
19507
1cde96b96673 Fixed code format issues.
Roland Schatz <roland.schatz@oracle.com>
parents: 14160
diff changeset
86 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 * @return {@code true} if this handler catches all exceptions
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 */
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
89 public boolean isCatchAll() {
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
90 return catchTypeCPI == 0;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
91 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 /**
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
94 * Returns the type of exception caught by this exception handler.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 */
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5544
diff changeset
96 public JavaType getCatchType() {
5544
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
97 return catchType;
20e390e09717 Convert ExceptionHandler class from interface to final data class. Remove CiExceptionHandler and HotSpotExceptionHandler classes and replace usages with ExceptionHandler class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
98 }
13305
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
99
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
100 @Override
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
101 public boolean equals(Object obj) {
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13307
diff changeset
102 if (!(obj instanceof ExceptionHandler)) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13307
diff changeset
103 return false;
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 13307
diff changeset
104 }
13305
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
105 ExceptionHandler that = (ExceptionHandler) obj;
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
106 if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) {
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
107 return false;
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
108 }
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
109 return Objects.equals(this.catchType, that.catchType);
13305
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
110 }
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
111
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
112 @Override
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
113 public String toString() {
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
114 return "ExceptionHandler<startBCI=" + startBCI + ", endBCI=" + endBCI + ", handlerBCI=" + handlerBCI + ", catchTypeCPI=" + catchTypeCPI + ", catchType=" + catchType + ">";
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 7530
diff changeset
115 }
13307
c9dd3d5000e8 added ExceptionHandler.hashCode() to remove Eclipse warning
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
116
c9dd3d5000e8 added ExceptionHandler.hashCode() to remove Eclipse warning
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
117 @Override
c9dd3d5000e8 added ExceptionHandler.hashCode() to remove Eclipse warning
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
118 public int hashCode() {
c9dd3d5000e8 added ExceptionHandler.hashCode() to remove Eclipse warning
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
119 return catchTypeCPI ^ endBCI ^ handlerBCI;
c9dd3d5000e8 added ExceptionHandler.hashCode() to remove Eclipse warning
Doug Simon <doug.simon@oracle.com>
parents: 13305
diff changeset
120 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 }