aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-12-20 17:43:42 -0800
committerPaul Eggert2015-12-20 17:44:51 -0800
commite9916d8880561cc06b6cb73bafe7257b93ffbf4c (patch)
treea74f4ca73a26f18e697592d85f8e03dca4a035b1 /src
parent6cd051b31c3440486888f417e028554de7542fb0 (diff)
downloademacs-e9916d8880561cc06b6cb73bafe7257b93ffbf4c.tar.gz
emacs-e9916d8880561cc06b6cb73bafe7257b93ffbf4c.zip
Revert some recent emacs-module commentary
Most of the recently-added commentary was incorrect, due to the possibility of stack overflow.
Diffstat (limited to 'src')
-rw-r--r--src/emacs-module.c11
-rw-r--r--src/lisp.h13
2 files changed, 5 insertions, 19 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 5d1b4dc8d6a..dca834973bd 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -86,7 +86,7 @@ struct emacs_env_private
86struct emacs_runtime_private 86struct emacs_runtime_private
87{ 87{
88 /* FIXME: Ideally, we would just define "struct emacs_runtime_private" 88 /* FIXME: Ideally, we would just define "struct emacs_runtime_private"
89 * as a synonym of "emacs_env", but I don't know how to do that in C. */ 89 as a synonym of "emacs_env", but I don't know how to do that in C. */
90 emacs_env pub; 90 emacs_env pub;
91}; 91};
92 92
@@ -325,8 +325,7 @@ module_non_local_exit_get (emacs_env *env, emacs_value *sym, emacs_value *data)
325 struct emacs_env_private *p = env->private_members; 325 struct emacs_env_private *p = env->private_members;
326 if (p->pending_non_local_exit != emacs_funcall_exit_return) 326 if (p->pending_non_local_exit != emacs_funcall_exit_return)
327 { 327 {
328 /* FIXME: We cannot call lisp_to_value here because that can 328 /* FIXME: lisp_to_value can exit non-locally. */
329 exit non-locally. */
330 *sym = lisp_to_value (p->non_local_exit_symbol); 329 *sym = lisp_to_value (p->non_local_exit_symbol);
331 *data = lisp_to_value (p->non_local_exit_data); 330 *data = lisp_to_value (p->non_local_exit_data);
332 } 331 }
@@ -436,7 +435,6 @@ module_is_not_nil (emacs_env *env, emacs_value value)
436 check_main_thread (); 435 check_main_thread ();
437 if (module_non_local_exit_check (env) != emacs_funcall_exit_return) 436 if (module_non_local_exit_check (env) != emacs_funcall_exit_return)
438 return false; 437 return false;
439 /* Assume that NILP never exits non-locally. */
440 return ! NILP (value_to_lisp (value)); 438 return ! NILP (value_to_lisp (value));
441} 439}
442 440
@@ -446,7 +444,6 @@ module_eq (emacs_env *env, emacs_value a, emacs_value b)
446 check_main_thread (); 444 check_main_thread ();
447 if (module_non_local_exit_check (env) != emacs_funcall_exit_return) 445 if (module_non_local_exit_check (env) != emacs_funcall_exit_return)
448 return false; 446 return false;
449 /* Assume that EQ never exits non-locally. */
450 return EQ (value_to_lisp (a), value_to_lisp (b)); 447 return EQ (value_to_lisp (a), value_to_lisp (b));
451} 448}
452 449
@@ -893,7 +890,7 @@ value_to_lisp_bits (emacs_value v)
893} 890}
894 891
895/* If V was computed from lisp_to_value (O), then return O. 892/* If V was computed from lisp_to_value (O), then return O.
896 Must never fail or exit non-locally. */ 893 Exits non-locally only if the stack overflows. */
897static Lisp_Object 894static Lisp_Object
898value_to_lisp (emacs_value v) 895value_to_lisp (emacs_value v)
899{ 896{
@@ -923,7 +920,7 @@ enum { HAVE_STRUCT_ATTRIBUTE_ALIGNED = 0 };
923#endif 920#endif
924 921
925/* Convert O to an emacs_value. Allocate storage if needed; this can 922/* Convert O to an emacs_value. Allocate storage if needed; this can
926 signal if memory is exhausted. Must be injective. */ 923 signal if memory is exhausted. Must be an injective function. */
927static emacs_value 924static emacs_value
928lisp_to_value (Lisp_Object o) 925lisp_to_value (Lisp_Object o)
929{ 926{
diff --git a/src/lisp.h b/src/lisp.h
index bcac4b694b7..995760a5019 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -329,15 +329,11 @@ error !;
329#define lisp_h_CHECK_TYPE(ok, predicate, x) \ 329#define lisp_h_CHECK_TYPE(ok, predicate, x) \
330 ((ok) ? (void) 0 : (void) wrong_type_argument (predicate, x)) 330 ((ok) ? (void) 0 : (void) wrong_type_argument (predicate, x))
331#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons) 331#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons)
332/* lisp_h_EQ must never exit non-locally; emacs-module.c relies on
333 that. */
334#define lisp_h_EQ(x, y) (XLI (x) == XLI (y)) 332#define lisp_h_EQ(x, y) (XLI (x) == XLI (y))
335#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float) 333#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float)
336#define lisp_h_INTEGERP(x) ((XTYPE (x) & (Lisp_Int0 | ~Lisp_Int1)) == Lisp_Int0) 334#define lisp_h_INTEGERP(x) ((XTYPE (x) & (Lisp_Int0 | ~Lisp_Int1)) == Lisp_Int0)
337#define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker) 335#define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
338#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc) 336#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc)
339/* lisp_h_NILP must never exit non-locally; emacs-module.c relies on
340 that. */
341#define lisp_h_NILP(x) EQ (x, Qnil) 337#define lisp_h_NILP(x) EQ (x, Qnil)
342#define lisp_h_SET_SYMBOL_VAL(sym, v) \ 338#define lisp_h_SET_SYMBOL_VAL(sym, v) \
343 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v)) 339 (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
@@ -386,14 +382,11 @@ error !;
386# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x) 382# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)
387# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x) 383# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x)
388# define CONSP(x) lisp_h_CONSP (x) 384# define CONSP(x) lisp_h_CONSP (x)
389/* EQ must never exit non-locally; emacs-module.c relies on that. */
390# define EQ(x, y) lisp_h_EQ (x, y) 385# define EQ(x, y) lisp_h_EQ (x, y)
391# define FLOATP(x) lisp_h_FLOATP (x) 386# define FLOATP(x) lisp_h_FLOATP (x)
392# define INTEGERP(x) lisp_h_INTEGERP (x) 387# define INTEGERP(x) lisp_h_INTEGERP (x)
393# define MARKERP(x) lisp_h_MARKERP (x) 388# define MARKERP(x) lisp_h_MARKERP (x)
394# define MISCP(x) lisp_h_MISCP (x) 389# define MISCP(x) lisp_h_MISCP (x)
395/* NILP must never exit non-locally; emacs-module.c relies on
396 that. */
397# define NILP(x) lisp_h_NILP (x) 390# define NILP(x) lisp_h_NILP (x)
398# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_VAL (sym, v) 391# define SET_SYMBOL_VAL(sym, v) lisp_h_SET_SYMBOL_VAL (sym, v)
399# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONSTANT_P (sym) 392# define SYMBOL_CONSTANT_P(sym) lisp_h_SYMBOL_CONSTANT_P (sym)
@@ -995,8 +988,7 @@ make_natnum (EMACS_INT n)
995 return USE_LSB_TAG ? make_number (n) : XIL (n + (int0 << VALBITS)); 988 return USE_LSB_TAG ? make_number (n) : XIL (n + (int0 << VALBITS));
996} 989}
997 990
998/* Return true if X and Y are the same object. Must never exit 991/* Return true if X and Y are the same object. */
999 non-locally; emacs-module.c relies on that. */
1000 992
1001INLINE bool 993INLINE bool
1002(EQ) (Lisp_Object x, Lisp_Object y) 994(EQ) (Lisp_Object x, Lisp_Object y)
@@ -2573,9 +2565,6 @@ enum char_bits
2573 2565
2574/* Data type checking. */ 2566/* Data type checking. */
2575 2567
2576/* Checks whether X is null. Must never exit non-locally;
2577 emacs-module.c relies on that. */
2578
2579INLINE bool 2568INLINE bool
2580(NILP) (Lisp_Object x) 2569(NILP) (Lisp_Object x)
2581{ 2570{