1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00
emacs/test/data
Philipp Stephani 096be9c454 Change module interface to no longer use GMP objects directly.
As described in the new comment added to emacs-module.c, using GMP
directly in the module interface has significant downsides: it couples
the module interface directly to the implementation and requires
module authors to link their module against the same GMP library as
Emacs itself, which is often difficult and an unnecessary burden.  By
picking a representation for the magnitude that often matches the one
used by GMP, we can avoid overhead when converting from and to GMP in
most cases.

Loading the test module in test/data/emacs-module and evaluating

(dotimes (_ 10000)
  (mod-test-double (* 2 most-negative-fixnum)))

under Callgrind shows that on my (GNU/Linux) machine Emacs only spends
10% of the CPU time of mod-test-double in mpz_import and mpz_export
combined, even though that function does little else.  (By contrast,
30% is spent in allocate_pseudovector.)

* src/emacs-module.h.in: Don't check EMACS_MODULE_GMP.  Don't include
gmp.h.  Remove emacs_mpz structure.  Instead, define type alias
emacs_limb_t and macro EMACS_LIMB_MAX.

* src/module-env-27.h: Change interface of extract_big_integer and
make_big_integer to take a sign-magnitude representation instead of
mpz_t.

* src/emacs-module.c: Don't check EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.  Add a comment about the chosen
implementation.
(module_extract_big_integer, module_make_big_integer): Reimplement
without using mpz_t in the interface.

* doc/lispref/internals.texi (Module Values): Adapt function
documentation and example.  Stop mentioning GMP and EMACS_MODULE_GMP.

* test/data/emacs-module/mod-test.c: Don't define EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.
(memory_full, extract_big_integer, make_big_integer): New helper
functions, identical to example in the Info documentation.
(Fmod_test_nanoseconds, Fmod_test_double): Adapt to new interface.
2019-12-04 21:17:10 +01:00
..
decompress * lisp/tar-mode.el (tar-extract): Call tar--try-jka-compr (bug#34251) 2019-02-03 23:00:29 +02:00
emacs-module Change module interface to no longer use GMP objects directly. 2019-12-04 21:17:10 +01:00
epg Fix epg-tests with dummy-pinentry program (Bug#23619) 2017-02-28 19:57:35 -05:00
image Add an Exif parsing library 2019-09-21 18:13:11 +02:00
mailcap Add tests for mailcap.el 2017-09-05 11:55:01 -04:00
net
shr Handle HTML 'ol' start attribute in shr.el 2019-02-22 09:52:57 +02:00
vc/diff-mode * test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock): New test. 2019-02-02 23:23:16 +02:00
xdg Add MIME apps spec utilities 2017-09-26 17:48:00 -04:00
xref
files-bug18141.el.gz
minibuffer-test-cttq$tion * test/lisp/minibuffer-tests.el (completion-table-test-quoting): New test 2019-11-26 13:18:18 -05:00
somelib.el Put re-loaded file back at start of load-history (bug#26837) 2017-05-09 19:44:09 -04:00
somelib2.el Put re-loaded file back at start of load-history (bug#26837) 2017-05-09 19:44:09 -04:00