Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-11 Thread Andres Freund
On 2013-12-11 12:37:56 +0100, Florian Pflug wrote: > On Dec11, 2013, at 11:47 , Andres Freund wrote: > > On 2013-12-11 11:42:25 +0100, Florian Pflug wrote: > > Yes (although there's C11 stuff to do equivalent stuff afair) - I was > > thinking of only doing it for compilers we support that dark mag

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-11 Thread Florian Pflug
On Dec11, 2013, at 11:47 , Andres Freund wrote: > On 2013-12-11 11:42:25 +0100, Florian Pflug wrote: >> On Dec5, 2013, at 15:44 , Andres Freund wrote: >>> There might be some ugly compiler dependent magic we could do. Depending >>> on how we decide to declare offsets. Like (very, very roughly) >>

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-11 Thread Andres Freund
On 2013-12-11 11:42:25 +0100, Florian Pflug wrote: > On Dec5, 2013, at 15:44 , Andres Freund wrote: > > There might be some ugly compiler dependent magic we could do. Depending > > on how we decide to declare offsets. Like (very, very roughly) > > > > #define relptr(type, struct_name, varname) un

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-11 Thread Florian Pflug
On Dec5, 2013, at 15:44 , Andres Freund wrote: > There might be some ugly compiler dependent magic we could do. Depending > on how we decide to declare offsets. Like (very, very roughly) > > #define relptr(type, struct_name, varname) union struct_name##_##varname{ \ >type relptr_type; \ >

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Andres Freund
On 2013-12-05 10:17:18 -0500, Robert Haas wrote: > On Thu, Dec 5, 2013 at 9:44 AM, Andres Freund wrote: > >> Why? Lots of people have written lots of programs that do just that. > > > > Well, but we're a database, not a generic programming library ;) > > I think we're arguably both. Fair enough

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Robert Haas
On Thu, Dec 5, 2013 at 9:44 AM, Andres Freund wrote: >> Why? Lots of people have written lots of programs that do just that. > > Well, but we're a database, not a generic programming library ;) I think we're arguably both. > But what's your alternative if you have a shared_palloc() like thingy?

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Robert Haas
On Thu, Dec 5, 2013 at 8:57 AM, Heikki Linnakangas wrote: > On 12/05/2013 06:32 AM, Robert Haas wrote: >> During development of the dynamic shared memory facility, Noah and I >> spent a lot of time arguing about whether it was practical to ensure >> that a dynamic shared memory segment got mapped

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Andres Freund
On 2013-12-05 15:44:34 +0100, Andres Freund wrote: > On 2013-12-05 07:44:27 -0500, Robert Haas wrote: > > And then I thought, boy, it sucks > > not to be able to declare what kind of a thing we're pointing *at* > > here, but apart from using C++ I see no solution to that problem. I > > guess we co

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Andres Freund
On 2013-12-05 07:44:27 -0500, Robert Haas wrote: > On Thu, Dec 5, 2013 at 4:56 AM, Andres Freund wrote: > > Hi Robert, > > > > On 2013-12-04 23:32:27 -0500, Robert Haas wrote: > >> But I'm also learning painfully that this kind of thing only goes so > >> far. For example, I spent some time lookin

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Andres Freund
On 2013-12-05 15:57:22 +0200, Heikki Linnakangas wrote: > As a side-note, I've been thinking that we don't really need same-address > mapping for shared_buffers either. Getting rid of it wouldn't buy us > anything right now, but if we wanted e.g to make shared_buffers changeable > without a restart

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Heikki Linnakangas
On 12/05/2013 06:32 AM, Robert Haas wrote: During development of the dynamic shared memory facility, Noah and I spent a lot of time arguing about whether it was practical to ensure that a dynamic shared memory segment got mapped at the same address in every backend that used it. My vote goes fo

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Robert Haas
On Thu, Dec 5, 2013 at 4:56 AM, Andres Freund wrote: > Hi Robert, > > On 2013-12-04 23:32:27 -0500, Robert Haas wrote: >> But I'm also learning painfully that this kind of thing only goes so >> far. For example, I spent some time looking at what it would take to >> provide a dynamic shared memory

Re: [HACKERS] same-address mappings vs. relative pointers

2013-12-05 Thread Andres Freund
Hi Robert, On 2013-12-04 23:32:27 -0500, Robert Haas wrote: > But I'm also learning painfully that this kind of thing only goes so > far. For example, I spent some time looking at what it would take to > provide a dynamic shared memory equivalent of palloc/pfree, a facility > that I feel fairly s

[HACKERS] same-address mappings vs. relative pointers

2013-12-04 Thread Robert Haas
During development of the dynamic shared memory facility, Noah and I spent a lot of time arguing about whether it was practical to ensure that a dynamic shared memory segment got mapped at the same address in every backend that used it. The argument went something like this: Me: We'll never be ab