Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(737)

Side by Side Diff: cgen/templates/FastPyFunctionDoCallDerivative

Issue 14757: INCA: Inline Caching meets Quickening in Python 3.3
Patch Set: Created 1 year ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cgen/templates/FastPyFunctionDerivative ('k') | cgen/templates/FastPyMethodDerivative » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <%namespace file="base.impl" import="*"/>\
2
3 TARGET(FAST_PYFUN_DOCALL_${ arity_str(instr) })
4 {
5 if (oparg != ${ instr.arity() }) goto TARGET_CALL_FUNCTION_SKIP_DISPATCH ;
6
7 % for operand,accessor in get_enumerated_args(instr.arity()):
8 ${operand}= ${accessor}();
9 % endfor
10
11 /* guard against inline cache misses */
12 if (PyMethod_Check(v) && PyMethod_GET_SELF(v) != NULL) {
13 ${ dbg_inf_ic_miss(instr) }
14 goto TARGET_CALL_FUNCTION_SKIP_DISPATCH;
15 } // if
16 if (PyFunction_Check(v) || PyCFunction_Check(v)) {
17 ${ dbg_inf_ic_miss(instr) }
18 goto TARGET_CALL_FUNCTION_SKIP_DISPATCH;
19 } // if
20 register ternaryfunc call= v->ob_type->tp_call;
21 if (call == NULL)
22 goto TARGET_CALL_FUNCTION_SKIP_DISPATCH;
23
24 % if instr.arity() > 0:
25 STACKADJ(-${ instr.arity() });
26 % endif
27 ${ dbg_inf_ic_hit(instr) }
28
29 register PyObject *args= PyTuple_New( ${ instr.arity() } );
30 <% ## pass arguments...
31 i= 0
32 revargs= get_enumerated_args(instr.arity())
33 revargs.reverse()
34 %>\
35 % for operand, accessor in revargs:
36 % if operand != 'v':
37 PyTuple_SET_ITEM(args, ${i}, ${operand});
38 <% i+= 1 %>\
39 % endif
40 % endfor
41
42 if (Py_EnterRecursiveCall(" while calling a Python object")) {
43 x= NULL;
44 SET_TOP(x);
45 break;
46 } // if
47
48 x= (*call)(v, args, NULL);
49
50 Py_LeaveRecursiveCall();
51
52 if (x == NULL && !PyErr_Occurred())
53 PyErr_SetString(PyExc_SystemError, "NULL result without error in PyO bject_Call");
54
55 ## use recursive freeing of tuple container to eliminate
56 ## the reference counts increased by the argument loading
57 ## instructions...
58 Py_XDECREF( args );
59
60 ## explicit freeing of the code object is necessary...
61 Py_DECREF(v);
62
63 ## stack management and dispatch...
64 ${ push_result() }
65 ${ dispatch() }
66 }
67
68
OLDNEW
« no previous file with comments | « cgen/templates/FastPyFunctionDerivative ('k') | cgen/templates/FastPyMethodDerivative » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7