if (uptr->finalizer)
uptr->finalizer (uptr->p);
}
+#ifdef HAVE_NATIVE_COMP
+ else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_NATIVE_COMP_UNIT))
+ {
+ struct Lisp_Native_Compilation_Unit *cu =
+ PSEUDOVEC_STRUCT (vector, Lisp_Native_Compilation_Unit);
+ eassert (cu->handle);
+ dynlib_close (cu->handle);
+ }
+#endif
}
/* Reclaim space used by unmarked vectors. */
break;
case PVEC_SUBR:
+#ifdef HAVE_NATIVE_COMP
+ if (XSUBR (obj)->native_comp_u)
+ set_vector_marked (ptr);
+#endif
break;
case PVEC_FREE:
break;
case Lisp_Vectorlike:
+#ifdef HAVE_NATIVE_COMP
+ survives_p =
+ (SUBRP (obj) && !XSUBR (obj)->native_comp_u) ||
+ vector_marked_p (XVECTOR (obj));
+#else
survives_p = SUBRP (obj) || vector_marked_p (XVECTOR (obj));
+#endif
break;
case Lisp_Cons:
--- /dev/null
+/* Elisp native compiler definitions
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+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 <https://www.gnu.org/licenses/>. */
+
+#ifndef COMP_H
+#define COMP_H
+
+#ifdef HAVE_NATIVE_COMP
+
+#include <dynlib.h>
+
+struct Lisp_Native_Compilation_Unit
+{
+ union vectorlike_header header;
+ /* Compilation unit file descriptor and handle. */
+ int fd;
+ dynlib_handle_ptr handle;
+};
+
+INLINE bool
+COMPILATIONP_UNITP (Lisp_Object a)
+{
+ return PSEUDOVECTORP (a, PVEC_NATIVE_COMP_UNIT);
+}
+
+INLINE struct Lisp_Native_Compilation_Unit *
+XCOMPILATION_UNIT (Lisp_Object a)
+{
+ eassert (COMPILATIONP_UNITP (a));
+ return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Native_Compilation_Unit);
+}
+
+/* Defined in comp.c. */
+extern void syms_of_comp (void);
+extern void fill_freloc (void);
+
+#endif
+#endif
#include <intprops.h>
#include <verify.h>
-#ifdef HAVE_NATIVE_COMP
-#include <dynlib.h>
-#endif
-
INLINE_HEADER_BEGIN
/* Define a TYPE constant ID as an externally visible name. Use like this:
PVEC_MUTEX,
PVEC_CONDVAR,
PVEC_MODULE_FUNCTION,
+ PVEC_NATIVE_COMP_UNIT,
/* These should be last, check internal_equal to see why. */
PVEC_COMPILED,
char_table_set (ct, idx, val);
}
-struct Native_Compilation_Unit
-{
- dynlib_handle_ptr handle;
-};
+#include "comp.h"
/* This structure describes a built-in function.
It is generated by the DEFUN macro only.
Lisp_Object native_doc;
};
#ifdef HAVE_NATIVE_COMP
- struct Native_Compilation_Unit *native_comp_u;;
+ Lisp_Object native_comp_u;;
#endif
} GCALIGNED_STRUCT;
union Aligned_Lisp_Subr
extern void malloc_probe (size_t);
extern void syms_of_profiler (void);
-#ifdef HAVE_NATIVE_COMP
-/* Defined in comp.c. */
-extern void syms_of_comp (void);
-extern void fill_freloc (void);
-#endif /* HAVE_NATIVE_COMP */
-
#ifdef DOS_NT
/* Defined in msdos.c, w32.c. */
extern char *emacs_root_dir (void);
}
break;
#endif
-
+#ifdef HAVE_NATIVE_COMP
+ case PVEC_NATIVE_COMP_UNIT:
+ {
+ print_c_string ("#<native compilation unit>", printcharfun);
+ int len = sprintf (buf, "%d", XCOMPILATION_UNIT (obj)->fd);
+ strout (buf, len, len, printcharfun);
+ printchar ('>', printcharfun);
+ }
+ break;
+#endif
default:
emacs_abort ();
}