annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java @ 19083:09292c24d555

LSStackSlotAllocator: hide inner class.
author Josef Eisl <josef.eisl@jku.at>
date Sat, 31 Jan 2015 11:07:15 +0100
parents f57d86eb036f
children 7e2c87dae93e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.nodes;
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
15926
af0e42dad358 reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents: 15261
diff changeset
25 import static com.oracle.graal.hotspot.HotSpotBackend.*;
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
26 import static com.oracle.graal.hotspot.nodes.CStringNode.*;
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
27
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.code.*;
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.api.meta.*;
15261
882f4cb7cfcf Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 14950
diff changeset
30 import com.oracle.graal.compiler.common.type.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16822
diff changeset
31 import com.oracle.graal.nodeinfo.*;
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 import com.oracle.graal.nodes.*;
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 12363
diff changeset
33 import com.oracle.graal.nodes.spi.*;
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 7530
diff changeset
34 import com.oracle.graal.replacements.*;
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
37 * Causes the VM to exit with a description of the current Java location and an optional
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
38 * {@linkplain Log#printf(String, long) formatted} error message specified.
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 */
16822
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
40 @NodeInfo
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
41 public class VMErrorNode extends DeoptimizingStubCall implements LIRLowerable {
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
43 protected final String format;
16897
f90dcdbbb75e switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents: 16895
diff changeset
44 @Input ValueNode value;
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45
18845
f57d86eb036f removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents: 17450
diff changeset
46 public VMErrorNode(String format, ValueNode value) {
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47 super(StampFactory.forVoid());
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48 this.format = format;
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49 this.value = value;
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 }
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
53 public void generate(NodeLIRBuilderTool gen) {
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
54 String whereString;
14734
6ae9af961b7c Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents: 14731
diff changeset
55 if (stateBefore() != null) {
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
56 String nl = CodeUtil.NEW_LINE;
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
57 StringBuilder sb = new StringBuilder("in compiled code associated with frame state:");
14734
6ae9af961b7c Introduce separate interfaces for deoptimizing nodes that deopt to a state before, during or after their execution.
Roland Schatz <roland.schatz@oracle.com>
parents: 14731
diff changeset
58 FrameState fs = stateBefore();
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
59 while (fs != null) {
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
60 MetaUtil.appendLocation(sb.append(nl).append("\t"), fs.method(), fs.bci);
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
61 fs = fs.outerFrameState();
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
62 }
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
63 whereString = sb.toString();
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
64 } else {
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
65 ResolvedJavaMethod method = graph().method();
16480
10c12d09a8d2 moved format(String format, JavaMethod method) from MetaUtil to be a default method in JavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 15926
diff changeset
66 whereString = "in compiled code for " + (method == null ? graph().toString() : method.format("%H.%n(%p)"));
14731
0cb5c4d276d4 use raw data support to fix incorrect use of String.intern() for embedding strings in code
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
67 }
14735
c5ee41cf9823 replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents: 14734
diff changeset
68 Value whereArg = emitCString(gen, whereString);
c5ee41cf9823 replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents: 14734
diff changeset
69 Value formatArg = emitCString(gen, format);
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
70
15926
af0e42dad358 reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents: 15261
diff changeset
71 ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(VM_ERROR);
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 12363
diff changeset
72 gen.getLIRGeneratorTool().emitForeignCall(linkage, null, whereArg, formatArg, gen.operand(value));
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73 }
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
74
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 @NodeIntrinsic
9605
1a87230c775d removed embedding of compiler creating objects into installed code (HotSpot cannot support this)
Doug Simon <doug.simon@oracle.com>
parents: 9181
diff changeset
76 public static native void vmError(@ConstantNodeParameter String format, long value);
6453
3bba61323b38 added VMErrorNode intrinsic to support handling fatal errors in snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
77 }