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
e4f5dd18
Commit
e4f5dd18
authored
Aug 22, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store keywords names inside the AST
solves a pointer reuse problem
parent
bedb3f3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+6
-15
src/core/ast.h
src/core/ast.h
+3
-0
No files found.
src/codegen/irgen/irgenerator.cpp
View file @
e4f5dd18
...
...
@@ -758,24 +758,15 @@ IREmitter* createIREmitter(IRGenState* irstate, llvm::BasicBlock*& curblock, IRG
return
new
IREmitterImpl
(
irstate
,
curblock
,
irgenerator
);
}
static
std
::
unordered_map
<
AST_expr
*
,
std
::
vector
<
BoxedString
*>*>
made_keyword_storage
;
std
::
vector
<
BoxedString
*>*
getKeywordNameStorage
(
AST_Call
*
node
)
{
auto
it
=
made_keyword_storage
.
find
(
node
);
if
(
it
!=
made_keyword_storage
.
end
())
return
it
->
second
;
auto
rtn
=
new
std
::
vector
<
BoxedString
*>
();
made_keyword_storage
.
insert
(
it
,
std
::
make_pair
(
node
,
rtn
));
// Only add the keywords to the array the first time, since
// the later times we will hit the cache which will have the
// keyword names already populated:
if
(
!
rtn
->
size
())
{
for
(
auto
kw
:
node
->
keywords
)
rtn
->
push_back
(
kw
->
arg
.
getBox
());
if
(
!
node
->
keywords_names
)
{
node
->
keywords_names
=
llvm
::
make_unique
<
std
::
vector
<
BoxedString
*>>
();
for
(
auto
kw
:
node
->
keywords
)
{
node
->
keywords_names
->
push_back
(
kw
->
arg
.
getBox
());
}
}
return
rtn
;
return
node
->
keywords_names
.
get
()
;
}
const
std
::
string
CREATED_CLOSURE_NAME
=
"#created_closure"
;
...
...
src/core/ast.h
View file @
e4f5dd18
...
...
@@ -353,6 +353,9 @@ public:
std
::
vector
<
AST_expr
*>
args
;
std
::
vector
<
AST_keyword
*>
keywords
;
// used during execution stores all keyword names
std
::
unique_ptr
<
std
::
vector
<
BoxedString
*>>
keywords_names
;
virtual
void
accept
(
ASTVisitor
*
v
);
virtual
void
*
accept_expr
(
ExprVisitor
*
v
);
...
...
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