Construct CallCompiledFunctionPosArgsDefaults
Source Code with Construct
from __future__ import print_function def compiled_func(a = 1,b = 2,c = 3,d = 4,e = 5,f = 6): return a, b, c, d, e, f def calledRepeatedly(): # This is supposed to make a call to a compiled function, which is # being optimized separately. compiled_f = compiled_func # construct_begin compiled_f() compiled_f() compiled_f() # construct_alternative return compiled_f import itertools for x in itertools.repeat(None, 50000): calledRepeatedly() print("OK.")
Source Code without Construct
from __future__ import print_function def compiled_func(a = 1,b = 2,c = 3,d = 4,e = 5,f = 6): return a, b, c, d, e, f def calledRepeatedly(): # This is supposed to make a call to a compiled function, which is # being optimized separately. compiled_f = compiled_func # construct_begin # construct_alternative pass # construct_end return compiled_f import itertools for x in itertools.repeat(None, 50000): calledRepeatedly() print("OK.")
Context Diff of Source Code
Construct | Baseline | ||||
---|---|---|---|---|---|
26 | # This is supposed to make a call to a compiled function, which is | 26 | # This is supposed to make a call to a compiled function, which is | ||
27 | # being optimized separately. | 27 | # being optimized separately. | ||
28 | compiled_f = compiled_func | 28 | compiled_f = compiled_func | ||
29 | 29 | ||||
30 | # construct_begin | 30 | # construct_begin | ||
n | 31 | compiled_f() | n | ||
32 | compiled_f() | ||||
33 | compiled_f() | ||||
34 | # construct_alternative | ||||
35 | 31 | ||||
36 | 32 | ||||
t | t | 33 | |||
34 | # construct_alternative | ||||
35 | pass | ||||
36 | # construct_end | ||||
37 | 37 | ||||
38 | return compiled_f | 38 | return compiled_f | ||
39 | 39 | ||||
40 | import itertools | 40 | import itertools | ||
41 | for x in itertools.repeat(None, 50000): | 41 | for x in itertools.repeat(None, 50000): |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
180 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | 180 | NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; | ||
181 | PyObject *exception_type = NULL; | 181 | PyObject *exception_type = NULL; | ||
182 | PyObject *exception_value = NULL; | 182 | PyObject *exception_value = NULL; | ||
183 | PyTracebackObject *exception_tb = NULL; | 183 | PyTracebackObject *exception_tb = NULL; | ||
184 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | 184 | NUITKA_MAY_BE_UNUSED int exception_lineno = 0; | ||
n | 185 | NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; | n | ||
186 | static struct Nuitka_FrameObject *cache_frame_aa9e053f519d499e889db14bb602587f = NULL; | 185 | static struct Nuitka_FrameObject *cache_frame_aa9e053f519d499e889db14bb602587f = NULL; | ||
187 | PyObject *tmp_return_value = NULL; | 186 | PyObject *tmp_return_value = NULL; | ||
188 | PyObject *exception_keeper_type_1; | 187 | PyObject *exception_keeper_type_1; | ||
189 | PyObject *exception_keeper_value_1; | 188 | PyObject *exception_keeper_value_1; | ||
190 | PyTracebackObject *exception_keeper_tb_1; | 189 | PyTracebackObject *exception_keeper_tb_1; | ||
238 | goto frame_exception_exit_1; | 237 | goto frame_exception_exit_1; | ||
239 | } | 238 | } | ||
240 | assert(var_compiled_f == NULL); | 239 | assert(var_compiled_f == NULL); | ||
241 | Py_INCREF(tmp_assign_source_1); | 240 | Py_INCREF(tmp_assign_source_1); | ||
242 | var_compiled_f = tmp_assign_source_1; | 241 | var_compiled_f = tmp_assign_source_1; | ||
n | 243 | } | n | ||
244 | { | ||||
245 | PyObject *tmp_called_name_1; | ||||
246 | PyObject *tmp_call_result_1; | ||||
247 | CHECK_OBJECT(var_compiled_f); | ||||
248 | tmp_called_name_1 = var_compiled_f; | ||||
249 | frame_aa9e053f519d499e889db14bb602587f->m_frame.f_lineno = 31; | ||||
250 | tmp_call_result_1 = CALL_FUNCTION_NO_ARGS(tmp_called_name_1); | ||||
251 | if (tmp_call_result_1 == NULL) { | ||||
252 | assert(ERROR_OCCURRED()); | ||||
253 | |||||
254 | FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); | ||||
255 | |||||
256 | |||||
257 | exception_lineno = 31; | ||||
258 | type_description_1 = "o"; | ||||
259 | goto frame_exception_exit_1; | ||||
260 | } | ||||
261 | Py_DECREF(tmp_call_result_1); | ||||
262 | } | ||||
263 | { | ||||
264 | PyObject *tmp_called_name_2; | ||||
265 | PyObject *tmp_call_result_2; | ||||
266 | CHECK_OBJECT(var_compiled_f); | ||||
267 | tmp_called_name_2 = var_compiled_f; | ||||
268 | frame_aa9e053f519d499e889db14bb602587f->m_frame.f_lineno = 32; | ||||
269 | tmp_call_result_2 = CALL_FUNCTION_NO_ARGS(tmp_called_name_2); | ||||
270 | if (tmp_call_result_2 == NULL) { | ||||
271 | assert(ERROR_OCCURRED()); | ||||
272 | |||||
273 | FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); | ||||
274 | |||||
275 | |||||
276 | exception_lineno = 32; | ||||
277 | type_description_1 = "o"; | ||||
278 | goto frame_exception_exit_1; | ||||
279 | } | ||||
280 | Py_DECREF(tmp_call_result_2); | ||||
281 | } | ||||
282 | { | ||||
283 | PyObject *tmp_called_name_3; | ||||
284 | PyObject *tmp_call_result_3; | ||||
285 | CHECK_OBJECT(var_compiled_f); | ||||
286 | tmp_called_name_3 = var_compiled_f; | ||||
287 | frame_aa9e053f519d499e889db14bb602587f->m_frame.f_lineno = 33; | ||||
288 | tmp_call_result_3 = CALL_FUNCTION_NO_ARGS(tmp_called_name_3); | ||||
289 | if (tmp_call_result_3 == NULL) { | ||||
290 | assert(ERROR_OCCURRED()); | ||||
291 | |||||
292 | FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); | ||||
293 | |||||
294 | |||||
295 | exception_lineno = 33; | ||||
296 | type_description_1 = "o"; | ||||
297 | goto frame_exception_exit_1; | ||||
298 | } | ||||
299 | Py_DECREF(tmp_call_result_3); | ||||
300 | } | 242 | } | ||
301 | 243 | ||||
302 | #if 0 | 244 | #if 0 | ||
303 | RESTORE_FRAME_EXCEPTION(frame_aa9e053f519d499e889db14bb602587f); | 245 | RESTORE_FRAME_EXCEPTION(frame_aa9e053f519d499e889db14bb602587f); | ||
304 | #endif | 246 | #endif | ||
369 | exception_type = NULL; | 311 | exception_type = NULL; | ||
370 | exception_value = NULL; | 312 | exception_value = NULL; | ||
371 | exception_tb = NULL; | 313 | exception_tb = NULL; | ||
372 | exception_lineno = 0; | 314 | exception_lineno = 0; | ||
373 | 315 | ||||
t | 374 | Py_XDECREF(var_compiled_f); | t | ||
375 | var_compiled_f = NULL; | ||||
376 | // Re-raise. | 316 | // Re-raise. | ||
377 | exception_type = exception_keeper_type_1; | 317 | exception_type = exception_keeper_type_1; | ||
378 | exception_value = exception_keeper_value_1; | 318 | exception_value = exception_keeper_value_1; | ||
379 | exception_tb = exception_keeper_tb_1; | 319 | exception_tb = exception_keeper_tb_1; | ||
380 | exception_lineno = exception_keeper_lineno_1; | 320 | exception_lineno = exception_keeper_lineno_1; |