annotate graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java @ 11760:ce0b00597980

made safepoint-on-return use specialized HotSpot runtime support for such safepoints (which have no debug info attached)
author Doug Simon <doug.simon@oracle.com>
date Tue, 24 Sep 2013 08:51:02 +0200
parents 79041ab43660
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7292
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
1 /*
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
4 *
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
8 *
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
13 * accompanied this code).
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
14 *
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
18 *
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
21 * questions.
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
22 */
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
23 package com.oracle.truffle.sl.nodes;
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
24
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
25 import java.io.*;
7503
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
26
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents: 10593
diff changeset
27 import com.oracle.truffle.api.dsl.*;
7292
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
28
10443
8b2573c8d47f dsl cleanup.
Christian Humer <christian.humer@gmail.com>
parents: 9222
diff changeset
29 @NodeChild(type = TypedNode.class)
7503
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
30 public abstract class PrintNode extends StatementNode {
7292
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
31
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
32 private final PrintStream output;
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
33
9222
aa9ffb3a715e Updated Truffle-SL to new codegen API.
Christian Humer <christian.humer@gmail.com>
parents: 7530
diff changeset
34 public PrintNode(PrintStream output) {
7292
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
35 this.output = output;
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
36 }
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
37
7503
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
38 public PrintNode(PrintNode node) {
9222
aa9ffb3a715e Updated Truffle-SL to new codegen API.
Christian Humer <christian.humer@gmail.com>
parents: 7530
diff changeset
39 this(node.output);
7503
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
40 }
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
41
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
42 @Specialization
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
43 public void doInt(int value) {
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
44 output.print(value);
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
45 }
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
46
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
47 @Specialization
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
48 public void doBoolean(boolean value) {
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
49 output.print(value);
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
50 }
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
51
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
52 @Specialization
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
53 public void doString(String value) {
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
54 output.print(value);
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
55 }
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
56
10593
447465567e6f Truffle-DSL: API change: removed useSpecializations in @Generic. The way of specifying this behaviour now is to create a @Specialization which won't rewrite. This way there is no generic case anymore which could use the specializations for its implementation.
Christian Humer <christian.humer@gmail.com>
parents: 10443
diff changeset
57 @Specialization
7503
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
58 public void doGeneric(Object value) {
31da1716950f Updated truffle-sl for the changed operation code generation.
Christian Humer <christian.humer@gmail.com>
parents: 7292
diff changeset
59 output.print(value.toString());
7292
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
60 }
213c1297a814 Simple Language: A simple dynamic programming language to demonstrate Truffle features
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
61 }