]> git.eshelyaron.com Git - emacs.git/commitdiff
add initial native compiler pdumper support
authorAndrea Corallo <akrl@sdf.org>
Mon, 23 Dec 2019 13:27:55 +0000 (14:27 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:38:15 +0000 (11:38 +0100)
src/doc.c
src/pdumper.c

index 369997a3db43240ee222465e96e7e78f0ab84c24..9e1d83927875bd71fbf44cbf29f67291dbd48d37 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -510,13 +510,15 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
            XSETCAR (tem, make_fixnum (offset));
        }
     }
-
+#ifdef HAVE_NATIVE_COMP
+  else if (SUBRP_NATIVE_COMPILEDP (fun))
+    {
+      XSUBR (fun)->native_doc = Qnil;
+    }
+#endif
   /* Lisp_Subrs have a slot for it.  */
   else if (SUBRP (fun))
     {
-#ifdef HAVE_NATIVE_COMP
-      eassert (NILP (Fsubr_native_elisp_p (fun)));
-#endif
       XSUBR (fun)->doc = offset;
     }
 
index 24698d48b57ee53253472f1dad6362e7e3f096ac..775f6c3e60b8125e995ea5298898a0c4196a40f6 100644 (file)
@@ -2931,18 +2931,49 @@ dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr)
   struct Lisp_Subr out;
   dump_object_start (ctx, &out, sizeof (out));
   DUMP_FIELD_COPY (&out, subr, header.size);
+#ifdef HAVE_NATIVE_COMP
+  if (subr->native_comp_u)
+    out.function.a0 = NULL;
+  else
+    dump_field_emacs_ptr (ctx, &out, subr, &subr->function.a0);
+#else
   dump_field_emacs_ptr (ctx, &out, subr, &subr->function.a0);
+#endif
   DUMP_FIELD_COPY (&out, subr, min_args);
   DUMP_FIELD_COPY (&out, subr, max_args);
   dump_field_emacs_ptr (ctx, &out, subr, &subr->symbol_name);
+#ifdef HAVE_NATIVE_COMP
+  if (subr->native_comp_u)
+    {
+      dump_field_lv (ctx, &out, subr, &subr->native_intspec, WEIGHT_NORMAL);
+      dump_field_lv (ctx, &out, subr, &subr->native_doc, WEIGHT_NORMAL);
+    }
+  else
+    {
+      dump_field_emacs_ptr (ctx, &out, subr, &subr->intspec);
+      DUMP_FIELD_COPY (&out, subr, doc);
+    }
+  dump_field_lv (ctx, &out, subr, &subr->native_comp_u, WEIGHT_NORMAL);
+#else
   dump_field_emacs_ptr (ctx, &out, subr, &subr->intspec);
   DUMP_FIELD_COPY (&out, subr, doc);
-#ifdef HAVE_NATIVE_COMP
-  dump_field_emacs_ptr (ctx, &out, subr, &subr->native_comp_u);
 #endif
   return dump_object_finish (ctx, &out, sizeof (out));
 }
 
+#ifdef HAVE_NATIVE_COMP
+static dump_off
+dump_native_comp_unit (struct dump_context *ctx,
+                      const struct Lisp_Native_Comp_Unit *comp_u)
+{
+  START_DUMP_PVEC (ctx, &comp_u->header, struct Lisp_Native_Comp_Unit, out);
+  dump_pseudovector_lisp_fields (ctx, &out->header, &comp_u->header);
+  out->fd = 0;
+  out->handle = 0;
+  return finish_dump_pvec (ctx, &out->header);
+}
+#endif
+
 static void
 fill_pseudovec (union vectorlike_header *header, Lisp_Object item)
 {
@@ -3044,6 +3075,11 @@ dump_vectorlike (struct dump_context *ctx,
       error_unsupported_dump_object (ctx, lv, "condvar");
     case PVEC_MODULE_FUNCTION:
       error_unsupported_dump_object (ctx, lv, "module function");
+#ifdef HAVE_NATIVE_COMP
+    case PVEC_NATIVE_COMP_UNIT:
+      offset = dump_native_comp_unit (ctx, XNATIVE_COMP_UNIT (lv));
+      break;
+#endif
     default:
       error_unsupported_dump_object(ctx, lv, "weird pseudovector");
     }