Skip to content

xzhong86/CJit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-Jit Project

A simple C programming language JIT project. Dynamicaly generate code from c code.

Currently I only have MIR backend for generating binary code.

Build

  1. init sub modules: git submodule update --init --recursive
  2. create build folder: mkdir build && cd build/.
  3. run cmake: cmake .. && make

Simple Example

    auto *compiler = cjit::create<cjit::MirCompiler>();

    const char *c_code = "int func_add(int a, int b) { return a + b; } \n";
    cjit::CompiledInfo info = compiler->compile(c_code);

    typedef int (*fun_p)(int, int);
    fun_p fun = (fun_p)info.binary;

    ASSERT_EQ(3, fun(1, 2));

About

A Simple JIT compiler for C language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published