Closed Bug 876366 Opened 7 years ago Closed 7 years ago

Avoid pointer to long casts in PerfSpewer::writeProfile.

Categories

(Core :: JavaScript Engine, defect)

x86_64
Windows 7
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: jacek, Assigned: jacek)

References

Details

Attachments

(1 file)

Attached patch fixSplinter Review
unsigned long is 32-bit on 64-bit Windows, so those casts are problematic there. The patch uses uintptr_t instead and avoids casts in printf call by using "%p" format.
Attachment #754395 - Flags: review?(nmatsakis)
Comment on attachment 754395 [details] [diff] [review]
fix

Review of attachment 754395 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/ion/PerfSpewer.cpp
@@ +135,5 @@
>      uint32_t thisFunctionIndex = nextFunctionIndex++;
>  
>      if (PerfFuncEnabled()) {
>          fprintf(fp_,
> +                "%p %p %s:%d: Func%02d\n",

I specifically chose not to use `%p` because it outputs a string like `0xABCDEFGH`, but I want `ABCDEFGH`. Perhaps rewrite the patch to use `PRIxPTR`? Alternatively, is there a way to make the cast not warn (reinterpret_cast, perhaps?)
Attachment #754395 - Flags: review?(nmatsakis) → review-
I pushed a fix using reinterpret_cast. Thanks for review.

https://hg.mozilla.org/integration/mozilla-inbound/rev/7c0c49dd4e91
https://hg.mozilla.org/mozilla-central/rev/7c0c49dd4e91
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.