libjit
[Top][All Lists]
Advanced

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

Re: Using libjit for stack based VM


From: Aleksey Demakov
Subject: Re: Using libjit for stack based VM
Date: Thu, 22 Jul 2021 22:10:30 +0300

On Thu, Jul 22, 2021 at 7:58 PM Slawomir Maludzinski
<slawomir.maludzinski@gmail.com> wrote:
>
> Thank you for your interest and response!
>
> My main problem (and the reason to send the email before) is how to create 
> 'common' value for branches as you have noticed. The code snippet which I 
> sent only simplifies what is automatically generated when analyzing some 
> virtual machine bytecode. I think I will try not only to manage the stack 
> 'top' variable directly in the host program (as it is right now) but I will 
> create stack and top variables as libjit data structures which are also 
> modified using jit_insn functions. Thus I hope to be able to create values 
> inside branches (push and pop) and later return values from stack top. I will 
> let you know if that approach works.
>

No, no, stack VM is one abstraction and libjit uses another
abstraction. Your task is to translate from the former into the later.
This has to be done at the jit compilation time. This happens once. At
the next phase the compiled code (formed as the result of translating
jit_insn calls into native instruction set) might be executed many
times and with different parameters. The compiled code should not deal
with the stack abstraction that was used at the previous phase. It is
already gone at this point. Trying to reinstate it would be a mistake.

Yes, in the case of a branch it might be a bit tricky to figure out
how to perform the translation but it is certainly doable. Perhaps I
am not good enough at explaining. This question was already addressed
in the past e.g. for the pnet project:

https://lists.gnu.org/archive/html/dotgnu-pnet/2006-02/msg00017.html

Regards,
Aleksey



reply via email to

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