From ab182c624868fcc0ed97597db669911099d4bd28 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 12 Jun 2016 10:31:25 -0700 Subject: New macro GNUC_PREREQ for GCC version * src/conf_post.h (GNUC_PREREQ): New macro. Change uses of __GNUC_MINOR__ and __GNUC_PATCHLEVEL__ to use this macro instead, for clarity and consistency. (PRINTF_ARCHETYPE): New macro. Define it to __gnu_printf__ only if glibc, since non-GNU platforms don’t necessarily support GNU printf formats. (ATTRIBUTE_FORMAT_PRINTF): Use it. --- src/bytecode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index fb9f617b514..c9e4a25dfa6 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -637,7 +637,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, the table clearer. */ #define LABEL(OP) [OP] = &&insn_ ## OP -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +#if GNUC_PREREQ (4, 6, 0) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Woverride-init" #elif defined __clang__ @@ -656,7 +656,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, #undef DEFINE }; -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__ +#if GNUC_PREREQ (4, 6, 0) || defined __clang__ # pragma GCC diagnostic pop #endif -- cgit v1.2.1 From 1873ef3b8986193803cee2721ee738f8dee39514 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2016 22:15:42 +0200 Subject: Remove now-inaccurate bytecode comments * src/bytecode.c: Remove comments that are no longer accurate. Most of these are actually old ChangeLog entries. --- src/bytecode.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index c9e4a25dfa6..75d51cc3e84 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -17,22 +17,6 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* -hacked on by jwz@lucid.com 17-jun-91 - o added a compile-time switch to turn on simple sanity checking; - o put back the obsolete byte-codes for error-detection; - o added a new instruction, unbind_all, which I will use for - tail-recursion elimination; - o made temp_output_buffer_show be called with the right number - of args; - o made the new bytecodes be called with args in the right order; - o added metering support. - -by Hallvard: - o added relative jump instructions; - o all conditionals now only do QUIT if they jump. - */ - #include #include "lisp.h" @@ -314,8 +298,7 @@ struct byte_stack #endif /* The string containing the byte-code, and its current address. - Storing this here protects it from GC because mark_byte_stack - marks it. */ + Storing this here protects it from GC. */ Lisp_Object byte_string; const unsigned char *byte_string_start; -- cgit v1.2.1 From 4ba72d329525332798b3b222eaec0efc8a23ac75 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2016 22:15:42 +0200 Subject: Remove BYTE_MAINTAIN_TOP It is no longer needed now that we assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (BYTE_MAINTAIN_TOP): Remove. All uses removed, and code simplified accordingly. (BEFORE_POTENTIAL_GC, AFTER_POTENTIAL_GC): Remove, since they are always no-ops now. All uses removed. (MAYBE_GC): Remove. All uses replaced by maybe_gc, since it is now equivalent. --- src/bytecode.c | 220 +++------------------------------------------------------ 1 file changed, 10 insertions(+), 210 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 75d51cc3e84..a551eca2447 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -278,9 +278,6 @@ enum byte_code_op Bset_mark = 0163, /* this loser is no longer generated as of v18 */ #endif }; - -/* Whether to maintain a `top' and `bottom' field in the stack frame. */ -#define BYTE_MAINTAIN_TOP BYTE_CODE_SAFE /* Structure describing a value stack used during byte-code execution in Fbyte_code. */ @@ -291,12 +288,6 @@ struct byte_stack and is relocated when that string is relocated. */ const unsigned char *pc; - /* Top and bottom of stack. The bottom points to an area of memory - allocated with alloca in Fbyte_code. */ -#if BYTE_MAINTAIN_TOP - Lisp_Object *top, *bottom; -#endif - /* The string containing the byte-code, and its current address. Storing this here protects it from GC. */ Lisp_Object byte_string; @@ -367,27 +358,6 @@ relocate_byte_stack (void) #define TOP (*top) -/* Actions that must be performed before and after calling a function - that might GC. */ - -#if !BYTE_MAINTAIN_TOP -#define BEFORE_POTENTIAL_GC() ((void)0) -#define AFTER_POTENTIAL_GC() ((void)0) -#else -#define BEFORE_POTENTIAL_GC() stack.top = top -#define AFTER_POTENTIAL_GC() stack.top = NULL -#endif - -/* Garbage collect if we have consed enough since the last time. - We do this at every branch, to avoid loops that never GC. */ - -#define MAYBE_GC() \ - do { \ - BEFORE_POTENTIAL_GC (); \ - maybe_gc (); \ - AFTER_POTENTIAL_GC (); \ - } while (0) - /* Check for jumping out of range. */ #ifdef BYTE_CODE_SAFE @@ -410,11 +380,9 @@ relocate_byte_stack (void) { \ Lisp_Object flag = Vquit_flag; \ Vquit_flag = Qnil; \ - BEFORE_POTENTIAL_GC (); \ if (EQ (Vthrow_on_input, flag)) \ Fthrow (Vthrow_on_input, Qt); \ Fsignal (Qquit, Qnil); \ - AFTER_POTENTIAL_GC (); \ } \ else if (pending_signals) \ process_pending_signals (); \ @@ -504,10 +472,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); -#if BYTE_MAINTAIN_TOP - stack.bottom = top + 1; - stack.top = NULL; -#endif stack.next = byte_stack_list; byte_stack_list = &stack; @@ -676,16 +640,12 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, || (v2 = SYMBOL_VAL (XSYMBOL (v1)), EQ (v2, Qunbound))) { - BEFORE_POTENTIAL_GC (); v2 = Fsymbol_value (v1); - AFTER_POTENTIAL_GC (); } } else { - BEFORE_POTENTIAL_GC (); v2 = Fsymbol_value (v1); - AFTER_POTENTIAL_GC (); } PUSH (v2); NEXT; @@ -694,7 +654,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bgotoifnil): { Lisp_Object v1; - MAYBE_GC (); + maybe_gc (); op = FETCH2; v1 = POP; if (NILP (v1)) @@ -716,7 +676,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, TOP = Qnil; else { - BEFORE_POTENTIAL_GC (); wrong_type_argument (Qlistp, v1); } NEXT; @@ -733,10 +692,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bmemq): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fmemq (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -750,7 +707,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, TOP = Qnil; else { - BEFORE_POTENTIAL_GC (); wrong_type_argument (Qlistp, v1); } NEXT; @@ -786,9 +742,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, SET_SYMBOL_VAL (XSYMBOL (sym), val); else { - BEFORE_POTENTIAL_GC (); set_internal (sym, val, Qnil, 0); - AFTER_POTENTIAL_GC (); } } (void) POP; @@ -821,9 +775,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, op -= Bvarbind; varbind: /* Specbind can signal and thus GC. */ - BEFORE_POTENTIAL_GC (); specbind (vectorp[op], POP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bcall6): @@ -843,7 +795,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, op -= Bcall; docall: { - BEFORE_POTENTIAL_GC (); DISCARD (op); #ifdef BYTE_CODE_METER if (byte_metering_on && SYMBOLP (TOP)) @@ -861,7 +812,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } #endif TOP = Ffuncall (op + 1, &TOP); - AFTER_POTENTIAL_GC (); NEXT; } @@ -881,21 +831,17 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bunbind5): op -= Bunbind; dounbind: - BEFORE_POTENTIAL_GC (); unbind_to (SPECPDL_INDEX () - op, Qnil); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bunbind_all): /* Obsolete. Never used. */ /* To unbind back to the beginning of this frame. Not used yet, but will be needed for tail-recursion elimination. */ - BEFORE_POTENTIAL_GC (); unbind_to (count, Qnil); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bgoto): - MAYBE_GC (); + maybe_gc (); BYTE_CODE_QUIT; op = FETCH2; /* pc = FETCH2 loses since FETCH2 contains pc++ */ CHECK_RANGE (op); @@ -905,7 +851,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bgotoifnonnil): { Lisp_Object v1; - MAYBE_GC (); + maybe_gc (); op = FETCH2; v1 = POP; if (!NILP (v1)) @@ -918,7 +864,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } CASE (Bgotoifnilelsepop): - MAYBE_GC (); + maybe_gc (); op = FETCH2; if (NILP (TOP)) { @@ -930,7 +876,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (Bgotoifnonnilelsepop): - MAYBE_GC (); + maybe_gc (); op = FETCH2; if (!NILP (TOP)) { @@ -942,7 +888,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (BRgoto): - MAYBE_GC (); + maybe_gc (); BYTE_CODE_QUIT; stack.pc += (int) *stack.pc - 127; NEXT; @@ -950,7 +896,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (BRgotoifnil): { Lisp_Object v1; - MAYBE_GC (); + maybe_gc (); v1 = POP; if (NILP (v1)) { @@ -964,7 +910,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (BRgotoifnonnil): { Lisp_Object v1; - MAYBE_GC (); + maybe_gc (); v1 = POP; if (!NILP (v1)) { @@ -976,7 +922,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } CASE (BRgotoifnilelsepop): - MAYBE_GC (); + maybe_gc (); op = *stack.pc++; if (NILP (TOP)) { @@ -987,7 +933,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (BRgotoifnonnilelsepop): - MAYBE_GC (); + maybe_gc (); op = *stack.pc++; if (!NILP (TOP)) { @@ -1024,10 +970,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, ptrdiff_t count1 = SPECPDL_INDEX (); record_unwind_protect (restore_window_configuration, Fcurrent_window_configuration (Qnil)); - BEFORE_POTENTIAL_GC (); TOP = Fprogn (TOP); unbind_to (count1, TOP); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1039,10 +983,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bcatch): /* Obsolete since 24.4. */ { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = internal_catch (TOP, eval_sub, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1098,30 +1040,24 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, Lisp_Object handlers, body; handlers = POP; body = POP; - BEFORE_POTENTIAL_GC (); TOP = internal_lisp_condition_case (TOP, body, handlers); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Btemp_output_buffer_setup): /* Obsolete since 24.1. */ - BEFORE_POTENTIAL_GC (); CHECK_STRING (TOP); temp_output_buffer_setup (SSDATA (TOP)); - AFTER_POTENTIAL_GC (); TOP = Vstandard_output; NEXT; CASE (Btemp_output_buffer_show): /* Obsolete since 24.1. */ { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; temp_output_buffer_show (TOP); TOP = v1; /* pop binding of standard-output */ unbind_to (SPECPDL_INDEX () - 1, Qnil); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1129,7 +1065,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { Lisp_Object v1, v2; EMACS_INT n; - BEFORE_POTENTIAL_GC (); v1 = POP; v2 = TOP; CHECK_NUMBER (v2); @@ -1139,7 +1074,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, v1 = XCDR (v1); immediate_quit = 0; TOP = CAR (v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1200,110 +1134,84 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (Blength): - BEFORE_POTENTIAL_GC (); TOP = Flength (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Baref): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Faref (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Baset): { Lisp_Object v1, v2; - BEFORE_POTENTIAL_GC (); v2 = POP; v1 = POP; TOP = Faset (TOP, v1, v2); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bsymbol_value): - BEFORE_POTENTIAL_GC (); TOP = Fsymbol_value (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bsymbol_function): - BEFORE_POTENTIAL_GC (); TOP = Fsymbol_function (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bset): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fset (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bfset): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Ffset (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bget): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fget (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bsubstring): { Lisp_Object v1, v2; - BEFORE_POTENTIAL_GC (); v2 = POP; v1 = POP; TOP = Fsubstring (TOP, v1, v2); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bconcat2): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fconcat (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bconcat3): - BEFORE_POTENTIAL_GC (); DISCARD (2); TOP = Fconcat (3, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bconcat4): - BEFORE_POTENTIAL_GC (); DISCARD (3); TOP = Fconcat (4, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (BconcatN): op = FETCH; - BEFORE_POTENTIAL_GC (); DISCARD (op - 1); TOP = Fconcat (op, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bsub1): @@ -1317,9 +1225,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } else { - BEFORE_POTENTIAL_GC (); TOP = Fsub1 (v1); - AFTER_POTENTIAL_GC (); } NEXT; } @@ -1335,9 +1241,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } else { - BEFORE_POTENTIAL_GC (); TOP = Fadd1 (v1); - AFTER_POTENTIAL_GC (); } NEXT; } @@ -1345,11 +1249,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Beqlsign): { Lisp_Object v1, v2; - BEFORE_POTENTIAL_GC (); v2 = POP; v1 = TOP; CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1); CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2); - AFTER_POTENTIAL_GC (); if (FLOATP (v1) || FLOATP (v2)) { double f1, f2; @@ -1366,48 +1268,38 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bgtr): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = arithcompare (TOP, v1, ARITH_GRTR); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Blss): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = arithcompare (TOP, v1, ARITH_LESS); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bleq): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = arithcompare (TOP, v1, ARITH_LESS_OR_EQUAL); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bgeq): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = arithcompare (TOP, v1, ARITH_GRTR_OR_EQUAL); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bdiff): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fminus (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bnegate): @@ -1421,55 +1313,41 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } else { - BEFORE_POTENTIAL_GC (); TOP = Fminus (1, &TOP); - AFTER_POTENTIAL_GC (); } NEXT; } CASE (Bplus): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fplus (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bmax): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fmax (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bmin): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fmin (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bmult): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Ftimes (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bquo): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fquo (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Brem): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Frem (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1482,23 +1360,17 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } CASE (Bgoto_char): - BEFORE_POTENTIAL_GC (); TOP = Fgoto_char (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Binsert): - BEFORE_POTENTIAL_GC (); TOP = Finsert (1, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (BinsertN): op = FETCH; - BEFORE_POTENTIAL_GC (); DISCARD (op - 1); TOP = Finsert (op, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bpoint_max): @@ -1518,17 +1390,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } CASE (Bchar_after): - BEFORE_POTENTIAL_GC (); TOP = Fchar_after (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bfollowing_char): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = Ffollowing_char (); - AFTER_POTENTIAL_GC (); PUSH (v1); NEXT; } @@ -1536,9 +1404,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bpreceding_char): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = Fprevious_char (); - AFTER_POTENTIAL_GC (); PUSH (v1); NEXT; } @@ -1546,17 +1412,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bcurrent_column): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); XSETFASTINT (v1, current_column ()); - AFTER_POTENTIAL_GC (); PUSH (v1); NEXT; } CASE (Bindent_to): - BEFORE_POTENTIAL_GC (); TOP = Findent_to (TOP, Qnil); - AFTER_POTENTIAL_GC (); NEXT; CASE (Beolp): @@ -1580,62 +1442,46 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (Bset_buffer): - BEFORE_POTENTIAL_GC (); TOP = Fset_buffer (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Binteractive_p): /* Obsolete since 24.1. */ - BEFORE_POTENTIAL_GC (); PUSH (call0 (intern ("interactive-p"))); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bforward_char): - BEFORE_POTENTIAL_GC (); TOP = Fforward_char (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bforward_word): - BEFORE_POTENTIAL_GC (); TOP = Fforward_word (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bskip_chars_forward): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fskip_chars_forward (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bskip_chars_backward): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fskip_chars_backward (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bforward_line): - BEFORE_POTENTIAL_GC (); TOP = Fforward_line (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bchar_syntax): { int c; - BEFORE_POTENTIAL_GC (); CHECK_CHARACTER (TOP); - AFTER_POTENTIAL_GC (); c = XFASTINT (TOP); if (NILP (BVAR (current_buffer, enable_multibyte_characters))) MAKE_CHAR_MULTIBYTE (c); @@ -1646,97 +1492,73 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bbuffer_substring): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fbuffer_substring (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bdelete_region): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fdelete_region (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bnarrow_to_region): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fnarrow_to_region (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bwiden): - BEFORE_POTENTIAL_GC (); PUSH (Fwiden ()); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bend_of_line): - BEFORE_POTENTIAL_GC (); TOP = Fend_of_line (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bset_marker): { Lisp_Object v1, v2; - BEFORE_POTENTIAL_GC (); v1 = POP; v2 = POP; TOP = Fset_marker (TOP, v2, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bmatch_beginning): - BEFORE_POTENTIAL_GC (); TOP = Fmatch_beginning (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bmatch_end): - BEFORE_POTENTIAL_GC (); TOP = Fmatch_end (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bupcase): - BEFORE_POTENTIAL_GC (); TOP = Fupcase (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bdowncase): - BEFORE_POTENTIAL_GC (); TOP = Fdowncase (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bstringeqlsign): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fstring_equal (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bstringlss): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fstring_lessp (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1751,10 +1573,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bnthcdr): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fnthcdr (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1765,11 +1585,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { /* Exchange args and then do nth. */ EMACS_INT n; - BEFORE_POTENTIAL_GC (); v2 = POP; v1 = TOP; CHECK_NUMBER (v2); - AFTER_POTENTIAL_GC (); n = XINT (v2); immediate_quit = 1; while (--n >= 0 && CONSP (v1)) @@ -1779,10 +1597,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } else { - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Felt (TOP, v1); - AFTER_POTENTIAL_GC (); } NEXT; } @@ -1790,46 +1606,36 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, CASE (Bmember): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fmember (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bassq): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fassq (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bnreverse): - BEFORE_POTENTIAL_GC (); TOP = Fnreverse (TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bsetcar): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fsetcar (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } CASE (Bsetcdr): { Lisp_Object v1; - BEFORE_POTENTIAL_GC (); v1 = POP; TOP = Fsetcdr (TOP, v1); - AFTER_POTENTIAL_GC (); NEXT; } @@ -1850,10 +1656,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, } CASE (Bnconc): - BEFORE_POTENTIAL_GC (); DISCARD (1); TOP = Fnconc (2, &TOP); - AFTER_POTENTIAL_GC (); NEXT; CASE (Bnumberp): @@ -1870,14 +1674,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, interpreter. */ case Bset_mark: - BEFORE_POTENTIAL_GC (); error ("set-mark is an obsolete bytecode"); - AFTER_POTENTIAL_GC (); break; case Bscan_buffer: - BEFORE_POTENTIAL_GC (); error ("scan-buffer is an obsolete bytecode"); - AFTER_POTENTIAL_GC (); break; #endif -- cgit v1.2.1 From 9569916d94c6c448862d02919e52fc3bfb9b9c8d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 15 Jul 2016 22:15:43 +0200 Subject: Stop worrying about Alliant in bytecode.c * src/bytecode.c (PUSH): Remove workaround for long-obsolete compiler. --- src/bytecode.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index a551eca2447..bb7922d54a4 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -338,12 +338,10 @@ relocate_byte_stack (void) #define FETCH2 (op = FETCH, op + (FETCH << 8)) -/* Push x onto the execution stack. This used to be #define PUSH(x) - (*++stackp = (x)) This oddity is necessary because Alliant can't be - bothered to compile the preincrement operator properly, as of 4/91. - -JimB */ +/* Push X onto the execution stack. The expression X should not + contain TOP, to avoid competing side effects. */ -#define PUSH(x) (top++, *top = (x)) +#define PUSH(x) (*++top = (x)) /* Pop a value off the execution stack. */ -- cgit v1.2.1 From 3e71e4379ce7b53afe51ead4c94e6bb016bc6e7a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 20 Jul 2016 10:31:33 +0200 Subject: Work around GCC bug 54561 in a better way The new approach is less selective, but also less intrusive on C code. * src/bytecode.c, src/image.c, src/keyboard.c: Ignore -Wclobbered. * src/conf_post.h (NONVOLATILE): Remove. All uses removed. --- src/bytecode.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index bb7922d54a4..1b02c60c618 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -32,6 +32,11 @@ along with GNU Emacs. If not, see . */ #include "xterm.h" #endif +/* Work around GCC bug 54561. */ +#if GNUC_PREREQ (4, 3, 0) +# pragma GCC diagnostic ignored "-Wclobbered" +#endif + /* * define BYTE_CODE_SAFE to enable some minor sanity checking (useful for * debugging the byte compiler...) -- cgit v1.2.1 From 60dd094a8c7bdbbff121c99f56f42910534e7cc1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Jul 2016 01:16:10 +0200 Subject: Remove CHECK_FRAME_FONT cruft from bytecode.c * src/bytecode.c [CHECK_FRAME_FONT]: Do not include frame.h, xterm.h. Remove some old ‘#if 0’ code. --- src/bytecode.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 1b02c60c618..8b700b0312a 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -27,11 +27,6 @@ along with GNU Emacs. If not, see . */ #include "syntax.h" #include "window.h" -#ifdef CHECK_FRAME_FONT -#include "frame.h" -#include "xterm.h" -#endif - /* Work around GCC bug 54561. */ #if GNUC_PREREQ (4, 3, 0) # pragma GCC diagnostic ignored "-Wclobbered" @@ -439,16 +434,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, Lisp_Object result; enum handlertype type; -#if 0 /* CHECK_FRAME_FONT */ - { - struct frame *f = SELECTED_FRAME (); - if (FRAME_X_P (f) - && FRAME_FONT (f)->direction != 0 - && FRAME_FONT (f)->direction != 1) - emacs_abort (); - } -#endif - CHECK_STRING (bytestr); CHECK_VECTOR (vector); CHECK_NATNUM (maxdepth); -- cgit v1.2.1 From 29f645d5262b1dee9118c6eb29c4ed462396444f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 21 Jul 2016 11:12:59 -0400 Subject: * src/bytecode.c: Fix compilation with BYTE_CODE_SAFE (struct byte_stack): Re-add `bottom'. (exec_byte_code): Initialize it. --- src/bytecode.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 8b700b0312a..05bc9fcdb08 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -288,6 +288,12 @@ struct byte_stack and is relocated when that string is relocated. */ const unsigned char *pc; + /* bottom of stack. The bottom points to an area of memory + allocated with alloca in Fbyte_code. */ +#ifdef BYTE_CODE_SAFE + Lisp_Object *bottom; +#endif + /* The string containing the byte-code, and its current address. Storing this here protects it from GC. */ Lisp_Object byte_string; @@ -460,6 +466,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); +#ifdef BYTE_CODE_SAFE + stack.bottom = top + 1; +#endif stack.next = byte_stack_list; byte_stack_list = &stack; -- cgit v1.2.1 From 50cc08bf6e6cdc96dcdcbef388cf9cf76a15f81a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 24 Jul 2016 11:10:09 +0200 Subject: ‘signal’ no longer returns Although for decades ‘signal’ has been documented to not return, a corner case in the Lisp debugger causes ‘signal’ to return. Remove the corner case and adjust Emacs internals accordingly. An alternative would be to document the corner case, but this would complicate the Lisp API unnecessarily. (Bug#24047) * src/eval.c (signal_or_quit): New function, with most of the old contents of Fsignal. (quit): New function, which uses signal_or_quit and which might return. All keyboard-based callers of Fsignal (Qquit, Qnil) changed to use this new function instead. (Fsignal): Use signal_or_quit. Now _Noreturn. All callers changed. (xsignal): Move to lisp.h. * src/lisp.h (xsignal): Now an inline function, as it's now just an alias for Fsignal. --- src/bytecode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bytecode.c') diff --git a/src/bytecode.c b/src/bytecode.c index 05bc9fcdb08..ee1b79f1826 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -386,7 +386,7 @@ relocate_byte_stack (void) Vquit_flag = Qnil; \ if (EQ (Vthrow_on_input, flag)) \ Fthrow (Vthrow_on_input, Qt); \ - Fsignal (Qquit, Qnil); \ + quit (); \ } \ else if (pending_signals) \ process_pending_signals (); \ -- cgit v1.2.1