vjardin / bcgen

A bytecode generator (compiler) for PHP7
56 stars 19 forks source link

include "file.php" #2

Closed vjardin closed 6 years ago

vjardin commented 6 years ago

What is the assumption to use the files compiled by bcgen_compile_file() ? -> should they keep the same names?

Same question, about the files included (required), how should they be named?

I feel that we cannot rename any files. So assuming that all the plain php code is into a folder orig/.php ; in order to avoid overwriting them, we need to compile them into a target folder target/.php without renaming them (for instance no *.phb renaming).

Please, can you confirm?

nanosonde commented 6 years ago

Yes, they keep the same name. It works basically he same way as with bcompiler. The internal zend_compile_function() is overridden so that bcgen can check if it is a byte-code file (header bytes in a bcgen compiled filr) or a normal PHP source file. In case of a normal PHP file the normal zend_compile_function() is called. In case of byte-code file the byte-code file is read and deserialized.

vjardin commented 6 years ago

Ok