Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/NodeFactory.java @ 7855:6e4fb0ccebb1
Generated factories implement the new NodeFactory interface.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 25 Feb 2013 13:13:02 +0100 |
parents | |
children | c4c3f50fa9c2 |
comparison
equal
deleted
inserted
replaced
7854:8e56c6951c86 | 7855:6e4fb0ccebb1 |
---|---|
1 /* | |
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.truffle.api.codegen; | |
24 | |
25 import java.util.*; | |
26 | |
27 /** | |
28 * Enables the dynamic creation of generated nodes. It provides an convenient way to instantiate | |
29 * generated node classes without using reflection. | |
30 */ | |
31 public interface NodeFactory<T> { | |
32 | |
33 /** | |
34 * Instantiates the node using the arguments array. The arguments length and types must suffice | |
35 * one of the returned signatures in {@link #getNodeSignatures()}. If the arguments array does | |
36 * not suffice one of the node signatures an {@link IllegalArgumentException} is thrown. | |
37 * | |
38 * @param arguments the argument values | |
39 * @return the instantiated node | |
40 * @throws IllegalArgumentException | |
41 */ | |
42 T createNode(Object... arguments); | |
43 | |
44 /** | |
45 * Instantiates a new specialized variant of the node. This is an optional method and throws an | |
46 * {@link UnsupportedOperationException} if not supported. | |
47 * | |
48 * @param thisNode the current node | |
49 * @param specializionClasses | |
50 * @return the specialized node | |
51 */ | |
52 T createNodeSpecialized(T thisNode, Class<?>... specializionClasses); | |
53 | |
54 /** | |
55 * Returns the node class that will get created by {@link #createNode(Object...)}. The node | |
56 * class does not match exactly to the instantiated object but they are guaranteed to be | |
57 * assignable. | |
58 */ | |
59 Class<T> getNodeClass(); | |
60 | |
61 /** | |
62 * Returns a list of signatures that can be used to invoke {@link #createNode(Object...)}. | |
63 */ | |
64 List<List<Class<?>>> getNodeSignatures(); | |
65 | |
66 } |