comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/call/SLInvokeNode.java @ 20956:2170de9acab0

SL: use DSL for call dispatches.
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 15:16:14 +0200
parents abe7128ca473
children
comparison
equal deleted inserted replaced
20955:f7bc60c3a8f6 20956:2170de9acab0
1 /* 1 /*
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
33 /** 33 /**
34 * The node for function invocation in SL. Since SL has first class functions, the 34 * The node for function invocation in SL. Since SL has first class functions, the
35 * {@link SLFunction target function} can be computed by an {@link #functionNode arbitrary 35 * {@link SLFunction target function} can be computed by an {@link #functionNode arbitrary
36 * expression}. This node is responsible for evaluating this expression, as well as evaluating the 36 * expression}. This node is responsible for evaluating this expression, as well as evaluating the
37 * {@link #argumentNodes arguments}. The actual dispatch is then delegated to a chain of 37 * {@link #argumentNodes arguments}. The actual dispatch is then delegated to a chain of
38 * {@link SLAbstractDispatchNode}s that form a polymorphic inline cache. 38 * {@link SLDispatchNode} that form a polymorphic inline cache.
39 */ 39 */
40 @NodeInfo(shortName = "invoke") 40 @NodeInfo(shortName = "invoke")
41 public final class SLInvokeNode extends SLExpressionNode { 41 public final class SLInvokeNode extends SLExpressionNode {
42 42
43 public static SLInvokeNode create(SourceSection src, SLExpressionNode function, SLExpressionNode[] arguments) { 43 public static SLInvokeNode create(SourceSection src, SLExpressionNode function, SLExpressionNode[] arguments) {
44 return new SLInvokeNode(src, function, arguments, new SLUninitializedDispatchNode()); 44 return new SLInvokeNode(src, function, arguments);
45 } 45 }
46 46
47 @Child protected SLExpressionNode functionNode; 47 @Child private SLExpressionNode functionNode;
48 @Children protected final SLExpressionNode[] argumentNodes; 48 @Children private final SLExpressionNode[] argumentNodes;
49 @Child protected SLAbstractDispatchNode dispatchNode; 49 @Child private SLDispatchNode dispatchNode;
50 50
51 private SLInvokeNode(SourceSection src, SLExpressionNode functionNode, SLExpressionNode[] argumentNodes, SLAbstractDispatchNode dispatchNode) { 51 private SLInvokeNode(SourceSection src, SLExpressionNode functionNode, SLExpressionNode[] argumentNodes) {
52 super(src); 52 super(src);
53 this.functionNode = functionNode; 53 this.functionNode = functionNode;
54 this.argumentNodes = argumentNodes; 54 this.argumentNodes = argumentNodes;
55 this.dispatchNode = dispatchNode; 55 this.dispatchNode = SLDispatchNodeGen.create();
56 } 56 }
57 57
58 @Override 58 @Override
59 @ExplodeLoop 59 @ExplodeLoop
60 public Object executeGeneric(VirtualFrame frame) { 60 public Object executeGeneric(VirtualFrame frame) {