Commit 3d01a810 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Revert "Can simplify InternedStringPool"

This reverts commit c78fdcb9.
parent aa9869df
......@@ -19,8 +19,19 @@
namespace pyston {
InternedString InternedStringPool::get(llvm::StringRef arg) {
// HACK: should properly track this liveness:
BoxedString* s = internStringImmortal(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;
}
#ifndef NDEBUG
return InternedString(s, this);
......
......@@ -89,6 +89,12 @@ 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