gecko-dev/js
nboyd%atg.com 0babafcaa0 Patch from Igor:
I must admit this is very subtitle, but still...

Here are the lines from
    public void defineProperty(String propertyName, Object delegateTo,
                               Method getter, Method setter, int attributes)


        GetterSlot slot = (GetterSlot)getSlotToSet(propertyName,
                                                   propertyName.hashCode(),
                                                   true);
        slot.delegateTo = delegateTo;
        slot.getter = getter;
        slot.setter = setter;
        slot.setterReturnsValue = setter != null && setter.getReturnType() != Void.TYPE;
        slot.value = null;
        slot.attributes = (short) attributes;
        slot.flags = (byte)flags;

Now suppose that after the new slot is added, another thread is accessing it. Then it would see not yet ready slot with all nasty consequences! For example,  SMP computer can re-arrange writes so the new value of slot.flags would be visible before slot.getter then another thread would generate null pointer exception.

race2_fix.diff fixes that by using the explicit Slot argument to addSlot instead of boolean flag so the new slot can be fully initialized and then inserted under synchronization to the table. I also call addSlot directly because it is supposed to be used with not-yet existed properties and split addSlot to addSlot and addSlotImpl so in case of table growth there is no need to re-enter already synchronized monitor.

This changes also allows to explicitly throw RuntimeException if defineProperty is called for the property that is already exists instead of either throwing cast exception in "GetterSlot slot = (GetterSlot)getSlotToSet(propertyName," or worth yet re-initializing already existed slot.

Regards, Igor
2001-10-30 13:07:00 +00:00
..
benchmarks
js2 Added fdlibm_ns to build, stopped warnings from formmatter.h 2001-07-18 22:34:09 +00:00
jsd More REQUIRES clean-up. 2001-10-16 22:08:55 +00:00
jsdj updated license boilerplate to xPL 1.1, a=chofmann@netscape.com,r=endico@mozilla.org 1999-11-06 02:47:15 +00:00
jsj
macbuild added files: mozilla/js/src/xpconnect/idl/nsIXPCScriptNotify.idl 2001-09-24 22:53:00 +00:00
ref
rhino Patch from Igor: 2001-10-30 13:07:00 +00:00
src Ensure atom strings are immutable -- duh! (107138, r=jag, sr=jband). 2001-10-30 02:33:41 +00:00
tests Adding reference to another Bugzilla bug this testcase covers. 2001-10-30 03:28:15 +00:00
.cvsignore
landbranch.pl
Makefile.in bug 76050, build js/jsd from toplevel makefile so we're sure we've got an xpidl compiler. r=cls 2001-05-15 20:38:26 +00:00
makefile.win updated license boilerplate to xPL 1.1, a=chofmann@netscape.com,r=endico@mozilla.org 1999-11-06 03:40:37 +00:00