Commit ec5266a1 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Intern string literals

We're keeping them around anyway
parent 2cf0cd11
......@@ -1474,7 +1474,7 @@ Value ASTInterpreter::visit_set(AST_Set* node) {
Value ASTInterpreter::visit_str(AST_Str* node) {
Box* o = NULL;
if (node->str_type == AST_Str::STR) {
o = parent_module->getStringConstant(node->str_data);
o = parent_module->getStringConstant(node->str_data, true);
} else if (node->str_type == AST_Str::UNICODE) {
o = parent_module->getUnicodeConstant(node->str_data);
} else {
......
......@@ -1278,8 +1278,9 @@ private:
CompilerVariable* evalStr(AST_Str* node, const UnwindInfo& unw_info) {
if (node->str_type == AST_Str::STR) {
llvm::Value* rtn = embedRelocatablePtr(
irstate->getSourceInfo()->parent_module->getStringConstant(node->str_data), g.llvm_value_type_ptr);
llvm::Value* rtn
= embedRelocatablePtr(irstate->getSourceInfo()->parent_module->getStringConstant(node->str_data, true),
g.llvm_value_type_ptr);
return new ConcreteCompilerVariable(STR, rtn, true);
} else if (node->str_type == AST_Str::UNICODE) {
......
......@@ -482,13 +482,8 @@ BoxedString* internStringImmortal(llvm::StringRef s);
// Callers should use this function if they can accept mortal string objects.
// FIXME For now it just returns immortal strings, but at least we can use it
// to start documenting the places that can take mortal strings.
inline BoxedString* internStringMortal(const char* s) {
return internStringImmortal(s);
}
inline BoxedString* internStringMortal(llvm::StringRef s) {
assert(s.data()[s.size()] == '\0');
return internStringMortal(s.data());
return internStringImmortal(s);
}
// TODO this is an immortal intern for now
......
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