bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68851: 30.0.50; Native comp: Optimization failure for org-element-pr


From: Stefan Monnier
Subject: bug#68851: 30.0.50; Native comp: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner
Date: Thu, 08 Feb 2024 19:47:57 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>> `org-element--property-idx` is defined in that same file, indeed, but
>> contrary to `defmacro`, `define-inline` does not make the function
>> usable during that same file's compilation.
> This is surprising. I would not mind compiler indicating this fact in
> less cryptic way or, better, making `define-inline' usable during file's
> compilation.

The same error would be signaled if `org-element--property-idx` were
defined with `defun`, and `define-inline` is another way to define
a function, so I thought it would make sense to make them
behave similarly.

> Also, I am very confused because the previous version worked:
>
> (define-inline org-element--property-idx (property)
>   "Return standard property index or nil."
>   (declare (pure t))
>   (if (inline-const-p property)
>       (plist-get
>        org-element--standard-properties-idxs
>        (inline-const-val property))
>     (inline-quote (plist-get
>                    org-element--standard-properties-idxs
>                    ,property))))

I can't see why it would behave differently with the above
definition, sorry.
BTW, improved patch below.


        Stefan


diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
index b624fd1c87..9a12299b60 100644
--- a/lisp/org-element-ast.el
+++ b/lisp/org-element-ast.el
@@ -348,7 +348,7 @@ node types.")
          (setq plist (plist-put plist property idx)))
        org-element--standard-properties)
       plist)
-    "Property list holding standard indexes for 
`org-element--standard-properties'."))
+    "Property list holding standard indexes for 
`org-element--standard-properties'.")
 
 (define-inline org-element--property-idx (property)
   "Return standard property index or nil."
@@ -356,7 +356,7 @@ node types.")
   (inline-letevals (property)
     (plist-get
      org-element--standard-properties-idxs
-     (inline-const-val property))))
+     (inline-const-val property)))))
 
 (define-inline org-element--parray (node)
   "Return standard property array for NODE."
@@ -405,26 +405,15 @@ Ignore standard property array."
 Do not resolve deferred values.
 If PROPERTY is not present, return DFLT."
   (declare (pure t))
-  (let ((idx (and (inline-const-p property)
-                  (org-element--property-idx property))))
-    (if idx
-        (inline-letevals (node)
-          (inline-quote
-           (if-let ((parray (org-element--parray ,node)))
-               (pcase (aref parray ,idx)
-                 (`org-element-ast--nil ,dflt)
-                 (val val))
-             ;; No property array exists.  Fall back to `plist-get'.
-             (org-element--plist-property ,property ,node ,dflt))))
-      (inline-letevals (node property)
-        (inline-quote
-         (let ((idx (org-element--property-idx ,property)))
-           (if-let ((parray (and idx (org-element--parray ,node))))
-               (pcase (aref parray idx)
-                 (`org-element-ast--nil ,dflt)
-                 (val val))
-             ;; No property array exists.  Fall back to `plist-get'.
-             (org-element--plist-property ,property ,node ,dflt))))))))
+  (let ((idx (org-element--property-idx (inline-const-val property))))
+    (inline-letevals (node)
+      (inline-quote
+       (if-let ((parray (org-element--parray ,node)))
+           (pcase (aref parray ,idx)
+             (`org-element-ast--nil ,dflt)
+             (val val))
+         ;; No property array exists.  Fall back to `plist-get'.
+         (org-element--plist-property ,property ,node ,dflt))))))
 
 (define-inline org-element--put-parray (node &optional parray)
   "Initialize standard property array in NODE.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]