Skip to content

Commit

Permalink
Write down my current thoughts
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jul 4, 2017
1 parent ee81d6f commit adf0114
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 35 deletions.
77 changes: 56 additions & 21 deletions LICENSE.txt
@@ -1,21 +1,56 @@
The MIT License (MIT)

Copyright (c) 2017 Takashi Kokubun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the
2-clause BSDL (see the file BSDL), or the conditions below:

1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the
original copyright notices and associated disclaimers.

2. You may modify your copy of the software in any way, provided that
you do at least ONE of the following:

a) place your modifications in the Public Domain or otherwise
make them Freely Available, such as by posting said
modifications to Usenet or an equivalent medium, or by allowing
the author to include your modifications in the software.

b) use the modified software only within your corporation or
organization.

c) give non-standard binaries non-standard names, with
instructions on where to get the original software distribution.

d) make other distribution arrangements with the author.

3. You may distribute the software in object code or binary form,
provided that you do at least ONE of the following:

a) distribute the binaries and library files of the software,
together with instructions (in the manual page or equivalent)
on where to get the original distribution.

b) accompany the distribution with the machine-readable source of
the software.

c) give non-standard binaries non-standard names, with
instructions on where to get the original software distribution.

d) make other distribution arrangements with the author.

4. You may modify and include the part of the software into any other
software (possibly commercial). But some files in the distribution
are not written by the author, so that they are not under these terms.

For the list of those files and their copying conditions, see the
file LEGAL.

5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the
copyright of the software, but belong to whomever generated them,
and may be sold commercially, and may be aggregated with this
software.

6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
64 changes: 50 additions & 14 deletions README.md
Expand Up @@ -2,20 +2,53 @@

LLRB is a LLVM-based JIT compiler for Ruby.

## Installation
## What's LLRB?
LLRB compiles YARV instructions to LLVM IR, ...

Add this line to your application's Gemfile:
Benchmark graph

```ruby
gem 'llrb'
```
## Why is it fast?
### Inline-cache based method inlining
TBD

instance variable and methods are inlined

### Optimization by LLVM Passes
- instcombine

### Fast compilation
- Compile from YARV iseq
- Distributed LLVM Module bitcode
- No C code parsing on runtime

### Lightweight sampling profiler
TBD

## Internal design decisions
### Conservative method replacement
- `opt_call_c_function`
- It's safe that YARV is usable

### Simple architecture
- Only JIT thread cretes funcptr

### Built as C extension
- XXX

## Build dependency

- LLVM/clang 3.8+
- `llvm-config` command needs to appear in `$PATH`
- `llvm-config` and `clang` commands need to appear in `$PATH`

## Usage
## Installation

Once build dependency is met, add this line to your application's Gemfile:

```ruby
gem 'llrb'
```

## How to hack
### Compiling method to native code

```rb
Expand Down Expand Up @@ -50,9 +83,16 @@ declare i64 @rb_str_resurrect(i64)
declare i64 @rb_funcall(i64, i64, i32, ...)
```

## Supported Iseq instructions
## Project status

Experimental.

LLRB is built to test whether LLVM can optimize MRI or not.
I'm seeking another optimization idea and it's not yet stable enough.

87/93 (93.5%)
## Supported YARV instructions

85/91 (93.4%)

### nop
- [x] nop
Expand Down Expand Up @@ -165,10 +205,6 @@ declare i64 @rb_funcall(i64, i64, i32, ...)
- [x] branchunless
- [x] branchnil

### joke
- [!] bitblt
- [!] answer

## License

MIT License
The same as Ruby.

0 comments on commit adf0114

Please sign in to comment.