Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Prozak

Weird Code generated by Visual Studio

This topic is 5325 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Some fancy speedup technique? I was having a look at the diferent code VS7 generates for a simple function call, and a function pointer to that same function. sqrt - dummy square root function, takes a UINT, returns UINT rv - return value, a UINT fptr - UINT(*fptr)(UINT) a function pointer, points to sqrt In the blue box you can see the weird code. The 2nd line basicly does nothing, because eax''s value hasn''t changed... Is this some fancy optimization routine for opcode pipelines or something (i know assembly, but i dont know the recent opcodes very well, like mmx and sse, and the best ways to optimise for those)...

[Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][Yann L.][Enginuity]
The most irrefutable evidence that there is intelligent life in the Universe is that they haven''t contacted us!

Share this post


Link to post
Share on other sites
Advertisement
Considering there''s that __RTC_CheckEsp in there, I''m guessing this is a debug build with runtime checks enabled. Debug builds have horribly unoptimized code. This particular instance could be either from a naive code generation, part of the runtime checks or necessary for the debug symbols to match up. Or something else entirely.

Share this post


Link to post
Share on other sites
Yup, it is wierd, but this is exactly something that a peephole optimizer will get rid of, and probably, fixing the compiler such that it never actually outputs that assembly will be problematic. This could be for many reasons, but generally debug code is useless when it comes to analyzing the quality of compiler generated code.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!