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
cfc7494a
Commit
cfc7494a
authored
Feb 05, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the asserts back into stringpool
parent
2df05571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
src/core/stringpool.h
src/core/stringpool.h
+18
-10
No files found.
src/core/stringpool.h
View file @
cfc7494a
...
@@ -42,6 +42,8 @@ private:
...
@@ -42,6 +42,8 @@ private:
// Only for testing purposes:
// Only for testing purposes:
InternedStringPool
*
pool
;
InternedStringPool
*
pool
;
InternedString
(
const
std
::
string
*
str
,
InternedStringPool
*
pool
)
:
_str
(
str
),
pool
(
pool
)
{}
InternedString
(
const
std
::
string
*
str
,
InternedStringPool
*
pool
)
:
_str
(
str
),
pool
(
pool
)
{}
static
InternedStringPool
*
invalidPool
()
{
return
reinterpret_cast
<
InternedStringPool
*>
(
-
1
);
}
#else
#else
InternedString
(
const
std
::
string
*
str
)
:
_str
(
str
)
{}
InternedString
(
const
std
::
string
*
str
)
:
_str
(
str
)
{}
#endif
#endif
...
@@ -65,8 +67,9 @@ public:
...
@@ -65,8 +67,9 @@ public:
}
}
bool
operator
==
(
InternedString
rhs
)
const
{
bool
operator
==
(
InternedString
rhs
)
const
{
assert
(
this
->
_str
);
assert
(
this
->
_str
||
this
->
pool
==
invalidPool
());
assert
(
this
->
pool
==
rhs
.
pool
);
assert
(
rhs
.
_str
||
rhs
.
pool
==
invalidPool
());
assert
(
this
->
pool
==
rhs
.
pool
||
this
->
pool
==
invalidPool
()
||
rhs
.
pool
==
invalidPool
());
return
this
->
_str
==
rhs
.
_str
;
return
this
->
_str
==
rhs
.
_str
;
}
}
...
@@ -134,17 +137,22 @@ template <> struct less<pyston::InternedString> {
...
@@ -134,17 +137,22 @@ template <> struct less<pyston::InternedString> {
namespace
llvm
{
namespace
llvm
{
template
<
>
struct
DenseMapInfo
<
pyston
::
InternedString
>
{
template
<
>
struct
DenseMapInfo
<
pyston
::
InternedString
>
{
static
inline
pyston
::
InternedString
getEmptyKey
()
{
return
pyston
::
InternedString
();
}
static
inline
pyston
::
InternedString
getEmptyKey
()
{
#ifndef NDEBUG
return
pyston
::
InternedString
(
nullptr
,
pyston
::
InternedString
::
invalidPool
());
#else
return
pyston
::
InternedString
(
nullptr
);
#endif
}
static
inline
pyston
::
InternedString
getTombstoneKey
()
{
static
inline
pyston
::
InternedString
getTombstoneKey
()
{
pyston
::
InternedString
str
;
#ifndef NDEBUG
str
.
_str
=
(
const
std
::
string
*
)
-
1
;
return
pyston
::
InternedString
((
const
std
::
string
*
)
-
1
,
pyston
::
InternedString
::
invalidPool
());
return
str
;
#else
return
pyston
::
InternedString
((
const
std
::
string
*
)
-
1
);
#endif
}
}
static
unsigned
getHashValue
(
const
pyston
::
InternedString
&
val
)
{
return
std
::
hash
<
pyston
::
InternedString
>
()(
val
);
}
static
unsigned
getHashValue
(
const
pyston
::
InternedString
&
val
)
{
return
std
::
hash
<
pyston
::
InternedString
>
()(
val
);
}
static
bool
isEqual
(
const
pyston
::
InternedString
&
lhs
,
const
pyston
::
InternedString
&
rhs
)
{
static
bool
isEqual
(
const
pyston
::
InternedString
&
lhs
,
const
pyston
::
InternedString
&
rhs
)
{
return
lhs
==
rhs
;
}
// Have to reimplement InternedString comparison otherwise asserts would trigger because of the empty keys.
return
lhs
.
_str
==
rhs
.
_str
;
}
};
};
}
}
...
...
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