]> git.eshelyaron.com Git - emacs.git/commitdiff
render data_relocs vector
authorAndrea Corallo <andrea_corallo@yahoo.it>
Fri, 16 Aug 2019 19:49:56 +0000 (21:49 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:34:01 +0000 (11:34 +0100)
lisp/emacs-lisp/comp.el
src/comp.c

index 80b71590ec43ffcfcc2f39521b6181afbb551ed7..9c31206cc2eee5d91f69948047b4ca30ebbba85b 100644 (file)
@@ -773,6 +773,9 @@ the annotation emission."
     (comp-emit-block 'entry)
     (comp-emit-annotation (concat "Lisp function: "
                                   (symbol-name (comp-func-symbol-name func))))
+    (comp-emit `(const-vector ,(concat (comp-func-c-func-name func) "_data_relocs")
+                              ,(prin1-to-string (aref (comp-func-byte-func func)
+                                                      2))))
     (if (comp-args-p args)
       (cl-loop for i below (comp-args-max args)
                do (cl-incf (comp-sp))
@@ -809,7 +812,8 @@ the annotation emission."
           ;; Once we have the final LIMPLE we jump into C.
           (comp-init-ctxt)
           (comp-add-func-to-ctxt func)
-          (comp-compile-and-load-ctxt)
+          (comp-compile-ctxt-to-file (symbol-name func-symbol-name))
+          ;; (comp-compile-and-load-ctxt)
           (comp-release-ctxt)))
     (error "Trying to native compile something not a function")))
 
index e3343afc7ba0827d6dfab4ea1d06876d75707bbe..32ece133c5ed1bccec2e8961b5a36a5bb299f650 100644 (file)
@@ -1360,12 +1360,33 @@ emit_limple_insn (Lisp_Object insn)
       /* Ex: (comment "Function: foo").         */
       emit_comment((char *) SDATA (arg0));
     }
+  else if (EQ (op, Qconst_vector))
+    {
+      /* Ex: (const-vector "F666f6f_foo_reloc"
+                          "[a b c 1 2]").  */
+      Lisp_Object vec = SECOND (args);
+      EMACS_INT v_len = XFIXNUM (FUNCALL1 (length, vec));
+
+      gcc_jit_context_new_global (
+       comp.ctxt,
+       NULL,
+       GCC_JIT_GLOBAL_INTERNAL,
+       gcc_jit_context_new_array_type (comp.ctxt,
+                                       NULL,
+                                       comp.lisp_obj_type,
+                                       v_len),
+       (char *) SDATA (arg0));
+    }
   else if (EQ (op, Qreturn))
     {
       gcc_jit_block_end_with_return (comp.block,
                                     NULL,
                                     emit_mvar_val (arg0));
     }
+  else
+    {
+      error ("LIMPLE op inconsistent");
+    }
 }
 
 \f
@@ -2622,8 +2643,7 @@ DEFUN ("comp-compile-ctxt-to-file", Fcomp_compile_ctxt_to_file,
        doc: /* Compile as native code the current context to file.  */)
      (Lisp_Object ctxtname)
 {
-  if (!STRINGP (ctxtname))
-    error ("Argument ctxtname not a string");
+  CHECK_STRING (ctxtname);
 
   gcc_jit_context_set_int_option (comp.ctxt,
                                  GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
@@ -2777,6 +2797,7 @@ syms_of_comp (void)
 {
   /* Limple instruction set.  */
   DEFSYM (Qcomment, "comment");
+  DEFSYM (Qconst_vector, "const-vector");
   DEFSYM (Qjump, "jump");
   DEFSYM (Qcall, "call");
   DEFSYM (Qcallref, "callref");