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

nspr: pratom.c should use CAS on ultrasparc

RESOLVED INVALID

Status

RESOLVED INVALID
16 years ago
16 years ago

People

(Reporter: neel, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

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:
1.
2.
3.
(Reporter)

Comment 1

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

modified pratom.c to support CAS
(Reporter)

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
(Assignee)

Comment 3

16 years ago
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
Last Resolved: 16 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

16 years ago
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.
(Assignee)

Comment 5

16 years ago
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.
(Reporter)

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
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?
(Assignee)

Comment 7

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



(Reporter)

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?
(Assignee)

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