Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
9f7a8d19
Commit
9f7a8d19
authored
Jul 19, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interpreter: Cache lookup type for AST_Name stores
parent
cf04e092
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+8
-4
No files found.
src/codegen/ast_interpreter.cpp
View file @
9f7a8d19
...
...
@@ -102,7 +102,7 @@ private:
Box
*
createFunction
(
AST
*
node
,
AST_arguments
*
args
,
const
std
::
vector
<
AST_stmt
*>&
body
);
Value
doBinOp
(
Value
left
,
Value
right
,
int
op
,
BinExpType
exp_type
);
void
doStore
(
AST_expr
*
node
,
Value
value
);
void
doStore
(
InternedString
name
,
Value
value
);
void
doStore
(
AST_Name
*
name
,
Value
value
);
Box
*
doOSR
(
AST_Jump
*
node
);
Value
getNone
();
...
...
@@ -506,8 +506,12 @@ Value ASTInterpreter::doBinOp(Value left, Value right, int op, BinExpType exp_ty
return
Value
();
}
void
ASTInterpreter
::
doStore
(
InternedString
name
,
Value
value
)
{
ScopeInfo
::
VarScopeType
vst
=
scope_info
->
getScopeTypeOfName
(
name
);
void
ASTInterpreter
::
doStore
(
AST_Name
*
node
,
Value
value
)
{
if
(
node
->
lookup_type
==
ScopeInfo
::
VarScopeType
::
UNKNOWN
)
node
->
lookup_type
=
scope_info
->
getScopeTypeOfName
(
node
->
id
);
InternedString
name
=
node
->
id
;
ScopeInfo
::
VarScopeType
vst
=
node
->
lookup_type
;
if
(
vst
==
ScopeInfo
::
VarScopeType
::
GLOBAL
)
{
if
(
jit
)
jit
->
emitSetGlobal
(
globals
,
name
.
getBox
(),
value
);
...
...
@@ -541,7 +545,7 @@ void ASTInterpreter::doStore(InternedString name, Value value) {
void
ASTInterpreter
::
doStore
(
AST_expr
*
node
,
Value
value
)
{
if
(
node
->
type
==
AST_TYPE
::
Name
)
{
AST_Name
*
name
=
(
AST_Name
*
)
node
;
doStore
(
name
->
id
,
value
);
doStore
(
name
,
value
);
}
else
if
(
node
->
type
==
AST_TYPE
::
Attribute
)
{
AST_Attribute
*
attr
=
(
AST_Attribute
*
)
node
;
Value
o
=
visit_expr
(
attr
->
value
);
...
...
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