Dear all: there''s no sun studio mailling list in opensolaris.org, i raise my problem here :) a simple piece of code, 2 nested while loops, and some if statements inside each while loop. i compiled this program in Solaris with sun cc (sun studio 12) and gcc. and i compiled it in Debian with gcc as well. Then I dumped (disassembled) these 3 programs. I found that there were alway serveral nop instructions followed with the jmp instruction in the program generated by suncc. and this problem didn''t exist in the other 2 program generated by gcc. err... Why does sun cc generate code using this pattern (a jmp followed by serveral nops)? For what? TIA Regards, TJ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070911/9ba0ad5b/attachment.html>
Sean McGrath - Sun Microsystems Ireland
2007-Sep-11 15:41 UTC
[dtrace-discuss] nop instruction generated by sun cc
???? TaoJie stated: < Dear all: < < there''s no sun studio mailling list in opensolaris.org, i raise my problem < here :) Theres the tools-discuss mailing list for this. < < a simple piece of code, 2 nested while loops, and some if statements < inside each while loop. < < i compiled this program in Solaris with sun cc (sun studio 12) and gcc. < and i compiled it in Debian with gcc as well. < < Then I dumped (disassembled) these 3 programs. < I found that there were alway serveral nop instructions followed with the < jmp instruction in the program generated by suncc. < and this problem didn''t exist in the other 2 program generated by gcc. < < err... Why does sun cc generate code using this pattern (a jmp followed by < serveral nops)? For what? Ask on the tools-discuss and maybe attach the (small?) c-source too. Regards, < < TIA < < < Regards, < TJ < _______________________________________________ < dtrace-discuss mailing list < dtrace-discuss at opensolaris.org -- Sean. .
Joerg Schilling
2007-Sep-11 15:46 UTC
[dtrace-discuss] nop instruction generated by sun cc
"???? TaoJie" <eulertao at gmail.com> wrote:> there''s no sun studio mailling list in opensolaris.org, i raise my problem > here :) > > a simple piece of code, 2 nested while loops, and some if statements inside > each while loop. > > i compiled this program in Solaris with sun cc (sun studio 12) and gcc. > and i compiled it in Debian with gcc as well. > > Then I dumped (disassembled) these 3 programs. > I found that there were alway serveral nop instructions followed with the > jmp instruction in the program generated by suncc. > and this problem didn''t exist in the other 2 program generated by gcc.This is how unoptimized sparc code looks since at least 21 years. J?rg -- EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin js at cs.tu-berlin.de (uni) schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
oh! yes! I forgot this... no optimization option was set when I called cc, it''s my fault :) 2007/9/11, Joerg Schilling <Joerg.Schilling at fokus.fraunhofer.de>:> > "???? TaoJie" <eulertao at gmail.com> wrote: > > > there''s no sun studio mailling list in opensolaris.org, i raise my > problem > > here :) > > > > a simple piece of code, 2 nested while loops, and some if statements > inside > > each while loop. > > > > i compiled this program in Solaris with sun cc (sun studio 12) and gcc. > > and i compiled it in Debian with gcc as well. > > > > Then I dumped (disassembled) these 3 programs. > > I found that there were alway serveral nop instructions followed with > the > > jmp instruction in the program generated by suncc. > > and this problem didn''t exist in the other 2 program generated by gcc. > > This is how unoptimized sparc code looks since at least 21 years. > > J?rg > > -- > EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 > Berlin > js at cs.tu-berlin.de (uni) > schilling at fokus.fraunhofer.de (work) Blog: > http://schily.blogspot.com/ > URL: http://cdrecord.berlios.de/old/private/ > ftp://ftp.berlios.de/pub/schily >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20070912/8bcd4319/attachment.html>
On 9/11/07, ?? TaoJie <eulertao at gmail.com> wrote:> I found that there were alway serveral nop instructions followed with the > jmp instruction in the program generated by suncc. > > err... Why does sun cc generate code using this pattern (a jmp followed by > serveral nops)? For what?In some cases, the compiler *needs* to put a nop instruction right after the branch because SPARC implements delayed branches. If the compiler could not find a useful instruction to fill the delay slot, then it puts a nop there. With no optimizations turned on, the compiler will not spend time to do any of that, so that it can trade code quality for faster compile time. Rayson> > TIA > > > Regards, > TJ > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >