Giter VIP home page Giter VIP logo

llvmruby's Introduction

* What's LLVMRuby

LLVMRuby is a set of bindings making the LLVM compiler infrastructure 
(http://llvm.org) usable from Ruby.  This extention allows using LLVM
as an abstract assembler and reflects a good chunk of the LLVM class
hierarchy into Ruby.  Included is an example of using this to build
a simple JIT compiler, written entirely in Ruby, which is able to 
interact with the native Ruby 1.8/1.9 data types.

* How to build

Get LLVM 2.4 from http://llvm.org/releases/2.4/llvm-2.4.tar.gz and 
build it separately following their instructions.

Make sure that you configure LLVM with PIC enabled:
  
  $ ./configure --enable-pic

Add the llvm bin directory to your path, extconf needs to be able to find llvm-conf:

  $ export PATH=$PATH:/$LLVMDIR/Release/bin

Run rake

  $ rake

Run the tests (you will need Rake installed)

  $ rake test

Look in test.rb to see examples of use and start messing around.  The
project was recently reorganized in gem format with Ruby files in lib,
and C/CPP and extension in ext.  You will need to either load the 
library as a gem or make sure that both lib and ext dirs are in your
load path.

* Caveats

I primarily develop this on my home machine which is 64bit Fedora.  I 
occasionally test it on a 32bit CentOS machine, and recently tested it 
on a 32bit MacBook.  It built and passed tests with no issues.  My
knowledge of building either Ruby or LLVM on Windows is minimal.  It
should be doable, but I don't believe LLVM currently is usable with
VC++, which is the main compiler for Ruby on Windows, so you may run
into fun times trying to figure out a good way to make that go.

* Things that definitely do not work right now

No attempt has been made to properly free LLVM objects.  This probably
isn't hard, LLVM api has easy to deal with memory management.  Many LLVM
objects end up owned by modules/execution engine and shouldn't be freed
normally anyway.

There needs to be a lot more exception raising when arguments are of wrong
number/type.

Malformed LLVM functions will cause the program to abort, even just 
from calling verify on a module.  This seems like a bug in LLVM.
Verification in theory is slow and should be used only for debugging, but
it would nice if tests did not abort and die because of missing block
terminators or whatever. 

* Copying

See the file COPYING

* Author

For questions or answers, my email is: [email protected]

llvmruby's People

Contributors

artob avatar justinweiss avatar lerno avatar macournoyer avatar plessl avatar tombagby avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.