You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While looking through the optimizer, there's kinda been a question in the back of my mind: Is it ok if memory consistency isn't perfectly maintained? (ie. results don't match an unoptimized program due to memory-related optimization) It partially isn't as-is, but currently the optimizations to that extent are somewhat restricted (i.e. in most cases can't cross branches), though I can still get it to screw up:
CON
_CLKFREQ =200_000_000
DEBUG_COGS =%01VARlong a,b,stack[100]
PUBmain() | lock,x,y,z,p,q
p := @a
q := @b
lock := locknew()
x:=locktry(lock)
cogspin(NEWCOG,cog(lock),@stack)
lockrel(lock)
x :=long[p]
debug("Just wasting some tiiiiiiiiiiiiimmmmmmmmmmmmeeeeeeeee...")
y :=long[q]
z :=long[p]
debug(sdec(x,y,z))
PRIcog(lock)
repeatuntil locktry(lock)
a :=1337
b :=11880
In C this sort of thing is explicitly ok (relatedly: do we even handle volatile right now?), idk about BASIC, but Spin may actually be written with the expectation of consistent memory in some cases.
The text was updated successfully, but these errors were encountered:
Spin definitely expects memory consistency, and we probably should try to preserve it as much as possible. Which conflicts with the desire to optimize code that's using globals / member variables and stack offsets :(.
While looking through the optimizer, there's kinda been a question in the back of my mind: Is it ok if memory consistency isn't perfectly maintained? (ie. results don't match an unoptimized program due to memory-related optimization) It partially isn't as-is, but currently the optimizations to that extent are somewhat restricted (i.e. in most cases can't cross branches), though I can still get it to screw up:
In C this sort of thing is explicitly ok (relatedly: do we even handle
volatile
right now?), idk about BASIC, but Spin may actually be written with the expectation of consistent memory in some cases.The text was updated successfully, but these errors were encountered: