diff options
| author | Po Lu | 2025-03-08 21:58:19 +0800 |
|---|---|---|
| committer | Po Lu | 2025-03-08 21:58:19 +0800 |
| commit | b36abc76ae3583ae30f9883ca276ff66d522bac1 (patch) | |
| tree | 57d11eccaafe26468d19733d0e8248259693a86d | |
| parent | b0b7ad24e6efca04a373a4f2845a483984e3f1ea (diff) | |
| download | emacs-b36abc76ae3583ae30f9883ca276ff66d522bac1.tar.gz emacs-b36abc76ae3583ae30f9883ca276ff66d522bac1.zip | |
; Enable pdumper on some buggy versions of Sun C
* src/pdumper.c (dump_sort_copied_objects, drain_reloc_list)
(dump_do_fixups, dump_do_dump_relocation): Do not expand
Fnreverse multiple times in CALLN. Sun C 5.12 evaluates the
arguments to array initializers to which it expands, which
clobbers the lists being reversed.
| -rw-r--r-- | src/pdumper.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index 7a8c5bba9ad..342c37b5e62 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -3388,13 +3388,16 @@ dump_metadata_for_pdumper (struct dump_context *ctx) | |||
| 3388 | static void | 3388 | static void |
| 3389 | dump_sort_copied_objects (struct dump_context *ctx) | 3389 | dump_sort_copied_objects (struct dump_context *ctx) |
| 3390 | { | 3390 | { |
| 3391 | Lisp_Object queue_reversed; | ||
| 3392 | |||
| 3393 | queue_reversed = Fnreverse (ctx->copied_queue); | ||
| 3391 | /* Sort the objects into the order in which they'll appear in the | 3394 | /* Sort the objects into the order in which they'll appear in the |
| 3392 | Emacs: this way, on startup, we'll do both the IO from the dump | 3395 | Emacs: this way, on startup, we'll do both the IO from the dump |
| 3393 | file and the copy into Emacs in-order, where prefetch will be | 3396 | file and the copy into Emacs in-order, where prefetch will be |
| 3394 | most effective. */ | 3397 | most effective. */ |
| 3395 | ctx->copied_queue = | 3398 | ctx->copied_queue |
| 3396 | CALLN (Fsort, Fnreverse (ctx->copied_queue), | 3399 | = CALLN (Fsort, queue_reversed, |
| 3397 | Qdump_emacs_portable__sort_predicate_copied); | 3400 | Qdump_emacs_portable__sort_predicate_copied); |
| 3398 | } | 3401 | } |
| 3399 | 3402 | ||
| 3400 | /* Dump parts of copied objects we need at runtime. */ | 3403 | /* Dump parts of copied objects we need at runtime. */ |
| @@ -3959,9 +3962,11 @@ drain_reloc_list (struct dump_context *ctx, | |||
| 3959 | struct dump_table_locator *out_locator) | 3962 | struct dump_table_locator *out_locator) |
| 3960 | { | 3963 | { |
| 3961 | struct dump_flags old_flags = ctx->flags; | 3964 | struct dump_flags old_flags = ctx->flags; |
| 3965 | Lisp_Object list_reversed, relocs; | ||
| 3962 | ctx->flags.pack_objects = true; | 3966 | ctx->flags.pack_objects = true; |
| 3963 | Lisp_Object relocs = CALLN (Fsort, Fnreverse (*reloc_list), | 3967 | list_reversed = Fnreverse (*reloc_list); |
| 3964 | Qdump_emacs_portable__sort_predicate); | 3968 | relocs = CALLN (Fsort, list_reversed, |
| 3969 | Qdump_emacs_portable__sort_predicate); | ||
| 3965 | *reloc_list = Qnil; | 3970 | *reloc_list = Qnil; |
| 3966 | dump_align_output (ctx, max (alignof (struct dump_reloc), | 3971 | dump_align_output (ctx, max (alignof (struct dump_reloc), |
| 3967 | alignof (struct emacs_reloc))); | 3972 | alignof (struct emacs_reloc))); |
| @@ -4082,8 +4087,9 @@ static void | |||
| 4082 | dump_do_fixups (struct dump_context *ctx) | 4087 | dump_do_fixups (struct dump_context *ctx) |
| 4083 | { | 4088 | { |
| 4084 | dump_off saved_offset = ctx->offset; | 4089 | dump_off saved_offset = ctx->offset; |
| 4085 | Lisp_Object fixups = CALLN (Fsort, Fnreverse (ctx->fixups), | 4090 | Lisp_Object fixups_reversed = Fnreverse (ctx->fixups); |
| 4086 | Qdump_emacs_portable__sort_predicate); | 4091 | Lisp_Object fixups = CALLN (Fsort, fixups_reversed, |
| 4092 | Qdump_emacs_portable__sort_predicate); | ||
| 4087 | Lisp_Object prev_fixup = Qnil; | 4093 | Lisp_Object prev_fixup = Qnil; |
| 4088 | ctx->fixups = Qnil; | 4094 | ctx->fixups = Qnil; |
| 4089 | while (!NILP (fixups)) | 4095 | while (!NILP (fixups)) |
| @@ -5430,8 +5436,8 @@ dump_do_dump_relocation (const uintptr_t dump_base, | |||
| 5430 | case RELOC_NATIVE_COMP_UNIT: | 5436 | case RELOC_NATIVE_COMP_UNIT: |
| 5431 | { | 5437 | { |
| 5432 | static enum { UNKNOWN, LOCAL_BUILD, INSTALLED } installation_state; | 5438 | static enum { UNKNOWN, LOCAL_BUILD, INSTALLED } installation_state; |
| 5433 | struct Lisp_Native_Comp_Unit *comp_u = | 5439 | struct Lisp_Native_Comp_Unit *comp_u |
| 5434 | dump_ptr (dump_base, reloc_offset); | 5440 | = dump_ptr (dump_base, reloc_offset); |
| 5435 | comp_u->lambda_gc_guard_h = CALLN (Fmake_hash_table, QCtest, Qeq); | 5441 | comp_u->lambda_gc_guard_h = CALLN (Fmake_hash_table, QCtest, Qeq); |
| 5436 | if (STRINGP (comp_u->file)) | 5442 | if (STRINGP (comp_u->file)) |
| 5437 | error ("trying to load incoherent dumped eln file %s", | 5443 | error ("trying to load incoherent dumped eln file %s", |