all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* jit-compile: Not a byte-compiled function
@ 2018-09-13 17:12 Óscar Fuentes
  2018-09-13 17:21 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Óscar Fuentes @ 2018-09-13 17:12 UTC (permalink / raw)
  To: emacs-devel

I'm trying the libjit branch but I'm stuck with the above error thrown
from jit-compile. For instance:

$ emacs -Q

;; Eval in *scratch*:

(defun foo ()
  (message "hi!"))

(byte-compile 'foo)
(jit-compile 'foo)


What I'm missing?


GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll
bars) of 2018-09-13

a25a9896d51bbf340675713bc45d15e3846fb816




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: jit-compile: Not a byte-compiled function
  2018-09-13 17:12 jit-compile: Not a byte-compiled function Óscar Fuentes
@ 2018-09-13 17:21 ` Tom Tromey
  2018-09-13 20:18   ` Óscar Fuentes
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2018-09-13 17:21 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

>>>>> "Óscar" == Óscar Fuentes <ofv@wanadoo.es> writes:

Óscar> I'm trying the libjit branch but I'm stuck with the above error thrown
Óscar> from jit-compile. For instance:

Óscar> What I'm missing?

The function has to be compiled with lexical-binding = t.

Tom



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: jit-compile: Not a byte-compiled function
  2018-09-13 17:21 ` Tom Tromey
@ 2018-09-13 20:18   ` Óscar Fuentes
  2018-09-14  3:30     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Óscar Fuentes @ 2018-09-13 20:18 UTC (permalink / raw)
  To: emacs-devel

Tom Tromey <tom@tromey.com> writes:

> Óscar> I'm trying the libjit branch but I'm stuck with the above error thrown
> Óscar> from jit-compile. For instance:
>
> Óscar> What I'm missing?
>
> The function has to be compiled with lexical-binding = t.

Thanks, but evaluating this sequence in *scratch* :

(setq lexical-binding t)
(defun foo ()
  (message "hi"))
(byte-compile 'foo)
(jit-compile 'foo)

still produces the error. Same with a function that is defined on a
source file that contains lexical-binding: t as file-local variable:

(jit-compile 'avy--style-fn)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: jit-compile: Not a byte-compiled function
  2018-09-13 20:18   ` Óscar Fuentes
@ 2018-09-14  3:30     ` Tom Tromey
  2018-09-14 15:30       ` Óscar Fuentes
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2018-09-14  3:30 UTC (permalink / raw)
  To: Óscar Fuentes; +Cc: emacs-devel

>>>>> "Óscar" == Óscar Fuentes <ofv@wanadoo.es> writes:

Óscar> (jit-compile 'foo)

Óscar> still produces the error. Same with a function that is defined on a
Óscar> source file that contains lexical-binding: t as file-local variable:

Sorry, I misremembered this earlier.  I built the libjit branch again
and tried it.  jit-compile takes a compiled object:

  if (!COMPILEDP (func))                                                                                                                                                                                           
    error ("Not a byte-compiled function");                                                                                                                                                                        

So you need

(jit-compile (symbol-function 'foo))

The compiled code is stored into the bytecode vector.

Tom



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: jit-compile: Not a byte-compiled function
  2018-09-14  3:30     ` Tom Tromey
@ 2018-09-14 15:30       ` Óscar Fuentes
  0 siblings, 0 replies; 5+ messages in thread
From: Óscar Fuentes @ 2018-09-14 15:30 UTC (permalink / raw)
  To: emacs-devel

Tom Tromey <tom@tromey.com> writes:

> Sorry, I misremembered this earlier.  I built the libjit branch again
> and tried it.  jit-compile takes a compiled object:
>
>   if (!COMPILEDP (func))                                                                                                                                                                                           
>     error ("Not a byte-compiled function");                                                                                                                                                                        
>
> So you need
>
> (jit-compile (symbol-function 'foo))
>
> The compiled code is stored into the bytecode vector.

Thanks, this method works.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-14 15:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-13 17:12 jit-compile: Not a byte-compiled function Óscar Fuentes
2018-09-13 17:21 ` Tom Tromey
2018-09-13 20:18   ` Óscar Fuentes
2018-09-14  3:30     ` Tom Tromey
2018-09-14 15:30       ` Óscar Fuentes

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.