© 2017 RuntimeConverter

February 1, 2019

January 23, 2019

Please reload

Recent Posts

About 2 weeks ago, we published that we had successfully converted a PHPUnit example project and it ran just the same as if it had been run with PHP....

PHPUnit [Beta] Full-Native Java Test Results

June 11, 2018

1/3
Please reload

Featured Posts

How does the Runtime Converter work?

May 7, 2017

The Runtime Converter produces code (right now in Java) that is automatically converted from PHP. It has a dependency on a library of helper functions and on the PHP runtime library itself, which is used to provide the library of standard functions.

 

When the user calls a method from one of the user-space classes that they converted, this call is made in the target language. The functions, classes, and include files from their project are all converted to code in the target language, which is then compiled and linked with the runtime library.

 

When the converter encounters code that calls on of the php standard library functions, or a function from an extenseion, it maps that call to the runtime which in turn passes that call directly to PHP. The function arguments are converted from Java objects to PHP objects, and after the function is called, its return value is also converted back to a Java object (or an object from another target language such as Swift). While there is some considerable overhead in this, especially in Java because of JNI, the result is that your user-space code always works with native objects whenever possible.

 

When working with arrays, there is no equivelent in the Java language of the php "array" type. For this reason, we have created our own array type called "ConverterRuntimeArray". Its implmentation (right now in Java nd Swift) is a "hash map list" with integer + string keys, just like the php "array" type. The majority of the php array functions are also implemented as native, to work with these native arrays instead of passing them over the JNI bridge and converting them to php and back all the time. This cuts down a lot of the overhead of working with JNI functions because, aside from these array functions, the majority of the php standard library functions do not take array arguments at all.

 

In addition to this, a large library of helper functions, including a unit tested implementation of the php comparison functions (ie. <, >, <=, >=, ==, === !=, <==>, etc) is used to get equiveent behavior between the source scirpts and the target binaries.

Share on Facebook
Share on Twitter
Please reload

Follow Us
Please reload

Search By Tags
Please reload

Archive
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square