@@ -63,7 +63,6 @@ public final class PFunction extends PythonObject {
63
63
private TruffleString qualname ;
64
64
private boolean forceSplitDirectCalls ;
65
65
private final Assumption codeStableAssumption ;
66
- private final Assumption defaultsStableAssumption ;
67
66
private final PythonObject globals ;
68
67
@ CompilationFinal private boolean isBuiltin ;
69
68
@ CompilationFinal (dimensions = 1 ) private final PCell [] closure ;
@@ -81,14 +80,12 @@ public PFunction(PythonLanguage lang, TruffleString name, TruffleString qualname
81
80
}
82
81
83
82
public PFunction (PythonLanguage lang , TruffleString name , TruffleString qualname , PCode code , PythonObject globals , Object [] defaultValues ,
84
- PKeyword [] kwDefaultValues ,
85
- PCell [] closure ) {
86
- this (lang , name , qualname , code , globals , defaultValues , kwDefaultValues , closure , Truffle .getRuntime ().createAssumption (), Truffle .getRuntime ().createAssumption ());
83
+ PKeyword [] kwDefaultValues , PCell [] closure ) {
84
+ this (lang , name , qualname , code , globals , defaultValues , kwDefaultValues , closure , Truffle .getRuntime ().createAssumption ());
87
85
}
88
86
89
87
public PFunction (PythonLanguage lang , TruffleString name , TruffleString qualname , PCode code , PythonObject globals , Object [] defaultValues ,
90
- PKeyword [] kwDefaultValues ,
91
- PCell [] closure , Assumption codeStableAssumption , Assumption defaultsStableAssumption ) {
88
+ PKeyword [] kwDefaultValues , PCell [] closure , Assumption codeStableAssumption ) {
92
89
super (PythonBuiltinClassType .PFunction , PythonBuiltinClassType .PFunction .getInstanceShape (lang ));
93
90
this .name = name ;
94
91
this .qualname = qualname ;
@@ -100,18 +97,13 @@ public PFunction(PythonLanguage lang, TruffleString name, TruffleString qualname
100
97
this .kwDefaultValues = this .finalKwDefaultValues = kwDefaultValues == null ? PKeyword .EMPTY_KEYWORDS : kwDefaultValues ;
101
98
this .closure = closure ;
102
99
this .codeStableAssumption = codeStableAssumption ;
103
- this .defaultsStableAssumption = defaultsStableAssumption ;
104
100
this .forceSplitDirectCalls = false ;
105
101
}
106
102
107
103
public Assumption getCodeStableAssumption () {
108
104
return codeStableAssumption ;
109
105
}
110
106
111
- public Assumption getDefaultsStableAssumption () {
112
- return defaultsStableAssumption ;
113
- }
114
-
115
107
public PythonObject getGlobals () {
116
108
return globals ;
117
109
}
@@ -203,7 +195,7 @@ public void setCode(PCode code) {
203
195
204
196
public Object [] getDefaults () {
205
197
if (CompilerDirectives .inCompiledCode () && CompilerDirectives .isPartialEvaluationConstant (this )) {
206
- if (defaultsStableAssumption .isValid ()) {
198
+ if (codeStableAssumption .isValid ()) {
207
199
return finalDefaultValues ;
208
200
}
209
201
}
@@ -212,14 +204,14 @@ public Object[] getDefaults() {
212
204
213
205
@ TruffleBoundary
214
206
public void setDefaults (Object [] defaults ) {
215
- this .defaultsStableAssumption .invalidate ("defaults changed for function " + getName ());
207
+ this .codeStableAssumption .invalidate ("defaults changed for function " + getName ());
216
208
this .finalDefaultValues = null ; // avoid leak, and make code that wrongly uses it crash
217
209
this .defaultValues = defaults ;
218
210
}
219
211
220
212
public PKeyword [] getKwDefaults () {
221
213
if (CompilerDirectives .inCompiledCode () && CompilerDirectives .isPartialEvaluationConstant (this )) {
222
- if (defaultsStableAssumption .isValid ()) {
214
+ if (codeStableAssumption .isValid ()) {
223
215
return finalKwDefaultValues ;
224
216
}
225
217
}
@@ -228,7 +220,7 @@ public PKeyword[] getKwDefaults() {
228
220
229
221
@ TruffleBoundary
230
222
public void setKwDefaults (PKeyword [] defaults ) {
231
- this .defaultsStableAssumption .invalidate ("kw defaults changed for function " + getName ());
223
+ this .codeStableAssumption .invalidate ("kw defaults changed for function " + getName ());
232
224
this .finalDefaultValues = null ; // avoid leak, and make code that wrongly uses it crash
233
225
this .kwDefaultValues = defaults ;
234
226
}
0 commit comments