PORTABLE OBJECT CODE -- plz post ur comments

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Alas it boils down to this.......?

Post by DeletedAccount »

8) I am almost convinced that most compilers generate redundant code..
even gcc...This may be less true for RISC architecture where there are 100's
of registers and we can view like a window only 30-40 of em ..like in SPARC...
Still it cant outperform a hardcore assembly programmer....,Yet It seems kina... boring to deal with this "micromanagement"....... (but the power
of controlling the register's and memory in your own way is tempting.!!)

One Final question.......
Whose time is more important your time or the machines time??? :?: :?: :
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re: Alas it boils down to this.......?

Post by Colonel Kernel »

SandeepMathew wrote:8) I am almost convinced that most compilers generate redundant code..
even gcc...
Oh, definitely -- especially when inlining. The point is that sometimes the performance is actually better with such code because it avoids other overheads (like setting up a call frame).
Still it cant outperform a hardcore assembly programmer....
Except in terms of assembly instructions emitted per hour. :)
One Final question.......
Whose time is more important your time or the machines time??? :?: :?: :
Unless lives are at stake, developers' time is paramount. It's the most expensive factor in the equation.
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Assembler Versus C/C++ (Developer Time Or Machine Time?)

Post by Kevin McGuire »

I think you just summed up the assembler versus C/C++ argument.

Unless lives are at stake, developers' time is paramount. It's the most expensive factor in the equation.

Which is quite true because the developer's time is a finite amount that must be partitioned among many things including actually eating and sleeping in all cases. And by placing more of this into a partition such as "outperforming GCC optimization by hand" would seriously steal time from other partitions creating a lacking of you take you're pick or you make a bunch of picks for a amount lesser in direct relation to how many picks you make.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven
Contact:

Re: Thanks guy's

Post by Candy »

Solar wrote:
SandeepMathew wrote:Still ther wont come a time when a compiler can generate code better than a master assembly
programmer...?


Since someone has to write the backend for the compiler, there will always be someone who is better at ASM than the compiler is.


Compilers don't make mistakes and don't make omissions because they didn't see the application somewhere, at least, less so than the programmer (who will teach the compiler all he knows).
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post by jnc100 »

For a thread originally asking about portable object code, surely arguing the benefits of assembly over C is a move in the opposite direction?

Regards,
John
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

Conversation evolves... get over it... if you have anything productive to add to the original post go for it.

IMHO, even the greatest assembly programmers (for their respective architectures) will not write as efficient and useful code in the same period of time that a programmer writing in a high level language would. Especially as it is slightly more time consuming to write assembly for Modern Operating System Applications (as opposed to system development or DOS apps).

Then there is the case of System Development, there is a large number of people who want completely portable code (i know some aassembly developers claim assembly is easy to port, but you still have to go manually through it all) which doubles assembly production time. With unlimited time constraints, someone who knows the system inside out could probably beat the assembler, but in the end, compilers do a pretty fine job as it is.
Last edited by Tyler on Tue May 15, 2007 2:38 am, edited 1 time in total.
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

felt the need to post twice tyler to make your statement :wink:

Still it cant outperform a hardcore assembly programmer....

Yeah like an asm programmer can fill all the instruction pipelines on a quad core processor and using mmx and xmm instructions in between. Problably he can but the compiler of a highlevel language programmer can do that much faster.
Author of COBOS
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

...and GCC -O3 is hardly the benchmark... try ICC. ;)
Every good solution is obvious once you've found it.
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

Apologies! My internet is being really slow for some reason. I am only running Azureus... wonder what the problem is :roll: Didnt think it had posted the first time and i would delete it if i knew how, still i had a good point didnt i!
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Thread Topic Change

Post by Kevin McGuire »

jnc100 wrote:For a thread originally asking about portable object code, surely arguing the benefits of assembly over C is a move in the opposite direction?

Regards,
John


The thread creator (SandeepMathew) changed the subject from portable object code (below). Surprisingly, huh. :P

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.......
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

meh..maybe a bit offtopic.. but one idea would be to use a generic assembly based bytecode
like have
"mov r0,30"
convert to
"mov ax,30"
except for that be byte code..

infact, I think I'll do this..lol just sounds fun to me..
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Hey that's what is already being done........

Post by DeletedAccount »

That's what's being done in the intermediate Code Generation phase of
a compiler (if the compiler has this phase...)....But the problem is that
there is no standard for how the intremediate code should look like....
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

But Still

Post by DeletedAccount »

If you make the 'generic code ' more portable and if it can be very efficently
translated to native code then.... 8) You will probably be the next James Gosling :P

(here the design of generic code is paramount...)one approach i would suggest (especially true to RISC arch's) is restrict most of the operations
to register whenever possible than to use the memory...... (keep some
kina index on the registers used and so on...)T00his should be
easier in RISC arch's where there are 100's of registers....,But unfortunately
i never had much opportunity to interact with RISC's ..... But from whatever
i have read..they seem to provide superior perfomance.... I practised my java labs on SUN (SPARC) servers connected via a thin client.... i did 'nt
seem to very fast...but i was amazed by its multitasking ability and roboustness,,,,,
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

Well, basically my idea would be best for application programming, and not OS, or even low level system programming..

but anyway..
ok so to code for optimizations on some archs, you use 100s of registers, so on those few archs that do support, it will be fast...but what do you do when the target arch only has 16?
My idea is to use memory in order to store missing registers..

the problem I have is bits(16,32,64) and endianess..I'm sure you could hardcode it somehow to fix that, but I'm not completely for sure on how to do that..

lets put endians aside..now bits:
lets say you wanted to program on 32bit for the generic assembly, but wanted to compile to use a 16bit arch. For example sake, we'll use 8086

Code: Select all

;generic
mov dword r0,0xFFFF FFFF ;spacing just there for readability..


Code: Select all

;actual produced
mov ax,0xFFFF
mov bx,0xFFFF


now where it gets more complicated is with arithmetic and conditioning..

Code: Select all

;generic
mov dword r0,0xFFFF FFFE
add dword r0,1


Code: Select all

;produced



see..I can't figure out a quick fast, easy way to do that..



for my example compiler thing, I will only compile tokenized generic code to actual asm code..I don't want to mess with parsing all the crap...
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Here is a suggesstion............

Post by DeletedAccount »

Here is my auggestion.........(But this leads to less efficent translation......)
One way to get over this is to make your own custom library tnat performs the all the 32 bit operations for you ....(for the corresponding
archs)
say procedure add_32 , performs 32 bit arithmethic for your code

Code: Select all

ADD R0 , #1


gets translated to

Code: Select all

extrn add_32 

;bla bla bluf

push dx ;save dx
mov dx,1h ;assuming in this procedure dx has immediate value
call add_32
pop dx ; restore dx
 
;

:P [/code]
Post Reply