libjit
[Top][All Lists]
Advanced

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

Using libjit for stack based VM


From: Slawomir Maludzinski
Subject: Using libjit for stack based VM
Date: Sun, 18 Jul 2021 12:26:52 +0200

Hi,

I would like to use libjit for stack based VM. Do you know how to change the following bytecode into jit-ed version using libjit?

Lets say we have the following function:

int test_min(int a, int b) { return (a < b) ? a : b; }

Code:
0: iload_0
1: iload_1
2: if_icmpge 9
5: iload_0
6: goto 10
9: iload_1
10: ireturn

Do you know how to manage the stack when the above bytecode is compiled using JIT? Without JIT reference to an object from the top of stack is returned. I would like to translate each bytecode into separate jit_insn function calls however, I cannot imagine how this can be done automatically.

I am attaching a simple program where I commented on hurdles.

Thank you for your help.

Sławomir Maludziński


Attachment: simple_jit.c
Description: Text Data


reply via email to

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