IRC channel logs


back to list of logs

***michel_mno_afk is now known as michel_mno
<civodul>Hello Guilers!
<artyom-poptsov1>Hi civodul
<robertle>hi folks, I am trying to understand the calling conventions within guile VM, and there is something I don't get.
<robertle>I am looking at, the stack layout node in the same document and the source
<robertle>although I don't understand the source in this case
<robertle>the docs around "call nargs" say: "Because the new frame pointer will point to sp[-nargs + 1], the arguments don’t have to be shuffled around – they are already in place. "
<robertle>I don't understand how the arguments could already be in place or the patching up of the stack could work without destroying it.
<robertle>the arguments are there, ok, but don't you need a few more stack cells below that? like for the return address and the current frame pointer?
<robertle>so let's say sp[0] contains a sole argument, then sp[-1] cotains the callee
<robertle>when inside the callee, according to teh stack layout, fp-1 contains the program, fp the argument
<robertle>easy so far, new fp = old sp
<robertle>however it also says that fp-2 through fp-4 contains return address, multivar return address and dynamic link respectively
<robertle>so how do they get into the stack?
<robertle>or does the caller need to leave three locals empty for this?
<ijp>robertle: I haven't looked at your question closely, but as a heads up, the vm will be changing with 2.2
<robertle>ijp: ok, understood. I think I am mostly interested in "new" behavior. I am interested in designing a VM as well and am studying calling conventions of various good existing ones...
<robertle>ijp: will look at the 2.1 manual instead...
<robertle>and yeah, that is more clear: "the two values below ... will be overwritten"
<robertle>but that leaves me with my second question: you do have "locals" in guile, so essentially directly adressable cells on the stack, relative to the frame pointer
<robertle>so I could set up a function call using intermediates/PUSHed values, or locals, right?
<robertle>in the case of PUSHed ones the behavior of SP around a call is quite clear: before the call the topmost elements on the stack are the arguments and the callee. these get consumed by the call, and instead of them you end up with the return value (let's ignore multiple return values for now)
<robertle>but if you use locals for this, doesn't callpotentially do the reverse of assert-locals?
<robertle>make locals inaccessible because they are now past SP?
<dsmith-work>Monday Greetings, Guilers
<civodul>robertle: you may be interested in the rationale about the new VM:
<robertle>civodul: I read that, that's why I'm here!
<robertle>sounds really cool
<civodul>ah good :-)
<civodul>the key insight is that all these push/pop are too costly, at least for a language like Scheme
<civodul>merely making one's code nicer through the use of local vars incurs run-time overhead
***cluck` is now known as cluck
***michel_mno is now known as michel_mno_afk
*davexunit begins to finally move off of gitorious
<davexunit>(self-signed cert alert!)