Commit c78fdcb9 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Can simplify InternedStringPool

now that the strings get interned anyway.  if we want to continue
down that road of interning BoxedStrings, we could probably do
away with InternedString's entirely.
parent 452204c0
......@@ -19,19 +19,8 @@
namespace pyston {
InternedString InternedStringPool::get(llvm::StringRef arg) {
auto it = interned.find(arg);
BoxedString* s;
if (it != interned.end()) {
s = it->second;
} else {
// HACK: should properly track this liveness:
s = internStringImmortal(arg);
// Note: make sure the key points to the value we just created, not the
// argument string:
interned[s->s()] = s;
}
// HACK: should properly track this liveness:
BoxedString* s = internStringImmortal(arg);
#ifndef NDEBUG
return InternedString(s, this);
......
......@@ -89,12 +89,6 @@ public:
};
class InternedStringPool {
private:
// We probably don't need to pull in llvm::StringRef as the key, but it's better than std::string
// which I assume forces extra allocations.
// (We could define a custom string-pointer container but is it worth it?)
std::unordered_map<llvm::StringRef, BoxedString*> interned;
public:
void gcHandler(gc::GCVisitor* v);
InternedString get(llvm::StringRef s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment