GC patches again

Attached. This makes the last change set compatible with the new hand-written lexer—a whole one line change!

See the readme file in the zip archive.

— Gordon

gc.7.zip (72.4 KB)

Attached. This makes the last change set compatible with the new hand-written lexer—a whole one line change!

See the readme file in the zip archive.

Hi Gordon, here’s some feedback:

include/llvm/Support/StringPool.h (+124)
lib/Support/StringPool.cpp (+52)
A reference-counted string interning facility. Will be used by the
next patch.

This implementation is not as fast as it could be, I’d suggest switching to using StringMap (char being a dummy). However, this is a fine starting point, the implementation can be tuned later.

About the interface:

  • PooledStringPtr intern(const std::string &Str);

Instead of taking an std::string, please provide two versions:

PooledStringPtr intern(const char *StrStart, const char *StrEnd);
and:

PooledStringPtr intern(const char *CStr) { return intern(CStr, CStr+strlen(CStr); }

This discourages string abuse/copying: std::string is not very efficient.

Also, in PooledStringPtr, please make the accessor not return an std::string.

//===-- gc-5-funattr.patch (+120 -47) -------------------------===//

Adds these methods to Function and makes corresponding changes to
assembly and bitcode:
The assembly representation is as such:

define void @f() gc “shadow-stack” { …

Uses StringPool to unique collector names, which are extremely
likely to be unique per process.

This patch depends on gc-4-stringpool.

Can you please explain to me again why this is needed? I’d like to avoid growing Function by another word for GC, is there another way?

-Chris