Making scripting support optional - page 9 - General Discussion and Assistance - CHDK Forum

Making scripting support optional

  • 83 Replies
  • 31262 Views
*

Offline ultimA

  • ***
  • 137
Re: Making scripting support optional
« Reply #80 on: 11 / January / 2011, 01:16:28 »
Advertisements
I just don't want to further the (almost always) mistaken belief that volatile solves concurrency problems.
I didn't throw it in for solving concurrency issues. It just makes sure that the variable is properly reloaded from memory. Basically, if the code is working then it is already being loaded from memory and hence performance should not degrade significantly. If it does result in a performance degradation, it means the variable is cached, so it might not see the latest value written by another thread - which can (but not necessarily) lead to a problem. I don't believe it will result in noticable performance decrease, but having volatiles at the right places helps avoid a problem which is very hard to diagnose on an embedded device. I do know that it does not make the code thread safe. (As a side note, all the action stack should be made thread safe...)

*

Offline reyalp

  • ******
  • 14082
Re: Making scripting support optional
« Reply #81 on: 11 / January / 2011, 16:11:00 »
I didn't throw it in for solving concurrency issues. It just makes sure that the variable is properly reloaded from memory.
Show me where it could be improperly kept in a register in a way that would cause a problem.
Don't forget what the H stands for.

*

Offline ultimA

  • ***
  • 137
Re: Making scripting support optional
« Reply #82 on: 11 / January / 2011, 21:48:26 »
Right now probably nowhere. I have seen no place like that and the fact that the code works more or less kind of prooves that. But we're only depending on compiler behavior to hope to overwrite whichever register it loads into! All it takes is someone in the future to shorten a loop or add a spinwait (we already have some of those in CHDK) and you'll have a problem which will cost hours for someone to debug. I can see no point in your argumentation. However unlikely it may sound for you, why not just play on the safe side, espcially if we both agree that it means no harm performance-wise? Even if it works now, you're just playing with fire. Yes, I admit I'm paranoid but what is your reason for deliberately walking the path of undefined behavior?

If you really hate that patch that much, just ignore it, I'm not going to be offended or anything. I'm just trying to convice you or trying to make you convince me :)

*

Offline reyalp

  • ******
  • 14082
Re: Making scripting support optional
« Reply #83 on: 15 / January / 2011, 18:30:38 »
Added 02-04.
00 - I think I will combine this with getting rid of the conf.save_raw abuse
01 - not needed.
Don't forget what the H stands for.


 

Related Topics