diff options
| author | Richard Brooksby | 2012-09-12 19:45:27 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2012-09-12 19:45:27 +0100 |
| commit | 513aabb046ca6417eea1355428d212e1f3a1573d (patch) | |
| tree | 60b30213ec2e2b381f569fb4608f91e1abbdf227 /mps/code | |
| parent | 9248316fb65eeafb7749b3879b81459f87bd9f54 (diff) | |
| download | emacs-513aabb046ca6417eea1355428d212e1f3a1573d.tar.gz emacs-513aabb046ca6417eea1355428d212e1f3a1573d.zip | |
Further elimination of type puns that violate the strict aliasing rule. this change eliminates puns on the format methods.
Copied from Perforce
Change: 179452
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/format.c | 18 | ||||
| -rw-r--r-- | mps/code/mpm.h | 16 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 14 | ||||
| -rw-r--r-- | mps/code/mpmtypes.h | 13 | ||||
| -rw-r--r-- | mps/code/mps.h | 3 | ||||
| -rw-r--r-- | mps/code/mpsi.c | 47 | ||||
| -rw-r--r-- | mps/code/root.c | 4 |
7 files changed, 50 insertions, 65 deletions
diff --git a/mps/code/format.c b/mps/code/format.c index 5155a740eb5..9867f562167 100644 --- a/mps/code/format.c +++ b/mps/code/format.c | |||
| @@ -40,11 +40,11 @@ Bool FormatCheck(Format format) | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | static Addr FormatDefaultClass(Addr object) | 43 | static mps_addr_t FormatDefaultClass(mps_addr_t object) |
| 44 | { | 44 | { |
| 45 | AVER(object != NULL); | 45 | AVER(object != NULL); |
| 46 | 46 | ||
| 47 | return ((Addr *)object)[0]; | 47 | return ((mps_addr_t *)object)[0]; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | 50 | ||
| @@ -53,13 +53,13 @@ static Addr FormatDefaultClass(Addr object) | |||
| 53 | Res FormatCreate(Format *formatReturn, Arena arena, | 53 | Res FormatCreate(Format *formatReturn, Arena arena, |
| 54 | Align alignment, | 54 | Align alignment, |
| 55 | FormatVariety variety, | 55 | FormatVariety variety, |
| 56 | FormatScanMethod scan, | 56 | mps_fmt_scan_t scan, |
| 57 | FormatSkipMethod skip, | 57 | mps_fmt_skip_t skip, |
| 58 | FormatMoveMethod move, | 58 | mps_fmt_fwd_t move, |
| 59 | FormatIsMovedMethod isMoved, | 59 | mps_fmt_isfwd_t isMoved, |
| 60 | FormatCopyMethod copy, | 60 | mps_fmt_copy_t copy, |
| 61 | FormatPadMethod pad, | 61 | mps_fmt_pad_t pad, |
| 62 | FormatClassMethod class, | 62 | mps_fmt_class_t class, |
| 63 | Size headerSize) | 63 | Size headerSize) |
| 64 | { | 64 | { |
| 65 | Format format; | 65 | Format format; |
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 58fb4da6a31..049cbf65343 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -807,13 +807,13 @@ extern Bool FormatCheck(Format format); | |||
| 807 | extern Res FormatCreate(Format *formatReturn, Arena arena, | 807 | extern Res FormatCreate(Format *formatReturn, Arena arena, |
| 808 | Align alignment, | 808 | Align alignment, |
| 809 | FormatVariety variety, | 809 | FormatVariety variety, |
| 810 | FormatScanMethod scan, | 810 | mps_fmt_scan_t scan, |
| 811 | FormatSkipMethod skip, | 811 | mps_fmt_skip_t skip, |
| 812 | FormatMoveMethod move, | 812 | mps_fmt_fwd_t move, |
| 813 | FormatIsMovedMethod isMoved, | 813 | mps_fmt_isfwd_t isMoved, |
| 814 | FormatCopyMethod copy, | 814 | mps_fmt_copy_t copy, |
| 815 | FormatPadMethod pad, | 815 | mps_fmt_pad_t pad, |
| 816 | FormatClassMethod class, | 816 | mps_fmt_class_t class, |
| 817 | Size headerSize); | 817 | Size headerSize); |
| 818 | extern void FormatDestroy(Format format); | 818 | extern void FormatDestroy(Format format); |
| 819 | extern Arena FormatArena(Format format); | 819 | extern Arena FormatArena(Format format); |
| @@ -940,7 +940,7 @@ extern Res RootCreateReg(Root *rootReturn, Arena arena, | |||
| 940 | void *p, size_t s); | 940 | void *p, size_t s); |
| 941 | extern Res RootCreateFmt(Root *rootReturn, Arena arena, | 941 | extern Res RootCreateFmt(Root *rootReturn, Arena arena, |
| 942 | Rank rank, RootMode mode, | 942 | Rank rank, RootMode mode, |
| 943 | FormatScanMethod scan, | 943 | mps_fmt_scan_t scan, |
| 944 | Addr base, Addr limit); | 944 | Addr base, Addr limit); |
| 945 | extern Res RootCreateFun(Root *rootReturn, Arena arena, | 945 | extern Res RootCreateFun(Root *rootReturn, Arena arena, |
| 946 | Rank rank, mps_root_scan_t scan, | 946 | Rank rank, mps_root_scan_t scan, |
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 5c21c60a6a0..1cd8a77a7ec 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -406,13 +406,13 @@ typedef struct FormatStruct { | |||
| 406 | Arena arena; /* owning arena */ | 406 | Arena arena; /* owning arena */ |
| 407 | RingStruct arenaRing; /* formats are attached to the arena */ | 407 | RingStruct arenaRing; /* formats are attached to the arena */ |
| 408 | Align alignment; /* alignment of formatted objects */ | 408 | Align alignment; /* alignment of formatted objects */ |
| 409 | FormatScanMethod scan; | 409 | mps_fmt_scan_t scan; |
| 410 | FormatSkipMethod skip; | 410 | mps_fmt_skip_t skip; |
| 411 | FormatMoveMethod move; | 411 | mps_fmt_fwd_t move; |
| 412 | FormatIsMovedMethod isMoved; | 412 | mps_fmt_isfwd_t isMoved; |
| 413 | FormatCopyMethod copy; | 413 | mps_fmt_copy_t copy; |
| 414 | FormatPadMethod pad; | 414 | mps_fmt_pad_t pad; |
| 415 | FormatClassMethod class; /* pointer indicating class */ | 415 | mps_fmt_class_t class; /* pointer indicating class */ |
| 416 | Size headerSize; /* size of header */ | 416 | Size headerSize; /* size of header */ |
| 417 | } FormatStruct; | 417 | } FormatStruct; |
| 418 | 418 | ||
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index 12d23e39989..890522b804e 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -242,19 +242,6 @@ typedef struct TraceStartMessageStruct *TraceStartMessage; | |||
| 242 | typedef struct TraceMessageStruct *TraceMessage; /* trace end */ | 242 | typedef struct TraceMessageStruct *TraceMessage; /* trace end */ |
| 243 | 243 | ||
| 244 | 244 | ||
| 245 | /* Format*Method -- see design.mps.format-interface */ | ||
| 246 | /* .fmt-methods: These methods must match those defined in the */ | ||
| 247 | /* MPS C Interface. (See <code/mps.h#fmt-methods>.) */ | ||
| 248 | |||
| 249 | typedef Res (*FormatScanMethod)(mps_ss_t ss, Addr base, Addr limit); | ||
| 250 | typedef Addr (*FormatSkipMethod)(Addr object); | ||
| 251 | typedef void (*FormatMoveMethod)(Addr object, Addr to); | ||
| 252 | typedef Addr (*FormatIsMovedMethod)(Addr object); | ||
| 253 | typedef void (*FormatCopyMethod)(Addr object, Addr to); | ||
| 254 | typedef void (*FormatPadMethod)(Addr base, Size size); | ||
| 255 | typedef Addr (*FormatClassMethod)(Addr object); | ||
| 256 | |||
| 257 | |||
| 258 | /* CONSTANTS */ | 245 | /* CONSTANTS */ |
| 259 | 246 | ||
| 260 | 247 | ||
diff --git a/mps/code/mps.h b/mps/code/mps.h index 945d43cc13b..6d0edbb75d2 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h | |||
| @@ -179,8 +179,7 @@ typedef struct mps_ld_s { /* location dependency descriptor */ | |||
| 179 | 179 | ||
| 180 | /* Format and Root Method Types */ | 180 | /* Format and Root Method Types */ |
| 181 | /* see design.mps.root-interface */ | 181 | /* see design.mps.root-interface */ |
| 182 | /* .fmt-methods: Keep in sync with <code/mpmtypes.h#fmt-methods> */ | 182 | /* see design.mps.format-interface */ |
| 183 | /* .root-methods: Keep in sync with <code/mpmtypes.h#root-methods> */ | ||
| 184 | 183 | ||
| 185 | typedef mps_res_t (*mps_root_scan_t)(mps_ss_t, void *, size_t); | 184 | typedef mps_res_t (*mps_root_scan_t)(mps_ss_t, void *, size_t); |
| 186 | typedef mps_res_t (*mps_fmt_scan_t)(mps_ss_t, mps_addr_t, mps_addr_t); | 185 | typedef mps_res_t (*mps_fmt_scan_t)(mps_ss_t, mps_addr_t, mps_addr_t); |
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index c620cad18dd..711f5807254 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c | |||
| @@ -463,12 +463,12 @@ mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o, | |||
| 463 | arena, | 463 | arena, |
| 464 | (Align)mps_fmt_A->align, | 464 | (Align)mps_fmt_A->align, |
| 465 | FormatVarietyA, | 465 | FormatVarietyA, |
| 466 | (FormatScanMethod)mps_fmt_A->scan, | 466 | mps_fmt_A->scan, |
| 467 | (FormatSkipMethod)mps_fmt_A->skip, | 467 | mps_fmt_A->skip, |
| 468 | (FormatMoveMethod)mps_fmt_A->fwd, | 468 | mps_fmt_A->fwd, |
| 469 | (FormatIsMovedMethod)mps_fmt_A->isfwd, | 469 | mps_fmt_A->isfwd, |
| 470 | (FormatCopyMethod)mps_fmt_A->copy, | 470 | mps_fmt_A->copy, |
| 471 | (FormatPadMethod)mps_fmt_A->pad, | 471 | mps_fmt_A->pad, |
| 472 | NULL, | 472 | NULL, |
| 473 | (Size)0); | 473 | (Size)0); |
| 474 | 474 | ||
| @@ -497,13 +497,13 @@ mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o, | |||
| 497 | arena, | 497 | arena, |
| 498 | (Align)mps_fmt_B->align, | 498 | (Align)mps_fmt_B->align, |
| 499 | FormatVarietyB, | 499 | FormatVarietyB, |
| 500 | (FormatScanMethod)mps_fmt_B->scan, | 500 | mps_fmt_B->scan, |
| 501 | (FormatSkipMethod)mps_fmt_B->skip, | 501 | mps_fmt_B->skip, |
| 502 | (FormatMoveMethod)mps_fmt_B->fwd, | 502 | mps_fmt_B->fwd, |
| 503 | (FormatIsMovedMethod)mps_fmt_B->isfwd, | 503 | mps_fmt_B->isfwd, |
| 504 | (FormatCopyMethod)mps_fmt_B->copy, | 504 | mps_fmt_B->copy, |
| 505 | (FormatPadMethod)mps_fmt_B->pad, | 505 | mps_fmt_B->pad, |
| 506 | (FormatClassMethod)mps_fmt_B->mps_class, | 506 | mps_fmt_B->mps_class, |
| 507 | (Size)0); | 507 | (Size)0); |
| 508 | 508 | ||
| 509 | ArenaLeave(arena); | 509 | ArenaLeave(arena); |
| @@ -531,12 +531,12 @@ mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o, | |||
| 531 | arena, | 531 | arena, |
| 532 | (Align)mps_fmt->align, | 532 | (Align)mps_fmt->align, |
| 533 | FormatVarietyAutoHeader, | 533 | FormatVarietyAutoHeader, |
| 534 | (FormatScanMethod)mps_fmt->scan, | 534 | mps_fmt->scan, |
| 535 | (FormatSkipMethod)mps_fmt->skip, | 535 | mps_fmt->skip, |
| 536 | (FormatMoveMethod)mps_fmt->fwd, | 536 | mps_fmt->fwd, |
| 537 | (FormatIsMovedMethod)mps_fmt->isfwd, | 537 | mps_fmt->isfwd, |
| 538 | NULL, | 538 | NULL, |
| 539 | (FormatPadMethod)mps_fmt->pad, | 539 | mps_fmt->pad, |
| 540 | NULL, | 540 | NULL, |
| 541 | (Size)mps_fmt->mps_headerSize); | 541 | (Size)mps_fmt->mps_headerSize); |
| 542 | 542 | ||
| @@ -565,12 +565,12 @@ mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o, | |||
| 565 | arena, | 565 | arena, |
| 566 | (Align)mps_fmt_fixed->align, | 566 | (Align)mps_fmt_fixed->align, |
| 567 | FormatVarietyFixed, | 567 | FormatVarietyFixed, |
| 568 | (FormatScanMethod)mps_fmt_fixed->scan, | 568 | mps_fmt_fixed->scan, |
| 569 | NULL, | 569 | NULL, |
| 570 | (FormatMoveMethod)mps_fmt_fixed->fwd, | 570 | mps_fmt_fixed->fwd, |
| 571 | (FormatIsMovedMethod)mps_fmt_fixed->isfwd, | 571 | mps_fmt_fixed->isfwd, |
| 572 | NULL, | 572 | NULL, |
| 573 | (FormatPadMethod)mps_fmt_fixed->pad, | 573 | mps_fmt_fixed->pad, |
| 574 | NULL, | 574 | NULL, |
| 575 | (Size)0); | 575 | (Size)0); |
| 576 | 576 | ||
| @@ -1265,11 +1265,10 @@ mps_res_t mps_root_create_table_masked(mps_root_t *mps_root_o, | |||
| 1265 | 1265 | ||
| 1266 | mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t arena, | 1266 | mps_res_t mps_root_create_fmt(mps_root_t *mps_root_o, mps_arena_t arena, |
| 1267 | mps_rank_t mps_rank, mps_rm_t mps_rm, | 1267 | mps_rank_t mps_rank, mps_rm_t mps_rm, |
| 1268 | mps_fmt_scan_t mps_fmt_scan, | 1268 | mps_fmt_scan_t scan, |
| 1269 | mps_addr_t base, mps_addr_t limit) | 1269 | mps_addr_t base, mps_addr_t limit) |
| 1270 | { | 1270 | { |
| 1271 | Rank rank = (Rank)mps_rank; | 1271 | Rank rank = (Rank)mps_rank; |
| 1272 | FormatScanMethod scan = (FormatScanMethod)mps_fmt_scan; | ||
| 1273 | Root root; | 1272 | Root root; |
| 1274 | RootMode mode = (RootMode)mps_rm; | 1273 | RootMode mode = (RootMode)mps_rm; |
| 1275 | Res res; | 1274 | Res res; |
diff --git a/mps/code/root.c b/mps/code/root.c index c94217c04ad..edb932f800a 100644 --- a/mps/code/root.c +++ b/mps/code/root.c | |||
| @@ -53,7 +53,7 @@ typedef struct RootStruct { | |||
| 53 | size_t s; /* passed to scan */ | 53 | size_t s; /* passed to scan */ |
| 54 | } reg; | 54 | } reg; |
| 55 | struct { | 55 | struct { |
| 56 | FormatScanMethod scan; /* format-like scanner */ | 56 | mps_fmt_scan_t scan; /* format-like scanner */ |
| 57 | Addr base, limit; /* passed to scan */ | 57 | Addr base, limit; /* passed to scan */ |
| 58 | } fmt; | 58 | } fmt; |
| 59 | } the; | 59 | } the; |
| @@ -315,7 +315,7 @@ Res RootCreateReg(Root *rootReturn, Arena arena, | |||
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | Res RootCreateFmt(Root *rootReturn, Arena arena, | 317 | Res RootCreateFmt(Root *rootReturn, Arena arena, |
| 318 | Rank rank, RootMode mode, FormatScanMethod scan, | 318 | Rank rank, RootMode mode, mps_fmt_scan_t scan, |
| 319 | Addr base, Addr limit) | 319 | Addr base, Addr limit) |
| 320 | { | 320 | { |
| 321 | union RootUnion theUnion; | 321 | union RootUnion theUnion; |