46
46
import com .oracle .graal .python .util .PythonUtils ;
47
47
import com .oracle .truffle .api .Assumption ;
48
48
import com .oracle .truffle .api .CompilerDirectives ;
49
+ import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
49
50
import com .oracle .truffle .api .frame .Frame ;
50
51
import com .oracle .truffle .api .frame .FrameDescriptor ;
51
52
import com .oracle .truffle .api .frame .FrameSlot ;
55
56
public abstract class PClosureRootNode extends PRootNodeWithFileName {
56
57
private final Assumption singleContextAssumption ;
57
58
private final boolean annotationsAvailable ;
58
- @ CompilerDirectives . CompilationFinal (dimensions = 1 ) protected final FrameSlot [] freeVarSlots ;
59
- @ CompilerDirectives . CompilationFinal (dimensions = 1 ) protected PCell [] closure ;
59
+ @ CompilationFinal (dimensions = 1 ) protected final FrameSlot [] freeVarSlots ;
60
+ @ CompilationFinal (dimensions = 1 ) protected PCell [] closure ;
60
61
private final int length ;
61
62
62
63
protected PClosureRootNode (PythonLanguage language , FrameDescriptor frameDescriptor , FrameSlot [] freeVarSlots , boolean hasAnnotations ) {
@@ -67,7 +68,7 @@ protected PClosureRootNode(PythonLanguage language, FrameDescriptor frameDescrip
67
68
this .annotationsAvailable = hasAnnotations ;
68
69
}
69
70
70
- protected void addClosureCellsToLocals (Frame frame ) {
71
+ protected final void addClosureCellsToLocals (Frame frame ) {
71
72
PCell [] frameClosure = PArguments .getClosure (frame );
72
73
if (frameClosure != null ) {
73
74
if (singleContextAssumption .isValid () && closure == null ) {
@@ -95,20 +96,20 @@ protected void addClosureCellsToLocals(Frame frame) {
95
96
}
96
97
}
97
98
98
- protected void addClosureCellsToLocalsLoop (Frame frame , PCell [] frameClosure ) {
99
+ protected final void addClosureCellsToLocalsLoop (Frame frame , PCell [] frameClosure ) {
99
100
for (int i = 0 ; i < length ; i ++) {
100
101
frame .setObject (freeVarSlots [i ], frameClosure [i ]);
101
102
}
102
103
}
103
104
104
105
@ ExplodeLoop
105
- protected void addClosureCellsToLocalsExploded (Frame frame , PCell [] frameClosure ) {
106
+ protected final void addClosureCellsToLocalsExploded (Frame frame , PCell [] frameClosure ) {
106
107
for (int i = 0 ; i < length ; i ++) {
107
108
frame .setObject (freeVarSlots [i ], frameClosure [i ]);
108
109
}
109
110
}
110
111
111
- public boolean hasFreeVars () {
112
+ public final boolean hasFreeVars () {
112
113
return freeVarSlots != null && freeVarSlots .length > 0 ;
113
114
}
114
115
0 commit comments