Witam,
Mam pytanie odnośnie bytecode (kodu bajtowego) a języka kompilowanego, czyli zamienianego bezpośrednio na język maszynowy. Cytaty są z anglojęzycznej Wikipedii.
Bytecode:
Bytecode, also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter.
p-code machine:
Why p-code?
Compared to direct translation into native machine code, a two-stage approach involving translation into p-code and execution by an interpreter or just-in-time compiler offers several advantages.
- Portability
It is much easier to write a small p-code interpreter for a new machine than it is to modify a compiler to generate native code for the same machine.
I na koniec process virtual machine:
A process VM, sometimes called an application virtual machine, runs as a normal application inside a host OS and supports a single process. It is created when that process is started and destroyed when it exits. Its purpose is to provide a platform-independent programming environment that abstracts away details of the underlying hardware or operating system, and allows a program to execute in the same way on any platform.
Podkreślone zdanie z ostatniego cytatu jest dla mnie dość niejasne. Przecież takie środowisko zapewniają wszystkie języki wysokiego poziomu, których kompilatory zostały dostarczone na określone platformy. No właśnie, kompilatory. A przecież ten process VM, który wykonuje bytecode danego języka, musi go jakoś przetłumaczyć na aktualnie obowiązujący kod maszynowy. Czyli wg mnie i tak, każdy process VM czyli p-code machine musi jakoś implementować w sobie kompilator danego języka...
Ale jednak cytaty, jak np. ten z foldoc.org, pokazują, że coś przeoczam:
The byte-code may be compiled to machine code ("native code") for speed of execution but this usually requires significantly greater effort for each new taraget architecture than simply porting the interpreter.
Jak te procesy VM wykonują ostatecznie linijki bytecodu bez kompilatora?
Pozdrawiam.