Closed
Bug 555338
Opened 13 years ago
Closed 13 years ago
preprocessor define to tell when rdtsc is available
Categories
(Core Graveyard :: Nanojit, enhancement)
Core Graveyard
Nanojit
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: igor, Assigned: igor)
Details
(Whiteboard: fixed-in-nanojit, fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
2.09 KB,
patch
|
n.nethercote
:
review+
|
Details | Diff | Splinter Review |
js/src/nanojit/avmplus.h defines the rdtsc function for number of platforms. But it does not provide a convenient macro to tell if the function is available. That makes it hard to use the function in the profiling code. To fix that the attached patch adds AVMPLUS_HAS_RDTSC and sets it 0 or 1 depending on rdtsc availability. To Nicholas:are you the right person to review this?
Attachment #435308 -
Flags: review?(nnethercote)
![]() |
||
Comment 1•13 years ago
|
||
Comment on attachment 435308 [details] [diff] [review] adding AVMPLUS_HAS_RDTSC >+#else >+ >+# define AVMPLUS_HAS_RDTSC 0 >+ > #endif /* architecture */ > >+#ifndef AVMPLUS_HAS_RDTSC >+# define AVMPLUS_HAS_RDTSC 1 >+#endif Ugh, I don't like this. I'd much prefer just putting #define AVMPLUS_HAS_RDTSC 1 in the appropriate #if branches. It's more verbose but simpler. Also, you haven't indicated where you would use this #define. Would it be simpler to just define rdtsc() on platforms that don't support it and make it return 0? I see that we also have _rdtsc() in vprof/vprof.cpp and that's how it works.
![]() |
||
Comment 2•13 years ago
|
||
(In reply to comment #1) > > Also, you haven't indicated where you would use this #define. Ah, I see it's bug 553682. > Would it be simpler to just define rdtsc() on platforms that don't support > it and make it return 0? I'd still like an answer on that.
Assignee | ||
Comment 3•13 years ago
|
||
(In reply to comment #1) > Would it be simpler to just define rdtsc() on platforms that don't support > it and make it return 0? In the bug 553682 I want to report a compile-time error when a user tries to enable a rdtsc-based GC profiling on a platform where rdtsc is not available. Reporting 0 during such profiling would just waste developers time.
Assignee | ||
Comment 4•13 years ago
|
||
The new version defines AVMPLUS_HAS_RDTSC explicitly for each supported architecture.
Attachment #435308 -
Attachment is obsolete: true
Attachment #435408 -
Flags: review?(nnethercote)
Attachment #435308 -
Flags: review?(nnethercote)
![]() |
||
Updated•13 years ago
|
Attachment #435408 -
Flags: review?(nnethercote) → review+
![]() |
||
Comment 5•13 years ago
|
||
You know you have to land this on nanojit-central first, right? (See https://developer.mozilla.org/en/NanojitMerge.) I'll be doing an NJ-to-TM merge tomorrow.
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to comment #5) > You know you have to land this on nanojit-central first, right? (See > https://developer.mozilla.org/en/NanojitMerge.) Could you land the patch then? I do not have permission to commit to hg.mozilla.org/projects/nanojit-central .
Whiteboard: checkin-needed
![]() |
||
Comment 7•13 years ago
|
||
NJ: http://hg.mozilla.org/projects/nanojit-central/rev/673444e26f48 TM: http://hg.mozilla.org/tracemonkey/rev/46b22e830aa9
Whiteboard: checkin-needed → fixed-in-nanojit, fixed-in-tracemonkey
Comment 8•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/46b22e830aa9
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•