summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-08-26 19:24:28 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-08-26 19:24:58 -0700
commit60d1b18734fff144f1608da6228d60e4bda7b24c (patch)
tree9b917c91b7de84ba517dba738784e1f1600f9234 /src/print.c
parent259a643d7f7c56976ff794cbdba8f5c70c795091 (diff)
downloademacs-60d1b18734fff144f1608da6228d60e4bda7b24c.tar.gz
Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/print.c b/src/print.c
index 2d4dca7a42a..d3b1a927b22 100644
--- a/src/print.c
+++ b/src/print.c
@@ -465,8 +465,6 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
ptrdiff_t i;
ptrdiff_t size = SCHARS (string);
ptrdiff_t size_byte = SBYTES (string);
- struct gcpro gcpro1;
- GCPRO1 (string);
if (size == size_byte)
for (i = 0; i < size; i++)
printchar (SREF (string, i), printcharfun);
@@ -480,7 +478,6 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
printchar (ch, printcharfun);
i += len;
}
- UNGCPRO;
}
}
@@ -739,17 +736,13 @@ If PRINTCHARFUN is omitted, the value of `standard-output' (which see)
is used instead. */)
(Lisp_Object object, Lisp_Object printcharfun)
{
- struct gcpro gcpro1;
-
if (NILP (printcharfun))
printcharfun = Vstandard_output;
- GCPRO1 (object);
PRINTPREPARE;
printchar ('\n', printcharfun);
print (object, printcharfun, 1);
printchar ('\n', printcharfun);
PRINTFINISH;
- UNGCPRO;
return object;
}
@@ -854,7 +847,6 @@ error message is constructed. */)
{
struct buffer *old = current_buffer;
Lisp_Object value;
- struct gcpro gcpro1;
/* If OBJ is (error STRING), just return STRING.
That is not only faster, it also avoids the need to allocate
@@ -870,10 +862,8 @@ error message is constructed. */)
set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));
value = Fbuffer_string ();
- GCPRO1 (value);
Ferase_buffer ();
set_buffer_internal (old);
- UNGCPRO;
return value;
}
@@ -888,7 +878,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
Lisp_Object caller)
{
Lisp_Object errname, errmsg, file_error, tail;
- struct gcpro gcpro1;
if (context != 0)
write_string_1 (context, stream);
@@ -927,7 +916,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
/* Print an error message including the data items. */
tail = Fcdr_safe (data);
- GCPRO1 (tail);
/* For file-error, make error message by concatenating
all the data items. They are all strings. */
@@ -958,8 +946,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
Fprin1 (obj, stream);
}
}
-
- UNGCPRO;
}
@@ -1428,16 +1414,13 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
print_string (obj, printcharfun);
else
{
- register ptrdiff_t i, i_byte;
- struct gcpro gcpro1;
+ ptrdiff_t i, i_byte;
ptrdiff_t size_byte;
/* True means we must ensure that the next character we output
cannot be taken as part of a hex character escape. */
bool need_nonhex = false;
bool multibyte = STRING_MULTIBYTE (obj);
- GCPRO1 (obj);
-
if (! EQ (Vprint_charset_text_property, Qt))
obj = print_prune_string_charset (obj);
@@ -1507,8 +1490,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
0, print_interval, printcharfun);
printchar (')', printcharfun);
}
-
- UNGCPRO;
}
break;
@@ -1702,11 +1683,9 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
{
ptrdiff_t i;
unsigned char c;
- struct gcpro gcpro1;
EMACS_INT size = bool_vector_size (obj);
ptrdiff_t size_in_chars = bool_vector_bytes (size);
ptrdiff_t real_size_in_chars = size_in_chars;
- GCPRO1 (obj);
int len = sprintf (buf, "#&%"pI"d\"", size);
strout (buf, len, len, printcharfun);
@@ -1743,8 +1722,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
if (size_in_chars < real_size_in_chars)
print_c_string (" ...", printcharfun);
printchar ('\"', printcharfun);
-
- UNGCPRO;
}
else if (SUBRP (obj))
{
@@ -2041,8 +2018,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
{
ptrdiff_t amount = v->data[1].integer;
-#if GC_MARK_STACK
-
/* valid_lisp_object_p is reliable, so try to print up
to 8 saved objects. This code is rarely used, so
it's OK that valid_lisp_object_p is slow. */
@@ -2067,16 +2042,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
}
if (i == limit && i < amount)
print_c_string (" ...", printcharfun);
-
-#else /* not GC_MARK_STACK */
-
- /* There is no reliable way to determine whether the objects
- are initialized, so do not try to print them. */
-
- i = sprintf (buf, "with %"pD"d objects", amount);
- strout (buf, i, i, printcharfun);
-
-#endif /* GC_MARK_STACK */
}
else
{