| | |
How PHP is implemented in WebSphere sMash

Runtime
- The PHP runtime in WebSphere sMash is implemented in Java. What this means is that the PHP code is lexed into tokens and parsed into an Abstract Syntax Tree (AST) which is exists as Java objects in the JVM. The AST is then either interpreted or compiled down into JVM bytecodes.
- In case you are interested we found that some types of PHP code are so hard to compile to a valid Java Class that we interpret instead. We also interpret "eval"s because the cost of compilation is unlikely to be worthwhile.
- For code which is compiled to Java bytecode, the JVM's just in time compiler (JIT) will profile the code and, once it feels it has a good handle on how the code is being used, it will compile the code down into efficient native code for whatever machine you are running on.
- The runtime contains a code cache which is conceptually similar to the opcode caches often used with PHP.net
- We have a debug connector which speaks the DBGp protocol. This is the same protocol used by Xdebug. We contributed a DBGp connector for the Eclipse PDT project which allows PDT to be used with Xdebug and with sMash.
- Much of the power of PHP lies in its great library of extension functions. We have re-implemented some of these in Java using our documented XAPI-J interface. We have also created a C interface called XAPI-C that we use to attach PHP extensions implemented in C.
- The Java Bridge gives us the ability to re-use existing Java Libraries.
- Our runtime is tested using library of some 8000 testcases. In fact we use the same set of testcases that php.net do. We have contributed over 3000 of these testcases to PHP.net.
- All of this sits inside the WebSphere sMash runtime which provides an integrated HTTP server and the zero programming model with its event driven architecture.
Tooling - WebSphere sMash offers two tooling choices to help you rapidly develop PHP applications
- App Builder is our premiere Web-based tool for developing WebSphere sMash applications. The App Builder is actually a WebSphere sMash application itself! It includes visual editors (for example, for HTML pages, forms, and flows) along with source editors tailored for script development. Example of leveraging the App Builder's flow editor to extend SugarCRM.
- App Builder is available with sMash Developers Editon (DE) and the latest builds of our next release. Use sMash DE to develop applications for the released WebSphere sMash runtime.
- For developers who prefer Eclipse, sMash offers an Eclipse plug-in for PHP. This plug-in is intended for platform developers (that is, developers creating extensions for the WebSphere sMash platform). The plug-in integrates common operations into the Eclipse workspace, including creating and running WebSphere sMash applications; editing dependencies; automatic resolves; and managing your local repository. You'll also have access to Eclipse features such as code completion and extensive debug support. The visual editors from the App Builder (for HTML pages, forms, flows, etc.) are not available in the plug-in.
|
r4 - 17 Apr 2009 - 08:24:38 - hayton
|
|
|
| | |