Closed Bug 511568 Opened 13 years ago Closed 13 years ago

CE shunt not overriding std::nothrow operator new

Categories

(Core :: General, defect)

ARM
Windows CE
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: vlad, Assigned: vlad)

Details

(Whiteboard: [nv])

Attachments

(1 file, 1 obsolete file)

The shunt is missing overrides of the std::nothrow variants of operator new, causing problems when it's used; we don't use it a lot, but we do in canvas, where we were ending up using the system allocator but calling jemalloc's delete.

This patch overrides std::nothrow variants of operator new.  It also makes the C++ new/delete operators all inline, which saves us an extra function call; it means that we don't export these symbols from mozce_shunt though, but that seems to be fine.
Flags: blocking1.9.2+
Attachment #395480 - Flags: review?(bugmail)
Attached patch better patchSplinter Review
Better patch, now going back to exporting as well as inlining.

The trick seemed to be to use inline instead of __forceinline, and to not try to export the placement new operators (but still define them inline), since they're essentially noops.

Also using declspec(dllimport) or dllexport didn't work -- compiler complained about changing the linkage of a built-in function declaration.
Attachment #395480 - Attachment is obsolete: true
Attachment #395503 - Flags: review?(bugmail)
Attachment #395480 - Flags: review?(bugmail)
Attachment #395503 - Flags: review?(bugmail) → review+
Comment on attachment 395503 [details] [diff] [review]
better patch


>+#include <stdlib.h>
use jemalloc.h directly


>+// actually throw for us.  Note that these are inline, so they
>+// are not exported from the shunt.
fix comment (as you pointed out on irc)

>+;; operator new[] nothrow
>+??_U@YAPAXIABUnothrow_t@std@@@Z
> ;; operator delete[]
> ??_V@YAXPAX@Z
>+
> malloc
nit, don't need the extra space
You need to log in before you can comment on or make changes to this bug.