Subject: Re: bug#68851: 30.0.50; Native comp: Optimization failure for org-element-property-raw: Handler: org-element-property-raw--inliner

From: Ihor Radchenko <[email-masked]>
Date: Fri, 09 Feb 2024 16:19:27 +0000

Stefan Monnier <[email-masked]> writes:

> BTW, improved patch below.

Thanks!

> 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)))))

I applied this part, as
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ecb5b605d
  
>  (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)
> ...
> +  (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))))))

This one causes failing tests. So, something is off.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>