summaryrefslogtreecommitdiff
path: root/src/textprop.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/textprop.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/textprop.c')
-rw-r--r--src/textprop.c40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/textprop.c b/src/textprop.c
index f6dbab09228..3f7c8d10639 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -375,15 +375,10 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
{
Lisp_Object tail1, tail2, sym1, val1;
bool changed = false;
- struct gcpro gcpro1, gcpro2, gcpro3;
tail1 = plist;
sym1 = Qnil;
val1 = Qnil;
- /* No need to protect OBJECT, because we can GC only in the case
- where it is a buffer, and live buffers are always protected.
- I and its plist are also protected, via OBJECT. */
- GCPRO3 (tail1, sym1, val1);
/* Go through each element of PLIST. */
for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1)))
@@ -396,9 +391,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2)))
if (EQ (sym1, XCAR (tail2)))
{
- /* No need to gcpro, because tail2 protects this
- and it must be a cons cell (we get an error otherwise). */
- register Lisp_Object this_cdr;
+ Lisp_Object this_cdr;
this_cdr = XCDR (tail2);
/* Found the property. Now check its value. */
@@ -456,8 +449,6 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object,
}
}
- UNGCPRO;
-
return changed;
}
@@ -1160,7 +1151,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
INTERVAL i, unchanged;
ptrdiff_t s, len;
bool modified = false;
- struct gcpro gcpro1;
bool first_time = true;
properties = validate_plist (properties);
@@ -1178,10 +1168,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
s = XINT (start);
len = XINT (end) - s;
- /* No need to protect OBJECT, because we GC only if it's a buffer,
- and live buffers are always protected. */
- GCPRO1 (properties);
-
/* If this interval already has the properties, we can skip it. */
if (interval_has_all_properties (properties, i))
{
@@ -1190,7 +1176,7 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
do
{
if (got >= len)
- RETURN_UNGCPRO (Qnil);
+ return Qnil;
len -= got;
i = next_interval (i);
got = LENGTH (i);
@@ -1233,11 +1219,6 @@ add_text_properties_1 (Lisp_Object start, Lisp_Object end,
if (LENGTH (i) >= len)
{
- /* We can UNGCPRO safely here, because there will be just
- one more chance to gc, in the next call to add_properties,
- and after that we will not need PROPERTIES or OBJECT again. */
- UNGCPRO;
-
if (interval_has_all_properties (properties, i))
{
if (BUFFERP (object))
@@ -1906,7 +1887,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
Lisp_Object plist;
ptrdiff_t s, e, e2, p, len;
bool modified = false;
- struct gcpro gcpro1, gcpro2;
i = validate_interval_range (src, &start, &end, soft);
if (!i)
@@ -1964,8 +1944,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
s = i->position;
}
- GCPRO2 (stuff, dest);
-
while (! NILP (stuff))
{
res = Fcar (stuff);
@@ -1976,8 +1954,6 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
stuff = Fcdr (stuff);
}
- UNGCPRO;
-
return modified ? Qt : Qnil;
}
@@ -2047,10 +2023,6 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp
void
add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object delta)
{
- struct gcpro gcpro1, gcpro2;
-
- GCPRO2 (list, object);
-
for (; CONSP (list); list = XCDR (list))
{
Lisp_Object item, start, end, plist;
@@ -2062,8 +2034,6 @@ add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object
Fadd_text_properties (start, end, plist, object);
}
-
- UNGCPRO;
}
@@ -2111,14 +2081,11 @@ extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
static void
call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end)
{
- struct gcpro gcpro1;
- GCPRO1 (list);
while (!NILP (list))
{
call2 (Fcar (list), start, end);
list = Fcdr (list);
}
- UNGCPRO;
}
/* Check for read-only intervals between character positions START ... END,
@@ -2138,7 +2105,6 @@ verify_interval_modification (struct buffer *buf,
Lisp_Object hooks;
Lisp_Object prev_mod_hooks;
Lisp_Object mod_hooks;
- struct gcpro gcpro1;
hooks = Qnil;
prev_mod_hooks = Qnil;
@@ -2295,7 +2261,6 @@ verify_interval_modification (struct buffer *buf,
if (!inhibit_modification_hooks)
{
- GCPRO1 (hooks);
hooks = Fnreverse (hooks);
while (! EQ (hooks, Qnil))
{
@@ -2303,7 +2268,6 @@ verify_interval_modification (struct buffer *buf,
make_number (end));
hooks = Fcdr (hooks);
}
- UNGCPRO;
}
}
}