On 11/02/2015 05:13, Marvin Humphrey wrote:
On Mon, Feb 9, 2015 at 4:55 AM, Nick Wellnhofer <[email protected]> wrote:
Looks great. One remaining issue are the String ivars in Class and Method.
These are immortal and shared across threads, so they need special refcount
handling, too. My original plan was to use a per-object immortal flag, but
I'd prefer a solution that doesn't need such a flag. I think it should work
to use "wrapped" strings in Class and Method and rely on the fact that these
will be copied when incref'd.

I've added a new commit on that branch which implements your
suggestion (updating the pull request):

https://github.com/rectang/lucy-clownfish/commit/c0b90906746d3825e3fc9fd41d023aa727e07b13

Nice.

Another question: Do we really need the "thread-safe but not immortal" distinction for LFReg? If we keep LFReg as an implementation detail, we could just treat it as an immortal class. This would simplify things as we wouldn't need atomic operations for refcount handling. (We probably never incref the class registry anyway.)

As a side note, our immutable String class is "thread-safe but not immortal", too. We could make it completely thread-safe with atomic refcount operations. But I wouldn't want to go down that way, since atomic operations are rather costly.

Nick

Reply via email to