Closed Bug 183607 Opened 23 years ago Closed 23 years ago

nspr: pratom.c should use CAS on ultrasparc

Categories

(NSPR :: NSPR, defect)

Sun
Solaris
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: neel, Assigned: wtc)

Details

Attachments

(2 files)

User-Agent: Mozilla/4.77 [en] (X11; U; SunOS 5.8 sun4u) Build Identifier: we can enhance pratom.c to use ultrasparc "cas" (compare and swap) instructions, and get 10% perf boost (atleast for 1 testcase). I will attch the modified pratom.c and a new file pratom_ultra_sparc.s We might have to modify some makefiles (FYI, js/ module uses this compare-and-swap instruction already for its own synchronization. It's mozilla/js/src/jslock.c and mozilla/js/src/lock_SunOS.s. ) Reproducible: Always Steps to Reproduce: 1. 2. 3.
Attached file modified pratom.c —
modified pratom.c to support CAS
assembly impl of _MD_ATOMIC_INCREMENT and others
NSPR already has this assembly code. It is in mozilla/nsprpub/pr/src/md/unix/os_SunOS_ultrasparc.s. That file is assembled and linked into libultrasparc4.so. libnspr4.so has a filtee named libatomic.so. You are supposed to install libultrasparc4.so in some directory as libatomic.so and add that directory to your LD_LIBRARY_PATH if you are running on UltraSPARC. So the problem is that Mozilla is not doing this configuration (which is not obvious) and therefore not taking advantage of the UltraSPARC assembly code. In NSPR 4.3 the filtee for libnspr4.so will use the $ISALIST linker keyword, which I hope will make it easier to set this up.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
can we change the build script so that libultrasparc.so is built by default. Right now, none of the sparc distributions on ftp.mozilla.org have this. It would be nice to add this to the solaris specific release notes for each release.
libultrasparc4.so is always built. I suspect the problem is that it is not packaged in the distributions on ftp.mozilla.org. You need to do more than including libultrasparc4.so. It needs to be installed correctly and the mozilla shell script needs to add the directory libatomic.so is in to LD_LIBRARY_PATH if it is running on UltraSPARC.
I guess it doesnt get included in the tarball that gets built when you do a "make dist" or something to create the final tarball. We can modify mozilla startup script to do this. Is this accpetable to you? do i have to create a new bug to track it? we can check to see if libatomic.so exists, if not, see if "isalist" returns sparcv8, and then rename. what do you think?
You should create a new (Browser) bug to track this. The installation of libultrasparc4.so as libatomic.so cannot be done by the mozilla startup script because the user running mozilla may not have the write permissions.
mozilla/js/src/jslock.c uses optimized instructions for compare_and_swap for v8 as well as v8+. Can nspr be changed to use the optimized asm instructions for v8 instead of pthread_mutex_lock/unlock?
The optimized asm instructions for v8 in mozilla/js/src implement a spin lock, which has its own problems. This is why NSPR only uses pthread_mutex_lock/unlock for v8. We trust that Sun has done a good job optimizing pthread_mutex_lock/unlock for all the processor architectures.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: