This presentation is delivered by the Stanford center for professional development oh we’re on about how about that hey everyone welcome I don’t have any handouts for you today I actually want to finish up the implementation section of the course I think I’ll get through today I’ll make it a point to finish it today come Monday we’re going to.
Start talking about multi-threading and I’ll even preface that a little bit today provided I don’t write at a time remember that your midterm is Wednesday evening over in Hewlett 200 the.
Largest room and this end of campus the 7:00 to 10:00 p.
it’s open note open book you can bring printouts of your every programs whatever you need just plan on taking the exam at three-hour period this is it’s designed to be more than enough time for the midterm okay there’s also the the technology.
Talk right after this class right here over in Hewlett 201 so you can go visit Toula 200 to see what room it’s like for the exam but into a1 they’ll be a technology.
Talk from 12:00 to 1:00 o’clock okay I left you last time with this example but I got several questions about how it worked which probably means that I rushed through in the last five minutes of class which is it which is probably true we had something like this whoops where I declared an array of length four and int I to service for loop for loop index and then I’m just going to go do this I don’t care that.
The array hasn’t been initialized I want to go ahead and do this right here okay and then just return.
And the statement you probably do remember from Wednesday is that given our memory model that this would prompt the program to run forever now why is that the case based on this local variable set we’re dealing with this as an activation record one two three this is the array as far as that full loop is concerned it’s just one too small this is the I variable it goes.
Through and it demotes all of these variables by for what values were there before we have no idea but it will certainly take whatever values happen to reside there and demote them by four okay unfortunately because the test is wrong it goes up and it uh denotes this numerically by four as well now that four isn’t so much a four as it.
So much a negative for Delta as it is a negative one instruction Delta because you know that this is the safe PC in our model this was supposed to be pointing somewhere.
In the code segment to the line that called the foo function this is planted down.
There in response to that assembly code statement that’s it well with everybody okay when you do this you inadvertently tell the safe PC that it wasn’t pointing to this instruction but that it should back up four bytes which happens to be this nice round number as far as assembly code instructions are concerned and it’s not pointing there and to point there instead so when this.
As a function returns it jumps back to this right here okay and it executes the call having no memory whatsoever that it called foo like 14 or 15 assembly code instructions ago okay does that make sense to people so this is this very well disguised form of recursion you won’t be able to emulate this on the solaris boxes or.