Thursday, September 17, 2009

Summer Work

We've had a few contributions over the last few months, and I've been able to get some work done on the Error Manager as well.

Corni contributed parsing and code generation support for basic if-else blocks. He's also commented a bit and cleaned up some of the code generation. In addition, he's setup a git repository that updates from the main svn trunk. If you're interested in using that, it's available at

I've added the Error Manager class to the runtime, which is in charge of:
  • Keeping track of current source location and PHP stack (when available)
  • Handling PHP runtime warnings, notices, fatal errors and exceptions
  • PHP level, user defined error and exception handlers
It's also used by the target system for emitting warnings and notices. This is because the compiler will be called from the runtime (during e.g. include or eval) and needs to be able to redirect its output to the current runtime instance.

When a runtime error occurs, a C++ exception is thrown. For this to work in the JIT, it has to catch a C++ exception above the JIT engine code when thrown by the runtime that gets called from the generated LLVM IR. We had a tough time getting this to work, and ended up making a new sandbox for simplified test cases in which to test this (and in the future, other) bits of code.

In the end it also led to porting the code to the latest (and as of this post, unreleased) version of LLVM: 2.6. It's in pre-release and should be available soon, however. Unfortunately this means the current trunk doesn't support 2.5, but it did fix our issues with exceptions.

I'll be attending the LLVM Dev Meeting in a few weeks, which I'm really looking forward to. If you're going or will be in the area and want to chat about rphp, let me know!

Finally, I've setup a mailing list for rphp development. You can find it at


Metal3d said...


You know me as Metal3d on IRC, and I did a little conference about roadsend PCC compiler. For now, I'm using the scheme version because it's very difficult to compile rphp.

Can you tell me more about the maintainance of this repository, if you have corrected PDO(Sqlite) troubles I found, and if you continue tu do bugfixes ?

I have 2 bugreport to give you.

Keep in mind that I want to package rphp (or pcc) for Fedora as soon as I am sure.

Good job anyway :)

internet marketing melbourne said...

This is really great. Keep it up the good going. Really very great blog this has given me all the information that i needed, good for visiting daily it will increase our knowledge. Best luck for future.