Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
04d80f87
Commit
04d80f87
authored
Aug 04, 2002
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small speedup for constant and name access
see sf #506436
parent
1ee99d31
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Python/ceval.c
Python/ceval.c
+6
-3
No files found.
Python/ceval.c
View file @
04d80f87
...
@@ -494,6 +494,8 @@ eval_frame(PyFrameObject *f)
...
@@ -494,6 +494,8 @@ eval_frame(PyFrameObject *f)
PyThreadState
*
tstate
=
PyThreadState_GET
();
PyThreadState
*
tstate
=
PyThreadState_GET
();
PyCodeObject
*
co
;
PyCodeObject
*
co
;
unsigned
char
*
first_instr
;
unsigned
char
*
first_instr
;
PyObject
*
names
;
PyObject
*
consts
;
#ifdef LLTRACE
#ifdef LLTRACE
int
lltrace
;
int
lltrace
;
#endif
#endif
...
@@ -512,8 +514,7 @@ eval_frame(PyFrameObject *f)
...
@@ -512,8 +514,7 @@ eval_frame(PyFrameObject *f)
/* Code access macros */
/* Code access macros */
#define GETCONST(i) (GETITEM(co->co_consts, (i)))
#define GETNAMEV(i) (GETITEM(names, (i)))
#define GETNAMEV(i) (GETITEM(co->co_names, (i)))
#define INSTR_OFFSET() (next_instr - first_instr)
#define INSTR_OFFSET() (next_instr - first_instr)
#define NEXTOP() (*next_instr++)
#define NEXTOP() (*next_instr++)
#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
...
@@ -575,6 +576,8 @@ eval_frame(PyFrameObject *f)
...
@@ -575,6 +576,8 @@ eval_frame(PyFrameObject *f)
tstate
->
frame
=
f
;
tstate
->
frame
=
f
;
co
=
f
->
f_code
;
co
=
f
->
f_code
;
names
=
co
->
co_names
;
consts
=
co
->
co_consts
;
fastlocals
=
f
->
f_localsplus
;
fastlocals
=
f
->
f_localsplus
;
freevars
=
f
->
f_localsplus
+
f
->
f_nlocals
;
freevars
=
f
->
f_localsplus
+
f
->
f_nlocals
;
_PyCode_GETCODEPTR
(
co
,
&
first_instr
);
_PyCode_GETCODEPTR
(
co
,
&
first_instr
);
...
@@ -753,7 +756,7 @@ eval_frame(PyFrameObject *f)
...
@@ -753,7 +756,7 @@ eval_frame(PyFrameObject *f)
break
;
break
;
case
LOAD_CONST
:
case
LOAD_CONST
:
x
=
GET
CONST
(
oparg
);
x
=
GET
ITEM
(
consts
,
oparg
);
Py_INCREF
(
x
);
Py_INCREF
(
x
);
PUSH
(
x
);
PUSH
(
x
);
goto
fast_next_opcode
;
goto
fast_next_opcode
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment