Opened 14 years ago

Closed 14 years ago

#2885 closed Patches (fixed)

[smart_ptr] g++/MIPS support for lockless sp_counted_base

Reported by: David Joyner <david.joyner@…> Owned by: Peter Dimov
Milestone: Boost 1.39.0 Component: smart_ptr
Version: Boost 1.38.0 Severity: Optimization
Keywords: Cc:

Description

Submitting a patch for your consideration. It contains an implementation of a lockless sp_counted_base for g++/MIPS platforms. This code has been used extensively for the last two years without issues.

Attachments (2)

boost_1_38_0.sp_counted_base_mips.patch (4.5 KB ) - added by David Joyner <david.joyner@…> 14 years ago.
sp_counted_base_gcc_mips.hpp (3.2 KB ) - added by David Joyner <david.joyner@…> 14 years ago.

Download all attachments as: .zip

Change History (12)

by David Joyner <david.joyner@…>, 14 years ago

comment:1 by Peter Dimov, 14 years ago

Status: newassigned

Thanks.

Is there a reason you use subu with a temp register instead of addiu with -1 in atomic_decrement?

comment:2 by Peter Dimov, 14 years ago

Another question... does g++/MIPS implement the sync intrinsics?

comment:3 by David Joyner <david.joyner@…>, 14 years ago

No good reason. ;)

This inline assembly was originally written for atomic subtraction rather than atomic decrement, thus the extra input parameter to the asm block. I believe GNU's as converts "subu %0, %1, 1" to "addiu %0, %1, -1" on the fly however I'm okay with changing this to addiu.

Would you like to me to reattach the patch?

As far as g++/MIPS support for __sync, the newest g++/MIPS toolchain I have access to is 4.1.2 and they are not implemented there.

comment:4 by Peter Dimov, 14 years ago

Would you like to me to reattach the patch?

Yes please.

Actually, just attach sp_counted_base_gcc_mips.hpp. The headers have been moved for 1.39 so the patch will not apply cleanly anyway.

Are you interested in fixing spinlock.hpp as well?

by David Joyner <david.joyner@…>, 14 years ago

comment:5 by David Joyner <david.joyner@…>, 14 years ago

Reattached.

We don't use user-mode spinlocks - we don't have the priority schemes in place to make it safe - so I can't help you there. Sorry.

comment:6 by Peter Dimov, 14 years ago

(In [51978]) Added g++/MIPS support submitted by David Joyner. Refs #2885.

comment:7 by Peter Dimov, 14 years ago

I've applied your patch to the SVN trunk; thanks again. If everything looks (and tests) OK for you, I'll merge the changes to the release branch so that they surface in 1.39.

comment:8 by David Joyner <david.joyner@…>, 14 years ago

Tried the build from SVN trunk. The #include of sp_typeinfo.hpp needs minor fixup:

-#include "sp_typeinfo.hpp"
+#include <boost/detail/sp_typeinfo.hpp>

Compiles fine after that change.

comment:9 by Peter Dimov, 14 years ago

(In [51985]) Fix sp_typeinfo.hpp include. Refs #2885.

comment:10 by Peter Dimov, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [52016]) Merge [51978], [51985] to release. Closes #2885.

Note: See TracTickets for help on using tickets.