ademakov / libjit Goto Github PK
View Code? Open in Web Editor NEWUnofficial libjit mirror.
License: GNU Lesser General Public License v2.1
Unofficial libjit mirror.
License: GNU Lesser General Public License v2.1
I noticed that jit_compile
, jit_optimize
, and jit_compile_entry
are documented but not declared in any header. Should they be un-documented (and perhaps renamed), or declared?
Hi,
I was wondering if it is possible to change the license of libjit? It seems that libjit copyright has not been assigned to FSF - is my understanding correct? If so, then are there reasons why the license could not be changed to MIT ?
I think it will make libjit a viable alternative to some other tools.
Regards
Dibyendu
I encountered a curious issue when using both LibJIT and Lightning in
the same program. The issue occurs on Linux, but not on macOS.
Here is a minimal working example (compile with g++ -g -o test test.C -ljit -llightning
):
extern "C"
{
#include <lightning.h>
}
#include "jit/jit.h"
void test()
{
auto jit_context = jit_context_create();
}
int main()
{
init_jit(nullptr);
auto _jit = jit_new_state();
jit_clear_state();
}
When run this will fail at the lightning jit_clear_state();
call.
The program outputs
free(): invalid pointer
Aborted (core dumped)
Running in the debugger I see
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7924859 in __GI_abort () at abort.c:79
#2 0x00007ffff798f3ee in __libc_message
(action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7ab9285 "%s\n") at
../sysdeps/posix/libc_fatal.c:155
#3 0x00007ffff799747c in malloc_printerr
(str=str@entry=0x7ffff7ab74ae "free(): invalid pointer") at
malloc.c:5347
#4 0x00007ffff7998cac in _int_free (av=<optimized out>, p=<optimized
out>, have_lock=0) at malloc.c:4173
#5 0x00007ffff7afc213 in _jit_clear_state (_jit=0x555555559580) at
lightning.c:908
#6 0x00005555555551dd in main () at test.C:17
#5 0x00007ffff7afc213 in _jit_clear_state (_jit=0x555555559580) at
lightning.c:908
908 jit_free((jit_pointer_t *)&_jitc->data.table);
(gdb) print *_jit
$1 = {pc = {uc = 0x0, us = 0x0, ui = 0x0, ul = 0x0, w = 0}, code =
{ptr = 0x0, length = 0}, data = {ptr = 0x0, length = 0}, note = {ptr =
0x0, length = 1}, comp = 0x5555555595d0, user_code = 0, user_data = 0}
(gdb) print *_jit->comp
$2 = {head = 0x0, tail = 0x0, prepare = 0x0, realize = 0, dataset = 0,
done = 0, emit = 0, again = 0, synth = 0, no_data = 0, no_note = 0,
reglen = 40, regarg = 0, regsav = 0, reglive = 0, regmask = 0, code =
{end = 0x0}, data = {ptr = 0x0, table = 0x0, size = 0, count = 0,
offset = 0}, spill = 0x555555559700, gen = 0x555555559850,
values = 0x555555559900, blocks = {ptr = 0x55555555e480, offset = 0,
length = 16}, patches = {ptr = 0x555555559cd0, offset = 0, length =
1024}, function = 0x0, functions = {ptr = 0x55555555dce0, offset = 0,
length = 16}, pool = {ptr = 0x55555555e3f0, offset = 0, length = 16},
list = 0x0, note = {head = 0x0, tail = 0x0, size = 40,
name = 0x0, note = 0x0, base = 0x0}}
Note that test()
is never called. So just linking to libjit causes the
issue. If the function body is entirely omitted the bug does not occur
(I'm suspecting some linker optimization results in not triggering a
symbol conflict... maybe?)
Hi,
Iโm using libjit to generate code thats calls a c++ function using the jit function jit_insn_call_native.
This c++ function may throw exceptions (e.g. out_of_range exception), I would like to catch this exception in the libjit function we created and return an error code (instead of throwing an exception).
Is this something we can do?
root@VM-0-12-debian:~/downloads/libjit-master/doc# ./mkpdf.sh
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdfetex)
restricted \write18 enabled.
entering extended mode
(./libjit.texi (/usr/share/texmf/tex/texinfo/texinfo.tex
Loading texinfo [version 2018-01-09.11]: pdf, fonts, markup, glyphs,
page headings, tables, conditionals, indexing, sectioning, toc, environments,
defuns, macros, cross references, insertions, localization, formatting,
and turning on texinfo input format.) [1{/var/lib/texmf/fonts/map/pdftex/updmap
/pdftex.map}]
Writing index file libjit.cp
Chapter 1 (/root/downloads/libjit-master/doc/libjit.aux) [1] Chapter 2
Chapter 3 [2] [3] l.309: Undefined cross reference Types-snt'. l.309: Undefined cross reference
Types-snt'.
l.309: Undefined cross reference Types-pg'. l.349: Undefined cross reference
Instructions-snt'.
l.349: Undefined cross reference Instructions-snt'. l.349: Undefined cross reference
Instructions-pg'. [4] [5] [6] [7] [8]
[9] l.773: Undefined cross reference C++ Interface-snt'. l.773: Undefined cross reference
C++ Interface-snt'.
l.773: Undefined cross reference C++ Interface-pg'. Overfull \hbox (14.94176pt too wide) in paragraph at lines 800--800 []@texttt jit_insn_call(function, "gcd", function, 0, temp_args, 2, JIT_CALL_T AIL);[] | [10] [11] [12] Chapter 4 ./libjit.texi:980: I can't find file
libjitext-init.texi'.
@temp ->@input libjitext-init.texi
@includezzz ...and @input #1 }@expandafter }@temp
@popthisfilestack
l.980 @include libjitext-init.texi
(Press Enter to retry, or Control-D to exit)
Please type another input file name:
hi, I was looking for an easy jit library, with a C interface, and libjit seems all I could hope for.
But I have no knowledge of the linux dev at all.
I've cloned the sources, installed MinGw, and selected a lot of MSys packages, googled a lot, and I'm stuck.
I first had to downgrade configure.ac from 2.69 to 2.68 (hoping I'm not breaking anything)
from MinGW bash:
$ autoconf-2.68
configure.ac:14: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:108: error: possibly undefined macro: AM_PROG_AR
configure.ac:113: error: possibly undefined macro: AM_PROG_LEX
it shows error but still generated the configure file, then it tried to run
$ configure
configure: error: cannot find install-sh, install.sh, or shtool in build-aux "."
/build-aux
So now I'm here, and I don't know what to do. libjit looks very nice, but feels unfriendly to windows users, and doesn't support win64 :/
When executing the following test code:
#include <jit/jit.h>
jit_context_t context = NULL;
void build_function() {
jit_type_t signature = jit_type_create_signature(jit_abi_cdecl, jit_type_int, NULL, 0, 1);
jit_function_t func = jit_function_create(context, signature);
jit_function_compile(func);
jit_function_to_closure(func);
//jit_function_abandon(func);
return;
}
int main() {
jit_init();
int c;
for(c = 0; c < 10000000; ++c) {
context = jit_context_create();
jit_context_build_start(context);
build_function();
jit_context_build_end(context);
jit_context_destroy(context);
}
return 0;
}
Valgrind detects a O(c) memory leak of 64 bytes per cycle. This does not change even when using jit_function_abandon()
instead of compiling the function. More careful analysis shows that the block is allocated at jit_calloc()
, called from create_complex()
(at line 489 of jit-type.c), called in turn from jit_type_create_signature()
(at line 612 of jit-type.c). Looks like these blocks are not kept track of by LibJIT.
Hi,
I am interested in using libjit as the backend in my C JIT compiler project (https://github.com/dibyendumajumdar/dmr_c). I was wondering how stable and well tested libjit is - I noticed that there aren't many tests in the project.
Thanks and Regards
Dibyendu
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.