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
994269dc
Commit
994269dc
authored
Feb 04, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #278 from undingen/interpreter_speed
Small performance improvement when interpreting
parents
bf63439c
552a3cfc
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
141 deletions
+165
-141
src/analysis/scoping_analysis.cpp
src/analysis/scoping_analysis.cpp
+3
-1
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+146
-140
src/core/stringpool.h
src/core/stringpool.h
+16
-0
No files found.
src/analysis/scoping_analysis.cpp
View file @
994269dc
...
...
@@ -14,6 +14,8 @@
#include "analysis/scoping_analysis.h"
#include "llvm/ADT/DenseSet.h"
#include "core/ast.h"
#include "core/common.h"
#include "core/util.h"
...
...
@@ -112,7 +114,7 @@ struct ScopingAnalysis::ScopeNameUsage {
const
std
::
string
*
private_name
;
ScopingAnalysis
*
scoping
;
typedef
std
::
unordered_s
et
<
InternedString
>
StrSet
;
typedef
llvm
::
DenseS
et
<
InternedString
>
StrSet
;
// Properties determined from crawling the scope:
StrSet
read
;
...
...
src/codegen/ast_interpreter.cpp
View file @
994269dc
This diff is collapsed.
Click to expand it.
src/core/stringpool.h
View file @
994269dc
...
...
@@ -19,6 +19,7 @@
#include <cstdio>
#include <sys/time.h>
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringRef.h"
...
...
@@ -78,6 +79,7 @@ public:
friend
class
InternedStringPool
;
friend
struct
std
::
hash
<
InternedString
>
;
friend
struct
std
::
less
<
InternedString
>
;
friend
struct
llvm
::
DenseMapInfo
<
pyston
::
InternedString
>
;
};
class
InternedStringPool
{
...
...
@@ -130,4 +132,18 @@ template <> struct less<pyston::InternedString> {
};
}
template
<
>
struct
llvm
::
DenseMapInfo
<
pyston
::
InternedString
>
{
static
inline
pyston
::
InternedString
getEmptyKey
()
{
return
pyston
::
InternedString
();
}
static
inline
pyston
::
InternedString
getTombstoneKey
()
{
pyston
::
InternedString
str
;
str
.
_str
=
(
const
std
::
string
*
)
-
1
;
return
str
;
}
static
unsigned
getHashValue
(
const
pyston
::
InternedString
&
val
)
{
return
std
::
hash
<
pyston
::
InternedString
>
()(
val
);
}
static
bool
isEqual
(
const
pyston
::
InternedString
&
lhs
,
const
pyston
::
InternedString
&
rhs
)
{
// Have to reimplement InternedString comparison otherwise asserts would trigger because of the empty keys.
return
lhs
.
_str
==
rhs
.
_str
;
}
};
#endif
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