On 7/26/2011 6:43 AM, John Nilsson wrote:
On Tue, Jul 26, 2011 at 8:16 AM, BGB <cr88...@gmail.com <mailto:cr88...@gmail.com>> wrote:

    the main merit of a bytecode format is that it could shorten the
    path in getting to native code, potentially allowing it to be faster.


It seems to me that there is a lot of derivation of information going on when interpreting source code. First a one dimensional stream of characters is transformed into some kind of structured representation, possibly in several steps. From the structural representation a lot of inference about the program happens to deduce types and other properties of the structure. Once inside a VM even more information is gathered such as determining if call sites are typically monomorphic or not, and so on.

In other words a _lot_ of CPU cycles are spend on deriving the same information, again and again, each time a program is loaded. Not only is this a waste of energy it also means that each interpreter of the program needs to be able to derive all this information on their own, which leads to very complex programs (expensive to develop).

Would it not be a big improvement if we could move from representing programs as text-strings into representing them in some format capable of representing all this derived information? Does any one know of attempts in this direction?


there are merits to using source-code and a multi-stage translation process, and to representing programs as source-code.


however, ideally, this shouldn't be the case for every time the program starts, and source-code is not the ideal format for:
use as the main/sole distribution format;
being the IR of another process, such as an interpreter or compiler for another language.

for example, JavaScript and "LangX" ("some language X") should be able to run, more or less, side-by-side (without requiring plugins and/or compromising security), with the LangX code essentially being able to target the underlying VM (ideally in a semi-portable manner).

if LangX needs basically to rewrite the code into JavaScript and feed it through eval, this works, but essentially makes LangX a lower-class citizen than JS is.


_______________________________________________
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc

Reply via email to