1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
Commit graph

5 commits

Author SHA1 Message Date
Charles Lowell
77804fce1c Don't check for strings and primitives in idmap.
It appears that `Ref::WeakValueMap` is not 100%
correct. There are cases where entries are 
temporarily corrupted; probably while attached
finalizers run.

This is a slight decrease in flexibility in that
strings and primitives cannot maintain referential
integrity when passed by reference to v8, but the
default is to pass them by value anyway, and it
greatly reduces the number of object_ids that the
idmap sees and therefore reduces the chances of 
a recycled object id causing a bad lookup.

While this is not a perfect fix, it does make a
collision very unlikely, and it prevents the 
crashes being seen in #169 

If this pops up again,
we'll have to look at getting a perfectly reliable
weakmap implementation.
2012-06-20 15:30:34 -05:00
Charles Lowell
1a93c34b07 remove WeakRef from the equation
It turns out that the Ruby stdlib WeakRef class is
completely broken. 

http://bugs.ruby-lang.org/issues/4168

While it is fixed in trunk, it is not useable, so
as a temporary measure, use the `ref` gem as a 
dependency. It appears to be both faster and more
correct.
2012-06-20 04:35:40 -05:00
Charles Lowell
87efe139e9 avoid potential race condition.
in between the weakref_alive? check and the actual
dereference via `__getobj__` the weak reference
could have been collected. It's better to just go
ahead and do the deref. If it throws an error,
then we know it didn't work.
2012-06-19 08:33:48 -05:00
Charles Lowell
6157d35d4a support two-way identity mapping 2012-06-11 05:07:13 -05:00
Charles Lowell
32028f31fc factor out v8 conversions into separate modules 2012-06-11 01:58:12 -05:00