PORTABLE OBJECT CODE -- plz post ur comments
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
PORTABLE OBJECT CODE -- plz post ur comments
Hi Fellow Os Developers,
I am an engineering student pursuing my btech in CET,TVM..India,
I have compiler design this sem , I got an idea -- want's to check its
feasibility. The reduction in performace in
java is due to its iterpretative nature.... What i am trying to do
create an object code (which is platform independent) yet cannot
be executed directly on any system.For execution purpose the
this object code is to be linked to get the executable version....
This linker is a specialized linker which is platform dependent...
The above process need to be done only once (while deploying..)
This should be feasible,becasue almost any modern machine can implement basic data structures like stacks ,queue etc...
Plz advize....
I have partially compleated a compiler that produces x86 code( hopelessly inefficent) .. yets it seems to work fine .. Will submit
it when finished.......
I am an engineering student pursuing my btech in CET,TVM..India,
I have compiler design this sem , I got an idea -- want's to check its
feasibility. The reduction in performace in
java is due to its iterpretative nature.... What i am trying to do
create an object code (which is platform independent) yet cannot
be executed directly on any system.For execution purpose the
this object code is to be linked to get the executable version....
This linker is a specialized linker which is platform dependent...
The above process need to be done only once (while deploying..)
This should be feasible,becasue almost any modern machine can implement basic data structures like stacks ,queue etc...
Plz advize....
I have partially compleated a compiler that produces x86 code( hopelessly inefficent) .. yets it seems to work fine .. Will submit
it when finished.......
I am afraid this has already been done. Check out the Tao Group / elate. They compile code to a "virtual processor", with the translation to native code being done by the loader (on loading from hard drive), or statically by the installer for really critical code parts.
Every good solution is obvious once you've found it.
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
It's been done: http://en.wikipedia.org/wiki/Common_Int ... e_Language
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
Nope... CIL is source, Tao VP is object code. And I am not sure about the portability of CIL (ignorance, not fact-based doubt).
I have to insist, though, that Tao was earlier. I hate it when Microsoft gets praised for "inventions" that are nothing more than copycat of other's work.
I have to insist, though, that Tao was earlier. I hate it when Microsoft gets praised for "inventions" that are nothing more than copycat of other's work.
Every good solution is obvious once you've found it.
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
CIL has a source representation, but how is it not object code? You can produce CIL binaries...Solar wrote:Nope... CIL is source, Tao VP is object code.
All it needs to be portable is a translator for the target architecture. The Mono project supports CIL on Linux -- it's probably portable to at least a reasonable subset of the architectures that Linux supports.And I am not sure about the portability of CIL (ignorance, not fact-based doubt).
I never said MS invented it, just that the OP is too late to invent it.I have to insist, though, that Tao was earlier. I hate it when Microsoft gets praised for "inventions" that are nothing more than copycat of other's work.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Ok, my bad... I didn't even read the article. It's definitely wrong -- CIL is itself a bytecode format, not another form of source code (although as I said, it does have a source code representation).
This is the part that's wrong. CIL is the bytecode, and .NET/CLI compilers target it directly. There is also a CIL "assembler" that can translate CIL source into CIL bytecode, but it isn't used very often...Languages which target the .NET Framework compile to CIL, which is assembled into bytecode.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
So the compilers generate bytecode directly, and "CIL source" is actually some kind of back-translation?
Sounds hauntingly similar to what happens when you call gcc with the "-S" option. The assembler source you get this way is never actually created during a normal compilation, because GCC and GAS communicate through a lower-level protocol usually.
Thanks, I think I understand the CIL concept better now.
Sounds hauntingly similar to what happens when you call gcc with the "-S" option. The assembler source you get this way is never actually created during a normal compilation, because GCC and GAS communicate through a lower-level protocol usually.
Thanks, I think I understand the CIL concept better now.
Every good solution is obvious once you've found it.
Yeah i was starting to wonder where Java had got lost on this conversation... clearly this is simply the idea of bytecode with even less fetures than Java/.NET provide. Also, even though there exists no native architecture to run CIL (I thought it was MSIL )... it is still considered Object Code not Source Code because it represents compiled code. It is also designed to be as quickly convertable to many native Machine Codes while still maintaing manageability. This of course goes for all byte code systems.Combuster wrote:...and Java .class files...
EDIT : Note Some people claim CIL is compiled into another Bytecode before distribution and then native compile. This comes from possibility to view CIL in Mnemonics... a form of Assembly for CIL. Source Code CIL is similar to Assembly but in the In-House Microsoft Articles i have seen they seem to use the Term CIL for compiled Byte Code also.
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Thanks guy's
I am happy to know that it is feasible....,Still ther wont come a time
when a compiler can generate code better than a master assembly
programmer...? Any takers for this.......
when a compiler can generate code better than a master assembly
programmer...? Any takers for this.......
Re: Thanks guy's
Since someone has to write the backend for the compiler, there will always be someone who is better at ASM than the compiler is.SandeepMathew wrote:Still ther wont come a time when a compiler can generate code better than a master assembly
programmer...?
But I'd daresay the number of people beating a compiler backend with their "everyday" ASM code recons in the hundreds, at best. And they are getting fewer, simply because the processor architectures grow ever more complex.
Every good solution is obvious once you've found it.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Thanks guy's
Genetic code?SandeepMathew wrote:I am happy to know that it is feasible....,Still ther wont come a time when a compiler can generate code better than a master assembly programmer...? Any takers for this.......
As long as you can't sensibly do things with compilers that can be done easily in assembly I think assembly code is in speed superior to compiler code:Solar wrote:But I'd daresay the number of people beating a compiler backend with their "everyday" ASM code recons in the hundreds, at best. And they are getting fewer, simply because the processor architectures grow ever more complex.
Not all compilers are the GCC -O3
You can't tailor register calling conventions, which is especially a burden on x86 where 5 out of 8 registers need to be preserved under standard calling conventions: EBX EBP ESI EDI, and implicitly, ESP
You must help the compiler in order to have it produce SSE code. Even then it's difficult to enforce a memory arrangement that allows optimal vectorisation by the compiler.
You know the exact preconditions and postconditions of function calls, which you can use to your advantage. GCC can only guess at that.
In all, GCC, and virtually all other compilers, are fundamentally limited when it comes to speed.
That said, an asm programmer with some experience will outperform all non-optimizing compilers, with some more experience -O2 gcc can still easily be beaten, and for quite a bit more gurus than you expect -O3 isn't a problem to beat.
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re: Thanks guy's
This depends a lot on the system. If you're using whole-program optimization, the compiler can use whatever calling convention it wants. It's only at the boundaries with other "unknown" code that this becomes a problem. Compilers can also do inlining to avoid this overhead.Combuster wrote:You can't tailor register calling conventions, which is especially a burden on x86 where 5 out of 8 registers need to be preserved under standard calling conventions: EBX EBP ESI EDI, and implicitly, ESP
The overhead of saving registers on x86 is probably not as big as you think it is anyway. In reality, a modern x86 processor has over a hundred registers internally, and uses register re-naming to allocate those "physical" registers to the "logical" registers of the x86 programming model. The processor itself can optimize the saving of register state better than an assembly programmer can, and processors these days are designed to optimize the code typically generated by popular compilers.
There is a huge gulf between what assembly programmers see in the programming model and what is actually going on in a typical x86 processor. You'd need to have a very deep understanding of the individual characteristics of each microarchitecture (Core, Athlon, etc.) and how they handle different types of code in order to optimize your code fully.
So, maybe 990 out of the 1000 such gurus in the world instead of 900? If it takes such guru power, then like Solar said, the gurus are probably already working on compiler back-ends.for quite a bit more gurus than you expect -O3 isn't a problem to beat.
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager