2015-01-07T00:02:29Z adlai joined #sbcl 2015-01-07T00:06:59Z akkad quit (Excess Flood) 2015-01-07T00:11:55Z akkad joined #sbcl 2015-01-07T01:00:02Z echo-are` quit (Remote host closed the connection) 2015-01-07T01:02:12Z nikki93 joined #sbcl 2015-01-07T01:24:49Z slyrus quit (Ping timeout: 245 seconds) 2015-01-07T01:34:56Z slyrus joined #sbcl 2015-01-07T01:46:32Z slyrus quit (Ping timeout: 245 seconds) 2015-01-07T01:51:52Z indifference joined #sbcl 2015-01-07T01:55:54Z indifference quit (Quit: Failure is only a permanent condition if you make it one.) 2015-01-07T01:56:38Z nikki93 quit (Remote host closed the connection) 2015-01-07T01:58:24Z edgar-rft joined #sbcl 2015-01-07T02:00:13Z snuglas quit (Ping timeout: 246 seconds) 2015-01-07T02:05:08Z oleo is now known as Guest95822 2015-01-07T02:06:02Z oleo__ joined #sbcl 2015-01-07T02:08:13Z Guest95822 quit (Ping timeout: 265 seconds) 2015-01-07T02:16:08Z echo-area joined #sbcl 2015-01-07T02:37:44Z loke: I'm looking at a dissasembly of a function, and I'm trying to understand the use of RSP and RBP. At the end of a function returning (VALUES), you always seem to have: MOV RSP,RBP; POP RBP; RET. What is the purpose of that mov and pop? 2015-01-07T02:38:48Z pkhuong: loke: standard frame pointer sequence 2015-01-07T02:39:24Z loke: OK, so RBP is the frame pointer. Makes sense, but what about RSP? 2015-01-07T02:39:31Z pkhuong: it's the stack pointer? 2015-01-07T02:43:27Z loke: So the stack pointer is set to the value of the frame pointer, and then the old frame pointer is popped off the stack... Hmm. So in the beginning of a function, the current frame pointer is pushed to the stack in the beginning of the function, so those two instructions restore the old stack and frame pointers. I get it 2015-01-07T02:43:28Z loke: Thnaks 2015-01-07T02:44:20Z loke: It begs the question though, why a function that contains nothing more than (lambda () (values)) is allocating a frame 2015-01-07T02:45:05Z loke: If I change (valies) to (values 1), then there is no restoring of the stack pointer happening. 2015-01-07T02:46:02Z pkhuong: loke: you read wrong. 2015-01-07T02:46:13Z loke: That does not surprise me 2015-01-07T02:46:31Z pkhuong: there is always a frame pointer because it makes debugging and error handling easier, and because we have much more important issues to tackle before worrying about leaf functions 2015-01-07T02:47:15Z nikki93 joined #sbcl 2015-01-07T02:48:46Z loke: pkhuong: Please, don't mistake my questions as any form of criticism. I'm already very impressed with SBCL and if it wasn't for it, I would likely not be enjoying programming in Lisp. 2015-01-07T02:49:09Z loke: I'm just very happy that there are people willing to answer questions such as mine. 2015-01-07T02:50:03Z pkhuong: don't worry, I'm rarely impressed by SBCL (and frequently unimpressed by compilers like gcc and clang...) 2015-01-07T02:52:14Z loke: Anyway, I'm guessing that the LEA RBX,[RBP+16] that I see in the beginning of the function (my function that does nothing but call (VALUES)) actuall comes from the inlining (transformation?) of the function VALUES. Dare I guess that VALUES is only truly optimised for the common case of it returning a single value? 2015-01-07T02:55:40Z pkhuong: yes 2015-01-07T02:56:00Z loke: Thanks 2015-01-07T02:56:24Z pkhuong: (values) compiles to a multiple values return for n = 0 2015-01-07T02:56:56Z pkhuong: (which includes defaulting RDX to NIL and setting the number of return values to 0) 2015-01-07T03:03:44Z loke: pkhuong: Right, but I don't understand why it needs to load something off of [RBP+16] 2015-01-07T03:08:00Z nyef joined #sbcl 2015-01-07T03:14:50Z pkhuong: it doesn't 2015-01-07T03:14:58Z pkhuong: LEA computes an address 2015-01-07T03:24:03Z cmack quit (Ping timeout: 264 seconds) 2015-01-07T03:38:59Z christoph_debian quit (Ping timeout: 245 seconds) 2015-01-07T03:43:23Z nikki93 quit (Remote host closed the connection) 2015-01-07T03:52:25Z christoph_debian joined #sbcl 2015-01-07T04:05:59Z loke: ah right 2015-01-07T04:06:31Z loke: so LEA RBX,[RBP+16] is kinda-sorta equivalent to (setq rbx (+ rbp 16)) ? 2015-01-07T04:07:12Z Bicyclidine: it's "load effective address", it loads the address that would be used for a memory load, but doesn't actually do the memory load. (so, i think so yes) 2015-01-07T04:09:08Z loke: All right, but it still makes little sense as RBX is never used after that (unless of coure the caller expects RBX ti be that value, but if so, why?) 2015-01-07T04:09:09Z loke: http://paste.lisp.org/display/145098 2015-01-07T04:12:06Z pkhuong: loke: try to see what happens when you return 4 or 5 values 2015-01-07T04:13:54Z nikki93 joined #sbcl 2015-01-07T04:19:15Z nikki93 quit (Ping timeout: 264 seconds) 2015-01-07T04:19:22Z loke: OK, so the three first values are passed in RDX, RDI and RSI? THe remaining ones are passed on the stack at RBP-16, etc? 2015-01-07T04:19:57Z pkhuong: and what happens to rbx? 2015-01-07T04:20:10Z loke: the number of values is passed in RCX, with the carry being set if the number of values is not 1? 2015-01-07T04:21:14Z loke: RBX+8 is pushed to the stack, which I presume is a pointer to the stack of the values beyond 3? 2015-01-07T04:21:25Z loke: RBX-8 even 2015-01-07T04:21:58Z pkhuong: loke: what happens right after the push? 2015-01-07T04:22:50Z loke: RET. Which means that RBX-8 is pulled off the stack and being used as the stack pointer in the calling frame? 2015-01-07T04:23:19Z pkhuong: what does RET do? 2015-01-07T04:24:21Z loke: Hmm, I might be making assumptions. Let me look up RET in "Intel 64 and IA-32 Architecture software developers manual" Which is next to my desk :-) 2015-01-07T04:27:01Z nyef: ... Heh. This confusion is partly my fault for messing with the x86oid calling conventions, isn't it? 2015-01-07T04:28:29Z oleo__ quit (Quit: Verlassend) 2015-01-07T04:29:07Z pkhuong: nyef: it used to be much worse. 2015-01-07T04:29:35Z oleo joined #sbcl 2015-01-07T04:29:59Z nyef: I know it did, why do you think I changed it? d-: 2015-01-07T04:32:01Z loke: OK, I'm sorry but I'm still confused. Accroding the the documentation, all RET does is to pop the new EIP off the stack, which suggests that execution should contuniue as RBX-8 in this case. How could that work? 2015-01-07T04:33:55Z pkhuong: take a second look at that PUSH 2015-01-07T04:36:50Z loke: PUSH QWORD PTR [RBX-8]. It pushes the value pointed to by RBP+16-8 = RPB+8, which I would presume is the caller address... oh. 2015-01-07T04:37:54Z loke: I'm still not clear why the value of RPB+16 is kept in RBX. 2015-01-07T04:38:31Z pkhuong: what happens to RBP before that PUSH? 2015-01-07T04:39:35Z loke: Um, right... It's restored to the value of the previous frame pointer I guess? 2015-01-07T04:39:43Z loke: that's what the MOV does, yes? 2015-01-07T04:40:52Z nyef: Oh, so I had this little idea last night... What would happen if we separated the concepts of "conservatively-scavenged registers" from "c-stack-is-control-stack"? 2015-01-07T04:41:46Z nyef: That is, separate boxed and unboxed stacks, but a mixed register set? 2015-01-07T04:47:20Z pkhuong: if we do that, ISTM we might as well go for annotated stack frames 2015-01-07T04:48:22Z nyef: The thing is, having a conservative register set with a split stack structure is straightforward on the runtime side. 2015-01-07T04:48:40Z pkhuong: annotated stack frames are straightforward on the compile-side 2015-01-07T04:48:51Z pkhuong: ... single stack, two linked list of frames? 2015-01-07T04:49:32Z pkhuong: so a stack frame is old-fp, # slots, [data] 2015-01-07T04:50:26Z nyef: I'm talking about calling something like preserve_context_registers() instead of scavenge_interrupt_context() on some of the non-x86 ports. 2015-01-07T04:50:50Z pkhuong: so am i. 2015-01-07T04:51:05Z pkhuong: I'm trying to avoid the overhead of a number stack pointer 2015-01-07T04:51:24Z nyef: Hrm. 2015-01-07T04:52:46Z nyef: Having trouble thinking that one through. /-: 2015-01-07T04:55:58Z pkhuong: let's say I can get codegen to emit stack frames with contiguous boxed/unboxed slots 2015-01-07T04:57:35Z pkhuong: the unboxed slots could be part of the regular stack frame, but with some annotation so that stack scanning can skip over unboxed slots 2015-01-07T04:57:56Z pkhuong: and the annotation could be a linked list w/ # slots & unboxed slots 2015-01-07T04:58:12Z pkhuong: (implicit on the stack, like normal frame pointers) 2015-01-07T04:58:24Z pkhuong: I think I can do the codegen bit, no clue about runtime (: 2015-01-07T05:00:14Z nyef: And I don't trust the runtime not to screw up backtrace under some circumstances. 2015-01-07T05:00:47Z pkhuong: but we don't need backtraces 2015-01-07T05:01:22Z pkhuong: the annotation is similar to DX pin lists 2015-01-07T05:01:33Z nyef: Hrm. 2015-01-07T05:01:42Z nyef: Okay, that's a little more plausible. 2015-01-07T05:02:10Z nyef: Are you trying to indicate the boxed data or the unboxed data? 2015-01-07T05:02:16Z pkhuong: unboxed 2015-01-07T05:02:22Z pkhuong: default is to preserve 2015-01-07T05:02:31Z nyef: Okay, what about alien stack frames? 2015-01-07T05:02:44Z pkhuong: preserved exactly like today 2015-01-07T05:03:15Z nyef: Hrm. Weak. 2015-01-07T05:03:47Z pkhuong: we could pull the same trick for boxed data, but arg passing is hard 2015-01-07T05:04:07Z nyef: The issue being that we'd like to be able to do a proper scavenge on the stack, not indicate which bits are definitely dead. 2015-01-07T05:04:15Z nyef: Arg passing and d-x allocation. 2015-01-07T05:04:27Z pkhuong: DX could be added to the list. 2015-01-07T05:05:58Z nyef: Oh, for reliable backtrace. /-: 2015-01-07T05:10:10Z nyef: I'm about out of time for tonight. 2015-01-07T05:10:29Z nyef quit (Quit: G'night all) 2015-01-07T05:12:11Z slyrus joined #sbcl 2015-01-07T05:15:00Z nikki93 joined #sbcl 2015-01-07T05:19:37Z nikki93 quit (Ping timeout: 264 seconds) 2015-01-07T05:24:40Z gingerale joined #sbcl 2015-01-07T05:24:50Z slyrus quit (Ping timeout: 264 seconds) 2015-01-07T05:25:05Z pranavrc joined #sbcl 2015-01-07T05:25:05Z pranavrc quit (Changing host) 2015-01-07T05:25:05Z pranavrc joined #sbcl 2015-01-07T05:33:34Z slyrus joined #sbcl 2015-01-07T05:55:40Z oleo quit (Quit: Verlassend) 2015-01-07T06:03:22Z pranavrc quit (Remote host closed the connection) 2015-01-07T06:06:03Z pranavrc joined #sbcl 2015-01-07T06:09:07Z gingerale quit (Ping timeout: 255 seconds) 2015-01-07T06:15:51Z nikki93 joined #sbcl 2015-01-07T06:20:22Z nikki93 quit (Ping timeout: 255 seconds) 2015-01-07T06:25:30Z nikki93 joined #sbcl 2015-01-07T06:27:11Z pranavrc quit (Remote host closed the connection) 2015-01-07T06:29:59Z nikki93 quit (Ping timeout: 256 seconds) 2015-01-07T06:31:51Z pranavrc joined #sbcl 2015-01-07T07:26:21Z nikki93 joined #sbcl 2015-01-07T07:30:39Z nikki93 quit (Ping timeout: 245 seconds) 2015-01-07T07:31:22Z slyrus quit (Ping timeout: 244 seconds) 2015-01-07T08:01:20Z Intensity quit (Remote host closed the connection) 2015-01-07T08:27:04Z nikki93 joined #sbcl 2015-01-07T08:31:39Z scymtym_ joined #sbcl 2015-01-07T08:33:12Z nikki93 quit (Ping timeout: 245 seconds) 2015-01-07T09:13:41Z adlai quit (Ping timeout: 250 seconds) 2015-01-07T09:16:49Z adlai joined #sbcl 2015-01-07T09:19:37Z pacon joined #sbcl 2015-01-07T09:50:42Z ivan4th quit (Ping timeout: 245 seconds) 2015-01-07T09:50:50Z ivan4th joined #sbcl 2015-01-07T10:06:30Z attila_lendvai joined #sbcl 2015-01-07T10:06:30Z attila_lendvai quit (Changing host) 2015-01-07T10:06:30Z attila_lendvai joined #sbcl 2015-01-07T10:17:22Z hlavaty quit (Ping timeout: 245 seconds) 2015-01-07T10:23:38Z Bicyclidine quit (Ping timeout: 264 seconds) 2015-01-07T10:37:43Z hlavaty joined #sbcl 2015-01-07T10:51:57Z scymtym_ quit (Ping timeout: 245 seconds) 2015-01-07T10:55:20Z Bicyclidine joined #sbcl 2015-01-07T10:59:42Z echo-area quit (Read error: Connection reset by peer) 2015-01-07T11:02:20Z nikki93 joined #sbcl 2015-01-07T11:10:08Z nikki93 quit (Remote host closed the connection) 2015-01-07T11:31:23Z nikki93 joined #sbcl 2015-01-07T11:36:54Z rszeno joined #sbcl 2015-01-07T11:39:05Z rszeno quit (Client Quit) 2015-01-07T11:49:30Z nikki93 quit (Remote host closed the connection) 2015-01-07T12:01:35Z stassats joined #sbcl 2015-01-07T12:03:25Z hzp2015 joined #sbcl 2015-01-07T12:06:51Z eudoxia joined #sbcl 2015-01-07T12:10:30Z specbot joined #sbcl 2015-01-07T12:10:30Z minion joined #sbcl 2015-01-07T12:24:28Z Bicyclidine quit (Ping timeout: 265 seconds) 2015-01-07T12:50:49Z Bicyclidine joined #sbcl 2015-01-07T12:57:11Z pacon quit (Read error: Connection reset by peer) 2015-01-07T13:13:46Z attila_lendvai quit (Read error: No route to host) 2015-01-07T13:13:53Z attila_lendvai joined #sbcl 2015-01-07T13:13:53Z attila_lendvai quit (Changing host) 2015-01-07T13:13:53Z attila_lendvai joined #sbcl 2015-01-07T13:17:51Z pranavrc quit 2015-01-07T13:21:40Z Hache joined #sbcl 2015-01-07T13:52:58Z psilord quit (Quit: Leaving.) 2015-01-07T14:03:07Z edgar-rft quit (Quit: lifeform experiment disconnected by unknown nothing) 2015-01-07T14:40:11Z oleo joined #sbcl 2015-01-07T14:48:35Z edgar-rft joined #sbcl 2015-01-07T15:00:02Z psilord joined #sbcl 2015-01-07T15:03:45Z segv- joined #sbcl 2015-01-07T15:24:31Z Bicyclidine quit (Ping timeout: 252 seconds) 2015-01-07T15:36:06Z cmack joined #sbcl 2015-01-07T16:06:31Z psilord quit (Quit: Leaving.) 2015-01-07T16:22:10Z Bicyclidine joined #sbcl 2015-01-07T16:23:08Z hzp2015 left #sbcl 2015-01-07T16:26:35Z stassats quit (Remote host closed the connection) 2015-01-07T16:27:25Z stassats joined #sbcl 2015-01-07T16:37:22Z eudoxia quit (Read error: Connection reset by peer) 2015-01-07T16:37:33Z stassats quit (Remote host closed the connection) 2015-01-07T16:39:38Z segv- quit (Remote host closed the connection) 2015-01-07T16:46:31Z Intensity joined #sbcl 2015-01-07T17:05:56Z gingerale joined #sbcl 2015-01-07T17:10:17Z edgar-rft quit (Quit: don't waste your life by reading this) 2015-01-07T17:31:29Z slyrus joined #sbcl 2015-01-07T17:36:58Z nyef joined #sbcl 2015-01-07T18:06:57Z Hache quit (Ping timeout: 245 seconds) 2015-01-07T18:15:45Z slyrus quit (Ping timeout: 252 seconds) 2015-01-07T18:49:19Z karswell` joined #sbcl 2015-01-07T18:52:19Z karswell quit (Ping timeout: 245 seconds) 2015-01-07T19:41:16Z psilord joined #sbcl 2015-01-07T19:53:25Z slyrus joined #sbcl 2015-01-07T20:06:06Z krzysz00 quit (Quit: Lost terminal) 2015-01-07T20:11:30Z krzysz00 joined #sbcl 2015-01-07T20:45:14Z karswell` quit (Read error: Connection reset by peer) 2015-01-07T20:45:30Z karswell` joined #sbcl 2015-01-07T20:51:35Z nikki93 joined #sbcl 2015-01-07T21:43:53Z scymtym_ joined #sbcl 2015-01-07T21:45:07Z gingerale quit (Ping timeout: 255 seconds) 2015-01-07T21:59:38Z nicdev quit (Remote host closed the connection) 2015-01-07T22:00:13Z nicdev joined #sbcl 2015-01-07T22:04:03Z nyef quit (Quit: Heading out) 2015-01-07T22:04:54Z nikki93 quit (Remote host closed the connection) 2015-01-07T22:13:17Z nikki93 joined #sbcl 2015-01-07T22:25:40Z attila_lendvai quit (Disconnected by services) 2015-01-07T22:25:40Z attila_lendvai1 joined #sbcl 2015-01-07T22:25:40Z attila_lendvai1 quit (Changing host) 2015-01-07T22:25:40Z attila_lendvai1 joined #sbcl