13514
|
1 /*
|
|
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This
|
|
3 * code is released under a tri EPL/GPL/LGPL license. You can use it,
|
|
4 * redistribute it and/or modify it under the terms of the:
|
|
5 *
|
|
6 * Eclipse Public License version 1.0
|
|
7 * GNU General Public License version 2
|
|
8 * GNU Lesser General Public License version 2.1
|
|
9 */
|
|
10 package com.oracle.truffle.ruby.nodes;
|
|
11
|
|
12 import com.oracle.truffle.api.*;
|
|
13 import com.oracle.truffle.api.frame.*;
|
|
14 import com.oracle.truffle.api.nodes.*;
|
|
15 import com.oracle.truffle.ruby.nodes.call.*;
|
|
16 import com.oracle.truffle.ruby.runtime.methods.*;
|
|
17
|
|
18 /**
|
|
19 * A method implementation that also carries the pristine root node and frame descriptor, from which
|
|
20 * we can inline.
|
|
21 *
|
|
22 * @see InlinedUnboxedDispatchNode
|
|
23 * @see InlinedBoxedDispatchNode
|
|
24 * @see InlineHeuristic
|
|
25 */
|
|
26 public class InlinableMethodImplementation extends CallTargetMethodImplementation {
|
|
27
|
|
28 private final FrameDescriptor frameDescriptor;
|
|
29 private final RubyRootNode pristineRootNode;
|
|
30
|
|
31 public final boolean alwaysInline;
|
|
32 public final boolean shouldAppendCallNode;
|
|
33
|
|
34 public InlinableMethodImplementation(CallTarget callTarget, MaterializedFrame declarationFrame, FrameDescriptor frameDescriptor, RubyRootNode pristineRootNode, boolean alwaysInline,
|
|
35 boolean shouldAppendCallNode) {
|
|
36 super(callTarget, declarationFrame);
|
|
37
|
|
38 assert frameDescriptor != null;
|
|
39 assert pristineRootNode != null;
|
|
40
|
|
41 this.frameDescriptor = frameDescriptor;
|
|
42 this.pristineRootNode = pristineRootNode;
|
|
43 this.alwaysInline = alwaysInline;
|
|
44 this.shouldAppendCallNode = shouldAppendCallNode;
|
|
45 }
|
|
46
|
|
47 public FrameDescriptor getFrameDescriptor() {
|
|
48 return frameDescriptor;
|
|
49 }
|
|
50
|
|
51 public RubyRootNode getPristineRootNode() {
|
|
52 return pristineRootNode;
|
|
53 }
|
|
54
|
|
55 public RubyRootNode getCloneOfPristineRootNode() {
|
|
56 return NodeUtil.cloneNode(pristineRootNode);
|
|
57 }
|
|
58
|
|
59 public boolean alwaysInline() {
|
|
60 return alwaysInline;
|
|
61 }
|
|
62
|
|
63 public boolean getShouldAppendCallNode() {
|
|
64 return shouldAppendCallNode;
|
|
65 }
|
|
66
|
|
67 }
|