OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 9:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Alas it boils down to this.......?
PostPosted: Mon May 14, 2007 10:17 am 
Offline
Member
Member

Joined: Tue Jun 20, 2006 9:17 am
Posts: 566
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??? :?: :?: :


Top
 Profile  
 
 Post subject: Re: Alas it boils down to this.......?
PostPosted: Mon May 14, 2007 1:45 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 6:06 pm
Posts: 1437
Location: Vancouver, BC, Canada
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).
Quote:
Still it cant outperform a hardcore assembly programmer....
Except in terms of assembly instructions emitted per hour. :)
Quote:
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!


Top
 Profile  
 
 Post subject: Assembler Versus C/C++ (Developer Time Or Machine Time?)
PostPosted: Mon May 14, 2007 4:03 pm 
Offline
Member
Member
User avatar

Joined: Tue Nov 09, 2004 12:00 am
Posts: 843
Location: United States
I think you just summed up the assembler versus C/C++ argument.

Quote:
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.

_________________
Projects


Top
 Profile  
 
 Post subject: Re: Thanks guy's
PostPosted: Mon May 14, 2007 11:52 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 11:33 pm
Posts: 3882
Location: Eindhoven
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).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 2:26 am 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 2:34 am 
Offline
Member
Member

Joined: Tue Nov 07, 2006 7:37 am
Posts: 514
Location: York, England
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.

Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 3:56 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 27, 2007 3:21 pm
Posts: 553
Location: Best, Netherlands
felt the need to post twice tyler to make your statement :wink:

Quote:
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 4:20 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
...and GCC -O3 is hardly the benchmark... try ICC. ;)

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 7:29 am 
Offline
Member
Member

Joined: Tue Nov 07, 2006 7:37 am
Posts: 514
Location: York, England
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!


Top
 Profile  
 
 Post subject: Thread Topic Change
PostPosted: Tue May 15, 2007 1:57 pm 
Offline
Member
Member
User avatar

Joined: Tue Nov 09, 2004 12:00 am
Posts: 843
Location: United States
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.......

_________________
Projects


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 19, 2007 11:08 am 
Offline
Member
Member

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

_________________
My new NEW blag


Top
 Profile  
 
 Post subject: Hey that's what is already being done........
PostPosted: Sat May 19, 2007 8:45 pm 
Offline
Member
Member

Joined: Tue Jun 20, 2006 9:17 am
Posts: 566
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....


Top
 Profile  
 
 Post subject: But Still
PostPosted: Sat May 19, 2007 9:20 pm 
Offline
Member
Member

Joined: Tue Jun 20, 2006 9:17 am
Posts: 566
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,,,,,


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 20, 2007 12:47 pm 
Offline
Member
Member

Joined: Thu Jul 07, 2005 11:00 pm
Posts: 1546
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:
;generic
mov dword r0,0xFFFF FFFF ;spacing just there for readability..


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


now where it gets more complicated is with arithmetic and conditioning..
Code:
;generic
mov dword r0,0xFFFF FFFE
add dword r0,1


Code:
;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...

_________________
My new NEW blag


Top
 Profile  
 
 Post subject: Here is a suggesstion............
PostPosted: Sun May 20, 2007 7:37 pm 
Offline
Member
Member

Joined: Tue Jun 20, 2006 9:17 am
Posts: 566
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:
ADD R0 , #1


gets translated to
Code:
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]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group