All users were logged out of Bugzilla on October 13th, 2018

nspr: pratom.c should use CAS on ultrasparc



16 years ago
16 years ago


(Reporter: neel, Assigned: wtc)


Firefox Tracking Flags

(Not tracked)



(2 attachments)



16 years ago
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:

Comment 1

16 years ago
Created attachment 108277 [details]
modified pratom.c

modified pratom.c to support CAS

Comment 2

16 years ago
Created attachment 108279 [details]
assembly impl of _MD_ATOMIC_INCREMENT and others

assembly impl of _MD_ATOMIC_INCREMENT and others

Comment 3

16 years ago
NSPR already has this assembly code.  It is in
That file is assembled and linked into has a filtee named  You are
supposed to install in some directory
as 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 will use the
$ISALIST linker keyword, which I hope will make it
easier to set this up.

Last Resolved: 16 years ago
Resolution: --- → INVALID

Comment 4

16 years ago
can we change the build script so that is built
by default. Right now, none of the sparc distributions on
have this. It would be nice to add this to the solaris specific 
release notes for each release.

Comment 5

16 years ago is always built.  I suspect the
problem is that it is not packaged in the distributions

You need to do more than including
It needs to be installed correctly and the mozilla
shell script needs to add the directory
is in to LD_LIBRARY_PATH if it is running on UltraSPARC.

Comment 6

16 years ago
I guess it doesnt get included in the tarball that gets built
when you do a "make dist" or something to create the final

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 exists, if not, see if "isalist"
returns sparcv8, and then rename. what do you think?

Comment 7

16 years ago
You should create a new (Browser) bug to track this.

The installation of as
cannot be done by the mozilla startup script because
the user running mozilla may not have the write


Comment 8

16 years ago
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?

Comment 9

16 years ago
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
You need to log in before you can comment on or make changes to this bug.