View Full Version : P-Code in Linux
Hey ! Does anyone know if Linux compiler P-Code generates and than dynamicaly it to other platforms(X86,Alpha,Sun) implements?
Am I right?:rolleyes:
Garfield
12-21-01, 06:19 PM
Do you mean C code??? That is a slight problem of C/C++. It is system dependant. The best you could do is go with conditional compilation. Troublesome, but worth it. So, you want to port code? That's what you'll have to do.
--Garfield
Originally posted by Garfield
Do you mean C code??? That is a slight problem of C/C++. It is system dependant. The best you could do is go with conditional compilation. Troublesome, but worth it. So, you want to port code? That's what you'll have to do.
--Garfield
Condit... what? What is ´CONDITIONAL COMPILATION´? I have never heard such termin!
P.S.
P-Codes are codes that are really look like assembler instructions( i mean that they take care of recources like asm), but are CPU and system independent. The time that is need to compilate them is extremly low (like any asm). They are compilated and executed in realtime with the help of system-archetecture dependant Compiler.
ACPI is a P-Code. Also Outlook and Win2K run on them.
P.P.S.
I think, It means Portable-Code( Microstop first invited it, or just says that).
Condit... what? What is ´CONDITIONAL COMPILATION´? I have never heard such termin!
I think he's talking about using ifdefs, do figure out the size of different data types and whatnot for a given platform you're trying to compile on.
P-Codes are codes that are really look like assembler instructions( i mean that they take care of recources like asm), but are CPU and system independent.
I would imagine that you'd need to rewrite it once you tried to move it to another architecture. Maybe you wouldn't have to if you were using gcc on Linux, and then also used gcc on the other OS, as long as it were all on x86.
Than, actually, Linux GCC is a P/Code compiler!:D
Could you do me a favor and define P/Code? I've never heard of it.
I have first met P-Code in Norton´s book "PC:Software and hardware". Because this book was in russish, I can only translate:
P-Code exists in OS or good-written programs.
1.When you write your programms in C or C++ your code must be compiled and linked (or interpreteted) with libraries, it takes a lot of time. That is why, it is not effective(usually) to write the kernel of OS in C++ and then ,using integrated interpretator translate the code at run-time.
2. When you use assembler the code interpretation will be extreme quick,but assembler is archeticture dependent. For example pure RISC systems can not make something like add-and-exchange-and-push in stack (it is an example) in one instruction!
3. The most effective way out of this, seems a more-to-hardware oriented language, but fully system independent.
So, when we take asm compiler and then modify it so that when it sees that system is RISC, it writes not ´addadd-and-exchange-and-push in stack´ but, add, then excange ,then push. It also assumes that on x86 MOV command should be translated in something like ´ BAh ´, but on the other systems, like Java processor , in ´=´.
The actual , usually integrated in system, software/hardware interpreter gets this P-language codes from the other system/device then translates them in its own and executes(reacts).
In that way acts ACPI standart. Systems and devices ´talk´to each other and form a configuration.
Punkt.
So I thought that Linux DYNAMICALLY takes a program in C, then looks for errors and bad actions, then calls a compiler for the processor/architekture on which it is installed (Linux), and finaly executes the translated program.
If It is so, (Linux interpretetes the C code at run-time) than Linux usues P-Codes.
Important is to notice that the system MUST MAKE A DYNAMICAL COMPILATION ( do NOT store the code , that it has made and then , to use it again it must compile-and-execute again).
P.S.
Much text, isn´t it?:beer:
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.