diff options
| author | Richard Brooksby | 2012-08-26 17:07:32 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2012-08-26 17:07:32 +0100 |
| commit | 71d487d995ed8209560d8442efd34fd628a0bf02 (patch) | |
| tree | 20d8a5c570de7749ba056e8d80b672702cd0d399 /mps/code | |
| parent | 7fe52ea4bdca753e8802e1ce81a8c8af199aee9f (diff) | |
| download | emacs-71d487d995ed8209560d8442efd34fd628a0bf02.tar.gz emacs-71d487d995ed8209560d8442efd34fd628a0bf02.zip | |
Fixing further pedantic compilation issues on xci3gc.
Copied from Perforce
Change: 179057
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/config.h | 58 | ||||
| -rw-r--r-- | mps/code/event.h | 1 | ||||
| -rw-r--r-- | mps/code/eventcnv.c | 6 | ||||
| -rw-r--r-- | mps/code/eventcom.h | 75 | ||||
| -rw-r--r-- | mps/code/eventpro.c | 6 |
5 files changed, 81 insertions, 65 deletions
diff --git a/mps/code/config.h b/mps/code/config.h index e27ee92ddca..435d2a9e22a 100644 --- a/mps/code/config.h +++ b/mps/code/config.h | |||
| @@ -277,7 +277,6 @@ | |||
| 277 | #define RememberedSummaryBLOCK 15 | 277 | #define RememberedSummaryBLOCK 15 |
| 278 | 278 | ||
| 279 | 279 | ||
| 280 | |||
| 281 | /* Events | 280 | /* Events |
| 282 | * | 281 | * |
| 283 | * EventBufferSIZE is the number of words in the global event buffer. | 282 | * EventBufferSIZE is the number of words in the global event buffer. |
| @@ -286,63 +285,6 @@ | |||
| 286 | #define EventBufferSIZE ((size_t)4096) | 285 | #define EventBufferSIZE ((size_t)4096) |
| 287 | #define EventStringLengthMAX ((size_t)255) /* Not including NUL */ | 286 | #define EventStringLengthMAX ((size_t)255) /* Not including NUL */ |
| 288 | 287 | ||
| 289 | /* EVENT_CLOCK -- fast event timestamp clock | ||
| 290 | * | ||
| 291 | * On platforms that support it, we want to stamp events with a very cheap | ||
| 292 | * and fast high-resolution timer. | ||
| 293 | */ | ||
| 294 | |||
| 295 | /* http://msdn.microsoft.com/en-US/library/twchhe95%28v=vs.100%29.aspx */ | ||
| 296 | #if (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && defined(MPS_BUILD_MV) | ||
| 297 | |||
| 298 | #pragma intrinsic(__rdtsc) | ||
| 299 | typedef unsigned __int64 EventClock; | ||
| 300 | #define EVENT_CLOCK(lvalue) \ | ||
| 301 | BEGIN \ | ||
| 302 | (lvalue) = __rdtsc(); \ | ||
| 303 | END | ||
| 304 | |||
| 305 | /* http://clang.llvm.org/docs/LanguageExtensions.html#builtins */ | ||
| 306 | #elif defined(MPS_BUILD_LL) | ||
| 307 | |||
| 308 | #if __has_builtin(__builtin_readcyclecounter) | ||
| 309 | |||
| 310 | typedef unsigned long long EventClock; | ||
| 311 | #define EVENT_CLOCK(lvalue) \ | ||
| 312 | BEGIN \ | ||
| 313 | (lvalue) = __builtin_readcyclecounter(); \ | ||
| 314 | END | ||
| 315 | |||
| 316 | #endif /* __has_builtin(__builtin_readcyclecounter) */ | ||
| 317 | |||
| 318 | #endif | ||
| 319 | |||
| 320 | /* Assemble the rdtsc instruction */ | ||
| 321 | #if !defined(EVENT_CLOCK) && \ | ||
| 322 | (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && \ | ||
| 323 | (defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL)) | ||
| 324 | |||
| 325 | /* Use __extension__ to enable use of a 64-bit type on 32-bit pedantic GCC */ | ||
| 326 | __extension__ typedef unsigned long long EventClock; | ||
| 327 | #define EVENT_CLOCK(lvalue) \ | ||
| 328 | BEGIN \ | ||
| 329 | unsigned _l, _h; \ | ||
| 330 | __asm__ __volatile__("rdtsc" : "=a"(_l), "=d"(_h)); \ | ||
| 331 | (lvalue) = ((EventClock)_h << 32) | _l; \ | ||
| 332 | END | ||
| 333 | |||
| 334 | #endif | ||
| 335 | |||
| 336 | /* no fast clock, use plinth, probably from the C library */ | ||
| 337 | #ifndef EVENT_CLOCK | ||
| 338 | |||
| 339 | #define EVENT_CLOCK(lvalue) \ | ||
| 340 | BEGIN \ | ||
| 341 | (lvalue) = mps_clock(); \ | ||
| 342 | END | ||
| 343 | |||
| 344 | #endif | ||
| 345 | |||
| 346 | 288 | ||
| 347 | /* Assert Buffer */ | 289 | /* Assert Buffer */ |
| 348 | 290 | ||
diff --git a/mps/code/event.h b/mps/code/event.h index 131e95496c2..161aa32d2e5 100644 --- a/mps/code/event.h +++ b/mps/code/event.h | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #ifndef event_h | 15 | #ifndef event_h |
| 16 | #define event_h | 16 | #define event_h |
| 17 | 17 | ||
| 18 | #include "config.h" /* for EVENT_CLOCK */ | ||
| 19 | #include "eventcom.h" | 18 | #include "eventcom.h" |
| 20 | #include "mpm.h" | 19 | #include "mpm.h" |
| 21 | #include "eventdef.h" | 20 | #include "eventdef.h" |
diff --git a/mps/code/eventcnv.c b/mps/code/eventcnv.c index 4fac8bbc4d8..10241135ceb 100644 --- a/mps/code/eventcnv.c +++ b/mps/code/eventcnv.c | |||
| @@ -556,7 +556,7 @@ static void readLog(EventProc proc) | |||
| 556 | printf("(t"); | 556 | printf("(t"); |
| 557 | } break; | 557 | } break; |
| 558 | case 'C': { | 558 | case 'C': { |
| 559 | printf("%llu", eventTime+1); | 559 | EVENT_CLOCK_PRINT(stdout, eventTime+1); |
| 560 | } break; | 560 | } break; |
| 561 | } | 561 | } |
| 562 | reportEventResults(totalEventCount); | 562 | reportEventResults(totalEventCount); |
| @@ -568,7 +568,9 @@ static void readLog(EventProc proc) | |||
| 568 | if (eventEnabled[c]) | 568 | if (eventEnabled[c]) |
| 569 | printf(" %04X %s\n", (unsigned)c, EventCode2Name(c)); | 569 | printf(" %04X %s\n", (unsigned)c, EventCode2Name(c)); |
| 570 | if (bucketSize == 0) | 570 | if (bucketSize == 0) |
| 571 | printf("\nevent clock stopped at %llu\n", eventTime); | 571 | printf("\nevent clock stopped at "); |
| 572 | EVENT_CLOCK_PRINT(stdout, eventTime); | ||
| 573 | printf("\n"); | ||
| 572 | } | 574 | } |
| 573 | } | 575 | } |
| 574 | } | 576 | } |
diff --git a/mps/code/eventcom.h b/mps/code/eventcom.h index 1bf0a67c311..64fe935edde 100644 --- a/mps/code/eventcom.h +++ b/mps/code/eventcom.h | |||
| @@ -10,11 +10,84 @@ | |||
| 10 | #define eventcom_h | 10 | #define eventcom_h |
| 11 | 11 | ||
| 12 | #include <limits.h> | 12 | #include <limits.h> |
| 13 | #include "config.h" /* for EventClock */ | ||
| 14 | #include "mpmtypes.h" /* for Word */ | 13 | #include "mpmtypes.h" /* for Word */ |
| 15 | #include "eventdef.h" | 14 | #include "eventdef.h" |
| 16 | 15 | ||
| 17 | 16 | ||
| 17 | /* EVENT_CLOCK -- fast event timestamp clock | ||
| 18 | * | ||
| 19 | * On platforms that support it, we want to stamp events with a very cheap | ||
| 20 | * and fast high-resolution timer. | ||
| 21 | */ | ||
| 22 | |||
| 23 | /* http://msdn.microsoft.com/en-US/library/twchhe95%28v=vs.100%29.aspx */ | ||
| 24 | #if (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && defined(MPS_BUILD_MV) | ||
| 25 | |||
| 26 | #pragma intrinsic(__rdtsc) | ||
| 27 | |||
| 28 | typedef unsigned __int64 EventClock; | ||
| 29 | |||
| 30 | #define EVENT_CLOCK(lvalue) \ | ||
| 31 | BEGIN \ | ||
| 32 | (lvalue) = __rdtsc(); \ | ||
| 33 | END | ||
| 34 | |||
| 35 | #define EVENT_CLOCK_PRINT(stream, clock) fprintf(stream, "%llu", clock) | ||
| 36 | |||
| 37 | /* http://clang.llvm.org/docs/LanguageExtensions.html#builtins */ | ||
| 38 | #elif defined(MPS_BUILD_LL) | ||
| 39 | |||
| 40 | #if __has_builtin(__builtin_readcyclecounter) | ||
| 41 | |||
| 42 | typedef unsigned long long EventClock; | ||
| 43 | |||
| 44 | #define EVENT_CLOCK(lvalue) \ | ||
| 45 | BEGIN \ | ||
| 46 | (lvalue) = __builtin_readcyclecounter(); \ | ||
| 47 | END | ||
| 48 | |||
| 49 | #define EVENT_CLOCK_PRINT(stream, clock) fprintf(stream, "%llu", clock) | ||
| 50 | |||
| 51 | #endif /* __has_builtin(__builtin_readcyclecounter) */ | ||
| 52 | |||
| 53 | #endif | ||
| 54 | |||
| 55 | /* Assemble the rdtsc instruction */ | ||
| 56 | #if !defined(EVENT_CLOCK) && \ | ||
| 57 | (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && \ | ||
| 58 | (defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL)) | ||
| 59 | |||
| 60 | /* Use __extension__ to enable use of a 64-bit type on 32-bit pedantic GCC */ | ||
| 61 | __extension__ typedef unsigned long long EventClock; | ||
| 62 | |||
| 63 | #define EVENT_CLOCK(lvalue) \ | ||
| 64 | BEGIN \ | ||
| 65 | unsigned _l, _h; \ | ||
| 66 | __asm__ __volatile__("rdtsc" : "=a"(_l), "=d"(_h)); \ | ||
| 67 | (lvalue) = ((EventClock)_h << 32) | _l; \ | ||
| 68 | END | ||
| 69 | |||
| 70 | #define EVENT_CLOCK_PRINT(stream, clock) \ | ||
| 71 | fprintf(stream, "%lu", (unsigned long)clock) /* FIXME: Should be %llu */ | ||
| 72 | |||
| 73 | #endif /* Intel, GCC or Clang */ | ||
| 74 | |||
| 75 | /* no fast clock, use plinth, probably from the C library */ | ||
| 76 | #ifndef EVENT_CLOCK | ||
| 77 | |||
| 78 | typedef Word EventClock; | ||
| 79 | |||
| 80 | #define EVENT_CLOCK(lvalue) \ | ||
| 81 | BEGIN \ | ||
| 82 | (lvalue) = mps_clock(); \ | ||
| 83 | END | ||
| 84 | |||
| 85 | #define EVENT_CLOCK_PRINT(stream, clock) \ | ||
| 86 | fprintf(stream, "%llu", (unsigned long long)clock) | ||
| 87 | |||
| 88 | #endif | ||
| 89 | |||
| 90 | |||
| 18 | /* Types for event fields */ | 91 | /* Types for event fields */ |
| 19 | 92 | ||
| 20 | typedef unsigned short EventCode; | 93 | typedef unsigned short EventCode; |
diff --git a/mps/code/eventpro.c b/mps/code/eventpro.c index ac7475498e4..1dc7a2f0a11 100644 --- a/mps/code/eventpro.c +++ b/mps/code/eventpro.c | |||
| @@ -109,7 +109,7 @@ for i in range(1,15): | |||
| 109 | the offsets of the fields within an event structure with the specified | 109 | the offsets of the fields within an event structure with the specified |
| 110 | format. | 110 | format. |
| 111 | 111 | ||
| 112 | for i in range(0, 15): | 112 | for i in range(1, 15): |
| 113 | plist = ", ".join(["p%d" % i for i in range(0, i)]) | 113 | plist = ", ".join(["p%d" % i for i in range(0, i)]) |
| 114 | print "#define EVENT%d_OFFSETS(%s) {%s}" % ( | 114 | print "#define EVENT%d_OFFSETS(%s) {%s}" % ( |
| 115 | i, plist, | 115 | i, plist, |
| @@ -117,7 +117,7 @@ for i in range(0, 15): | |||
| 117 | for j in range(0, i)]) | 117 | for j in range(0, i)]) |
| 118 | ) | 118 | ) |
| 119 | */ | 119 | */ |
| 120 | #define EVENT0_OFFSETS() {} | 120 | #define EVENT0_OFFSETS() {0} |
| 121 | #define EVENT1_OFFSETS(p0) {offsetof(EVENT1_STRUCT(p0), f0)} | 121 | #define EVENT1_OFFSETS(p0) {offsetof(EVENT1_STRUCT(p0), f0)} |
| 122 | #define EVENT2_OFFSETS(p0, p1) {offsetof(EVENT2_STRUCT(p0, p1), f0), offsetof(EVENT2_STRUCT(p0, p1), f1)} | 122 | #define EVENT2_OFFSETS(p0, p1) {offsetof(EVENT2_STRUCT(p0, p1), f0), offsetof(EVENT2_STRUCT(p0, p1), f1)} |
| 123 | #define EVENT3_OFFSETS(p0, p1, p2) {offsetof(EVENT3_STRUCT(p0, p1, p2), f0), offsetof(EVENT3_STRUCT(p0, p1, p2), f1), offsetof(EVENT3_STRUCT(p0, p1, p2), f2)} | 123 | #define EVENT3_OFFSETS(p0, p1, p2) {offsetof(EVENT3_STRUCT(p0, p1, p2), f0), offsetof(EVENT3_STRUCT(p0, p1, p2), f1), offsetof(EVENT3_STRUCT(p0, p1, p2), f2)} |
| @@ -134,7 +134,7 @@ for i in range(0, 15): | |||
| 134 | #define EVENT14_OFFSETS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) {offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f0), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f1), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f2), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f3), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f4), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f5), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f6), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f7), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f8), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f9), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f10), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f11), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f12), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f13)} | 134 | #define EVENT14_OFFSETS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) {offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f0), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f1), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f2), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f3), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f4), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f5), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f6), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f7), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f8), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f9), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f10), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f11), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f12), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f13)} |
| 135 | 135 | ||
| 136 | static eventRecord eventTypes[] = { | 136 | static eventRecord eventTypes[] = { |
| 137 | {"(unused)", 0, 0, 0, "", {}}, | 137 | {"(unused)", 0, 0, 0, "", {0}}, |
| 138 | #define EVENT_INIT(X, name, code, always, kind, count, format) \ | 138 | #define EVENT_INIT(X, name, code, always, kind, count, format) \ |
| 139 | {#name, \ | 139 | {#name, \ |
| 140 | code, \ | 140 | code, \ |