Pages

Sunday 1 May 2011

Crazy JIT Prototype - resurrection!

Aloha!


Couple of weeks ago I've put Parrot's jit prototype on hold. One of the major issue was C macro preprocessor. Now, it's time to unhold it

Monday 18 April 2011

Crazy JIT Prototype is on hold.

G'Day


“Crazy JIT prototype” is on hold. I found 2 big problems with current approach. Which will require a quite big effort from me (or anyone else) to “fix”.

  • Parsing of larger subset of C. Mostly of struct definitions and preprocessor.
  • Type analyzes.

Tuesday 5 April 2011

Crazy JIT Prototype. Part 4.

Aloha


I'm little bit tired and doesn't have energy to write lengthly post about “Crazy JIT prototype”. And I didn't make a lot of progress since last post. But still there is some good news and some roadblocks.

Monday 28 March 2011

Crazy JIT Prototype. Part 3.

Hi there


Since last post about “Crazy JIT Prototype” and progress of opsc_llvm branch I moved little bit further. Two major achievements:
  • Skeleton for generating JITted Subs is done.
  • JITting of simple ops with function calls and constants
  • Emulator of Parrot's runcore from within Parrot it self.

Tuesday 22 March 2011

LLVM in Parrot is getting even closer!

Привет!


After my post about finishing opsc_llvm branch few things happened.

  • Luben Karavelov jumped on this branch and implemented writing and reading LLVM bitcode. It will allow faster turn-around for crazy JIT prototype branch. Just because I don't have to spend time on generating quite complex Parrot's structures like VTABLE (which is auto-generated during build from template by some dark magic) and parrot_interp_t. Just load pre-compiled LLVM bitcode and lookup type by name.
  • James Keenan (aka jkeenan, aka kid51) stepped on “infrastructure” tasks. E.g. proper Configure/Makefile generating, testing and LLVM version check.
  • Jonathan “Duke” Leto did initial changes for “Module Navigational Methods”, but looks like he was sidetracked by other issues.


Kudos for every contributor! Not only including someone who committed changes, but everyone involved.

Monday 21 March 2011

Crazy JIT Prototype. Work In Progress.

Bon jour


In last couple of days I was thinking about "CJP". Major change in approach — I will actually "JIT" few ops in one go. It doesn't makes any sense to JIT one op only even for prototype.

I'm currently playing with JITting small sub like this:
.sub 'main' :main
    say "Answer"
    say 42
    say "Correct"
.end

Bytecode for this sub is:

0000: 00000000 00000000 say_sc
0002: 00000001 0000002a say_ic
0004: 00000000 00000001 say_sc
0006: 00000002 end

Saturday 19 March 2011

Parrot-on-Parrot or "Crazy Idea For JIT Prototype"

Aloha!


This is just a braindump of idea for prototyping of JIT in Parrot.

As I described early now we have properly parsed ops and half-baked LLVM bindings. Based on it I can implement JIT prototype for Parrot.

Blog updates.

Updated blog a little bit:

  • Switched to disqus for comments.
  • Updated old posts to have "Read more" link instead of full text on homepage. They are still have full text in feed.

Friday 18 March 2011

Finishing of opsc_llvm branch

Hi there!


Preamble

Few days ago I posted note about LLVM bindings in Parrot. It was in my experimental branch opsc_llvm. When I started this branch it was purely my own playground for LLVM/opsc/JIT/etc. I had no idea what I can get out of it. Especially because I had no previous experience not only with with LLVM but with Parrot's NCI (Native Call Interface) as well. But now I can almost get something really useful - Fully Functional LLVM Bindings.

Thursday 17 March 2011

Parrot ops revamp in 3.2 (part 2)

Hi there.

In previous post I briefly described Parrot's ops. For past 10 years we used to "parse" ops as just chunks of text almost without any semantics behind. And this approach used to work for this 10 years. But life changed and now we need more than this.

Tuesday 15 March 2011

Parrot ops revamp in 3.2 (part 1)

Currently Parrot VM consists of about 1000 ops. Each op is smallest operation available. For example add $I0, $I1, $I2 and goto label. Ops are implemented in some kind of C with quite few macro-substitutions for accessing registers and flow control. Let's take simple add op.

Ho-ho-ho. LLVM in Parrot is getting closer :)

Current results of few days of reading LLVM docs/tutorials and one day of hacking.

Basically we can create something like:
int foo() {
     printf("Hello World\n");
     return 42;
} 


In run-time. With LLVM. JIT in parrot is getting closer :)