Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ControlFlowException.java @ 14584:6189c1983cd3
Truffle: make Node#replace accept any CharSequence as reason
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 18 Mar 2014 13:14:53 +0100 |
parents | 20e7727588e8 |
children |
rev | line source |
---|---|
7659
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
11279
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7731
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7731
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7731
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
7659
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 * questions. |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 */ |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.nodes; |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 /** |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 * An exception thrown to model control flow in a Truffle interpreter. The Truffle optimizer has |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 * special knowledge of this exception class for performance optimizations. |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
7666
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
31 public class ControlFlowException extends RuntimeException { |
7659
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 private static final long serialVersionUID = 3676602078425211386L; |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 /** |
7665
386b00821c66
Fix comment.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7659
diff
changeset
|
36 * Creates an exception thrown to model control flow. |
7659
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 */ |
7666
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
38 public ControlFlowException() { |
13820
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
39 /* |
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
40 * We use the super constructor that initializes the cause to null. Without that, the cause |
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
41 * would be this exception itself. This helps escape analysis: it avoids the circle of an |
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
42 * object pointing to itself. |
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
43 */ |
20e7727588e8
ControlFlowException can always have a null cause
Christian Wimmer <christian.wimmer@oracle.com>
parents:
11279
diff
changeset
|
44 super((Throwable) null); |
7666
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
45 } |
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
46 |
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
47 /** |
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
48 * For performance reasons, this exception does not record any stack trace information. |
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
49 */ |
7731
8b7996916df6
Make fillInStackTrace final and non-synchronized in exceptions that do not need stack trace.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7666
diff
changeset
|
50 @SuppressWarnings("sync-override") |
7666
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
51 @Override |
7731
8b7996916df6
Make fillInStackTrace final and non-synchronized in exceptions that do not need stack trace.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7666
diff
changeset
|
52 public final Throwable fillInStackTrace() { |
7666
31540ca73e81
Remove ControlFlowException in SimpleLanguage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7665
diff
changeset
|
53 return null; |
7659
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 } |
5a63675be8ca
Introduce ControlFlowException class in Truffle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 } |